Good evening everyone,
I am trying to compile a simple program in Ada for Arm-based microcontroller.
I installed gnat-5-arm-linux-gnueabi
package on Linux subsystem for Windows.
Now, compiling with arm-linux-gnueabi-gcc-5 -mcpu=cortex-m4 -mthumb program.adb
works fine, however linking with arm-linux-gnueabi-ld -T flash.ld -o program.elf program.o
results in an error:
program.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
I have looked through existing solutions, however none of them worked for me. I have tried installing gcc-arm-none-eabi
package and using its linker (the same error), as well as using ld
(does not recognise arm target).
One of my theories is that I might be using wrong GNAT package or binary, either for compiling or linking. Therefore, if someone knows where to find some descriptions of those, it might also help me :-) (there are quite a few GNAT packages, but only 2 with "arm" in their name)
EDIT: There is a file libgcc_eh.a
under /usr/lib/gcc-cross/arm-linux-gnueabi/5/
, which contains symbol "unwind"; adding this file to the linker input seems to solve this error, but makes a few new "undefined references" appear:
Incl/libgcc_eh.a(unwind-arm.o): In function 'get_eit_entry':
(.text+0x238): undefined reference to '__exidx_start'
Incl/libgcc_eh.a(unwind-arm.o): In function 'get_eit_entry':
(.text+0x23c): undefined reference to '__exidx_end'
Incl/libgcc_eh.a(unwind-arm.o): In function 'unwind_phase2':
(.text+0x334): undefined reference to 'abort'
Incl/libgcc_eh.a(unwind-arm.o): In function 'unwind_phase2_forced':
(.text+0x424): undefined reference to 'memcpy'
Incl/libgcc_eh.a(unwind-arm.o): In function 'unwind_phase2_forced':
(.text+0x478): undefined reference to 'memcpy'
Incl/libgcc_eh.a(unwind-arm.o): In function '__gnu_Unwind_Resume':
(.text+0x5b8): undefined reference to 'abort'
Incl/libgcc_eh.a(unwind-arm.o): In function '__gnu_Unwind_Resume':
(.text+0x5f4): undefined reference to 'abort'
Incl/libgcc_eh.a(pr-support.o): In function '_Unwind_GetTextRelBase':
(.text+0x4f0): undefined reference to 'abort'