[SOLVED] gdbserver + gdb + generic semihosting

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] gdbserver + gdb + generic semihosting

    I am using your implementation of semihosting to do file I/O (the generic one with SEGGER_SEMIHOST_DebugHalt and no bkpt). Everything works great under Ozone. Now I would like to execute that under gdb.
    I start arm-none-eabi-gdb my_project.elf. My gdb session is:

    Source Code

    1. target remote localhost:2331
    2. monitor semihosting enable
    3. monitor semihosting breakOnError 1
    4. monitor reset
    5. load
    6. continue
    I have a BKPT after my file I/O. It is reached almost immediately (it takes ~1 minute to do all the I/O under Ozone), no files are created, nothing happens. I don't see any error messages.

    Am I enabling semihosting correctly? Do I have to switch to the BKPT 0xAB method?


    Thanks for help

    The post was edited 1 time, last by artur ().

  • Hi,

    When using GDB, you first need to decide which way to go:
    #1 Have GDB handling the semihosting requests
    #2 Have J-Link GDB Server handling the semihosting requests

    Then you need to determine what approach your target application is following:
    #a Using SWI / SVC calls + vector catch for semihosting
    #b Target application has breakpoint instructions compiled in the code for semihosting

    wiki.segger.com/Semihosting#Semihosting_with_GCC_and_newlib
    wiki.segger.com/J-Link_GDB_Ser…te_.28monitor.29_commands

    There is no generic approach, it depends on your application / library how the printf / scanf / fopen / ... calls are implemented on the low-level.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.