contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.72k stars 2.58k forks source link

Question about a weird error while compiling #1098

Closed areaarea closed 9 years ago

areaarea commented 9 years ago

We are trying to incorporate an IPsec extension that we have found into our build.

wejem we did we got a linker error of this nature:

LD ipsec-example.elf /usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m/libc.a(lib_a-sbrkr.o): In function _sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to_sbrk' collect2: error: ld returned 1 exit status

From what I was able to find it seems that this _sbrk function is one of the system hooks in the compiler. This one specifically somehow related with memory allocation, i.e. malloc() implementation. To make IPsec build, I just added a stub implementation of it like this one below, just to see if it is really called:

caddr_t _sbrk(int incr) { printf("_sbrk: %d\n", incr ); return (caddr_t)0; }

I don't see any outputs from it as well as I can't make the device to run any process, I can't even print out any string, it just shows initial data and then nothing:

Contiki-ipsec-alpha-2-2-g3de55d7
TI SmartRF06 + cc2538EM
Net: sicslowpan
MAC: CSMA
RDC: ContikiMAC

I have don't have a lot of experience at this compiler/linker levels (spoiled by modern tools.) Any guidance would be helpful.

Adam

bthebaudeau commented 9 years ago

Please see #1088. The comments explain everything. You can use that temporarily in your local repository. We're working on the final version to be included into Contiki.