ADC example project HardFault exeception in LPCXpresso v5.1.2_2065

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC example project HardFault exeception in LPCXpresso v5.1.2_2065

454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cakehuang on Wed Apr 10 21:52:39 MST 2013
I had Hardfaul exeception when runing ADC example project in debug mode under LPCXpresso v5.1.2_2065. Further investigation shows it is the instruction of floating library linked in causes this exeception. The instruction which causes this exeception is a branch instruction but it is illeagal. I am sure this example project is OK under LPCXpresso v4.3.0_1023.

Step to reproduce this problem:
1, clean and then rebuild lib_small_printf_m0
2, clean and then rebuild ADC
3, download and debug, then run. Code execution will stop at hardware fault handler.    
By the way,I am using LPCXpresso 1114 board and had  LPCXpresso v4.3.0_1023 and LPCXpresso v5.1.2_2065 installed in different folder as following:
C:\nxp\LPCXpresso_4.3.0_1023\
C:\nxp\LPCXpresso_5.1.2_2065\
0 Kudos
6 Replies

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Thu Apr 11 06:26:54 MST 2013
Why a new thread?
0 Kudos

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cakehuang on Thu Apr 11 05:02:39 MST 2013
Thank you! I will post a new thread and attach the log withit.
0 Kudos

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Apr 11 04:36:46 MST 2013
Assuming that your analysis is correct. then if it is executing an invalid instruction it must be because you have compiled/linked with the wrong compiler settings. An LPC1114 is a Cortex-M0 and so compiling for Cortex-M3 or M4 will produce code that cannot run on the M0.

Clean your project and build it. Then
1. Post your build log (copy/paste it from the Build Console)
2. Post your .map file

This may help identify where your problem is
0 Kudos

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cakehuang on Thu Apr 11 04:01:43 MST 2013
The below disassembly code is that instruction which would cause hardware fault:
00001420: b.w 0x1e24
It is nside the sw floating lib named "****_ui2d". It should be unsigned int to double conversion provided by the lib.

Sorry that I did not attach the whole screen snapshot.
0 Kudos

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cakehuang on Thu Apr 11 03:09:02 MST 2013

Quote: frame
I'm not using version 5.1.2 of the LPCXpresso IDE, but I guess it could be a simple stack size problem.
Both versions might differ in their default stack size, or in their stack usage due to differing code.
This assumes you have a correct library version. The M0 does not support floating point instructions.
And the library must be built for the M0 explicitly, as it has a reduced instruction set, compared to the M3.


Thanks for your you reply.
It seems the software floating point library linked by the linker is not correct because I could locate the exact instruction which causes this problem by checking the contents of the stack frame. That construction is some kind of branch instruction. I checked M0 document and found no such kind of branch instruction.
0 Kudos

378 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by frame on Wed Apr 10 23:43:43 MST 2013
I'm not using version 5.1.2 of the LPCXpresso IDE, but I guess it could be a simple stack size problem.
Both versions might differ in their default stack size, or in their stack usage due to differing code.
This assumes you have a correct library version. The M0 does not support floating point instructions.
And the library must be built for the M0 explicitly, as it has a reduced instruction set, compared to the M3.
0 Kudos