zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.83k stars 6.6k forks source link

esp32: compile failed when enable sysbuild #62515

Closed feilongfl closed 1 year ago

feilongfl commented 1 year ago

Describe the bug

compile failed when build in sysbuild mode.

To Reproduce

west build -p always -b esp32c3_devkitm --sysbuild samples/hello_world
west build -p always -b esp32s3_devkitm --sysbuild samples/hello_world

Expected behavior compile success

Impact compiled failed

Logs and console output

Compile Logs ``` shell (venv) ~/P/z/zephyr  py[venv]   main ±  west build -p always -b esp32c3_devkitm --sysbuild samples/hello_world -- west build: generating a build system Loading Zephyr module(s) (Zephyr base): extensions sysbuild_extensions python west root zephyr_module boards shields sysbuild_kconfig -- Found Python3: /home/feilong/Program-ext/zephyr/zephyr/venv/bin/python (found suitable version "3.11.3", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: /home/feilong/.cache/zephyr -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: esp32c3_devkitm Parsing /home/feilong/Program-ext/zephyr/zephyr/share/sysbuild/Kconfig Loaded configuration '/home/feilong/Program-ext/zephyr/zephyr/build/zephyr/.config' No change to configuration in '/home/feilong/Program-ext/zephyr/zephyr/build/zephyr/.config' No change to Kconfig header in '/home/feilong/Program-ext/zephyr/zephyr/build/autoconf.h' -- ********************************* * Running CMake for hello_world * ********************************* Loading Zephyr default modules (Zephyr base). -- Application: /home/feilong/Program-ext/zephyr/zephyr/samples/hello_world -- CMake version: 3.27.4 -- Found Python3: /home/feilong/Program-ext/zephyr/zephyr/venv/bin/python (found suitable version "3.11.3", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: /home/feilong/.cache/zephyr -- Zephyr version: 3.4.99 (/home/feilong/Program-ext/zephyr/zephyr) -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: esp32c3_devkitm -- Found host-tools: zephyr 0.16.1 (/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.1 (/opt/zephyr-sdk) -- Found Dtc: /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") -- Found BOARD.dts: /home/feilong/Program-ext/zephyr/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm.dts -- Generated zephyr.dts: /home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/zephyr.dts -- Generated devicetree_generated.h: /home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: /home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/dts.cmake Parsing /home/feilong/Program-ext/zephyr/zephyr/Kconfig Loaded configuration '/home/feilong/Program-ext/zephyr/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm_defconfig' Merged configuration '/home/feilong/Program-ext/zephyr/zephyr/samples/hello_world/prj.conf' Merged configuration '/home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/.config.sysbuild' Configuration saved to '/home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/.config' Kconfig header saved to '/home/feilong/Program-ext/zephyr/zephyr/build/hello_world/zephyr/include/generated/autoconf.h' -- Found GnuLd: /opt/zephyr-sdk/riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/12.2.0/../../../../riscv64-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/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -- Including signing script: /home/feilong/Program-ext/zephyr/zephyr/cmake/mcuboot.cmake -- Configuring done (1.9s) -- Generating done (0.1s) -- Build files have been written to: /home/feilong/Program-ext/zephyr/zephyr/build/hello_world -- ***************************** * Running CMake for mcuboot * ***************************** Loading Zephyr default modules (Zephyr base). -- Application: /home/feilong/Program-ext/zephyr/bootloader/mcuboot/boot/zephyr -- CMake version: 3.27.4 -- Found Python3: /home/feilong/Program-ext/zephyr/zephyr/venv/bin/python (found suitable version "3.11.3", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: /home/feilong/.cache/zephyr -- Zephyr version: 3.4.99 (/home/feilong/Program-ext/zephyr/zephyr) -- Found west (found suitable version "1.1.0", minimum required is "0.14.0") -- Board: esp32c3_devkitm -- Found host-tools: zephyr 0.16.1 (/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.1 (/opt/zephyr-sdk) -- Found Dtc: /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") -- Found BOARD.dts: /home/feilong/Program-ext/zephyr/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm.dts -- Found devicetree overlay: /home/feilong/Program-ext/zephyr/bootloader/mcuboot/boot/zephyr/app.overlay -- Generated zephyr.dts: /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/zephyr.dts -- Generated devicetree_generated.h: /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/dts.cmake warning: MCUBOOT_GENERATE_UNSIGNED_IMAGE (defined at soc/riscv/espressif_esp32/common/Kconfig.defconfig.series:43, soc/riscv/espressif_esp32/common/Kconfig.defconfig.series:43, modules/Kconfig.mcuboot:121) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ((BOOTLOADER_MCUBOOT && SOC_FAMILY_ESP32) || (BOOTLOADER_MCUBOOT && SOC_FAMILY_ESP32) || BOOTLOADER_MCUBOOT) (=n). See http:docs.zephyrproject.org/latest/kconfig.html#CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE and/or look up MCUBOOT_GENERATE_UNSIGNED_IMAGE in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too. Parsing /home/feilong/Program-ext/zephyr/bootloader/mcuboot/boot/zephyr/Kconfig Loaded configuration '/home/feilong/Program-ext/zephyr/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm_defconfig' Merged configuration '/home/feilong/Program-ext/zephyr/bootloader/mcuboot/boot/zephyr/prj.conf' Merged configuration '/home/feilong/Program-ext/zephyr/bootloader/mcuboot/boot/zephyr/boards/esp32c3_devkitm.conf' Merged configuration '/home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/.config.sysbuild' Configuration saved to '/home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/.config' Kconfig header saved to '/home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/include/generated/autoconf.h' -- Found GnuLd: /opt/zephyr-sdk/riscv64-zephyr-elf/bin/.. /lib/gcc/riscv64-zephyr-elf/12.2.0/.. /.. /.. /.. /riscv64-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/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -- Configuring done (1.9s) -- Generating done (0.0s) -- Build files have been written to: /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot -- Configuring done (4.7s) -- Generating done (0.0s) CMake Warning: Manually-specified variables were not used by the project: CMAKE_EXPORT_COMPILE_COMMANDS -- Build files have been written to: /home/feilong/Program-ext/zephyr/zephyr/build -- west build: building application [9/16] Performing build step for 'mcuboot' [1/170] Preparing syscall dependency handling [3/170] Generating include/generated/version.h -- Zephyr version: 3.4.99 (/home/feilong/Program-ext/zephyr/zephyr), build: bakng-210-g662a14a25e41 [165/170] Linking C executable zephyr/zephyr_pre0.elf FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/zephyr_pre0.map : && ccache /opt/zephyr-sdk/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/riscv/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=/home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/riscv/core/libarch__riscv__core.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/timer/libdrivers__timer.a modules/mcuboot/ libmcuboot_util.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"/opt/zephyr-sdk/riscv64-zephyr-elf/bin/.. /lib/gcc/riscv64-zephyr-elf/12.2.0" -L/home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a -lgcc -mabi=ilp32 -march=rv32imc_zicsr -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_INTEGER_PRINTF_SCANF -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/src/linker/esp32c3.rom.alias.ld -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/.. /.. /components/esp_rom/esp32c3/ld/esp32c3.rom.ld -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/.. /../components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/.. /.. /components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/.. /.. /components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld -T/home/feilong/Program-ext/zephyr/modules/hal/espressif/zephyr/esp32c3/.. /.. /components/soc/esp32c3/ld/esp32c3.peripherals.ld --specs=picolibc.specs -lc -lgcc && cd /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr && /usr/bin/cmake -E true /opt/zephyr-sdk/riscv64-zephyr-elf/bin/.. /lib/gcc/riscv64-zephyr-elf/12.2.0/.. /.. /.. /.. /riscv64-zephyr-elf/bin/ld.bfd: zephyr/lib/libc/common/liblib__libc__common.a(malloc.c.obj): in function `k_mutex_unlock': /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:1002: undefined reference to `z_impl_k_mutex_unlock' /opt/zephyr-sdk/riscv64-zephyr-elf/bin/.. /lib/gcc/riscv64-zephyr-elf/12.2.0/.. /.. /.. /.. /riscv64-zephyr-elf/bin/ld.bfd: zephyr/lib/libc/common/liblib__libc__common.a(malloc.c.obj): in function `k_mutex_lock': /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:986: undefined reference to `z_impl_k_mutex_lock' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. [10/16] No configure step for 'hello_world' FAILED: images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build /home/feilong/Program-ext/zephyr/zephyr/build/images/bootloader/mcuboot-prefix/src/mcuboot-stamp/mcuboot-build cd /home/feilong/Program-ext/zephyr/zephyr/build/mcuboot && /usr/bin/cmake --build . ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/feilong/Program-ext/zephyr/zephyr/build ```

Environment (please complete the following information):

Additional context I revert commit and found there are two PR releate to this bug:

zephyr/bootloader/mcuboot/boot/zephyr/main.c:30

+ #ifndef CONFIG_SOC_FAMILY_ESP32
#include <cmsis_core.h>
+ #endif
github-actions[bot] commented 1 year ago

Hi @feilongfl! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

feilongfl commented 1 year ago

I find https://github.com/zephyrproject-rtos/mcuboot/pull/110 fix this problem, close this