semihosting print too slow

Sysprogs forums Forums VisualGDB semihosting print too slow

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7061
    bernardofca
    Participant

    I have written my own printf routine which, at the end, calls:

    _swiwrite(STDOUT_FILENO, printfString, length);

    This works well but it seems that the call is taking quite a lot of time (STM32F0 with ST-LINK/V2). As a result, I lose characters coming from a UART even if I print a very short string.

    Is there some data related to the speed of this operation and any way I could speed it up?

    This is an unsolicited comment: I am a licensee of VisualGDB . This is definitely the best piece of software I bought… I painfully moved from the ST “classic” peripheral interface to the CUBE. Support from VisualGDB is excellent.

     

    #7067
    support
    Keymaster

    Hi,

    This is an unfortunate limitation of the semihosting mechanism. Handling a semihosting call involves stopping the CPU and reading the registers/memory. Due to the USB latencies, this takes tens of milliseconds, so your app will certainly miss some real-time events. The only reasonable workaround we could suggest is to use another UART port to print the diagnostic messages.

    That said, it looks like we should be able to create a non-stop semihosting alternative similar to our live variables feature. We will investigate into this and perhaps add it to VisualGDB 5.2 feature list.

    #7070
    bernardofca
    Participant

    Thanks for the answer. At least I know that this is an expected behavior. I have a debug UART on the PCB but I am waiting for the mating connector!

    #7074
    support
    Keymaster

    No problem. You can also use the live variables to somewhat monitor what’s happening with our program without stopping it. E.g. define a set of global counters and watch them while your program is running.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.