Repository navigation
BACKPORT: arch: arm: cortex_m: add ARMV8_M_CDE_CP0 option - #260
venkatesan-krishnamoorthy wants to merge 3 commits into
Conversation
commit a96482e upstream. Add a Kconfig option for SoCs that implement an Arm Custom Datapath Extension coprocessor on CP0. GCC rejects +cdecp0 on -mcpu, so when the option is set build with -march=armv8[.1]-m.main[+dsp|+mve|+mve.fp]+cdecp0 and -mtune set to the CPU, via the new GCC_M_ARCH and GCC_M_TUNE variables. This applies to any ARMv8-M Mainline CPU rather than Cortex-M33 only. Clang takes +cdecp0 on -mcpu. The option is not selected by any SoC yet, so there is no change in behavior for existing targets. Signed-off-by: Venkatesan Krishnamoorthy <v-krishnamoorthy@ti.com>
commit 59510f9 upstream. Select ARMV8_M_CDE_CP0 so the build enables the CDE coprocessor on CP0 for this SoC. Signed-off-by: Venkatesan Krishnamoorthy <v-krishnamoorthy@ti.com>
commit e040823 upstream. Add a build-only test that enables ARMV8_M_CDE_CP0 through a test-local Kconfig symbol and uses the CDE intrinsics from arm_cde.h on coprocessor 0. The test checks __ARM_FEATURE_CDE and the coprocessor mask at compile time, so a missing +cdecp0 in the compiler flags fails the build. The code is never run: whether CP0 is implemented and enabled depends on the SoC. Built with GCC and Clang, and confirmed that the build fails with the option disabled. Signed-off-by: Venkatesan Krishnamoorthy <v-krishnamoorthy@ti.com>
PR Summary by QodoBACKPORT: arch: arm: cortex_m: add ARMV8_M_CDE_CP0 option
AI Description
Merge Risk
|
| config SOC_AM13E23019 | ||
| select ARM | ||
| select ARMV8_M_DSP | ||
| select ARMV8_M_CDE_CP0 |
There was a problem hiding this comment.
2. Cde applications fault on am13 🐞 Bug ≡ Correctness
SOC_AM13E23019 selects ARMV8_M_CDE_CP0, but AM13 startup does not enable CP0 access in the coprocessor access control register. After reset, an application that uses the newly enabled CDE intrinsics can execute a CP0 instruction while access remains disabled.
Agent Prompt
## Issue description
AM13 advertises CDE CP0 to the compiler without enabling access to CP0 before applications can use it.
## Fix Focus Areas
- soc/ti/am13/am13e/Kconfig[7-13]
- soc/ti/am13/am13e/soc.c[8-36]
## Recommended Fix
Enable the appropriate CP0 access in AM13's early startup path before CDE instructions can execute. Verify the access setting for the intended execution contexts, or defer selecting the option until startup provides that guarantee.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| tests: | ||
| arch.arm.cde_cp0: |
There was a problem hiding this comment.
1. The cde build test never enters twister 🐞 Bug ≡ Correctness
The new test manifest is named tests.yaml, whereas this branch's Twister discovery recognizes testcase.yaml for tests. Its directory is skipped during test discovery, so neither the build nor its compiler-feature checks run.
Agent Prompt
## Issue description
Twister cannot discover the new build-only test because its manifest has the wrong filename for this branch.
## Fix Focus Areas
- tests/arch/arm/arm_cde_cp0/tests.yaml[1-13]
## Recommended Fix
Rename `tests.yaml` to `testcase.yaml`, retaining its contents, and verify that Twister discovers the CDE scenario.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| config ARMV8_M_CDE_CP0 | ||
| bool | ||
| depends on ARMV8_M_MAINLINE | ||
| help |
There was a problem hiding this comment.
3. Other arm toolchains leave cde disabled 🐞 Bug ≡ Correctness
The new compiler-feature handling covers GCC and Clang but leaves armclang and IAR generating their existing CPU flags without enabling CP0 CDE. Builds selecting ARMV8_M_CDE_CP0 through either toolchain therefore do not receive the promised compiler feature, and CDE-dependent source cannot use it as configured.
Agent Prompt
## Issue description
Selecting the new CDE option does not enable the compiler feature when building with armclang or IAR.
## Fix Focus Areas
- cmake/compiler/armclang/target.cmake[17-29]
- cmake/compiler/iar/target.cmake[75-82]
- arch/arm/core/cortex_m/Kconfig[293-301]
## Recommended Fix
Add each toolchain's supported CDE CP0 configuration flags where available; otherwise explicitly reject the option for that toolchain rather than silently leaving the requested feature disabled.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Backport of zephyrproject-rtos#125401, merged upstream on 2026-12-01.
Adds the
ARMV8_M_CDE_CP0option for SoCs with an Arm Custom Datapath Extension coprocessor on CP0, selects it for AM13, and adds a build-only test.Upstream commits (cherry-picked unchanged, only the
UPSTREAM:tag and thecommit <sha> upstream.line added):Note: the test keeps the upstream file name
tests.yaml; twister on this base readstestcase.yaml.