cancel
Showing results for 
Search instead for 
Did you mean: 

use_no_semihosting_swi doesn't work

mschwab
Associate II
Posted on June 17, 2011 at 19:25

I am running the simplest sample program that came with the Standard Peripheral Library Template (that lights 4 LEDs, displays a line on the UART, and 3 lines on the LCD).  Using the Keil tool chain, I turned off Use MicroLib (I'd rather not use MicroLib so I can use C++ code), and the program stopped working (seems to go to a BKPT instruction).  So I read ''Note for MDK-ARM in the StdLib help, and it said to use:

#pragma import(__use_no_semihosting_swi)

But the Linker complains:

.\STM3210C-EVAL\STM3210C-EVAL.axf: Error: L6915E: Library reports error: __use_no_semihosting_swi was requested, but _sys_exit was referenced

.\STM3210C-EVAL\STM3210C-EVAL.axf: Error: L6915E: Library reports error: __use_no_semihosting_swi was requested, but _sys_open was referenced

.\STM3210C-EVAL\STM3210C-EVAL.axf: Error: L6915E: Library reports error: __use_no_semihosting_swi was requested, but _ttywrch was referenced

I tried making dummy routines for these 3 in main.c, and got rid of the complaints about _sys_exit and _ttywrch, but _sys_open still complains:

.\STM3210C-EVAL\STM3210C-EVAL.axf: Error: L6200E: Symbol _sys_open multiply defined (by sys_io.o and main.o).

How do I get around this problem, so I don't have to use MicroLib?

2 REPLIES 2
Posted on June 18, 2011 at 17:09

There is nothing to stop you from creating your own putchar()/getchar() type routines to output the USART or whatever, and not use the library/semihosting/whatever.

If you use functions from the library, you're going to have to link in the library, or equivalents.

If you don't want to use the library, DON'T use stdio.h, and scanf(), printf(), etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ColdWeather
Senior
Posted on June 19, 2011 at 14:09

You need an appropriate retarget.c. Try the attached one.

You need to implement your own char sending/receiving functions that are declared in the

retarget.c as follows:

extern int sendchar (int ch); extern int getkey (void);

Look for

serial.c in your example folders to find some implementations for the functions.

P.S. If you wanna use Flash-FS from KEIL in the future, switch microlib OFF!

________________

Attachments :

Retarget.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Uz&d=%2Fa%2F0X0000000bap%2F8.mGSDW2kiizbTUutT7OZd3mZO8Qnw3bqXAmf9j6R_k&asPdf=false