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

How to use semihosting?

I'm developing an application to run on an Atmel SAM7S and I'm currently using an AT91SAM7S-EK board for testing. The final product will have rather simple software that has no need for an operating system and the Micro Library is more than enough for run time support.

But during testing, I thought it would be nice to test my data processing algorithms on data sets that I've recorded in files on my PC. Semihosting sounded like it should do just what I wanted - I could call fopen() from my SAM7S code, read some data with fread(), and then let my normal data processing algorithms run. I added the code to my program and set it to use the standard library instead of MicroLib. But when I tried to run it, the program hangs at SWI_Handler in the SAM7.s startup file.

It looks like during initialization (before main is called), a routine called init_io() is called which then calls freopen() which calls sys_open(). That last routine contains a SWI 0xAB instruction and that's where I die. I even created a simple "Hello World" program and it dies in exactly the same way.

Am I missing something obvious (it wouldn't be the first time)? I thought that the uVision debugger was supposed to catch the SWI instruction and perform the I/O operation on the PC. Or am I trying to do something that can't be done (which would explain why I can't find any sample code or information in the documentation).

Any help to point me in the right direction would be appreciated.