Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Add Arm MPS3 AN524 Target and Trusted Firmware-M by microbuilder · Pull Request #264 · eclipse-threadx/getting-started · GitHub
Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitmodules
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = https://github.com/azure-rtos/threadx.git
# url = https://github.com/azure-rtos/threadx.git
url = https://github.com/Linaro/threadx.git
branch = mps3_an524
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
[submodule "core/lib/tfm"]
path = core/lib/tfm
url = https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git
[submodule "core/lib/tf-m-tests"]
path = core/lib/tf-m-tests
url = https://git.trustedfirmware.org/TF-M/tf-m-tests.git
34 changes: 34 additions & 0 deletions Arm/MPS3_AN524/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
set(CMAKE_C_STANDARD 99)

set(GSG_BASE_DIR ${CMAKE_SOURCE_DIR}/../..)
set(CORE_SRC_DIR ${GSG_BASE_DIR}/core/src)
set(CORE_LIB_DIR ${GSG_BASE_DIR}/core/lib)

# use the repo version of ninja on Windows as there is no Ninja installer
if(WIN32)
set(CMAKE_MAKE_PROGRAM ${GSG_BASE_DIR}/cmake/ninja CACHE STRING "Ninja location")
endif()

# Set the toolchain if not defined
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "${GSG_BASE_DIR}/cmake/arm-gcc-cortex-m33.cmake")
endif()

include(${GSG_BASE_DIR}/cmake/utilities.cmake)

# Define the Project
# The project name must be mps3_524 to conform to the 8.3 naming convention
project(mps3_524 C ASM)

# Exceptions required by CMSIS UART driver (-Wno-ignored-qualifiers -Wno-return-type)
# Make threadx run in non-secure mode (-DTX_SINGLE_MODE_NON_SECURE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-qualifiers -Wno-return-type -DTX_SINGLE_MODE_NON_SECURE")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DTX_SINGLE_MODE_NON_SECURE")

# add_subdirectory(${CORE_SRC_DIR} core_src)
add_subdirectory(lib)
add_subdirectory(app)
120 changes: 120 additions & 0 deletions Arm/MPS3_AN524/app/CMakeLists.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(APP_CONFIG_OPTIONS "${CMAKE_CURRENT_LIST_DIR}/config.cmake" CACHE FILEPATH
"Configuration Options"
)

include(${APP_CONFIG_OPTIONS})

set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/startup/mps3_an524.ld")

