This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

baremetal program execution on ARM Morello board

Hello,

I am running baremetal programs on FVP. I compiled using llvm toolchain with baremetal support and created the .axf binaries under the debug directory of the project folder. This .axf executable Is something I like to test on morello board without any OS environment.  when I tried to run the .axf binary on the board using the ARM development studio IDE morello edition, under the run> debug config> made the settings and when I I started debugging it gets stuck at the HLT instruction (when performing debug from symbol) or starting from the initial address and going into an infinite loop when starting from entry point. while on the terminal console I couldn't see the output of the printf statement which i was expecting. even if I try to run directly or debug it step by step. (the program is correct because I already tested on FVP) ..I am being redirected to the debug configuration. and iterating thru the same process as described without seeing the actual output on the terminal which I configured with the /dev/ttyusb2  115200 command. Any suggestions please.

I have also used the semihosting code

set semihosting heap-base 0
set semihosting heap-limit 0x80800000
set semihosting stack-limit 0x80800000
set semihosting stack-base 0x81000000
set semihosting enabled on

Parents
  • Hello Stephen,

    here I am including the copy of the text from the command view where the program below is getting halted as shown in the pic below. Here also I am not using semihosting, but the problem still persists.

    ======================================

    #include <stdio.h>
    #include <stdlib.h>


    #define PLAT_ARM_BOOT_UART_BASE 0x2A400000

    volatile char * ptr = (volatile char*) PLAT_ARM_BOOT_UART_BASE;

    int main()
    {
      *ptr='h';
      *ptr='e';
      *ptr='l';
      *ptr='l';
      *ptr='o';
      while (1);
      return 0;
    }

    =============================================

    ================ Command view =================================================

    Connected to stopped target Arm - Morello SDP
    cd "/home/sanu/developmentstudio-workspace_2"
    Working directory "/home/sanu/developmentstudio-workspace_2"
    Execution stopped in EL2h mode at EL2N:0x0000000000000200
    loadfile "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    EL2N:0x0000000000000200   UDF      #0
    Loaded section .rela.dyn: EL2N:0x0000000080000200 ~ EL2N:0x0000000080001E1F (size 0x1C20)
    Loaded section .rodata: EL2N:0x0000000080001E20 ~ EL2N:0x0000000080001E3F (size 0x20)
    Loaded section .text: EL2N:0x0000000080012000 ~ EL2N:0x00000000800184BB (size 0x64BC)
    Loaded section .init: EL2N:0x00000000800184BC ~ EL2N:0x00000000800184EF (size 0x34)
    Loaded section .fini: EL2N:0x00000000800184F0 ~ EL2N:0x0000000080018523 (size 0x34)
    Loaded section .data.rel.ro: EL2N:0x0000000080028530 ~ EL2N:0x00000000800285AF (size 0x80)
    Loaded section .init_array: EL2N:0x00000000800285B0 ~ EL2N:0x00000000800285BF (size 0x10)
    Loaded section .got: EL2N:0x00000000800285C0 ~ EL2N:0x00000000800287BF (size 0x200)
    Loaded section .data: EL2N:0x0000000080039000 ~ EL2N:0x000000008003CDD1 (size 0x3DD2)
    Loaded section .data.rel.ro: EL2N:0x0000000080028530 ~ EL2N:0x00000000800285AF (size 0x80)
    Loaded section .init_array: EL2N:0x00000000800285B0 ~ EL2N:0x00000000800285BF (size 0x10)
    Loaded section .got: EL2N:0x00000000800285C0 ~ EL2N:0x00000000800287BF (size 0x200)
    Entry point EL2N:0x0000000080012000
    add-symbol-file "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    ERROR(ITR575): Symbols for image /home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf are already loaded at offset EL2N:0x0000000000000000
    set debug-from *$ENTRYPOINT
    start
    Starting target with image /home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf
    Running from entry point
    wait
    Execution stopped in EL2h mode at EL2N:0x0000000080012000
    In _start (no debug info)
    EL2N:0x0000000080012000   ADR      x1,#0x280
    wait
    stepi
    Execution stopped in EL2h mode at EL2N:0x0000000080012004
    EL2N:0x0000000080012004   MOV      w0,#0x16
    wait
    stepi
    Execution stopped in EL2h mode at EL2N:0x0000000080012008
    EL2N:0x0000000080012008   HLT      #0xf000
    wait
    stepi
    Execution stopped in EL2h mode due to a breakpoint or watchpoint: EL2N:0x0000000080012008
    EL2N:0x0000000080012008   HLT      #0xf000

    ========================================================================================================

    GUI:

    Debug Config view and selected debug from entry point.

    I am using the compiler path as shown below:

    with the C build settings for the project

    For reference, I am also enclosing the contents of the header section of the elf file that is being generated.

    I am not sure why this problem still persists. Is there any step where I am making a mistake please?

