Failed to debug hello world project on Cortex-A76


I'm trying to debug a hello-world C project following the tutorial on FVP Cortex-A76. The program can stop at main and can be debugged successfully, however, fail to execute function printf. I debugged the same hello-world project on FVP Cortex-A55 and it works. But on FVP Cortex-A76, the FVP will keep executing the following instruction.

I tried the example code startup_Cortex-A76x1 and found that I may need to startup.S to set up the MMU and cache configuration and specify the entry point as start64 so that the printf function can work. May I ask why this happen on Cortex-A76?

Thanks in advance.

  • Hi Harper

    What you are seeing is the result of an "exception" occurring in your code.  The exception might be caused by a number of different reasons, including:

    • execution of an invalid instruction (e.g. executing a floating point instruction but the hardware floating point unit is not enabled),
    • a load/store to inaccessible memory (e.g. outside of regions allowed by the MMU, maybe a null pointer access, or stack/heap overflow, or data misalignment)
    • an interrupt, but the interrupt handler has not yet been set up
    • a semihosting operation

    You'll need to debug your code to find out what is causing the exception.

    As a starting point, enable the trapping of all exceptions, and enable instruction execution "trace":

    1) Disconnect the Debugger from the FVP
    2) Run > Debug Configurations..., select your debug launch config
    3) Click on "DTSL Options..."
    4) In Trace Configuration tab, select Fast Models Trace, OK
    5) In Debug Configurations, click Debug to re-establish the connection.  Don't run your code yet.
    6) Open the Trace view with Window > Show view > Trace
    7) In the Breakpoints view, select "Manage Signals", then click "Select All" for "Stop" and "Print" headings.
    8) Now run your code.  Code execution should stop in the exception handler.  Now look in the Trace view for the last instruction captured.  That's where the exception occurred.

    You'll then need to investigate why the exception occurred there, based on the type of instruction it is, e.g. if it is a load/store instruction, check the address being accessed.

    "Hello World" should work OK using "semihosting" to setup the stack, heap, C run-time etc.  But for embedded software that does not use semihosying, you'll need startup code like startup.S.  startup.S does much more than just setup the cache and MMU.  It also sets up the stack, enables hardware floating point, etc.

    Hope this helps


More questions in this forum