You are currently reviewing an older revision of this page.
Hafnium is a reference Secure Partition Manager (SPM) for systems that implement the Armv8.4-A Secure-EL2 extension. It enables multiple, isolated Secure Partitions (SPs) to run at Secure-EL1.More information about Hafnium can be found here.Regarding the TotalCompute software stack which also include the BL32(SPM), the BL32(SPM) is implemented as Hafnium software component. You can find the introduction Here
The TC software stack can both support buildroot and Android build, since the hafnium is part of fimrware, we take buildroot as example.
Firstly, let's setup the workspace following the user guide here to build out the whole software stack, let's take the buildroot file system as example as below.
./run-scripts/tc2/run_model.sh -m <model binary path> -d buildroot
The AP firmware bootflow is as below:
BL1 --> BL2 --> BL1 --> BL31 --> BL32(SPM) --> BL31 --> BL33
build-scripts/run_docker.sh build-scripts/build-hafnium.sh build build-scripts/run_docker.sh build-scripts/build-hafnium.sh deploy build-scripts/run_docker.sh build-scripts/build-tfa.sh build build-scripts/run_docker.sh build-scripts/build-tfa.sh deploy build-scripts/run_docker.sh build-scripts/build-flash-image.sh build build-scripts/run_docker.sh build-scripts/build-flash-image.sh deploy
diff --git a/build/BUILD.gn b/build/BUILD.gn index 1baac1ba..80b9f44d 100644 --- a/build/BUILD.gn +++ b/build/BUILD.gn @@ -20,6 +20,7 @@ config("compiler_defaults") { "-fstack-protector-all", ] + asmflags = ["-g"] cflags_c = [ "-std=c11" ] cflags_cc = [ "-std=c++2a" ]
From the ARM DS Debug control pannel, navigate to:Debug Congtrol--> New Debug Connection... -->Choose "Model Connection --> Debug connection name, such as "TC22-Hafnium-debug" -> Next --> Target Selection --> Add a new model ...
Debug Congtrol--> New Debug Connection... -->Choose "Model Connection --> Debug connection name, such as "TC22-Hafnium-debug" -> Next --> Target Selection --> Add a new model ...
Then, "Select Model Interface(Iris)" --> Next--> choose "Launch and connect to specific model" --> Next --> Browse the Model Path to select the downloaded file path of “TC22 model” --> Finish
At last, the model is imported as below:
-C board.flashloader0.fname=/data/jetzho01/tc22-2023.04.21/build-scripts/output/deploy/tc2/fip_gpt-tc.bin -C css.rss.rom.raw_image=/data/jetzho01/tc22-2023.04.21/build-scripts/output/deploy/tc2/rss_rom.bin -C css.scp.c0_pik.rvbaraddr_lw=0x1000 -C css.scp.c0_pik.rvbaraddr_up=0x0000 -C css.rss.VMADDRWIDTH=23 -C css.rss.CMU0_NUM_DB_CH=16 -C displayController=2 -C board.smsc_91c111.enabled=1 -C board.hostbridge.userNetworking=1 -C board.hostbridge.userNetPorts="5555=5555,8080=80,8022=22" --data board.dram=/data/jetzho01/tc22-2023.04.21/build-scripts/output/deploy/tc2/tc-fitImage.bin@0x20000000
On the window that opens, navigate to the "Debugger" tab, tick "Connect only", tick "Execute debugger commands", and copy-paste the following into the text box to automatically load all symbols into the correct virtual address space each time you connect to the model:
add-symbol-file "<workspace>/build-scripts/output/tmp_build/tfa/build/tc/debug/bl1/bl1.elf" EL3:0x0add-symbol-file "<workspace>/build-scripts/output/tmp_build/tfa/build/tc/debug/bl2/bl2.elf" EL1S:0x0add-symbol-file "<workspace>/build-scripts/output/tmp_build/tfa/build/tc/debug/bl31/bl31.elf" EL3:0x0add-symbol-file "<workspace>/build-scripts/output/tmp_build/hafnium/secure_tc_clang/hafnium.elf" EL2S:0x0
Replacing <workspace> with the path to your workspace directory.
<workspace>
The EL and number at the end of each command (e.g. `EL2S:0') ensure the symbols are loaded into the correct virtual address space and at the correct memory offset, for software uses absolute addresses for its symbols so we ensure an offset of 0.
`EL2S:0'
Click "Apply" and then "Debug" to connect to the paused model. You can now step through the Hafnium code or set a breakpoint on the symbol corresponding to the functionality that you are interested.
The PSTATE can be dumped into BL1