Semihosting with Cortex-A32 (A32)

We are trying to setup semihosting with a new Cortex-A32 SoC.

We are using gcc-arm-none-eabi v9.X to compile a bare-metal "hello world".

Does ARM DS 2020.1 support semihosting out-of-the-box for Cortex-A32 bare-metal application compiled with the abovementioned GCC?

We have enable semihosting with CLI, and when we step, we can observed SVC handler getting called.

But the App Console is not showing any of the printf().

Anything that we need to take care of specifically for Cortex-A32?  This is a AArch32-only ARMv8 core.

Parents
  • Hi Kahho

    Yes, Arm DS supports semihosting for Cortex-A32 with GCC.

    For semihosting to work, semihosting C libraries must be linked-into the executable image at link time, and the Debugger must have semihosting enabled.
    The Debugger enables semihosting automatically if either symbols "__auto_semihosting" or "__semihosting_library_function" are present in the loaded executable.  Arm Compiler 6 adds "__semihosting_library_function" automatically to an executable at link time if that image uses any semihosting-using functions, but GCC does not, however you can use an alias symbol definition, e.g.:
    void __auto_semihosting(void) __attribute__ ((alias("main")));

    After connecting the Debugger to the target, you should see in the Commands view:
    Semihosting server socket created at port 8000
    Semihosting enabled automatically due to semihosting symbol detected in image

    If not, try explicitly enabling semihosting by adding "set semihosting enabled on" into the "Execute debugger commands" box in the debug launcher dialog.

    A ready-made example for Cortex-A32 FVP model with GCC and semihosting is provided in the Examples.  
    Please take a look at the "startup_Cortex-A32_GCC" example:
    1) Launch Arm DS
    2) File > Import, Arm Development Studio > Examples & Programming Libraries
    3) Expand Examples > Armv8 Bare-Metal, select "startup_Cortex-A32_GCC"
    4) In Project Explorer view, expand the project.  This example project comes with source code, pre-built executable, and debug launcher to run on an FVP model.
    5) Double-click on startup_Cortex-A32x1_GCC-FVP.launch

    Hope this helps

    Stephen

Reply
  • Hi Kahho

    Yes, Arm DS supports semihosting for Cortex-A32 with GCC.

    For semihosting to work, semihosting C libraries must be linked-into the executable image at link time, and the Debugger must have semihosting enabled.
    The Debugger enables semihosting automatically if either symbols "__auto_semihosting" or "__semihosting_library_function" are present in the loaded executable.  Arm Compiler 6 adds "__semihosting_library_function" automatically to an executable at link time if that image uses any semihosting-using functions, but GCC does not, however you can use an alias symbol definition, e.g.:
    void __auto_semihosting(void) __attribute__ ((alias("main")));

    After connecting the Debugger to the target, you should see in the Commands view:
    Semihosting server socket created at port 8000
    Semihosting enabled automatically due to semihosting symbol detected in image

    If not, try explicitly enabling semihosting by adding "set semihosting enabled on" into the "Execute debugger commands" box in the debug launcher dialog.

    A ready-made example for Cortex-A32 FVP model with GCC and semihosting is provided in the Examples.  
    Please take a look at the "startup_Cortex-A32_GCC" example:
    1) Launch Arm DS
    2) File > Import, Arm Development Studio > Examples & Programming Libraries
    3) Expand Examples > Armv8 Bare-Metal, select "startup_Cortex-A32_GCC"
    4) In Project Explorer view, expand the project.  This example project comes with source code, pre-built executable, and debug launcher to run on an FVP model.
    5) Double-click on startup_Cortex-A32x1_GCC-FVP.launch

    Hope this helps

    Stephen

Children
More questions in this forum