Migrates plain ThreadX to the upstream RISC-V ports

Keeps the Moonlight startup objects local to the board. Updates the plain and SMP VP regression harnesses for the new ThreadX revision and replaces generated ISR hooks with direct callbacks.
This commit is contained in:
alex committed 2026-11-26 18:56:36 +01:00
1 parent 26fd407a1e
commit d404e17e5a
22 files changed
+148 -2311

No files matched your search

+32 -74
View File
@@ -1,85 +1,43 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* 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
**************************************************************************/
.section .text
.align 4
#include "tx_port.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* trap_entry RISC-V64/GNU */
/* 6.2.1 */
/* AUTHOR */
/* */
/* Jer6y , luojun@oerv.isrc.iscas.ac.cn */
/* */
/* DESCRIPTION */
/* */
/* This function is responsible for riscv processor trap handle */
/* It will do the contex save and call c trap_handler and do contex */
/* load */
/* */
/* INPUT */
/* */
/* None */
/* */
/* OUTPUT */
/* */
/* None */
/* */
/* CALLS */
/* */
/* trap_handler */
/* */
/* CALLED BY */
/* */
/* hardware exception */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 10-25-2024 Jerry Luo */
/* */
/**************************************************************************/
#include "tx_port.h"
/**************************************************************************/
/**************************************************************************/
/** */
/** ThreadX Component */
/** */
/** Initialize */
/** */
/**************************************************************************/
/**************************************************************************/
.global trap_entry
.extern _tx_thread_context_restore
trap_entry:
addi sp, sp, -TX_INTERRUPT_FRAME_SIZE
#if __riscv_xlen == 64
#define REG_STORE sd
#define REG_LOAD ld
#define REG_BYTES 8
#else
#define REG_STORE sw
#define REG_LOAD lw
#define REG_BYTES 4
#endif
STORE x1, 28*REGBYTES(sp) // Store RA, 28*REGBYTES(because call will override ra [ra is a calle register in riscv])
.section .text
.balign 4
.global trap_entry
.type trap_entry, @function
trap_entry:
addi sp, sp, -TX_RISCV_TRAP_FRAME_SIZE
REG_STORE ra, (28 * REG_BYTES)(sp)
call _tx_thread_context_save
call _tx_thread_context_save
csrr a0, mcause
csrr a1, mepc
csrr a2, mtval
addi sp, sp, -TX_RISCV_TRAP_CALL_FRAME_SIZE
REG_STORE ra, 0(sp)
call trap_handler
REG_LOAD ra, 0(sp)
addi sp, sp, TX_RISCV_TRAP_CALL_FRAME_SIZE
csrr a0, mcause
csrr a1, mepc
csrr a2, mtval
addi sp, sp, -16 // Keep the C handler stack aligned
STORE ra, 0(sp)
call trap_handler
LOAD ra, 0(sp)
addi sp, sp, 16
call _tx_thread_context_restore
// it will nerver return
.weak trap_handler
trap_handler:
1:
j 1b
.section .text
call _tx_thread_context_restore
1: j 1b
.size trap_entry, .-trap_entry