This repository provides a rudimentary bare-metal execution environment that can be flexibly used for multiple architectures and boards. Is is easy to extend and only assumes a board connection in terms of a GDB server and UART interface.
Extending the platform for new boards requires a linkerscript, entry code, a UART driver and possibly GDB scripts to get the code loaded correctly. The main goal is conducting low-level experiments that are typically implemented for a certain processor ISA (architecture family).
This platform mainly makes use of the EmbExp-Box
infrastructure to run the low-level experiment software on hardware boards.
It is fairly integrated with this infrastructure for convenience but can also be used with other GDB server based setups with a few tweaks.
The repository EmbExp-BalRob
is an example where the program platform has been ported to local deployment for one board type.
The repository EmbExp-Logs
utilizes this platform to run individual experiments and collect their outputs.
- ARM Cortex-A7 - ARMv7-A (Raspberry Pi 2B)
- ARM Cortex-A53 - ARMv8-A (Raspberry Pi 3B)
- ARM Cortex-A72 - ARMv8-A (Raspberry Pi 4B)
- ARM Cortex-M0 - ARMv6-M (LPCXpresso LPC11C24)
- SiFive Freedom E300 - RV32IMAC (Arty A7-100T)
Even though the cross compiler can be provided using environment variables, the preferred way is to load a HolBA
environment.
Fist, look at the repository HolBA
to setup a basic environment with the EmbExp
repositories as well as the required gcc packages.
Then, load the environment by running source ${HOLBA}/env.sh
.
Finally, test the compilation by compiling everything with the execution of make
.
Some gdb requires the package libtinfo5
and you may need to install it with apt
or similar.
If possible, try to see the output of an execution with make connect
in one terminal and make runlog
in another.
See file Makefile.config
and all/inc/config.h
.
- Compilation and linking depends on
Makefile.config
. The directoryall/
is always considered and otherwise the configuredPROGPLAT_BOARD
andPROGPLAT_ARCH
selects the respective subdirectories inboard/
andarch/
. The linker script is taken fromboard/${PROGPLAT_BOARD}/
. - Compiler options:
- ARM compiler: "gcc_arm" and "gcc_arm8" from HolBA (preferred)
- Arch package aarch64-linux-gnu
- Run
make
.
- Run
make connect
. This runs{EmbExp-Box}/interface/remote.py ${PROGPLAT_BOARD}
. - Wait until openocd is started and the local ports are connected (20000-UART 20013-gdb and 20004-oocd_telnet).
- Leave the terminal running until you're done.
- Don't forget to disconnect afterwards by pressing return in this terminal (so that the board is free for others again).
- Just in case: If one of the applications crashes by some operation (like openocd), just stop the script by pressing return and start everything again.
- Run
make runlog
and observe the output.
- If it suffices, just run
make log
, - otherwise:
- Run
make uart
. - Press the key combination
^]
(Ctrl+]
). - Type
mode character
and hit return.
- Run
- Run with
make run
, or - debug with
make debug
.
- Install gdb-dashboard by
wget -P ~ git.io/.gdbinit
(fromhttps://github.com/cyrus-and/gdb-dashboard
). - Run gdb by
make debug
. - Start another terminal and run
tty
to determine this shell's identifier. - In the
gdb
shell, typedashboard source -output /dev/pts/3
where/dev/pts/3
is the shell identifier determined before.
-
j main
jumps to the symbol main and executes -
when gdb is running and no prompt shows, press the key combination
^c
(Ctrl+c
) to interrupt the execution -
j main.c:198
jumps to the beginning of code line 198 and executes -
continue
to continue execution -
step
to step to the next code line -
stepi
to step to the next assembly instruction -
set $pc = 0x1000
andcontinue
to execute from address0x1000
-
b main
sets a breakpoint at the symbol main -
clear main
clears the breakpoint at the symbol main -
monitor poll
to show the underlying processor state rendered by OpenOCD -
some documentation
https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html
https://stackoverflow.com/questions/42800801/how-to-use-gdb-to-debug-qemu-with-smp-symmetric-multiple-processors
https://quequero.org/2014/04/introduction-to-arm-architecture/