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

Error L6915E use_no_semihosting and sys_exit

Hello guys!

I'm having a problem here. I want to use the printf() function in a STM32F3 application to print debug messages to UART1. I've done this before on a M0 and worked like a charm.

The problem on the M4 is this: If I declare

#pragma import (__use_no_semihosting)


to append my own putc function to print the printf() output to a UART I get linker error

L6915E: Library reports error: __use_no_semihosting was requested, but _sys_exit was referenced

I'm using full assert and the std periph lib nothing more...

Any idea to fix that?
Thanks!

Parents
  • When retargeting I use this :

    //******************************************************************************
    
    #include <rt_misc.h>
    
    #pragma import(__use_no_semihosting_swi)
    
    struct __FILE { int handle; /* Add whatever you need here */ };
    FILE __stdout;
    FILE __stdin;
    
    int fputc(int ch, FILE *f)
    {
      ITM_SendChar(ch);
    
      return(ch);
    }
    
    int fgetc(FILE *f)
    {
      char ch;
    
      ch = 1;
    
      return((int)ch);
    }
    
    int ferror(FILE *f)
    {
      /* Your implementation of ferror */
      return EOF;
    }
    
    void _ttywrch(int ch)
    {
      ITM_SendChar(ch);
    }
    
    void _sys_exit(int return_code)
    {
    label:  goto label;  /* endless loop */
    }
    
    //******************************************************************************
    

Reply
  • When retargeting I use this :

    //******************************************************************************
    
    #include <rt_misc.h>
    
    #pragma import(__use_no_semihosting_swi)
    
    struct __FILE { int handle; /* Add whatever you need here */ };
    FILE __stdout;
    FILE __stdin;
    
    int fputc(int ch, FILE *f)
    {
      ITM_SendChar(ch);
    
      return(ch);
    }
    
    int fgetc(FILE *f)
    {
      char ch;
    
      ch = 1;
    
      return((int)ch);
    }
    
    int ferror(FILE *f)
    {
      /* Your implementation of ferror */
      return EOF;
    }
    
    void _ttywrch(int ch)
    {
      ITM_SendChar(ch);
    }
    
    void _sys_exit(int return_code)
    {
    label:  goto label;  /* endless loop */
    }
    
    //******************************************************************************
    

Children