[SOLVED] Semihosting on STM32 with GNU ARM Embedded, Eclipse and JLink GDB Server

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

  • [SOLVED] Semihosting on STM32 with GNU ARM Embedded, Eclipse and JLink GDB Server

    Hi

    I'm facing an issue regarding the semihosting mode with a STM32F207ZG (Cortex M3) and a J-Link (Lite).

    I use the latest GNU ARM embedded 4.7 2013q2 and Eclipse.

    Code :

    Source Code

    1. #include <stdio.h>
    2. int main(void)
    3. {
    4. RCC_ClocksTypeDef RCC_Clocks;
    5. STM_EVAL_LEDInit(LED4);
    6. /* Initialize User_Button */
    7. STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);
    8. /* SysTick end of count event each 1ms */
    9. RCC_GetClocksFreq(&RCC_Clocks);
    10. SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
    11. while(1)
    12. {
    13. /* Check if the user button is pressed */
    14. if(STM_EVAL_PBGetState(BUTTON_USER) == 0) {
    15. printf("Hello World !\n");
    16. STM_EVAL_LEDOn(LED4);
    17. /* wait for 1s */
    18. Delay(1000);
    19. /* Turn off LED after 1s each time User button is pressed */
    20. STM_EVAL_LEDOff(LED4);
    21. }
    22. }
    23. }
    Display All


    Linker options :

    Source Code

    1. "-Wl,-Map=${BuildArtifactFileBaseName}.map" -T"..\stm32_flash.ld" -Wl,--gc-sections -mthumb -mcpu=cortex-m3 --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group


    as indicated in the GNU ARM Embedded readme.txt (launchpadlibrarian.net/143625601/readme.txt)

    GDB command :

    Source Code

    1. arm-none-eabi-gdb


    Initialization commands :

    Source Code

    1. target remote localhost:2331
    2. monitor interface SWD
    3. monitor endian little
    4. monitor speed auto
    5. monitor semihosting enable
    6. monitor flash device = STM32F207ZG
    7. monitor flash download = 1
    8. monitor reset

    I get these errors in the J-Link GDB Server log (v4.76a)

    Source Code

    1. WARNING: Semihosting command SYS_FLEN failed. Handle is 0.
    2. WARNING: Semihosting command SYS_WRITE failed. Handle is 0.
    3. WARNING: Semihosting command SYS_WRITE failed. Handle is 0.
    4. WARNING: Semihosting command SYS_WRITE failed. Handle is 0.


    I'm almost sure I missed something very basic...

    Can you help ?

    Thanks !

    The post was edited 3 times, last by Efcis ().

  • Hi memphiscz

    Actually, the error disappeared after specifying

    Source Code

    1. extern void initialise_monitor_handles(void);


    and calling

    Source Code

    1. initialise_monitor_handles();


    at start of the main function.

    But I still can't see my "Hello World !" anywhere ?! The application console in Eclipse is empty.

    Did I miss something obvious ?
  • Hi,

    And just for info, i think that Segger`s semihosting dont support write, only read.

    The current version (V4.76d) should also support writing for semihosting.
    Moreover, it also supports the GDB File I/O extensions for users who prefer getting/sending semihosting data directly from/via the GDB window.


    Best regards
    Alex
    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.