Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Based on the upstream TF-M code at https://git.trustedfirmware.org/trusted-firmware-m.git/

TF-M Software Requirements

For system requirements to build TF-M, see `tfm_build_instruction.txt` in the `docs` folder.

Build TF-M binaries

Tested with:

  • `AN521` build target (MPS2 in dual core M33 mode)
  • GNU GCC 7.3.1 (7-2018-q2-update)
  • TF-M hash `88661e56612d51811b6ea7b14ae6467128967bb2`

...


$ cd trusted-firmware-m
$ mkdir build && cd build
$ cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../ConfigRegression.cmake` \
-DTARGET_PLATFORM=AN521 -DBL2=false -DCMAKE_BUILD_TYPE=Debug -DCOMPILER=GNUARM ../
$ cmake --build ./

Merging `tfm_s.axf` and `tfm_ns.axf`

Builds that include the bootloader result in a `tfm_full.bin` file in the
build folder, as well as a version signed by `imgtool.py` for use with
mcu-boot

...

NOTE: Converting the .hex file to a .bin file will result in a 256MB
binary due to the gap between the secure and unsecure memory. The .hex file,
however, can be used directly by QEMU.

QEMU Support

ARMv8 support was added to QEMU 4.0, along with `machine` support for the
Musca and MPS2 development boards.

...

If you have an older version, see the appendix in this document on how to
build QEMU from source.

Running in QEMU

Tested using qemu 4.0.0 release (required for ARMv8 support),
and MPS2 `AN521` as a machine target.

...


[Sec Thread] Secure image initializing!

#### Execute test suites for the Secure area ####


Running Test Suite PSA protected storage S interface tests (TFM_SST_TEST_2XXX)...
> Executing 'TFM_SST_TEST_2001'
Description: 'Set interface'
TEST PASSED!

> Executing 'TFM_SST_TEST_2002'
Description: 'Set interface with create flags'
...

Debugging with QEMU

Tested using qemu 4.0.0 release (required for ARMv8 support),
and MPS2 `AN521` as a machine target.

...


$ gdb -s app/tfm_ns.axf -ex "target remote tcp:localhost:1234"
(gdb) break main
Breakpoint 1 at 0x10111c: file /Users/kevin/Dropbox/linaro/code/tfm/trusted-firmware-m/app/main_ns.c, line 115.
(gdb) layout asm
(gdb) continue

Appendix: Building QEMU from source (Optional)

Depending on your platform or distro you may need to build QEMU from source.

...