将我自己的库添加到Contiki OS [英] Adding my own library to Contiki OS
问题描述
我想向Contiki添加一些第三方库,但是目前我还不能。
所以我只想用一个简单的库进行测试。
I want to add some third party libraries to Contiki, but at the moment I can't. So I wanted to just test with a simple library.
我写了两个文件hello.c hello.h,在hello.c中我有:
I wrote two files hello.c hello.h, in hello.c I have:
printf(" Hello everbody, library call\n");
在hello.h中,我有:
In hello.h I have:
extern void print_hello();
我使用以下命令创建了hello.o:
I created hello.o using the command:
msp430-gcc -mmcu=msp430f1611 hello.c -o hello.o
我创建了一个存档文件:
I created an archive file:
ar -cvq libhello.a hello.o
我转到contiki,我写了一个简单的程序,调用hello.h来执行一个函数。我尝试包含hello。在makefile中使用PROJECT LIBRARIES变量,当我编译时会得到以下信息:
I move to contiki, i write a simple program that calls hello.h to execute a function.I try to include hello.a using PROJECT LIBRARIES variable in the makefile, when i compile i get this :
Hello_lib.sky section .vectors' will not fit in region'vectors'
...
region vectors overflowed by 32 Bytes
有人可以向我解释一下问题是什么(我是该领域的新手)?
Can someone please explain me what is the problem (I am new to the field) ?
以及在可能的情况下如何解决? (我应该为msp430-gcc指定哪些选项)
谢谢。
And how to correct it if possible? ( What options should i specify for msp430-gcc) Thanks.
推荐答案
请确保您为
例如,如果要使用为 sky
节点构建可执行文件( MSP430F1611 MCU),使用以下命令构建库:
For example, if you want to use build an executable for sky
motes (MSP430F1611 MCU), build the library with:
msp430-gcc -mmcu=msp430f1611 -c hello.c -o hello.o
msp430-ar -cvq libhello.a hello.o
然后将路径添加到库及其到应用程序的Makefile的名称:
Then add the path to the library and its name to application's Makefile:
TARGET_LIBFILES += -L./hellolib -lhello
然后照常构建应用程序:
Then build the application as usual:
make TARGET=sky
这篇关于将我自己的库添加到Contiki OS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!