This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62A7: Enabling semihosting

Part Number: AM62A7

Tool/software:

Hello 

We have fopen() / fprintf() / fclose() - function calls on C7 - working well and outputting data to a file on the debug folder on the PC.

However, we can't get it to work on A53 core. fopen() always returns NULL. 

We are thinking maybe this is a problem with semihosting not enabled, what do you think? 

How to get fopen() / fprintf() work on A53 ? 

Thanks in advance

Guy

  • Hi Guy,

    However, we can't get it to work on A53 core. fopen() always returns NULL. 

    What OS is running on A53, Linux or something else?

  • Hello 

    Were using freeRTOS as example project. 

    Guy

  • I am routing your thread to our RTOS expert for comments.

  • Hi Guy,

    Can you please tell which example are you using from MCU+SDK or is it custom example?

    Also please tell us which version of MCU+SDK you are using?

    Which method of initialization have you used? Is it SBL or SPL?

    Regards,

    Tushar

  • Hello, 

    Yes, 

    Can you please tell which example are you using from MCU+SDK or is it custom example? => hello_world freertos gcc arch64

    Also please tell us which version of MCU+SDK you are using? => mcu sdk 10_00_00_14

    Which method of initialization have you used? Is it SBL or SPL => SBL null (JTAG)

    BTW, fprintf works with C7 and MCU R5, but fails on A53. 

    Please advise, thank you

    Guy

  • Hi Guy,

    To make the semihosting enable while compiling through GCC, you will need to link the libc.a and librdimon.a library.

    To link the above mentioned library, add the -lc and -lrdimon flag to linker command. Also remove the -nostartfiles flag to allow linking of standard libraries.

    Please refer below image.

    Add the --specs=rdimon.specs flag in GCC compiler args to use the semihosted version of the syscalls. Please refer below image.

    Once the above changes is done, add the below function call in *.c file.

    extern void initialise_monitor_handles(void);

    Also call the above function before making any system calls. Please refer below image.

    Make sure you enable the semihosting option in the debugger. Navigate to Tools -> Debugger -> Program/Memory Load Options.

    Rebuild the program and run it again.

    Please let us know if the above solution works.

    Regards,

    Tushar

  • Thank you very much Tushar, 

    The issue resolved Slight smile

    Best regards

    Guy