Skip to content

modules: hal_ethos_u: fix failure to override ETHOSU_TARGET_NPU_CONFIG #89977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

ccli8
Copy link
Collaborator

@ccli8 ccli8 commented May 15, 2025

This fixes failure to override ETHOSU_TARGET_NPU_CONFIG in hal_ethos_u due to cmake policy CMP0126 not being NEW. ETHOSU_TARGET_NPU_CONFIG originally as directory variable will fail to override that in hal_ethos_u as cache variable.. This is fixed by passing also as cache variable.

See:
https://cmake.org/cmake/help/latest/policy/CMP0126.html#policy:CMP0126

wearyzen
wearyzen previously approved these changes May 15, 2025
Copy link
Collaborator

@wearyzen wearyzen left a comment

Choose a reason for hiding this comment

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

could you update the PR with the test that failed or how you encountered the failure?

@ccli8
Copy link
Collaborator Author

ccli8 commented May 16, 2025

This failure was found in the port of nuvoton's m55m1 ethos-u (#88941). On m55m1, its ethos-u is ethos-u55-256, not default ethos-u55-128:

default ARM_ETHOS_U55_256 if SOC_SERIES_M55M1X
default ARM_ETHOS_U55_128

Build on numaker_m55m1 board:

west -v build -b numaker_m55m1 zephyr/samples/modules/tflite-micro/tflm_ethosu

hal_ethos_u will dump config message, like:

*******************************************************
PROJECT_NAME                           : ethosu_core_driver
ETHOSU_TARGET_NPU_CONFIG               : ethos-u55-128
CMAKE_SYSTEM_PROCESSOR                 : arm
CMSIS_PATH                             : <SKIP>
ETHOSU_LOG_ENABLE                      : ON
ETHOSU_LOG_SEVERITY                    : warning
ETHOSU_INFERENCE_TIMEOUT               : Default (no timeout)
*******************************************************

On m55m1 target, ETHOSU_TARGET_NPU_CONFIG should be ethos-u55-256, not ethos-u55-128. This PR is addressing the issue.

@wearyzen wearyzen added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label May 16, 2025
@jonny-svaerd-arm
Copy link
Contributor

@ccli8 Thanks! Considering that the Ethos-U Core Driver is added later in that CMake file, I think the FORCE option can be removed? Theoretically it's possible to set the CMake define on CLI, but if the entry has FORCE then that will override everything.

This fixes failure to override ETHOSU_TARGET_NPU_CONFIG in hal_ethos_u
due to CMP0126 not being NEW. See:
https://cmake.org/cmake/help/latest/policy/CMP0126.html#policy:CMP0126

Signed-off-by: Chun-Chieh Li <[email protected]>
@ccli8 ccli8 force-pushed the ethos_u_fix_config_override branch from 0177220 to 84f0f7e Compare May 22, 2025 01:20
@ccli8
Copy link
Collaborator Author

ccli8 commented May 22, 2025

Considering that the Ethos-U Core Driver is added later in that CMake file, I think the FORCE option can be removed? Theoretically it's possible to set the CMake define on CLI, but if the entry has FORCE then that will override everything.

Agree. Removed the FORCE option.

Copy link

@jonny-svaerd-arm
Copy link
Contributor

LGTM, but I don't have review rights. Could you approve this from your end please @kristofer-jonsson-arm

@kartben kartben merged commit 35cf9ad into zephyrproject-rtos:main May 23, 2025
26 checks passed
@ccli8 ccli8 deleted the ethos_u_fix_config_override branch May 23, 2025 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ARM Arm Limited Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants