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
  • Many thanks Stephen and Kevin for the suggesstion on semihosting settings and the EL3 priviledges. It indeed solved some of the problems that bypassed the HLT instruction in the disassembly but finally it is moving into a state as shown in the screen shot below address at EL2N. I am using this settings below.

    On a separate note I even tried with starting the program at EL3 priviledges with proper settings as mentioned in the thread https://community.arm.com/support-forums/f/morello-forum/52905/how-to-load-a-bare-metal-el3-program-onto-the-hardware but it seems after bootup here is no expected output.

    Semihosting settings:


    set semihosting heap-base 0
    set semihosting heap-limit 0x80800000
    set semihosting stack-limit 0x80800000
    set semihosting stack-base 0x81000000
    set semihosting vector ADDR EL2N:0x200
    set semihosting enabled on

    Disassembly where it i getting stuck:

    I am getting the command console log:

    Connected to stopped target Arm - Morello SDP
    cd "/home/sanu/developmentstudio-workspace_2"
    Working directory "/home/sanu/developmentstudio-workspace_2"
    source /v "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/targetinitialization.ds"
    Execution stopped in EL2h mode at EL2N:0x0000000000000204
    EL2N:0x0000000000000204   UDF      #0
    +set semihosting heap-base 0
    +set semihosting heap-limit 0x80800000
    +set semihosting stack-limit 0x80800000
    +set semihosting stack-base 0x81000000
    +set semihosting vector ADDR EL2N:0x200
    +set semihosting enabled on
    Semihosting implemented using a hardware breakpoint at EL2N:0x0000000000000200
    Semihosting server socket created at port 8000
    loadfile "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    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
    continue
    Semihosting stack/heap configured using values:
    Stack: 0x81000000 ~ 0x80800000
    Heap:  0 ~ 0x80800000
    interrupt
    WARNING(TAB186): Unknown semihosting operation 0x0 (returning to EL2N:0x0000000000000204)
    Execution stopped in EL2h mode at EL2N:0x0000000000000204
    EL2N:0x0000000000000204   UDF      #0

Reply
  • Many thanks Stephen and Kevin for the suggesstion on semihosting settings and the EL3 priviledges. It indeed solved some of the problems that bypassed the HLT instruction in the disassembly but finally it is moving into a state as shown in the screen shot below address at EL2N. I am using this settings below.

    On a separate note I even tried with starting the program at EL3 priviledges with proper settings as mentioned in the thread https://community.arm.com/support-forums/f/morello-forum/52905/how-to-load-a-bare-metal-el3-program-onto-the-hardware but it seems after bootup here is no expected output.

    Semihosting settings:


    set semihosting heap-base 0
    set semihosting heap-limit 0x80800000
    set semihosting stack-limit 0x80800000
    set semihosting stack-base 0x81000000
    set semihosting vector ADDR EL2N:0x200
    set semihosting enabled on

    Disassembly where it i getting stuck:

    I am getting the command console log:

    Connected to stopped target Arm - Morello SDP
    cd "/home/sanu/developmentstudio-workspace_2"
    Working directory "/home/sanu/developmentstudio-workspace_2"
    source /v "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/targetinitialization.ds"
    Execution stopped in EL2h mode at EL2N:0x0000000000000204
    EL2N:0x0000000000000204   UDF      #0
    +set semihosting heap-base 0
    +set semihosting heap-limit 0x80800000
    +set semihosting stack-limit 0x80800000
    +set semihosting stack-base 0x81000000
    +set semihosting vector ADDR EL2N:0x200
    +set semihosting enabled on
    Semihosting implemented using a hardware breakpoint at EL2N:0x0000000000000200
    Semihosting server socket created at port 8000
    loadfile "/home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elf"
    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
    continue
    Semihosting stack/heap configured using values:
    Stack: 0x81000000 ~ 0x80800000
    Heap:  0 ~ 0x80800000
    interrupt
    WARNING(TAB186): Unknown semihosting operation 0x0 (returning to EL2N:0x0000000000000204)
    Execution stopped in EL2h mode at EL2N:0x0000000000000204
    EL2N:0x0000000000000204   UDF      #0

Children