Reply
  • Hello Stephen,

    here I am including the copy of the text from the command view where the program below is getting halted as shown in the pic below. Here also I am not using semihosting, but the problem still persists.

    ======================================

    #include <stdio.h>
    #include <stdlib.h>


    #define PLAT_ARM_BOOT_UART_BASE 0x2A400000

    volatile char * ptr = (volatile char*) PLAT_ARM_BOOT_UART_BASE;

    int main()
    {
      *ptr='h';
      *ptr='e';
      *ptr='l';
      *ptr='l';
      *ptr='o';
      while (1);
      return 0;
    }

    =============================================

    ================ Command view =================================================

    Connected to stopped target Arm - Morello SDP
    cd "/home/sanu/developmentstudio-workspace_2"
    Working directory "/home/sanu/developmentstudio-workspace_2"
    Execution stopped in EL2h mode at EL2N:0x0000000000000200
    loadfile "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    EL2N:0x0000000000000200   UDF      #0
    Loaded section .rela.dyn: EL2N:0x0000000080000200 ~ EL2N:0x0000000080001E1F (size 0x1C20)
    Loaded section .rodata: EL2N:0x0000000080001E20 ~ EL2N:0x0000000080001E3F (size 0x20)
    Loaded section .text: EL2N:0x0000000080012000 ~ EL2N:0x00000000800184BB (size 0x64BC)
    Loaded section .init: EL2N:0x00000000800184BC ~ EL2N:0x00000000800184EF (size 0x34)
    Loaded section .fini: EL2N:0x00000000800184F0 ~ EL2N:0x0000000080018523 (size 0x34)
    Loaded section .data.rel.ro: EL2N:0x0000000080028530 ~ EL2N:0x00000000800285AF (size 0x80)
    Loaded section .init_array: EL2N:0x00000000800285B0 ~ EL2N:0x00000000800285BF (size 0x10)
    Loaded section .got: EL2N:0x00000000800285C0 ~ EL2N:0x00000000800287BF (size 0x200)
    Loaded section .data: EL2N:0x0000000080039000 ~ EL2N:0x000000008003CDD1 (size 0x3DD2)
    Loaded section .data.rel.ro: EL2N:0x0000000080028530 ~ EL2N:0x00000000800285AF (size 0x80)
    Loaded section .init_array: EL2N:0x00000000800285B0 ~ EL2N:0x00000000800285BF (size 0x10)
    Loaded section .got: EL2N:0x00000000800285C0 ~ EL2N:0x00000000800287BF (size 0x200)
    Entry point EL2N:0x0000000080012000
    add-symbol-file "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    ERROR(ITR575): Symbols for image /home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf are already loaded at offset EL2N:0x0000000000000000
    set debug-from *$ENTRYPOINT
    start
    Starting target with image /home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf
    Running from entry point
    wait
    Execution stopped in EL2h mode at EL2N:0x0000000080012000
    In _start (no debug info)
    EL2N:0x0000000080012000   ADR      x1,#0x280
    wait
    stepi
    Execution stopped in EL2h mode at EL2N:0x0000000080012004
    EL2N:0x0000000080012004   MOV      w0,#0x16
    wait
    stepi
    Execution stopped in EL2h mode at EL2N:0x0000000080012008
    EL2N:0x0000000080012008   HLT      #0xf000
    wait
    stepi
    Execution stopped in EL2h mode due to a breakpoint or watchpoint: EL2N:0x0000000080012008
    EL2N:0x0000000080012008   HLT      #0xf000

    ========================================================================================================

    GUI:

    Debug Config view and selected debug from entry point.

    I am using the compiler path as shown below:

    with the C build settings for the project

    For reference, I am also enclosing the contents of the header section of the elf file that is being generated.

    I am not sure why this problem still persists. Is there any step where I am making a mistake please?

Children
No data