Commit Graph
53 Commits
Author SHA1 Message Date
Frédéric DesbiensGitHubCopilot 223556219+Copilot@users.noreply.github.com
7486de06c8 Refactored, consolidated, and cleaned up RV32/RV64 ports (#536)
risc-v: refactor, consolidate, and fix RV32/RV64 ports

Consolidates the RISC-V 32-bit and 64-bit GNU/Clang port sources, fixes two
pre-existing assembly bugs discovered during testing, and hardens the build
infrastructure for both the regression suite and the CORE-V MCU example.

--- Port consolidation (RV32 GNU + Clang) ---

 - Delete ports/risc-v32/clang/src/ (8 .S files had no Clang-specific
 directives; diverged from GNU only due to missing bug fixes). The Clang
 port CMakeLists.txt now compiles from ../gnu/src/.
 - Change .global -> .weak for _tx_initialize_low_level in gnu/src/ to allow
 BSP-level override without a linker conflict (adopted from Clang port).
 - Create ports/risc-v32/common/tx_port_riscv32_common.h with all definitions
 shared between GNU and Clang ports. Reduce both tx_port.h files to thin
 wrappers.
 - Add a prominent comment in risc-v64/gnu/inc/tx_port.h explaining why
 LONG/ULONG are intentionally 32-bit on RV64 (ThreadX ABI requirement,
 mirrors win64/MSVC LLP64).

--- Shared CMake helper ---

 - Add cmake/threadx_riscv_port.cmake with threadx_add_riscv_port(). All
 three port CMakeLists.txt files are reduced to ~8 lines each. Include path
 is relative to CMAKE_CURRENT_LIST_DIR so the helper works whether ports
 are built standalone or as a subdirectory of the test framework.

--- Shared example-build drivers ---

 - Create canonical driver files under ports/risc-v_common/:
  inc/csr.h                  (uintptr_t-based; portable RV32 + RV64)
  example_build/plic/        (plic.c, plic.h)
  example_build/uart/        (uart_qemu_ns16550.c/h; static inline putc_nolock)
  example_build/trap/        (trap_qemu.c; XLEN-portable mcause constants)
 - Replace per-example copies with symlinks in all qemu_virt and cva6_ariane
 example directories.
 - Fix OS_IS_INTERRUPT typo (was OS_IS_INTERUPT) in shared trap_qemu.c.
 - Gate print_hex() behind TX_RISCV_TRAP_DEBUG.

--- Bug fixes in RV32 assembly ---

tx_thread_schedule.S:

 - Solicited-return FP path: reload t0 from the mepc stack slot before
 csrw mepc, t0. After the FP restore block, t0 held the fcsr value (0 for
 new threads), which caused mepc = 0 and an immediate instruction-address
 fault on the first context switch.
 - Same path: reload t0 from the mstatus stack slot before csrw mstatus, t0
 to avoid writing the stale fcsr value into mstatus.

tx_thread_system_return.S:

 - FP callee-saved registers were saved unconditionally before the mstatus.FS
 check, causing an illegal instruction trap (mcause=0x2) when a thread with
 FS=Off (lazy FPU, thread has never used FP) voluntarily yielded.
 - Apply the same FS guard pattern used in tx_thread_context_save.S: read
 mstatus first, isolate FS[1:0], and skip fsw/fsd if FS == Off.

Both bugs were pre-existing on origin/dev and are unrelated to the
consolidation changes.

--- RV64 64-bit pointer compatibility ---

 - Add TX_TIMER_INTERNAL_EXTENSION, TX_THREAD_CREATE_TIMEOUT_SETUP, and
 TX_THREAD_TIMEOUT_POINTER_SETUP to risc-v64/gnu/inc/tx_port.h to store the
 thread timeout pointer in a VOID
  * extension field rather than truncating it
 into a 32-bit ULONG. Mirrors the win64 port pattern.
 - Define TX_TIMER_EXTENSION_PTR_DEFINED as a portable sentinel.
 - Update threadx_thread_basic_execution_test.c guard from #if defined(_WIN64)
 to #if defined(_WIN64) || defined(TX_TIMER_EXTENSION_PTR_DEFINED).
 - Disable -Wconversion for the RV64 test build: ULONG = unsigned int (32-bit)
 is intentional for ThreadX ABI but triggers spurious warnings when sizeof()
 (8 bytes on RV64) appears in arithmetic with ULONG in common/src/.

--- Regression suite cmake fixes ---

test/tx/cmake/riscv/regression/CMakeLists.txt:

 - Build testcontrol_weak_defaults.c as a separate OBJECT library and include
 it in every test executable via $<TARGET_OBJECTS:>. GNU ld does not extract
 objects from a static archive to satisfy weak symbols, so bundling it in
 test_utility was insufficient for the standalone
 threadx_initialize_kernel_setup_test.

test/tx/cmake/regression/CMakeLists.txt,
test/smp/cmake/regression/CMakeLists.txt:

 - Same fix applied to the Linux and SMP regression builds. The symbols
 abort_all_threads_suspended_on_mutex, suspend_lowest_priority, and
 abort_and_resume_byte_allocating_thread were introduced by the win64 merge
 and left the standalone test unlinkable.

--- CORE-V MCU toolchain and build fixes ---

cmake/riscv64-gcc-rv32imc.cmake:

 - Resolve riscv64-unknown-elf-gcc via PATH so the riscv-collab toolchain in
 /opt/riscv/bin is preferred when it appears first.

ports/risc-v32/gnu/example_build/core_v_mcu/bsp/clz.c (new):

 - The riscv-collab toolchain is built without rv32 multilib, so its libgcc
 does not define __clzsi2 (the helper emitted for __builtin_clz() in fll.c).
 Add a weak __clzsi2 fallback so the build is self-contained with any
 riscv64-unknown-elf toolchain. The weak attribute yields to a
 libgcc-provided strong symbol when the Ubuntu multilib package is used.

core_v_mcu/CMakeLists.txt:

 - Add bsp/clz.c to sources.
 - Reference CMAKE_TOOLCHAIN_FILE via message(STATUS) to suppress the false-
 positive "Manually-specified variables were not used by the project" CMake
 warning and to show the active toolchain at configure time.

--- Housekeeping ---

 - Rename azrtos_test_* -> threadx_test_* (eliminate Azure RTOS branding).
 - Add RV64 QEMU CI test script:
  ports/risc-v64/gnu/example_build/qemu_virt/test/
  threadx_test_tx_gnu_riscv64_qemu.py
 - Normalize entry.s -> entry.S in all 4 example directories.
 - .gitignore: exclude build_m7/ and .codex local artifacts.
 - CI: comment out the riscv regression workflow job and remove it from the
 deploy job's needs list (preserved in-place for easy re-enablement).

--- Verified ---

 - 95/95 RV32 regression tests pass (QEMU virt)
 - 95/95 RV64 regression tests pass (QEMU virt)
 - All 5 Linux build configurations build cleanly (default_build_coverage,
 disable_notify_callbacks_build, stack_checking_build,
 stack_checking_rand_fill_build, trace_build)
 - CORE-V MCU example_build links cleanly with /opt/riscv toolchain

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
2026-05-27 10:30:57 -04:00
Akif EjazandGitHub c1e3678797 Add QEMU based CI regression test infra for RV32 and RV64 (#526)
Added a QEMU virt-machine BSP and CTest infrastructure to run the
ThreadX regression suite on both RISC-V 32-bit and 64-bit targets
in CI.

New components:
- BSP (entry, trap, PLIC, CLINT timer, UART, linker script) targeting
  QEMU virt machine for RV32 and RV64
- CMake build system with Ninja, supporting multiple build configs
- CI scripts: install_riscv.sh (toolchain + QEMU), build_tx_riscv.sh,
  test_tx_riscv.sh
- GitHub Actions workflow job for RISC-V regression gating

Port fixes:
- RV32 tx_thread_context_restore.S: set MPIE alongside MPP (0x1800 →
  0x1880) so mret re-enables interrupts
- RV32/RV64 tx_port.h: add TX_REGRESSION_TEST extension macros needed
  by the test harness
- RV32/RV64 example_build scripts: add compile and QEMU launch steps

Regression test portability fixes:
- Block memory tests: increase pool sizes (320 → 340) to accommodate
  larger RISC-V block-header alignment
- Byte memory test: replace hardcoded offsets with BYTE_POOL_OVERHEAD
  macro for portable pool-size computation
- Event flag timeout test: make counter tolerance unconditional,
  removing linux-only guard

Signed-off-by: Akif Ejaz <akif.ejaz@10xengineers.ai>
2026-05-19 11:03:23 -04:00
Frédéric DesbiensandGitHub c3259a2160 Updated copyright headers and version number constants (#509)
* Updated version number constants

* Removed revision history from all files

* Added Eclipse ThreadX contributors' copyright header
2026-03-05 10:46:30 +01:00
Frédéric Desbiens 8616486d99 Fixed code coverage report download step in deploy_code_coverage. 2025-07-29 17:05:07 -04:00
Frédéric Desbiens 8e808e70f1 Added condition to "Coverage Report Name". Corrected formatting. 2025-07-29 16:46:45 -04:00
Frédéric Desbiens c00056bb78 Fixed code coverage artefacts upload 2025-07-29 16:23:08 -04:00
Frédéric Desbiens 754c348568 Updated all actions to their latest release.
Signed-off-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
2025-07-17 19:51:12 -04:00
Frédéric Desbiens b19b468e13 Added workflow permissions.
Signed-off-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
2025-07-17 16:26:04 -04:00
Frédéric DesbiensandGitHub 7ad78c40e9 Merge pull request #387 from netomi/patch-1
regression_test / tx (push) Has been skipped
regression_test / smp (push) Has been skipped
regression_test / deploy (push) Has been skipped
cortex_m / Cortex M0 build (push) Has been cancelled
cortex_m / Cortex M3 build (push) Has been cancelled
cortex_m / Cortex M4 build (push) Has been cancelled
cortex_m / Cortex M7 build (push) Has been cancelled
Add new label for all created issues, enforce the use of issue templates
2025-02-27 11:32:30 -05:00
Frédéric Desbiens 72ab369eb7 Upgrading upload-artifact version to 4.6.0. 2025-02-13 10:58:58 -05:00
dependabot[bot]andGitHub 7add20186e Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 22:12:22 +00:00
Thomas NeidhartandGitHub 7b2259c052 Add new label 2024-05-27 09:05:29 +02:00
Thomas NeidhartandGitHub 23691895c9 Add new label 2024-05-27 09:05:07 +02:00
Thomas NeidhartandGitHub f648d4b461 Add new label 2024-05-27 09:04:46 +02:00
Thomas NeidhartandGitHub bfde2d5493 Add new label 2024-05-27 09:04:13 +02:00
Thomas NeidhartandGitHub e7fde60363 Create config.yml 2024-05-27 09:02:53 +02:00
Stefan WickandGitHub 0093df510b Update hardware-or-architecture-support.md 2024-03-10 22:09:40 -07:00
Stefan WickandGitHub bbce1f326c Update feature_request.md 2024-03-10 22:09:22 -07:00
Stefan WickandGitHub 7a29b8b463 Update bug_report.md 2024-03-10 22:08:50 -07:00
Eric WolzandGitHub 66954968b1 Delete .github/workflows/codeql.yml 2024-01-18 11:31:07 -08:00
Eric WolzandGitHub 1047cd7261 Update CODEOWNERS 2024-01-11 13:48:24 -08:00
Wenhui Xie 23aa67c948 Add sudo to move coverage folder created by root user. 2023-12-22 01:36:38 +00:00
Ting ZhuandGitHub 776ea213ce Correct condition syntax in "Prepare Coverage GitHub Pages" step.l (#329)
* Correct syntax.

* Update regression_template.yml

* Update regression_template.yml
2023-11-30 10:52:29 +08:00
Ting ZhuandGitHub ebe373b1f3 Add additional condition for "Prepare Coverage GitHub Pages" step. 2023-11-29 14:17:16 +08:00
a8e5d0946c Added input skip_coverage and coverage_name for customiziing. (#327)
* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

Coverage name of all -> default_build_coverage

* Update regression_template.yml

* Update regression_template.yml

Check inputs.skip_coverage to do steps.

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

Enable coverage upload when manually triggered.

* Update regression_template.yml

* Update regression_template.yml

* Update regression_template.yml

* Update .github/workflows/regression_template.yml

Fix comments.

Co-authored-by: TiejunZhou <50469179+TiejunMS@users.noreply.github.com>

---------

Co-authored-by: TiejunZhou <50469179+TiejunMS@users.noreply.github.com>
2023-11-27 11:50:52 +08:00
TiejunZhouandGitHub cad6c42ecc Fix action to run on fork repo for cortex-m builds and unify them (#326) 2023-11-24 16:23:21 +08:00
TiejunZhouandGitHub e420e2fa02 Restrict deploy run condition (#325)
* Restrict deploy run condition

* Fail the job for testing purpose

* Revert "Fail the job for testing purpose"

This reverts commit 6ae18cafe2.
2023-11-24 15:41:34 +08:00
TiejunZhouandGitHub 5f9c713c48 Split artifacts for multiple jobs (#324)
* Test multiple code coverage pages

* Add affix to artifacts

* Test uploading code coverage as artifact

* Deploy GitHub pages at last for multiple jobs

* Test using unified upload pages

* Disable test cases to accelerate experiment

* Fix escape character $

* Revert "Test using unified upload pages"

This reverts commit 3668d9f672.

* Set destination for downloaded artifact

* Use a different artifact name

* Fix escape value

* Revert "Disable test cases to accelerate experiment"

This reverts commit 8468f17d02.

* Override duplicated github-pages in artifact

* Revert "Override duplicated github-pages in artifact"

This reverts commit 17a83aa97d.

* Delete Duplicate Code Coverage Artifact
2023-11-24 13:59:26 +08:00
TiejunZhouandGitHub 11a7db22b4 Convert ADO pipelines to GitHub actions (#321)
* Convert ADO pipelines to GitHub actions

* Remove version in uses as not valid for local workflows

* Fix cmake path and add deploy url affix

* Add SMP build job

* Fix code coverage URL

* Add affix to titles of steps

* Remove ADO pipelines

* Add affix to titles of code coverage

* separate PR results for multiple jobs

* Revert "separate PR results for multiple jobs"

This reverts commit 6da13540fd.

* separate PR results for multiple jobs
2023-11-23 13:17:52 +08:00
TiejunZhouandGitHub 1ffd7c2cde Allow manual trigger for CodeQL action (#286) 2023-07-13 13:24:31 +08:00
TiejunZhouandGitHub fd2bf7c19a Enable CodeQL (#285)
* Enable CodeQL

* Build cortex-m0 in CodeQL

* Trigger the CodeQL by cron only
2023-07-13 13:09:47 +08:00
TiejunZhouandGitHub 08380caa77 Unify ThreadX and SMP for ARMv8-A. (#275)
* Unify ThreadX and SMP for ARMv8-A.

* Fix path in pipeline to check ports arch.

* Add ignore folders for ARM DS

* Generate ThreadX and SMP ports for ARMv8-A.

* Ignore untracked files for ports_arch check.

* Use arch instead of CPU to simplify the project management.
2023-06-21 18:23:36 +08:00
TiejunZhouandGitHub 25a8fa2362 Add a pull request template (#272) 2023-06-06 14:03:35 +08:00
TiejunZhouandGitHub 672c5e953e Release ARMv7-A architecture ports and add tx_user.h to GNU port assembly files (#250)
* Release ARMv7-A architecture ports

* Add tx_user.h to GNU port assembly files

* Update GitHub action to perform check for Cortex-A ports
2023-04-19 17:56:09 +08:00
TiejunZhouandGitHub 23680f5e5f Release ARMv7-M and ARMv8-M architecture ports (#249)
* Release ARMv7-M and ARMv8-M architecture ports

* Add a pipeline to check ports_arch
2023-04-18 18:11:20 +08:00
TiejunZhouandGitHub d64ef2ab06 Filter the path for PR trigger and add codeowners (#248)
* Filter the path for PR trigger

* Add codeowners

* Fix syntax in pipeline
2023-04-17 13:16:14 +08:00
Liya DuandGitHub 35a301ad3b Update issue templates 2022-11-15 21:03:59 -08:00
Liya DuandGitHub e23b09fe0b Update issue templates 2022-11-15 20:48:09 -08:00
Liya DuandGitHub aea1a3d8f9 Update issue templates 2022-11-15 20:44:48 -08:00
Scott Larson 69287b8bb4 update workflows 2020-12-09 10:57:26 -08:00
Scott LarsonandGitHub 1777796996 Update ci_cortex_m0.yml 2020-12-07 14:56:14 -08:00
Scott LarsonandGitHub 64b4d510ba Update ci_cortex_m0.yml 2020-12-07 14:38:48 -08:00
PProvost dd64ed2b19 Cache update every 3 days is better 2020-05-15 18:47:55 -06:00
PProvost 70c3360947 Added cortex m0 and m3 to cloud CI 2020-05-14 14:14:19 -06:00
PProvost f9401c4c03 Updated GH actions to cache arm-none-eabi 2020-05-14 14:11:20 -06:00
PProvost 1710230620 Still working on path issues 2020-05-14 14:02:43 -06:00
PProvost 1bc7f6aa50 Add cached folder to path 2020-05-14 13:45:25 -06:00
PProvost 2efcfc4ad9 Typo in cache updater 2020-05-14 13:37:37 -06:00
PProvost 710a8b8d53 Scheduled cache updater 2020-05-14 13:25:27 -06:00
PProvost 9e56e21def Caching arm compiler for builds 2020-05-14 13:02:07 -06:00