Skip to content
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
29 changes: 22 additions & 7 deletions .github/workflows/module_qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ name: module_qemu
#
# - cortex_m3 on mps2-an385 and cortex_m4 on mps2-an386, the latter built
# for its FPU with the hard-float ABI;
# - cortex_m55 in secure-only and dual-state modes on mps3-an547 with the
# hard-float ABI, exercising secure stack allocation, scheduling, exhaustion,
# and timer calls with timers processed in a thread and in the ISR;
# - a protected module loaded, started, exercising the kernel, stopped and
# unloaded twice, with its memory given back;
# - a protected module faulting on a read of kernel memory, reported to the
Expand All @@ -45,6 +48,7 @@ on:
- "common_modules/**"
- "ports_module/cortex_m3/**"
- "ports_module/cortex_m4/**"
- "ports_module/cortex_m55/**"
- "test/tx/cmake/module_qemu/**"
- "scripts/tx_ci_common.sh"
pull_request:
Expand All @@ -57,6 +61,7 @@ on:
- "common_modules/**"
- "ports_module/cortex_m3/**"
- "ports_module/cortex_m4/**"
- "ports_module/cortex_m55/**"
- "test/tx/cmake/module_qemu/**"
- "scripts/tx_ci_common.sh"

Expand Down Expand Up @@ -121,29 +126,39 @@ jobs:
arm-none-eabi-gcc --version | head -1

status=0
for port in cortex_m3 cortex_m4; do
build="build/module_qemu_$port"
for config in cortex_m3 cortex_m4 cortex_m55 cortex_m55_dual cortex_m55_dual_isr; do
build="build/module_qemu_$config"
port="$config"
dual=OFF
timer_isr=OFF
case "$config" in
cortex_m55_dual*) port=cortex_m55; dual=ON ;;
esac
if [ "$config" = cortex_m55_dual_isr ]; then
timer_isr=ON
fi
echo ""
echo "=============================================================="
echo "== $port"
echo "== $config"
echo "=============================================================="

if ! cmake -S test/tx/cmake/module_qemu -B "$build" -G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$PWD/test/tx/cmake/module_qemu/arm-none-eabi-qemu.cmake" \
-DMODULE_QEMU_PORT="$port"; then
echo "::error::$port: CMake configure failed"
-DMODULE_QEMU_PORT="$port" -DMODULE_QEMU_M55_DUAL_STATE="$dual" \
-DMODULE_QEMU_TIMER_IN_ISR="$timer_isr"; then
echo "::error::$config: CMake configure failed"
status=1
continue
fi
if ! cmake --build "$build"; then
echo "::error::$port: the images did not build"
echo "::error::$config: the images did not build"
status=1
continue
fi
# --no-tests=error: the tests are registered only when QEMU and
# Python are found, and ctest's default would pass on none.
if ! ctest --test-dir "$build" --output-on-failure --no-tests=error; then
echo "::error::$port: one or more images failed on QEMU, or no tests were registered"
echo "::error::$config: one or more images failed on QEMU, or no tests were registered"
status=1
fi
done
Expand Down
717 changes: 717 additions & 0 deletions ports_module/cortex_m55/gnu/inc/tx_port.h

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions ports_module/cortex_m55/gnu/inc/tx_secure_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Thread */
/** */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/* */
/* COMPONENT DEFINITION RELEASE */
/* */
/* tx_secure_interface.h PORTABLE C */
/* 6.1 */
/* AUTHOR */
/* */
/* Scott Larson, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file defines the ThreadX secure thread stack components, */
/* including data types and external references. */
/* It is assumed that tx_api.h and tx_port.h have already been */
/* included. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 Scott Larson Initial Version 6.1 */
/* */
/**************************************************************************/

#ifndef TX_SECURE_INTERFACE_H
#define TX_SECURE_INTERFACE_H

/* Define internal secure thread stack function prototypes. */

extern UINT _tx_thread_secure_mode_stack_initialize(void);
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
extern void _tx_thread_secure_stack_initialize(void);
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);

#endif
30 changes: 30 additions & 0 deletions ports_module/cortex_m55/gnu/inc/tx_thread_secure_stack_registers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/***************************************************************************
* Copyright (c) 2026 Eclipse ThreadX contributors
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* AI Disclosure: This file was largely AI-generated by Codex (GPT-6.2-Sol).
* The AI-generated portions may be considered public domain (CC0-1.0)
* and not subject to the project's licence. The human contributor has
* reviewed and verified that the code is correct.
*
* SPDX-License-Identifier: MIT and CC0-1.0
**************************************************************************/

#ifndef TX_THREAD_SECURE_STACK_REGISTERS_H
#define TX_THREAD_SECURE_STACK_REGISTERS_H

/* MISRA C:2023 Rule 1.2 and Directive 4.3. GNU assembly accesses the
Cortex-M55 special registers. */
#define TX_SECURE_REGISTER_READ(reg, value) \
__asm__ volatile("MRS %0, " #reg : "=r" (value))
#define TX_SECURE_REGISTER_WRITE(reg, value) \
__asm__ volatile("MSR " #reg ", %0" :: "r" (value))

/* Keep both active stack registers clear before the allocator can reuse the stack. */
#define TX_SECURE_STACK_CLEAR_BEFORE_FREE() \
__asm__ volatile("MSR PSPLIM, %0\n\tMSR PSP, %0" :: "r" (0UL) : "memory")

#endif
Loading