Skip to content
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

cmake: Fix SOC_FULL_DIR path #69399

Conversation

iuliana-prodan
Copy link
Collaborator

Create SOC_FULL_DIR path based on SOC_FAMILY
name which is expected to be of type:
vendor[_-]soc_family.

AS this is defined now, for some boards,
SOC_FULL_DIR is empty. So, when compiling
for Xtensa and I get the following error:

Generating ../../../../include/generated/core-isa-dM.h
...
xtensa-nxp_imx_adsp_zephyr-elf-gcc: fatal error:
no input files
compilation terminated.

That's because in arch/xtensa/core/CMakeLists.txt
we have:

COMMAND ${CMAKE_C_COMPILER} -E -dM -U__XCC__
-I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC} -I${SOC_FULL_DIR} ${CORE_ISA_IN} -o ${CORE_ISA_DM})

Create SOC_FULL_DIR path based on SOC_FAMILY
name which is expected to be of type:
vendor[_\-]soc_family.

AS this is defined now, for some boards,
SOC_FULL_DIR is empty. So, when compiling
for Xtensa and I get the following error:
```
Generating ../../../../include/generated/core-isa-dM.h
...
xtensa-nxp_imx_adsp_zephyr-elf-gcc: fatal error:
no input files
compilation terminated.

```

That's because in arch/xtensa/core/CMakeLists.txt
we have:
COMMAND ${CMAKE_C_COMPILER} -E -dM -U__XCC__
-I${ZEPHYR_XTENSA_MODULE_DIR}/zephyr/soc/${CONFIG_SOC}
-I${SOC_FULL_DIR} ${CORE_ISA_IN} -o ${CORE_ISA_DM})

Signed-off-by: Iuliana Prodan <[email protected]>
Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

If the variable is not set then you have not set the soc name properly or have a mismatch

@iuliana-prodan
Copy link
Collaborator Author

If the variable is not set then you have not set the soc name properly or have a mismatch

Here #69398 I've ported the ADSP (Xtensa arch) from i.MX family.
When trying to compile hello_world I get:

$zephyrproject/zephyr$ west build -p always -b mimx8mp_evk/imx8mp/adsp samples/hello_world/
-- west build: making build dir /zephyrproject/zephyr/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /zephyrproject/zephyr/samples/hello_world
-- CMake version: 3.21.1
-- Found Python3: /usr/bin/python3.8 (found suitable version "3.8.10", minimum required is "3.8") found components: Interpreter 
-...
-- Found host-tools: zephyr 0.16.4 (/opt/zephyr-sdk-0.16.4)
-- Found toolchain: zephyr 0.16.4 (/opt/zephyr-sdk-0.16.4)
-- Found Dtc: /opt/zephyr-sdk-0.16.4/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /zephyrproject/zephyr/boards/nxp/mimx8mp_evk/mimx8mp_evk_imx8mp_adsp.dts
-- Generated zephyr.dts: /zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /zephyrproject/zephyr/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /zephyrproject/zephyr/build/zephyr/dts.cmake
Parsing /zephyrproject/zephyr/Kconfig
Loaded configuration '/zephyrproject/zephyr/boards/nxp/mimx8mp_evk/mimx8mp_evk_imx8mp_adsp_defconfig'
Merged configuration '/zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
============>SOC_NAME = mimx8ml8
============>SOC_SERIES = imx8m
============>SOC_TOOLCHAIN_NAME = nxp_imx8m_adsp
============>SOC_FAMILY = nxp_imx
============>SOC_V2_DIR = 
============>SOC_FULL_DIR = 
============>BOARD = mimx8mp_evk
-- Found GnuLd: /opt/zephyr-sdk-0.16.4/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/../lib/gcc/xtensa-nxp_imx8m_adsp_zephyr-elf/12.2.0/../../../../xtensa-nxp_imx8m_adsp_zephyr-elf/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/zephyr-sdk-0.16.4/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/xtensa-nxp_imx8m_adsp_zephyr-elf-gcc
Load components for MIMX8ML8:
driver_common component is included.
driver_reset component is included.
driver_iuart component is included.
-- Using ccache: /usr/bin/ccache
-- Configuring done
-- Generating done
-- Build files have been written to: /zephyrproject/zephyr/build
-- west build: building application
[1/134] Generating ../../../../include/generated/core-isa-dM.h
FAILED: zephyr/include/generated/core-isa-dM.h /zephyrproject/zephyr/build/zephyr/include/generated/core-isa-dM.h 
cd /zephyrproject/zephyr/build/zephyr/arch/arch/xtensa/core && /opt/zephyr-sdk-0.16.4/xtensa-nxp_imx8m_adsp_zephyr-elf/bin/xtensa-nxp_imx8m_adsp_zephyr-elf-gcc -E -dM -U__XCC__ -I/zephyrproject/modules/hal/xtensa/zephyr/soc/mimx8ml8 -I /zephyrproject/zephyr/build/zephyr/include/generated/core-isa-dM.c -o /zephyrproject/zephyr/build/zephyr/include/generated/core-isa-dM.h
xtensa-nxp_imx8m_adsp_zephyr-elf-gcc: fatal error: no input files
compilation terminated.
[2/134] Preparing syscall dependency handling

As you can see SOC_FULL_DIR is empty.
SoC name is mimx8ml8 because based on this name we load the drivers from HAL_NXP or overlays from HAL_Xtensa.
In hwmv1 was the same soc_name.

@nordicjm
Copy link
Collaborator

SoC name is mimx8ml8 because based on this name we load the drivers from HAL_NXP or overlays from HAL_Xtensa. In hwmv1 was the same soc_name.

Then the soc name is wrong, it is not listed in your soc.yml, in fact the reason you are getting an empty variable is actually the indication of the error

Copy link
Collaborator

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

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

SoC name is mimx8ml8 because based on this name we load the drivers from HAL_NXP or overlays from HAL_Xtensa.

Then why are you using imx8mp here ?

you should take a look at the compliance failure in #69398

soc name: imx8mp not found in CONFIG_SOC defaults.
soc name: imx8qm not found in CONFIG_SOC defaults.
soc name: imx8mn not found in CONFIG_SOC defaults.
soc name: imx8ulp not found in CONFIG_SOC defaults.
soc name: imx8mm not found in CONFIG_SOC defaults.
soc name: imx8qxp not found in CONFIG_SOC defaults.
soc name: imx93 not found in CONFIG_SOC defaults.

the Kconfig SOC value must be in sync with the soc name used in soc.yml / board.yml.

So please fix such errors before changing the code in this PR.

@iuliana-prodan
Copy link
Collaborator Author

iuliana-prodan commented Feb 23, 2024

SoC name is mimx8ml8 because based on this name we load the drivers from HAL_NXP or overlays from HAL_Xtensa.

Then why are you using imx8mp here ?

mimx8ml8 is not "friendly" at all :(

you should take a look at the compliance failure in #69398

soc name: imx8mp not found in CONFIG_SOC defaults.
soc name: imx8qm not found in CONFIG_SOC defaults.
soc name: imx8mn not found in CONFIG_SOC defaults.
soc name: imx8ulp not found in CONFIG_SOC defaults.
soc name: imx8mm not found in CONFIG_SOC defaults.
soc name: imx8qxp not found in CONFIG_SOC defaults.
soc name: imx93 not found in CONFIG_SOC defaults.

the Kconfig SOC value must be in sync with the soc name used in soc.yml / board.yml.

So please fix such errors before changing the code in this PR.

Ok, will do.

@iuliana-prodan
Copy link
Collaborator Author

I will close this since the problem was the mismatch between the soc name defined in Kconfig and in soc.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants