This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

cortex-m3 +ulink2+uVision 4.x - sw trace (printf) broken?

I have a firmware project using a Stellaris (TI) cortex-m3 cpu (LM3S9B95) which has always used its own uart based stdio functions. as I need to reserve the serial port for a two way serial protocol without any noise added by debug messages, I thought that at least during development, it would be good if the trace messages could go to the Keil uVision debug printf window.

Attempts to use debug printf features lead me to rtl crashes at startup at swi BKPT instruction when I add printf. I am at wits end here. I think that the semihosting thing is not there at all, and we are unable to get anything to work, even though I have the sw port and ITM options for ulink2 configured. Of course, I could be doing something else wrong.

To turn on and configure ITM and the SW port, whereas previously we had been using JTAG only, not the SW port, and we had not had tracing enabled ever, the steps I took were:

1. change configuration of the debug-options for the ulink cortex debugger (my usb emulator device is keil ulink2), I checked the SWJ checkbox and changed from port JTAG to port SW. these options are in the window titled "cortex-m target driver setup", on the debug page.

2. on the second tab, named trace, of the same dialog, I clicked the "trace enable" checkbox. I also checked ports 31 and 0 and unchecked the rest, in the ITM stiumulus ports.

Now here's the interesting thing:

a. I can still build and download after this change.

b. whether I use the changes above or not, any attempt to use the KEIL rtx library header stdio.h, and to call printf() in my code, causes a crash at application initialization time, before we reach my own code. So it's library initialization that is failing.

Tracing into the library initialization failure, I see this sequence:

__rt_lib_init_stdio_1: calls other stuff. eventually gets to _sys_open.

Then it freezes at the instruction "BKPT 0xAB".

I bet that this is an SWI instruction that is NOT being handled, and thus we're broken.

This is all in Keil uVision 4.03,
using RealView MDK ARM version 4.10,
usb ulink2 jtag/sw adaptor V0239xxx, f/w rev 1.40.

What I can not vouch for sure for is that it is possible that the board I am using brings out all the jtag/sw pins correctly to the ulink2 only for regular jtag mode, and not for trace operation. I am a software guy and so I need a pointer on what to check or what to do. Obviously it works for jtag mode, and the debug and download features still work when I switch to sw mode. This is on our own board, not an LM3Sxxx development quickstart board.

Any ideas?

Warren P+stma