1

I have to use a library that was precompiled for an ARM Cortex M4 in a project with an ARM Cortex A8. The linker naturally gives me an error:

file "..." has a Tag_CPU_arch_profile attribute value of "77" that is different than one previously seen ("65"); combining incompatible files

Can I use arm-none-eabi-objcopy to convert the library? It does not contain code specific to peripherals or the microcontroller itself. Both are ARM. Seems likely, but how?

TM_
  • 21
  • 8
  • 1
    Both are ARM but they are of different architectures (ARMv7-M vs ARMv7-A). The generated binary is dependent on assumptions about the architecture specially if the "-mcpu=" option was used in compiling your library. – sessyargc.jp Sep 30 '14 at 08:55
  • 1
    While, they are 99% the same, there are some differences. The M4 has a *thumb div* instruction where as the cortex-A8 doesn't support it. The compiler may generate this code based on the knowledge (flag passed to it) that it will be run on an M4. Some Cortex-A8 contain the *Thumb div* and others do not. That is a land mine I can point to now. Others may exist. You can create an empty *A8* object and use `objcopy -O binary -j sample thumb.elf sample.bin` followed by `objcopy --add-section sample=sample.bin a8.elf` where *sample* is each section. – artless noise Sep 30 '14 at 17:46
  • I take it this is userspace code? Any system code would be totally unportable; even in userspace there are some instructions like `MRS` that may still blow up due to the architecture differences. – Notlikethat Sep 30 '14 at 20:45
  • other than how they start up you can probably do this, one way is to objcopy to a -O binary format then using some creative objcopy options you can get from bin to whatever arch/target you want (naturally one that supports the armv7 thumb/thumb2 instructions, but techically you can insert anything you want) – old_timer Sep 30 '14 at 23:00
  • @Notlikethat: You mention "some instructions" that differ between the architectures. Can I read up on the differences somewhere? In the ARM-ARM I only find the description of i.e. `MRS`. But I don't see the difference. Can you please explain? Thank you! – TM_ Oct 06 '14 at 08:48

0 Answers0