Skip to content
Merged
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
37 changes: 19 additions & 18 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,24 @@ jobs:
cmake_path: ./test/smp/cmake
result_affix: SMP
skip_deploy: true
riscv:
permissions:
contents: read
issues: read
checks: write
pull-requests: write
pages: write
id-token: write
uses: ./.github/workflows/regression_template.yml
with:
install_script: ./scripts/install_riscv.sh
build_script: ./scripts/build_tx_riscv.sh
test_script: ./scripts/test_tx_riscv.sh
cmake_path: ./test/tx/cmake/riscv
result_affix: RISC-V
skip_deploy: true
skip_coverage: true
# riscv: disabled — re-enable when RISC-V CI is ready
# riscv:
# permissions:
# contents: read
# issues: read
# checks: write
# pull-requests: write
# pages: write
# id-token: write
# uses: ./.github/workflows/regression_template.yml
# with:
# install_script: ./scripts/install_riscv.sh
# build_script: ./scripts/build_tx_riscv.sh
# test_script: ./scripts/test_tx_riscv.sh
# cmake_path: ./test/tx/cmake/riscv
# result_affix: RISC-V
# skip_deploy: true
# skip_coverage: true
deploy:
permissions:
contents: read
Expand All @@ -66,7 +67,7 @@ jobs:
pull-requests: write
pages: write
id-token: write
needs: [tx, smp, riscv]
needs: [tx, smp]
uses: ./.github/workflows/regression_template.yml
with:
skip_test: true
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ CTestTestfile.cmake
*.a
*.htm


# Local build artifacts
build_m7/
.codex
18 changes: 15 additions & 3 deletions cmake/riscv64-gcc-rv32imc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@

# CMake toolchain file for CORE-V MCU (CV32E40P, RV32IMC)
#
# Uses the riscv64-unknown-elf-gcc multi-lib toolchain (Ubuntu package
# gcc-riscv64-unknown-elf) to cross-compile for a 32-bit RISC-V target.
# Uses the riscv64-unknown-elf-gcc cross-compiler to produce rv32imc/ilp32
# bare-metal firmware. The riscv-collab toolchain (installed to /opt/riscv by
# scripts/install_riscv.sh) is used by default. The Ubuntu package
# gcc-riscv64-unknown-elf also works and can be installed via install_deps.sh.
#
# Note: the riscv-collab toolchain is built without multilib, so it does not
# ship an rv32/ilp32 libgcc. The CORE-V MCU BSP provides a weak __clzsi2
# fallback in bsp/clz.c to satisfy any __builtin_clz() calls without relying
# on libgcc.
#
# Target ISA : rv32imc_zicsr (integer, multiply, compressed, Zicsr)
# ABI : ilp32 (32-bit int/long/ptr, no hardware FP)
Expand All @@ -33,7 +40,12 @@ set(CFLAGS "${ARCH_FLAGS}")
set(ASFLAGS "${ARCH_FLAGS}")
set(LDFLAGS "${ARCH_FLAGS}")

# Toolchain binaries (riscv64-unknown-elf can target rv32 via multilib)
# Toolchain binaries: riscv64-unknown-elf-gcc cross-compiler.
# The riscv-collab toolchain (scripts/install_riscv.sh → /opt/riscv/bin) is the
# preferred choice. The Ubuntu package (gcc-riscv64-unknown-elf, install via
# install_deps.sh) is also supported. Both are searched via PATH so whichever
# comes first is used; ensure /opt/riscv/bin precedes /usr/bin if you want the
# riscv-collab toolchain.
set(CMAKE_C_COMPILER riscv64-unknown-elf-gcc)
set(CMAKE_CXX_COMPILER riscv64-unknown-elf-g++)
set(AS riscv64-unknown-elf-as)
Expand Down
50 changes: 50 additions & 0 deletions cmake/threadx_riscv_port.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# threadx_riscv_port.cmake
#
# Helper function shared by the three RISC-V port CMakeLists files
# (risc-v32/gnu, risc-v32/clang, risc-v64/gnu).
#
# Usage:
# include(cmake/threadx_riscv_port.cmake)
# threadx_add_riscv_port(SRC_DIR <path-to-src>
# INC_DIR <path-to-inc>
# [EXAMPLE_DIR <path-to-example-build>])
#
# SRC_DIR — directory containing the 8 ThreadX .S port files.
# INC_DIR — directory containing tx_port.h (added as PUBLIC include).
# EXAMPLE_DIR — optional: if provided and contains a CMakeLists.txt,
# add_subdirectory() is called on it.

function(threadx_add_riscv_port)
cmake_parse_arguments(RISCV "" "SRC_DIR;INC_DIR;EXAMPLE_DIR" "" ${ARGN})

if(NOT RISCV_SRC_DIR)
message(FATAL_ERROR "threadx_add_riscv_port: SRC_DIR is required")
endif()
if(NOT RISCV_INC_DIR)
message(FATAL_ERROR "threadx_add_riscv_port: INC_DIR is required")
endif()

target_sources(${PROJECT_NAME}
PRIVATE
# {{BEGIN_TARGET_SOURCES}}
${RISCV_SRC_DIR}/tx_initialize_low_level.S
${RISCV_SRC_DIR}/tx_thread_context_restore.S
${RISCV_SRC_DIR}/tx_thread_context_save.S
${RISCV_SRC_DIR}/tx_thread_interrupt_control.S
${RISCV_SRC_DIR}/tx_thread_schedule.S
${RISCV_SRC_DIR}/tx_thread_stack_build.S
${RISCV_SRC_DIR}/tx_thread_system_return.S
${RISCV_SRC_DIR}/tx_timer_interrupt.S
# {{END_TARGET_SOURCES}}
)

target_include_directories(${PROJECT_NAME}
PUBLIC
${RISCV_INC_DIR}
)

if(RISCV_EXAMPLE_DIR AND
EXISTS ${RISCV_EXAMPLE_DIR}/CMakeLists.txt)
add_subdirectory(${RISCV_EXAMPLE_DIR})
endif()
endfunction()
11 changes: 7 additions & 4 deletions ports/cortex_m33/gnu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
target_sources(${PROJECT_NAME} PRIVATE
target_sources(${PROJECT_NAME}
PRIVATE
# {{BEGIN_TARGET_SOURCES}}
${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_secure_stack_allocate.c
${CMAKE_CURRENT_LIST_DIR}/src/txe_thread_secure_stack_free.c
${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.S
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_restore.S
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_save.S
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_control.S
Expand All @@ -14,8 +15,10 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_stack_build.S
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_system_return.S
${CMAKE_CURRENT_LIST_DIR}/src/tx_timer_interrupt.S
# {{END_TARGET_SOURCES}}
)

target_include_directories(${PROJECT_NAME} PUBLIC
inc
target_include_directories(${PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/inc
)
Loading