Skip to content

Added the Renesas RH850 G4KH GNU port - #842

Open
parthitce wants to merge 5 commits into
eclipse-threadx:devfrom
linumiz:rh850/rh850-gnu
Open

parthitce wants to merge 5 commits into
eclipse-threadx:devfrom
linumiz:rh850/rh850-gnu

Conversation

@parthitce

Copy link
Copy Markdown

PR checklist

  • Updated function header with a short description and version number
  • Added test case for bug fix or new feature
  • Validated on real hardware

ThreadX port for the Renesas RH850 G4KH core with GCC, hard and soft float. Follows up on #515.

Includes a QEMU example, the regression suite in test/tx/cmake/rh850 and a CI workflow. All 96 tests pass in all six configurations, hard and soft. Tested on QEMU only, not on hardware yet.

Toolchain: https://github.com/linumiz/rh850-gcc-toolchain/releases/tag/v1.2.0
QEMU: https://github.com/linumiz/qemu-rh850/releases/tag/rh850-v1.2.0

Signed-off-by: Parthiban Nallathambi parthiban@linumiz.com

@fdesbiens

Copy link
Copy Markdown
Contributor

Hi @parthitce.

Thank you very much for this contribution! I should be able to review it next week. In the meantime, I authorised the CI run to please keep an eye on it.

@parthitce

Copy link
Copy Markdown
Author

Hi @parthitce.

Thank you very much for this contribution! I should be able to review it next week. In the meantime, I authorised the CI run to please keep an eye on it.

Sure, many thanks.

@fdesbiens fdesbiens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the RH850 port and putting its QEMU suite in CI. I reproduced 96/96 passes in each of the 12 hard- and soft-float configurations, plus 96/96 with low power enabled. I could not test on hardware. The two code and CI concerns below need attention. Could you also provide measured line and branch coverage for the new port code, with an explanation of any uncovered paths?

Comment thread ports/rh850/gnu/inc/tx_port.h Outdated
#define TX_DISABLE \
{ \
interrupt_save = _tx_port_mask_get(); \
_tx_port_mask_set(TX_INT_DISABLE); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could TX_DISABLE preserve the stricter of the current PLMR value and TX_INT_DISABLE? For example, with TX_PORT_MAX_IPL=2, a caller can set PLMR to 0 to mask every EIINT, but a ThreadX service then writes 2 and temporarily unmasks priorities 0 and 1. A test with an already masked posture would help guard this path.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, a stricter caller PLMR is kept now. Added mask_posture for it.

Comment thread test/tx/cmake/rh850/run.sh Outdated
--test-output-size-passed 4194304 \
--test-output-size-failed 4194304 \
--output-on-failure \
--repeat until-pass:${repeat_fail} \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we remove --repeat until-pass:2 from the CI run? A test that fails once and passes on retry currently leaves the job green, which could hide an intermittent context-switch or interrupt problem.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, all runs pass without it.

set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../regression)
set(BSP_DIR ${CMAKE_CURRENT_LIST_DIR}/../bsp)

set(regression_test_cases

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hard-float build saves and restores FPSR and FPEPC, but the selected tests do not use floating-point operations or give threads distinct FPU state. Could you add a QEMU test that switches between two threads with different FPU state and checks each after resumption?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added fpu_switch, two threads with their own FPSR and FPEPC.

For the Renesas RH850 G4KH core with v850-elf-gcc, hard and soft float. Issue eclipse-threadx#515.
TX_DISABLE keeps a stricter PLMR of the caller when TX_PORT_MAX_IPL is above 0.
TX_RH850_MAX_IPL sets TX_PORT_MAX_IPL and RH850_EXTRA_FLAGS adds compiler flags.
The library builds hard and soft with RH850_EXTRA_FLAGS=-Werror and no warnings.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Runs samples/demo_threadx.c on the rh850-u2c machine of qemu-system-rh850, with two
port tests. mask_posture checks that ThreadX services keep a caller PLMR of 0, and
fpu_switch checks FPSR and FPEPC of switched threads in the hard float build.
Tested on QEMU rh850-u2c, the example passes hard 3/3, soft 2/2 and max-ipl 3/3.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Builds test/tx/regression with the configurations of test/tx/cmake/riscv. Each test
runs once, a failure is not retried.
Tested on QEMU rh850-u2c, regression 576/576 hard and soft without retries.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Adds the build and QEMU run steps of the RH850 GNU port.
Tested on QEMU rh850-u2c, the readme steps pass hard and soft.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Builds the RH850 port hard and soft with -Werror and runs the example, the example
with TX_RH850_MAX_IPL=4 and the regression tests on qemu-system-rh850, also for kernel
changes. Tool archives are checked with SHA-256.
Tested locally, the workflow steps pass. actionlint and shellcheck report nothing.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
@parthitce

Copy link
Copy Markdown
Author

Thanks for adding the RH850 port and putting its QEMU suite in CI. I reproduced 96/96 passes in each of the 12 hard- and soft-float configurations, plus 96/96 with low power enabled. I could not test on hardware. The two code and CI concerns below need attention. Could you also provide measured line and branch coverage for the new port code, with an explanation of any uncovered paths?

Thanks for the review @fdesbiens, all fixed. Coverage on QEMU: port asm about 80% hard and 86% soft, timer 100%. The gaps are nested interrupts and FPU exception paths. Kindly re-visit.

@parthitce
parthitce requested a review from fdesbiens November 29, 2026 15:41
@fdesbiens

Copy link
Copy Markdown
Contributor

Hi @parthitce, thanks for addressing the PLMR, CI retry, and FPU context-switch feedback. I reran QEMU on 04da0b0 without retries. Each of the 12 hard- and soft-float configurations passed 96/96 tests, and the hard-float tickless build also passed 96/96. All 11 example tests passed, including the stricter PLMR check at IPL 4 and the FPU context-switch test.

Could you add focused QEMU tests for nested interrupts and pending FPU exceptions, then share the per-file line and branch coverage for the port and the commands used to collect it? Please include any remaining uncovered paths and why they remain uncovered.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants