HardFault_Handler when printf() is enabled in LPC1114 LPCXpresso (Eclipse)

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

HardFault_Handler when printf() is enabled in LPC1114 LPCXpresso (Eclipse)

396 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Thu Oct 06 16:00:21 MST 2011
Hi everyone

Playing around with such a board in order to get aquantaint with ARM-Cortex (I've also used LPC2129, LPC2103, etc.) my program crashes whenever I enable the next option (in "driver_config.h" file):

[FONT=Courier New]CONFIG_ENABLE_DRIVER_PRINTF 1[/FONT]


The project is very simple, I just followed the instruction for starting a fresh "template" one. If I disable that option the program runs (led blinks); if I don't, then the program is catch with that exception. I copied for you the stack, so it may help:

[FONT=Courier New]Thread [1] (Suspended: Signal 'SIGSTOP' received. Description: Stopped (signal).)
7 HardFault_Handler() cr_startup_lpc11.c:338 0x000001e0
6 <signal handler called>()  0xfffffff9
5 <symbol is not available> 0x1000002c
4 _fdopen()  0x00000a82
3 _initio()  0x000009c2
2 __main()  0x00000978
1 ResetISR() cr_startup_lpc11.c:313 0x000001ca[/FONT]

Maybe I need to set some other option in order printf() to work. Also I guess this is the CMSIS release I've attached to the project:


[FONT=Courier New]* @file     core_cm0.h
* @brief    CMSIS Cortex-M0 Core Peripheral Access Layer Header File
* @version  V1.30
* @date     30. October 2009[/FONT]


Any help would be very appreciated, and thank you in advanced. Kind regards.

Javier
0 Kudos
1 Reply

307 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Thu Oct 06 16:19:43 MST 2011
After googling I found that I needed to set the (standard) library I was going to use in my project. Section 6.4.1 of the document:

"Getting started with NXP LPCXpresso"

recommends to use the "Redlib (none)" library for functions like printf(). I did so and the program doesn't crash anymore (when coding in the PC one takes for granted that kind of things).

Anyway, thank you to everybody who read this post. Happy coding.


BTW, it worths to look at this page:

http://support.code-red-tech.com/CodeRedWiki/UsingPrintf
0 Kudos