set(SOURCES
startup/startup_cmsdk_mps3_an524_bl2.S
main.c
board_init.c
console.c
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_definitions(${PROJECT_NAME}
PRIVATE
$<$<BOOL:${TFM_REGRESSION}>:TFM_REGRESSION>
$<$<BOOL:${TFM_PSA_TEST}>:TFM_PSA_TEST>
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
threadx-cmsis

# app_common
# jsmn
AN524
tfm_api
# netx_driver
)

target_link_options(${PROJECT_NAME}
PRIVATE
-T${LINKER_SCRIPT} -Wl,-Map=${PROJECT_NAME}.map)

set_target_properties(${PROJECT_NAME}
PROPERTIES
LINK_DEPENDS ${LINKER_SCRIPT}
SUFFIX ".elf"
)

target_include_directories(${PROJECT_NAME}
PUBLIC
.
)

if(BUILD_WITH_TFM)
if (NOT TFM_MCUBOOT_IMAGE_NUMBER STREQUAL "OFF")
set(TFM_MCUBOOT_IMAGE_NUMBER_OPTION "MCUBOOT_IMAGE_NUMBER ${TFM_MCUBOOT_IMAGE_NUMBER}")
endif()
if (TFM_ISOLATION_LEVEL)
set(TFM_ISOLATION_LEVEL_OPTION "ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}")
endif()
if (TFM_KEY_FILE_S)
set(TFM_KEY_FILE_S_OPTION "KEY_FILE_S ${TFM_KEY_FILE_S}")
endif()
if (TFM_KEY_FILE_NS)
set(TFM_KEY_FILE_NS_OPTION "KEY_FILE_NS ${TFM_KEY_FILE_NS}")
endif()
if (TFM_PROFILE)
set(TFM_PROFILE_OPTION BUILD_PROFILE ${TFM_PROFILE})
endif()
if (TFM_BL2)
set(TFM_BL2_OPTION "BL2")
endif()
if (TFM_IPC)
set(TFM_IPC_OPTION "IPC")
endif()
if (TFM_PSA_TEST)
set(TFM_PSA_TEST_OPTION PSA_TEST_SUITE ${TFM_PSA_TEST})
endif()
if (TFM_REGRESSION)
set(TFM_REGRESSION_OPTION "REGRESSION")
endif()
if (TFM_PARTITION_PROTECTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_PROTECTED_STORAGE")
endif()
if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
list(APPEND PARTITIONS "TFM_PARTITION_INTERNAL_TRUSTED_STORAGE")
endif()
if (TFM_PARTITION_PLATFORM)
list(APPEND PARTITIONS "TFM_PARTITION_PLATFORM")
endif()
if (TFM_PARTITION_CRYPTO)
list(APPEND PARTITIONS "TFM_PARTITION_CRYPTO")
endif()
if (TFM_PARTITION_INITIAL_ATTESTATION)
list(APPEND PARTITIONS "TFM_PARTITION_INITIAL_ATTESTATION")
endif()
if (TFM_PARTITION_AUDIT_LOG)
list(APPEND PARTITIONS "TFM_PARTITION_AUDIT_LOG")
endif()
if (TFM_PARTITION_FIRMWARE_UPDATE)
list(APPEND PARTITIONS "TFM_PARTITION_FIRMWARE_UPDATE")
endif()
if (PARTITIONS)
set(PARTITIONS_OPTION "ENABLED_PARTITIONS ${PARTITIONS}")
endif()
trusted_firmware_build(
BINARY_DIR ${CMAKE_BINARY_DIR}/tfm
BOARD arm/mps3/an524
${TFM_PROFILE_OPTION}
${TFM_PSA_TEST_OPTION}
${TFM_MCUBOOT_IMAGE_NUMBER_OPTION}
${TFM_ISOLATION_LEVEL_OPTION}
${TFM_KEY_FILE_S_OPTION}
${TFM_KEY_FILE_NS_OPTION}
${TFM_BL2_OPTION}
${TFM_IPC_OPTION}
${TFM_REGRESSION_OPTION}
${PARTITIONS_OPTION}
)
endif()
35 changes: 35 additions & 0 deletions Arm/MPS3_AN524/app/board_init.c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
/* Copyright (c) 2021 Linaro Limited. */

#include <stdio.h>
#include <assert.h>

#include "board_init.h"

/* Initialise uart console */
static void console_init()
{
int32_t ret;

/* Initialize the USART driver */
ret = Driver_USART0.Initialize(NULL);
assert(ret == ARM_DRIVER_OK);

/* Power up the USART peripheral */
ret = Driver_USART0.PowerControl(ARM_POWER_FULL);
assert(ret == ARM_DRIVER_OK);

/* Configure the USART to 115200 (DEFAULT_UART_BAUDRATE) Bits/sec */
ret = Driver_USART0.Control(ARM_USART_MODE_ASYNCHRONOUS,
DEFAULT_UART_BAUDRATE);
assert(ret == ARM_DRIVER_OK);

/* Enable Transmitter line */
Driver_USART0.Control(ARM_USART_CONTROL_TX, 1);
}

/* Initialise the board */
void board_init()
{
/* Initialise uart console */
console_init();
}
14 changes: 14 additions & 0 deletions Arm/MPS3_AN524/app/board_init.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
/* Copyright (c) 2021 Linaro Limited. */

#ifndef _BOARD_INIT_H
#define _BOARD_INIT_H

#include "Driver_USART.h"
#include "device_cfg.h"

/* USART0 driver */
extern ARM_DRIVER_USART Driver_USART0;

void board_init();

#endif // _BOARD_INIT_H
159 changes: 159 additions & 0 deletions Arm/MPS3_AN524/app/config.cmake
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
# Copyright (c) 2021 Linaro Limited.
# Licensed under the MIT License.

set(TX_TFM_BASE_DIR ${GSG_BASE_DIR}/core/lib/tfm)
set(TX_TFM_BL2_DIR ${TX_TFM_BASE_DIR}/bl2/ext/mcuboot)

option(BUILD_WITH_TFM "Build with TF-M as the Secure Execution Environment" ON)
include(CMakeDependentOption)
set(TFM_KEY_FILE_S
"${TX_TFM_BL2_DIR}/root-RSA-3072.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing secure
firmware images."
)

set(TFM_KEY_FILE_NS
"${TX_TFM_BL2_DIR}/root-RSA-3072_1.pem"
CACHE FILEPATH
"The path and filename for the .pem file containing the private key
that should be used by the BL2 bootloader when signing non-secure
firmware images."
)

set(TFM_PROFILE
OFF
CACHE STRING
"The build profile used for TFM Secure image."
)

set(TFM_ISOLATION_LEVEL
"1"
CACHE STRING
"Manually set the required TFM isolation level. Possible values are
1,2 or 3; the default is set by build configuration."
)

cmake_dependent_option(TFM_BL2
"TFM is designed to run with MCUboot in a certain configuration.
This config adds MCUboot to the build - built via TFM's build system."
ON
BUILD_WITH_TFM OFF
)

set(TFM_MCUBOOT_IMAGE_NUMBER
"1"
CACHE STRING
"How many images the bootloader sees when it looks at TFM and the app.
When this is 1, the S and NS are considered as 1 image and must be
updated in one atomic operation. When this is 2, they are split and
can be updated independently if dependency requirements are met."
)

cmake_dependent_option(TFM_PARTITION_PROTECTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
"Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_CRYPTO
"Setting this option will cause '-DTFM_PARTITION_CRYPTO'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_INITIAL_ATTESTATION
"Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_PLATFORM
"Setting this option will cause '-DTFM_PARTITION_PLATFORM'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_AUDIT_LOG
"Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_PARTITION_FIRMWARE_UPDATE
"Setting this option will cause '-DTFM_PARTITION_FIRMWARE_UPDATE'
to be passed to the TF-M build system. Look at 'config_default.cmake'
in the trusted-firmware-m repository for details regarding this
parameter. Any dependencies between the various TFM_PARTITION_*
options are handled by the build system in the trusted-firmware-m
repository."
On
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_IPC
"When enabled, this option signifies that the TF-M build supports
the PSA API (IPC mode) instead of the secure library mode."
ON
BUILD_WITH_TFM OFF
)

cmake_dependent_option(TFM_REGRESSION
"When enabled, this option signifies that the TF-M build includes
the Secure and the Non-Secure regression tests."
OFF
BUILD_WITH_TFM OFF
)

set(TFM_PSA_TEST
""
CACHE STRING
"Enable a PSA test suite. Available test suites include CRYPTO,
PROTECTED_STORAGE, INTERNAL_TRUSTED_STORAGE, STORAGE and
INITIAL_ATTESTATION."
)

set(APP_CONFIG OFF CACHE FILEPATH
"Configuration file for the MPS3 AN524 example app"
)

if (APP_CONFIG)
include(${APP_CONFIG})
endif()
Loading