printf causing hard fault in NewLibNano(semihost)

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

printf causing hard fault in NewLibNano(semihost)

1,614 Views
leo838
Contributor II

Hello All,

I recently tried running demo programs (provided in an LPC812 SDK) in debug mode on a LPC812 Xpresso board (eg. lpcxpresso812max_sctimer_16bit_counter ) & because of memory space constraints was forced to compile it with the Newlibano(semihost) library. This resulted during running in a hard fault (redirection to  function void HardFault_Handler(void)). Once the printf's were committed out the program executed normally.

Am I doing something wrong? From what I've read printf's should be supported in this library./ environment.

Thanks,

Leo

Labels (1)
0 Kudos
Reply
2 Replies

1,442 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi leo838 

I don't have exact LPC812 board in my hand, so I tested it with LPCXpresso824 demo board.

If you want to print to uart, I suggest you use Newlibano nohost. although I tested semihost lib also working, but using Newlibano nohost is my recommendation.

Please see my attached video, there is no hardfault while running the program. I suggest you follow the steps and test yours.

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,442 Views
leo838
Contributor II

Jun,

Thanks for the reply.

I was under the impression that a semihost library was required to enable printf messages to be sent to the debug console. I tried your solution but unfortunately the same result. I then tried using the following:

quick setting> SDK debug console> semihost console

& together with the nohost library it solved the issue.

It seems, at least in my environment, that these settings are not retained during builds.

Thanks for your help

0 Kudos
Reply