Introduction-To-System-On-Chip / QEMU_an505

C code on QEMU AN505 to experiment on Arm TrustZone for Cortex M.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cortex-mv8-experiments

Based on

Clone the project as follow:

git clone --recurse-submodules <URL> 

Get QEMU

sudo apt-get -y install libglib2.0-dev libpixman-1-dev ninja-build libncurses5

# This is already done through the submodule
##  git clone https://github.com/qemu/qemu.git
cd qemu
mkdir -p build
./configure
make

QEMU needs at least the following patches: http://next.patchew.org/QEMU/20180220180325.29818-1-peter.maydell@linaro.org/20180220180325.29818-2-peter.maydell@linaro.org/

Get Arm toolchain

Get the toolchain from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads. Tested using gcc-arm-none-eabi-8-2018-q4-major.

wget "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2?revision=c34d758a-be0c-476e-a2de-af8c6e16a8a2?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,8-2019-q3-update" -O gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2

# Extract the archive
tar xvf gcc-arm-none-eabi-8-2019-q3-update-linux.tar.bz2

Get CMSIS

# This is already done through the submodule
##  git clone https://github.com/ARM-software/CMSIS_5.git

Tested with commit-id 5865a4a5e511ab094bac46862bd358859ce5ccb4

Linker script is extracted from $(CMSIS)/Device/ARM/ARMCM33/Source/GCC/gcc_arm.ld and adapted for an505. See Chapter "SIE-200 Memory Map Overview" of Application Note AN505.

Build and start

  • Update path to toolchain, CMSIS and Qemu in the Makefile.
  • Compile using make and start with make run. Note: You might need to adjust CMSIS_PATH, QEMU_PATH and TOOLCHAIN_PATH if they are not at the same place.
  • Debug using make gdbserver and (in another terminal) make gdb.

References

About

C code on QEMU AN505 to experiment on Arm TrustZone for Cortex M.


Languages

Language:C 80.1%Language:Assembly 15.4%Language:Makefile 4.4%Language:GDB 0.1%