Skip to content

Commit ac0bf59

Browse files
zejiang0jasondanieldegrasse
authored andcommitted
modules: hal_nxp: mcux-sdk-ng: Fix RT595 F1 build error
In MCUX SDK NG, the `core_id` and `core_id_suffix_name` are different concepts, generally the values are the same. But there are exeptions, such as RT595 F1. Zephyr's `CONFIG_MCUX_CORE_SUFFIX` is actually MCUX SDK's `core_id_suffix_name`. SDK NG CMake needs `core_id`, but current integration layer uses `CONFIG_MCUX_CORE_SUFFIX` as `core_id`, so there is build error with RT595 F1. Fix the code that convert `CONFIG_MCUX_CORE_SUFFIX` to `core_id`, handle the special case. Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
1 parent ede6186 commit ac0bf59

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

modules/hal_nxp/mcux/mcux-sdk-ng/device/device.cmake

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,32 @@ if(NOT mcux_device_folder)
2222
message(FATAL_ERROR "Device ${MCUX_DEVICE} not found in ${SdkRootDirPath}/devices/")
2323
endif()
2424

25+
# Note: Difference between `core_id` and `core_id_suffix_name` in MCUX SDK NG.
26+
#
27+
# MCUX SDK NG uses `core_id` to distinguish which core currently is running on.
28+
#
29+
# In most of the time, `core_id` and `core_id_suffix_name` are the same, but
30+
# there are some exceptions, for example: RT595 FUSIONF1.
31+
# `core_id` is used for the core's folder name in device folder, like:
32+
# "mcux-sdk-ng/devices/RT/RT500/MIMXRT595S/fusionf1", here `core_id` is fusionf1.
33+
# `core_id_suffix_name` is used for the device files and macro suffix, such as:
34+
# file "system_MIMXRT595S_dsp.h", macro `CPU_MIMXRT595SFAWC_dsp`, here
35+
# `core_id_suffix_name` is dsp.
36+
#
37+
# MCUX SDK NG needs `core_id` as input, it defines `core_id_suffix_name` based on
38+
# `core_id` in file "mcux-sdk-ng/devices/RT/RT500/MIMXRT595S/<core_id>".
39+
#
40+
# Zephyr provides `MCUX_CORE_SUFFIX` to distinguish the core, it is actaully the
41+
# `core_id_suffix_name` in MCUX SDK NG, here convert it to `core_id`, then pass
42+
# it to MCUX SDK NG.
2543
if(DEFINED CONFIG_MCUX_CORE_SUFFIX)
26-
string (REGEX REPLACE "^_" "" core_id "${CONFIG_MCUX_CORE_SUFFIX}")
44+
if (CONFIG_SOC_MIMXRT595S_F1)
45+
set(core_id "fusionf1")
46+
else()
47+
string (REGEX REPLACE "^_" "" core_id "${CONFIG_MCUX_CORE_SUFFIX}")
48+
endif()
2749
endif()
2850

29-
# Definitions to load device drivers
30-
set(CONFIG_MCUX_HW_DEVICE_CORE "${MCUX_DEVICE}${CONFIG_MCUX_CORE_SUFFIX}")
31-
32-
# Define CPU macro
33-
zephyr_compile_definitions("CPU_${CONFIG_SOC_PART_NUMBER}${CONFIG_MCUX_CORE_SUFFIX}")
34-
3551
if(CONFIG_SOC_SERIES_IMXRT10XX OR CONFIG_SOC_SERIES_IMXRT11XX)
3652
set(CONFIG_MCUX_COMPONENT_device.boot_header ON)
3753
endif()
@@ -62,6 +78,13 @@ endif()
6278
# load device variables
6379
include(${mcux_device_folder}/variable.cmake)
6480

81+
# Define CPU macro, like: CPU_MIMXRT595SFAWC_dsp.
82+
# Variable `core_id_suffix_name` is from file ${mcux_device_folder}/variable.cmake
83+
zephyr_compile_definitions("CPU_${CONFIG_SOC_PART_NUMBER}${core_id_suffix_name}")
84+
85+
# Definitions to load device drivers, like: CPU_MIMXRT595SFAWC_dsp.
86+
set(CONFIG_MCUX_HW_DEVICE_CORE "${MCUX_DEVICE}${core_id_suffix_name}")
87+
6588
# Load device files
6689
mcux_add_cmakelists(${mcux_device_folder})
6790

0 commit comments

Comments
 (0)