NewLib and Semihosting on LPCOpen project

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

NewLib and Semihosting on LPCOpen project

1,197 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by acinfo32 on Tue Jul 01 04:42:36 MST 2014
Dear all,

Can someone tell what can go wrong while using semihosting on LPCOpen?

I created a new C++ LPCOpen project with the wizzard (v720) on a custom board. Then I switched the library to NewLib (semihosting). Set in Path and Symbols the symbols DEBUG_ENABLE and DEBUG_SEMIHOSTING. In the board library I did the same.

Then I started debugging with JLink, the debugging works but when stepping over printf nothing happens or it crashes.

"Can't find a source file at "F:\jenkins-slave\workspace\LibrariesFresco\Newlib_hostings\newlib_stub_semihost\armv7-m/../src/swi.h" "

1) Do I need to write code to implement the semihosting or should it work out of the box?
2) Which paths do I need for stdio.h
   - C:\Programs\LPCXpresso_7.2.0_153\lpcxpresso\tools\arm-none-eabi\include
   - C:\Programs\LPCXpresso_7.2.0_153\lpcxpresso\tools\arm-none-eabi\include\c++\4.8.3\tr1
   - C:\Programs\LPCXpresso_7.2.0_153\lpcxpresso\tools\arm-none-eabi\include\sys
3) Do I need to link to libcr_semihost.a or libcr_newlib_semihost.a? Although it doesn't work.
4) ....?

(when using CoIDE semihosting works so the hardware is ok)
Labels (1)
0 Kudos
7 Replies

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jul 02 05:31:02 MST 2014
So,

Quote:
Finally, if you have any further problems, ASK ON THE SEGGER FORUMS.

0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by acinfo32 on Wed Jul 02 05:08:05 MST 2014

Quote: TheFallGuy
You would help yourself if you read the documentation. Anyway
Follow the instructions here:
http://www.segger.com/nxp-lpcxpresso.html



I read that document long a go, just like many others. Debugging works.


Quote: TheFallGuy

and in the section where it says
"Finally, the "Startup" tab should look as follows:"
where it says "monitor reset" add another line with "monitor semihost enable"



I did that (see my 1) but that does not work.

0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jul 02 04:12:47 MST 2014
You would help yourself if you read the documentation. Anyway

Follow the instructions here:
http://www.segger.com/nxp-lpcxpresso.html

and in the section where it says
"Finally, the "Startup" tab should look as follows:"
where it says "monitor reset" add another line with "monitor semihost enable"

Finally, if you have any further problems, ASK ON THE SEGGER FORUMS.
0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by acinfo32 on Wed Jul 02 03:25:47 MST 2014
Thanks,

When starting with it some things can be very confusing.

1) I had read the thread and did put the "monitor semihosting enable" in the "LPCXpresso debug configuration -> startup" (I dont have a gdbinit script in my segger directory). Did not work.

2) In the thread "http://www.lpcware.com/content/faq/lpcopen-debug-inputoutput-support" below I only see comments "not working" That's why my question if someone get it to work. If it does not work then I can better quit trying.

3) I did made a minimal app with only printing. Even then it did not work.

4) With CoIDE it works. Conclusion now: They use GNU ARM and therefor need several additional files for semihosting (e.g. semihosting.h and semihosting.c). LPCXpressio used e.g. Newlib(semihostig) which already includes this semihosting files, so no additional files are needed? (Strange that it works for them)

Thanks again for you help! I now know that I don't have to focus on LPCOpen.
0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jul 02 02:18:04 MST 2014
Semihosting is NOTHING to do with LPCOpen, but you do need to make sure that you are linking with the semihosting C libraries.

To prove (to yourself) that it is nothing to do with LPCOpen, why don't you start with a simple Hello World program with no LPCOpen involved. There is even a Wizard that will create the application for you.

Also, If I read the J-Link thread properly, you need to add "monitor semihosting enable" to the J-Link startup (in the gdbinit script)

Failing that, I suggest you use the Segger forums to ask your question - the Segger guys don't hang around here much...
0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by acinfo32 on Wed Jul 02 02:10:28 MST 2014
Thanks for your reaction. I read a lot about J-Link and semihosting but I cant figure out how to get it working.

On CoIDE is't working more or less out of the box. But to let it work it generates some semihosting files which work together with CMSIS.

Do I need to write some code when using LPCOpen to let it work?

Did someone here successfully used the J-Link in combination with LPCOpen? I only saw people writing that it didn't work for them.

My J-Link is the v4.86a.
0 Kudos

850 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Tue Jul 01 04:50:01 MST 2014
Suggest you search for Semihosting and J-Link. I found this post:

http://forum.segger.com/index.php?page=Thread&postID=4448#post4448
0 Kudos