yus*_*4dz 5 c cpu-architecture msp430 contiki
我想为Contiki添加一些第三方库,但目前我不能.所以我想用一个简单的库进行测试.
我在hello.c中写了两个文件hello.c hello.h我有:
printf(" Hello everbody, library call\n");
Run Code Online (Sandbox Code Playgroud)
在hello.h我有:
extern void print_hello();
Run Code Online (Sandbox Code Playgroud)
我使用命令创建了hello.o:
msp430-gcc -mmcu=msp430f1611 hello.c -o hello.o
Run Code Online (Sandbox Code Playgroud)
我创建了一个存档文件:
ar -cvq libhello.a hello.o
Run Code Online (Sandbox Code Playgroud)
我转到contiki,我编写了一个调用hello.h来执行函数的简单程序.我尝试在makefile中使用PROJECT LIBRARIES变量包含hello.a,当我编译时我得到这个:
Hello_lib.sky section .vectors' will not fit in region'vectors'
...
region vectors overflowed by 32 Bytes
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下我的问题是什么(我是该领域的新手)?
如果可能的话如何纠正?(我应该为msp430-gcc指定哪些选项)谢谢.
确保您构建的库与构建程序的架构相同。
例如,如果您想要为sky节点 (MSP430F1611 MCU) 构建可执行文件,请使用以下命令构建库:
msp430-gcc -mmcu=msp430f1611 -c hello.c -o hello.o
msp430-ar -cvq libhello.a hello.o
Run Code Online (Sandbox Code Playgroud)
然后将库的路径及其名称添加到应用程序的 Makefile 中:
TARGET_LIBFILES += -L./hellolib -lhello
Run Code Online (Sandbox Code Playgroud)
然后照常构建应用程序:
make TARGET=sky
Run Code Online (Sandbox Code Playgroud)