One of the issues that you run into using Clang/LLVM as your compiler for bare-metal ARM Cortex cores is you have to directly use arm-none-eabi-ld to do your linking.
Directly using ld can be a bit nerve wrecking at times to get the options correct (and the order of options does matter) as normally you are just let gcc use collect2 and have it internally execute ld to perform your linking.
One of the areas using it directly that can bite you is not linking to the proper libgcc.a for the Cortex-M that you are targeting. Looking into your arm-none-eabi/lib/gcc/arm-none-eabi/X.X.X tool-chain directory and you will find multiple directories. One for each ARM architecture; armv6-m, armv7-ar, armv7-m, thumb, thumb2, etc…
Add a library include for architecture directory that matches the core that you compiled against and everything will be fine:
Cortex M3 example:
1
|
|
Cortex M0+ example:
1
|
|
ARM Cortex-M |
Thumb | Thumb-2 | Hardware multiply |
Hardware divide |
Saturated math |
DSP extensions |
Floating-point | ARM architecture |
Core architecture |
---|---|---|---|---|---|---|---|---|---|
|
|
|
|
No | No | No | No |
|
Von Neumann |
|
|
|
|
No | No | No | No |
|
Von Neumann |
|
|
|
|
No | No | No | No |
|
Von Neumann |
|
Entire | Entire | 1 cycle | Yes | Yes | No | No |
|
Harvard |
|
Entire | Entire | 1 cycle | Yes | Yes | Yes |
|
|
Harvard |