Closed matthiasbock closed 8 years ago
Traced to the following line:
channel_index = (channel_index + 1) % 3;
A similar problem occurs when trying to compile demo_radio.c with timers:
make all /usr/bin/arm-none-eabi-ld -nostartfiles -nostdlib -static -lgcc -L /usr/lib/gcc/arm-none-eabi/4.8/armv6-m/ -T nrf51.ld nrf51_startup.o system_nrf51.o strings.o heap.o fifo.o uart.o delay.o timer.o radio.o demo_radio.o -o demo_radio.elf timer.o: In function `us2ticks': /home/code/nRF51822/playground/timer.c:58: undefined reference to `__aeabi_lmul' Makefile:51: recipe for target 'demo_radio.elf' failed /home/code/nRF51822/playground/timer.c:58: undefined reference to `__aeabi_uldivmod' timer.o: In function `ticks2us': /home/code/nRF51822/playground/timer.c:63: undefined reference to `__aeabi_lmul' /home/code/nRF51822/playground/timer.c:63: undefined reference to `__aeabi_uldivmod' make: *** [demo_radio.elf] Error 1
Using arm-linux-gnueabi-gcc-4.7 instead of arm-none-eabi-gcc-4.8 did not help...
Compiles after including https://github.com/bobbl/libaeabi-cortexm0.git and adding the --start-group parameter to linker to enable iterated symbol reference lookup.
New problem:
(gdb) load Loading section .data, size 0x1c lma 0x20000000 Loading section .text, size 0x1710 lma 0x0 Loading section .rodata, size 0x164 lma 0x1710 Loading section .ARM.exidx, size 0x8 lma 0x1874 Start address 0x0, load size 6296 Transfer rate: 3 KB/sec, 1574 bytes/write. (gdb) c Continuing. nrf51.cpu -- clearing lockup after double fault Program received signal SIGINT, Interrupt. 0xfffffffe in ?? () (gdb)
Turns out, the --start-group parameter before -lgcc is sufficient to fix the undefined reference problems, the additional library is not required.
However, there seems to be a new section .ARM.exidx in the binary now, which is not set up by the linker script yet. Probably related to this section or the stack in general, now a double fault occurs at the second(?) instruction after load.