-
Notifications
You must be signed in to change notification settings - Fork 15
Improve SimpleTrustZone CI and add external build templates #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e0b083d
9affbf4
607703f
caa5898
134cf68
0a14d79
3f52d07
93258d5
f41232e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,19 @@ | ||
| # Parameters: | ||
| # instance.parameter=value #(type, mode) default = 'def value' : description : [min..max] | ||
| #-------------------------------------------------------------------------------------------------------------------------------------------------- | ||
| fvp_mps2.mps2_visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation | ||
| cpu0.semihosting-heap_limit=0x0 # (int , init-time) default = '0x10700000' : Virtual address of top of heap : [0x0..0xFFFFFFFF] | ||
| fvp_mps2.mps2_visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation | ||
| fvp_mps2.UART0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when an EOT (ASCII 4) character is transmitted | ||
| fvp_mps2.UART0.out_file=- # (string, init-time) default = '' : Send UART output to stdout | ||
| fvp_mps2.UART0.unbuffered_output=1 # (bool , init-time) default = '0' : Disable UART output buffering | ||
| fvp_mps2.telnetterminal0.start_telnet=0 # (bool , init-time) default = '1' : Do not launch an external terminal | ||
| fvp_mps2.telnetterminal1.start_telnet=0 # (bool , init-time) default = '1' : Do not launch an external terminal | ||
| fvp_mps2.telnetterminal2.start_telnet=0 # (bool , init-time) default = '1' : Do not launch an external terminal | ||
| cpu0.semihosting-heap_limit=0x0 # (int , init-time) default = '0x10700000' : Virtual address of top of heap : [0x0..0xFFFFFFFF] | ||
| cpu0.semihosting-stack_base=0x0 # (int , init-time) default = '0x10700000' : Virtual address of base of descending stack : [0x0..0xFFFFFFFF] | ||
| cpu0.semihosting-stack_limit=0x0 # (int , init-time) default = '0x10800000' : Virtual address of stack limit : [0x0..0xFFFFFFFF] | ||
| cpu0.ITM=0 # (bool , init-time) default = '1' : Level of instrumentation trace supported. false : No ITM trace included, true: ITM trace included | ||
| cpu0.INITSVTOR=0x00000000 # (int , init-time) default = '0x10000000' : Secure vector-table offset at reset : [0x0..0xFFFFFF80] | ||
| cpu0.SAU=0x8 # (int , init-time) default = '0x4' : Number of SAU regions (0 => no SAU) : [0x0..0x8] | ||
| idau.NUM_IDAU_REGION=0x0 # (int , init-time) default = '0xA' : | ||
| fvp_mps2.DISABLE_GATING=1 # (bool , init-time) default = '0' : Disable Memory gating logic | ||
| #-------------------------------------------------------------------------------------------------------------------------------------------------- | ||
| #-------------------------------------------------------------------------------------------------------------------------------------------------- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,10 +51,28 @@ The solution provides `Debug` and `Release` target sets. Select the required set | |
|
|
||
| Replace `AC6` with `GCC` to build a target set with the GCC compiler. | ||
|
|
||
| ## Use an Existing Secure Image | ||
|
|
||
| The `AVH-NS-only` target demonstrates the CMSIS-Toolbox concept [Use a Prebuilt Secure Image](https://open-cmsis-pack.github.io/cmsis-toolbox/build-overview/#use-a-prebuilt-secure-image). It builds only `CM33_ns` and reuses two outputs previously generated for the `AVH` target: | ||
|
|
||
| - `CM33_s.hex`, which is loaded together with the non-secure application. | ||
| - `CM33_s_CMSE_Lib.o`, which provides the secure callable interface used to link the non-secure application. | ||
|
|
||
| The existing secure outputs must match the selected build type and compiler. Build the `AVH` target before building the corresponding `AVH-NS-only` target: | ||
|
|
||
| ```txt | ||
| > cbuild SimpleTZ.csolution.yml --packs --active AVH@Debug --toolchain AC6 | ||
| > cbuild SimpleTZ.csolution.yml --context CM33_ns.Debug+AVH-NS-only --toolchain AC6 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this to work as well: cbuild SimpleTZ.csolution.yml --active AVH-NS-only@Debug --toolchain AC6 Unless the toolchain changes in between.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. documented. |
||
| ``` | ||
|
|
||
| When using VS Code, first select and build `AVH@Debug` or `AVH@Release` in the Manage Solution view. Then select the matching `AVH-NS-only` target set and build or run it. Building `AVH-NS-only` first in a clean workspace fails because the secure HEX file and CMSE library do not yet exist. | ||
|
|
||
| The non-secure executable is listed before the secure HEX file in the target set and FVP invocation. This load order lets the executable configure the debug session before the prebuilt secure image is overlaid. | ||
|
|
||
| ## Execute the project on Arm Virtual Hardware | ||
|
|
||
| ```txt | ||
| > FVP_MPS2_Cortex-M33 -a ./out/CM33_ns/AVH/Debug/CM33_ns.axf -a ./out/CM33_s/AVH/Debug/CM33_s.axf -f ./../FVP/FVP_MPS2_Cortex-M33/fvp_config.txt --stat | ||
| > FVP_MPS2_Cortex-M33 -a ./out/CM33_ns/AVH/Debug/CM33_ns.axf -a ./out/CM33_s/AVH/Debug/CM33_s.axf -f ./../FVP/FVP_MPS2_Cortex-M33/fvp_config.txt --simlimit 10 --stat | ||
|
|
||
| telnetterminal0: Listening for serial connection on port 5000 | ||
| telnetterminal1: Listening for serial connection on port 5001 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| cbuild-pack: | ||
| resolved-packs: | ||
| - resolved-pack: ARM::CMSIS@6.1.0 | ||
| selected-by-pack: | ||
| - ARM::CMSIS | ||
| - resolved-pack: ARM::CMSIS-View@1.2.0 | ||
| selected-by-pack: | ||
| - ARM::CMSIS-View | ||
| - resolved-pack: ARM::Cortex_DFP@1.1.0 | ||
| selected-by-pack: | ||
| - ARM::Cortex_DFP | ||
| cbuild-pack: | ||
| resolved-packs: | ||
| - resolved-pack: ARM::CMSIS@6.1.0 | ||
| selected-by-pack: | ||
| - ARM::CMSIS | ||
| - resolved-pack: ARM::CMSIS-Compiler@2.3.0 | ||
| selected-by-pack: | ||
| - ARM::CMSIS-Compiler | ||
| - resolved-pack: ARM::CMSIS-View@1.2.0 | ||
| selected-by-pack: | ||
| - ARM::CMSIS-View | ||
| - resolved-pack: ARM::Cortex_DFP@1.1.0 | ||
| selected-by-pack: | ||
| - ARM::Cortex_DFP |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright (c) 2026 Arm Limited. All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /* | ||
| * Common stdout retargeting implementation for both the Secure and | ||
| * Non-secure parts of the application. | ||
| */ | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #include "retarget_stdout.h" | ||
|
|
||
| /* UART0 memory-mapped registers used for polling-based output. */ | ||
| #define UART0_BASE 0x40004000U | ||
| #define UART0_DATA (*(volatile uint32_t *)(UART0_BASE + 0x000U)) | ||
| #define UART0_STATE (*(volatile uint32_t *)(UART0_BASE + 0x004U)) | ||
| #define UART0_CTRL (*(volatile uint32_t *)(UART0_BASE + 0x008U)) | ||
| #define UART0_BAUDDIV (*(volatile uint32_t *)(UART0_BASE + 0x010U)) | ||
|
|
||
| /* Status and control bits required by the transmit path. */ | ||
| #define UART_TX_FULL (1UL << 0) | ||
| #define UART_TX_ENABLE (1UL << 0) | ||
|
|
||
| int stdout_putchar(int ch) { | ||
| /* Initialize the UART on first use, preserving an existing setup. */ | ||
| if ((UART0_CTRL & UART_TX_ENABLE) == 0U) { | ||
| UART0_BAUDDIV = 16U; | ||
| UART0_CTRL = UART_TX_ENABLE; | ||
| } | ||
|
|
||
| /* Wait until the transmit FIFO has room for the next character. */ | ||
| while ((UART0_STATE & UART_TX_FULL) != 0U) { | ||
| } | ||
|
|
||
| UART0_DATA = (uint32_t)(uint8_t)ch; | ||
| return ch; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.