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 0set semihosting heap-limit 0x80800000set semihosting stack-limit 0x80800000set semihosting stack-base 0x81000000set semihosting enabled on
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 0set semihosting heap-limit 0x80800000set semihosting stack-limit 0x80800000set semihosting stack-base 0x81000000set semihosting vector ADDR EL2N:0x200set semihosting enabled on
Disassembly where it i getting stuck:
I am getting the command console log:
Connected to stopped target Arm - Morello SDPcd "/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:0x0000000000000204EL2N: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 onSemihosting implemented using a hardware breakpoint at EL2N:0x0000000000000200Semihosting server socket created at port 8000loadfile "/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:0x0000000080012000add-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:0x0000000000000000set debug-from *$ENTRYPOINTstartStarting target with image /home/sanu/developmentstudio-workspace_2/Proj_HelloWorld/Debug/Proj_HelloWorld.elfRunning from entry pointwaitExecution stopped in EL2h mode at EL2N:0x0000000080012000In _start (no debug info)EL2N:0x0000000080012000 ADR x1,#0x280waitcontinueSemihosting stack/heap configured using values:Stack: 0x81000000 ~ 0x80800000Heap: 0 ~ 0x80800000interruptWARNING(TAB186): Unknown semihosting operation 0x0 (returning to EL2N:0x0000000000000204)Execution stopped in EL2h mode at EL2N:0x0000000000000204EL2N:0x0000000000000204 UDF #0
Sorry, I realised that what I suggested doesn't make sense. As Manoj explained in the thread you linked, running baremetal binaries at EL3 (in general) is not straightforward on the board, as you need to implement some initialisation steps that TF-A would normally take care of.
At this point it seems that the best option remains to build for and run at EL2, manually specifying the startup files for EL2 as per the post I linked above. As you can tell this is far from straightforward at the moment, we are considering how to improve the situation.
Maybe it is a good opportunity to ask what your goal is? At the moment it is much easier to run purecap code under Morello Linux or CheriBSD.
Many thanks Kevin for the information. I exactly followed the steps you shared (https://git.morello-project.org/morello/docs/-/blob/morello/release-1.4/standalone-baremetal-readme.rst) to execute baremetal while bootup and it is executing well along with the output 'hello'. I couldn't have reached here without your help.
As of my goal is concerned, I like to see the register values in the development studio IDE or any terminal after the board boots up with the output. But there it shows register values are unavailable which is not the case when I execute any generated elf program on the Morello board through the IDE, I can see the register values being popped up in the register window after using an interrupt.
Additionally 2 things I also noticed that if a program contains a printf function it does not produce any output after I followed the same boot-up process of its corresponding binary.
and while executing multiple program binaries from the IDE, I could also hardly see any changes in the register values except the program counter.