33typedef enum : uintptr_t {
42typedef enum : uint32_t {
58typedef enum : uint32_t {
84 __asm__
volatile(
"wfi");
97typedef enum : uint16_t {
108 (void)
ra8_nsc_log_emit(
"UI",
"UI thread started -- Simulating screen/event loop");
126 (void)
ra8_nsc_log_emit(
"WORK",
"Worker thread started -- Processing background tasks");
132 (void)
ra8_nsc_log_emit(
"WORK",
"Worker Loop: Reading battery & sensor state via NSC veneers");
143 (void)first_unused_memory;
149 (
CHAR*)(uintptr_t)
"UI Thread",
161 (
CHAR*)(uintptr_t)
"Worker Thread",
196 for (uintptr_t addr = bss_start; addr < bss_end; addr +=
sizeof(uint32_t)) {
197 *(
volatile uint32_t*)addr = 0U;
209 (void)
ra8_nsc_log_emit(
"BOOT",
"tz_threadx_demo: Non-Secure world online!");
226 __asm__
volatile(
"wfi");
void PendSV_Handler(void)
Perform the ThreadX Non-Secure context switch requested by PendSV.
void _tx_timer_interrupt(void)
Advance the ThreadX kernel timer by one hardware tick.
void ns_reset_handler(void)
Non-Secure Reset handler: entered via Secure-to-NS transition.
void tx_application_define(void *first_unused_memory)
Setup ThreadX threads and resources.
const uint32_t g_ra8_ns_vector_table[8]
NS-world ARMv8-M vector table.
uint32_t g_ra8_ls_ns_stack_top
uint32_t g_ra8_ls_ns_bss_start
NS world reset handler – entry point of the BLXNS branch.
void ns_reset_handler(void)
uint32_t g_ra8_ls_ns_bss_end
ns_scb_addr_t
NS-state VTOR (0xE000ED08 is the current-domain alias in NS).
@ k_ns_scb_vtor_addr
Ns scb vtor address.
static void ns_nmi_halt(void)
NMI / fault halt vector for the NS table.
void(* ns_exc_handler_t)(void)
Function-pointer type for entries in the NS vector table.
static void ns_systick_handler(void)
NS SysTick handler – drives the ThreadX 1 ms time base.
uint32_t g_ra8_ls_ns_run_start
Linker symbol: NS vector table base.
ns_log_cadence_t
Heartbeat-log cadence per thread (iterations between log lines).
@ k_ns_ui_heartbeat_iters
UI heartbeat log cadence.
@ k_ns_work_heartbeat_iters
Worker heartbeat log cadence.
static TX_THREAD s_ui_thread
static TX_THREAD s_work_thread
static void ns_panic_halt(void)
Park the CPU in an idle loop if a fatal startup error occurs.
ns_thread_cadence_t
Per-thread sleep cadence, in ThreadX ticks.
@ k_ns_work_sleep_ticks
Worker thread sleep between batches.
@ k_ns_ui_sleep_ticks
UI thread sleep between refreshes.
ns_thread_stack_t
Stack sizes for Non-Secure ThreadX threads.
@ k_ns_ui_thread_stack_size
Stack size for UI thread.
@ k_ns_work_thread_stack_size
Stack size for Worker thread.
static uint8_t s_ui_thread_stack[k_ns_ui_thread_stack_size]
static void ui_thread_entry(ULONG thread_input)
UI thread entry: logs periodically to simulate UI rendering loops.
static uint8_t s_work_thread_stack[k_ns_work_thread_stack_size]
static void work_thread_entry(ULONG thread_input)
Worker thread entry: simulates background sensors/storage processing.
void PendSV_Handler(void)
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Non-Secure Callable veneers – the only NS->S gateway.
ra8_err_t ra8_nsc_log_emit(const char *tag, const char *message)
NSC veneer: emit a log line via the secure ITM channel.
ra8_err_t ra8_nsc_periph_init(void)
NSC veneer: bring up the secure-side peripheral substrate.
volatile uint32_t g_ra8_threadx_systick_ready
0 until _tx_initialize_low_level has armed ThreadX's SysTick + timer state; 1 afterwards.
char CHAR
ThreadX-compatible CHAR (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
Opaque thread stand-in for the host build.