We are developing in mbed of ARM.
NUCLEO-F446RE board.
In mbed, the method of converting functions (archive files, static libraries) is
don’t understand.
There are 3 files below.
main.cpp
#include “mbed.h”
#include “add.h”
#define WAIT_TIME 1000 //msec
DigitalOut led1(LED1);
Serial pc(USBTX, USBRX); // USBシリアルポートのインスタンス
int a,b,c,d;
int main()
{
a = 100;
b = 200;
while (true)
{
led1 = !led1;
thread_sleep_for(WAIT_TIME);
d = add(a,b);
pc.printf(“a + b =%d \n”,d);
a = a + 1;
}
}
add.h
int add(int x,int y);
add.cpp
int add(int x,int y){
int z;
z = x+ y;
return z;
}
Convert add.cpp into .a (archive file, static library) among these three files.
arm-none-eabi-g++ -c add.cpp -o add.o
arm-none-eabi-ar rcs add.a add.o
cp add.a add.ar
Copy the generated add.ar to Mbed Studio.
When I compile using this, the following error is output.
Building project 20230807_func_Test (NUCLEO_F446RE, ARMC6)
Scan: 20230807_func_Test
Link: 20230807_func_Test
[Warning] @0,0: L3912W: Option ‘legacyalign’ is deprecated.
[Error] @0,0: L6366E: ./add.ar(add.o) attributes are not compatible with the provided attributes .
[Error] @0,0: L6242E: Cannot link object ./add.ar(add.o) as its attributes are incompatible with the image attributes.
Warning: L3912W: Option ‘legacyalign’ is deprecated.
Error: L6366E: ./add.ar(add.o) attributes are not compatible with the provided attributes .
Object ./add.ar(add.o) contains Build Attributes that are incompatible with the provided 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)
Tag_FP_arch = No use of FP hardware was permitted (=0)
Tag_ABI_HardFP_use = Permitted VFP use is implied by Tag_FP_arch (=0)
Tag_FP_HP_extension = Use of the optional half-precision extension to VFPv3/Advanced SIMDv1 was permitted (=1)
Error: L6242E: Cannot link object ./add.ar(add.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 the image map.
Finished: 10 information, 1 warning and 2 error messages.
[ERROR] Warning: L3912W: Option ‘legacyalign’ is deprecated.
Error: L6366E: ./add.ar(add.o) attributes are not compatible with the provided attributes .
Object ./add.ar(add.o) contains Build Attributes that are incompatible with the provided 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)
Tag_FP_arch = No use of FP hardware was permitted (=0)
Tag_ABI_HardFP_use = Permitted VFP use is implied by Tag_FP_arch (=0)
Tag_FP_HP_extension = Use of the optional half-precision extension to VFPv3/Advanced SIMDv1 was permitted (=1)
Error: L6242E: Cannot link object ./add.ar(add.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 the image map.
Finished: 10 information, 1 warning and 2 error messages.