We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I created a static library for the micro-ecc project using GNU Arm Embedded Toolchain:arm-none-eabi-gcc -Wall -c uECC.cand armar:armar -rcs libuECC.a uECC.o
I added the library file to my Keil Project and I get this error:
Build started: Project: xxx*** Using Compiler 'V5.05 update 1 (build 106)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'Build Project 'app_main' - Target 'xxx'linking....\release\xxx.axf: Error: L6366E: uECC.o attributes are not compatible with the provided cpu and fpu attributes .Object uECC.o contains Build Attributes that are incompatible with the CPU attributes.Tag_CPU_arch = ARM v4T (=2)Tag_THUMB_ISA_use = Thumb instructions were permitted to be used (=1)Tag_ARM_ISA_use = ARM instructions were permitted to be used (=1).\release\xxx.axf: Error: L6242E: Cannot link object uECC.o as its attributes are incompatible with the image attributes.... wchart-16 clashes with wchart-32.... arm-isa clashes with m-profile.Not enough information to list image symbols.Not enough information to list load addresses in the image map.Finished: 8 information, 0 warning and 2 error messages.".\release\xxx.axf" - 2 Error(s), 0 Warning(s).Target not created.Build Time Elapsed: 00:00:02
If I try to link just the object file on its own (not a static library), I get the same error.
I realize that I'm using an old version of the ARM compiler and upgrading might fix these issues; but I just wanted to know if there is a workaround that I could try first.
" Error: L6366E: uECC.o attributes are not compatible with the provided cpu and fpu attributes" indicates that the build attributes used in your lib built by the gcc compiler are different/incompatible with the ones currently used in your project.
You can use the fromelf.exe together with --decode_build_attributes command line option to decode your lib file as well as your uECC.o to compare the attributes
https://www.keil.com/support/man/docs/armutil/armutil_pge1362128892751.htm
They must be aligned, otherwise you will get this error
So, this is what I get as output from executing
fromelf.exe --decode_build_attributes libuECC.a
** Section #8 '.ARM.attributes' (SHT_ARM_ATTRIBUTES) Size : 48 bytes 'aeabi' file build attributes: 0x000000: 05 41 52 4d 37 54 44 4d 49 00 06 02 08 01 09 01 .ARM7TDMI....... 0x000010: 12 04 14 01 15 01 17 03 18 01 19 01 1a 01 1e 02 ................ Tag_CPU_name = "ARM7TDMI" Tag_CPU_arch = ARM v4T (=2) Tag_ARM_ISA_use = ARM instructions were permitted to be used (=1) Tag_THUMB_ISA_use = Thumb instructions were permitted to be used (=1) Tag_ABI_PCS_wchar_t = Size of wchar_t is 4 (=4) Tag_ABI_FP_denormal = This code was permitted to require IEEE 754 denormal numbers (=1) Tag_ABI_FP_exceptions = This code was permitted to check the IEEE 754 inexact exception (=1) Tag_ABI_FP_number_model = This code may use all the IEEE 754-defined FP encodings (=3) Tag_ABI_align8_needed = Code was permitted to depend on the 8-byte alignment of 8-byte data items (=1) Tag_ABI_align8_preserved = Code was required to preserve 8-byte alignment of 8-byte data objects (=1) Tag_ABI_enum_size = Enum values occupy the smallest container big enough to hold all values (=1) Tag_ABI_optimization_goals = Optimized aggressively for speed, small size and debug illusion sacrificed (=2)
How do I see the attributes of my project and how would I align them?
Surely, the messages are telling you which parts are in conflict:
Anvi said:Build Attributes that are incompatible with the CPU attributes.Tag_CPU_arch = ARM v4T (=2)Tag_THUMB_ISA_use = Thumb instructions were permitted to be used (=1)Tag_ARM_ISA_use = ARM instructions were permitted to be used (=1)
and
Anvi said:attributes are incompatible with the image attributes.... wchart-16 clashes with wchart-32.... arm-isa clashes with m-profile.
For a start, it looks like your project is Cortex-M, but the library is ARM7TDMI ?
I see, thank you for your response. I'm trying to find documentation for the GNU ARM Embedded Toolchain on how to modify these attributes when compiling the library object. I can't seem to find anything explicit
I attempted to re-compile using my target cpu name:
arm-none-eabi-gcc -Wall -O3 -mcpu=cortex-m3 -c uECC.c
error: target CPU does not support ARM mode
Anvi said:and I get this error:
Well, you would: a Cortex-M3 indeed does not support ARM mode - it is Thumb only.
Anvi said:how to modify these attributes when compiling the library object. I can't seem to find anything explicit
Did you read the 'Compilation Notes' in the documentation on the Github page you linked?
Have you tried contacting the author?
I see, I understand. I re-compiled using the following flags:
arm-none-eabi-gcc -Wall -O3 -fshort-wchar -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -c uECC.c
I'm able to link the resulting object into my project now. Thanks for you guidance