I have a strange failure happening in the _fp_init function which is part of the C library startup code. When my application does NOT include a 3rd party library, the _fp_init function looks like this:
_fp_init: B510 PUSH {r4, lr} F7FEFAE6 BL.W __rt_fp_status_addr F04F0100 MOV r1,#0x00 6001 STR r1,[r0,0x00]
That code runs and works correctly. However, when I include a particular 3rd party library in my build, the _fp_init function now looks like this:
__fp_init: F04F7040 MOV r0,#0x3000000 EEE10A10 MCR P10,0x07,r0,C1,C0
This code always crashes on the MCR instruction. This code is programmed into Flash, and I've examined the code immediately after flash programming (i.e. the software is not corrupting the flash).
Can anyone explain this? How can the C runtime startup code change based on whether or not a completely unrelated library is being linked into the build? What other explanation for this could there be?
I am using Keil tools C Compiler version 4.0.0.728.
It is not strange.
It seems that you 3rd party library is built for HW FPU which will upgrade the entire image to use HW FPU. Initialization of FPU will therefore cause an abort.
Take a look at the following Knowledge Article: infocenter.arm.com/.../index.jsp
That was it. The project I created for the library had an option for "Floating Point Hardware" on the Options|Target page. Not sure why that option appears since I had chosen the AT91SAM3U4E processor, this option doesn't appear on the application project with the same processor selection. I don't understand that still. Anyway once I set that option to "Not Used" and re-built the lib and re-linked everything was good. Thanks!