Skip to content

ch32v003f4p6_dev_board build failed with blinky example #90450

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

Open
letanphuc opened this issue May 25, 2025 · 1 comment · May be fixed by #90438
Open

ch32v003f4p6_dev_board build failed with blinky example #90450

letanphuc opened this issue May 25, 2025 · 1 comment · May be fixed by #90438
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: WinChipHead

Comments

@letanphuc
Copy link

Describe the bug
Build blinky example failed for the board ch32v003f4p6_dev_board

To Reproduce
build command:

west build -b ch32v003f4p6_dev_board zephyr/samples/basic/blinky

Expected behavior
Build OK

Impact
Cannot develop ch32v003f4p6_dev_board

Logs and console output
master west build -b ch32v003f4p6_dev_board zephyr/samples/basic/blinky
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /Users/phuc/Work/zephyr/master/zephyr/samples/basic/blinky
-- CMake version: 3.31.1
-- Found Python3: /usr/local/bin/python (found suitable version "3.10.11", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /Users/phuc/Library/Caches/zephyr
-- Zephyr version: 4.1.99 (/Users/phuc/Work/zephyr/master/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: ch32v003f4p6_dev_board, qualifiers: ch32v003
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/Users/phuc/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/Users/phuc/zephyr-sdk-0.17.0)
-- Found Dtc: /opt/homebrew/bin/dtc (found suitable version "1.7.2", minimum required is "1.4.6")
-- Found BOARD.dts: /Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/ch32v003f4p6_dev_board.dts
-- Generated zephyr.dts: /Users/phuc/Work/zephyr/master/build/zephyr/zephyr.dts
-- Generated pickled edt: /Users/phuc/Work/zephyr/master/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: /Users/phuc/Work/zephyr/master/build/zephyr/include/generated/zephyr/devicetree_generated.h
Parsing /Users/phuc/Work/zephyr/master/zephyr/Kconfig
Loaded configuration '/Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/ch32v003f4p6_dev_board_defconfig'
Merged configuration '/Users/phuc/Work/zephyr/master/zephyr/samples/basic/blinky/prj.conf'
Configuration saved to '/Users/phuc/Work/zephyr/master/build/zephyr/.config'
Kconfig header saved to '/Users/phuc/Work/zephyr/master/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /Users/phuc/zephyr-sdk-0.17.0/riscv64-zephyr-elf/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: /Users/phuc/zephyr-sdk-0.17.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc
-- Using ccache: /opt/homebrew/bin/ccache
-- Found gen_kobject_list: /Users/phuc/Work/zephyr/master/zephyr/scripts/build/gen_kobject_list.py
-- Configuring done (7.8s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/phuc/Work/zephyr/master/build
-- west build: building application
[1/116] Preparing syscall dependency handling

[2/116] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.1.99 (/Users/phuc/Work/zephyr/master/zephyr), build: v4.1.0-4629-g64ac57abcb90
[92/116] Building C object zephyr/boards/wch/ch32v003f4p6_dev_board/CMakeFiles/boards__wch__ch32v003f4p6_dev_board.dir/board.c.obj
FAILED: zephyr/boards/wch/ch32v003f4p6_dev_board/CMakeFiles/boards__wch__ch32v003f4p6_dev_board.dir/board.c.obj
ccache /Users/phuc/zephyr-sdk-0.17.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__ZEPHYR__=1 -I/Users/phuc/Work/zephyr/master/build/zephyr/include/generated/zephyr -I/Users/phuc/Work/zephyr/master/zephyr/include -I/Users/phuc/Work/zephyr/master/build/zephyr/include/generated -I/Users/phuc/Work/zephyr/master/zephyr/soc/wch/ch32v -I/Users/phuc/Work/zephyr/master/zephyr/soc/wch/ch32v/qingke_v2a/. -I/Users/phuc/Work/zephyr/master/modules/hal/ti/mspm0/source/ti/devices/msp/. -I/Users/phuc/Work/zephyr/master/modules/hal/ti/mspm0/source/ti/devices/msp/m0p -I/Users/phuc/Work/zephyr/master/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals -I/Users/phuc/Work/zephyr/master/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p -I/Users/phuc/Work/zephyr/master/modules/hal/ti/mspm0/source/ti/devices/msp/peripherals/m0p/sysctl -I/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun -I/Users/phuc/Work/zephyr/master/zephyr/modules/hal_wch/. -isystem /Users/phuc/Work/zephyr/master/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /Users/phuc/Work/zephyr/master/build/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=ilp32e -march=rv32ec_zicsr_zifencei --sysroot=/Users/phuc/zephyr-sdk-0.17.0/riscv64-zephyr-elf/riscv64-zephyr-elf -imacros /Users/phuc/Work/zephyr/master/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/Users/phuc/Work/zephyr/master/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/Users/phuc/Work/zephyr/master/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/Users/phuc/Work/zephyr/master=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -std=c99 -MD -MT zephyr/boards/wch/ch32v003f4p6_dev_board/CMakeFiles/boards__wch__ch32v003f4p6_dev_board.dir/board.c.obj -MF zephyr/boards/wch/ch32v003f4p6_dev_board/CMakeFiles/boards__wch__ch32v003f4p6_dev_board.dir/board.c.obj.d -o zephyr/boards/wch/ch32v003f4p6_dev_board/CMakeFiles/boards__wch__ch32v003f4p6_dev_board.dir/board.c.obj -c /Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c
In file included from /Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c:10:
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:398:38: error: unknown type name 'IRQn_Type'
398 | RV_STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:404:39: error: unknown type name 'IRQn_Type'
404 | RV_STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:410:45: error: unknown type name 'IRQn_Type'
410 | RV_STATIC_INLINE uint32_t NVIC_GetStatusIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:416:46: error: unknown type name 'IRQn_Type'
416 | RV_STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:422:42: error: unknown type name 'IRQn_Type'
422 | RV_STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:428:44: error: unknown type name 'IRQn_Type'
428 | RV_STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:434:42: error: unknown type name 'IRQn_Type'
434 | RV_STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:440:40: error: unknown type name 'IRQn_Type'
440 | RV_STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint8_t priority)
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function 'NVIC_get_enabled_IRQs':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:464:20: error: 'NVIC' undeclared (first use in this function)
464 | return ( ((NVIC->ISR[0] >> 2) & 0b11) | ((NVIC->ISR[0] >> 12) << 2) | ((NVIC->ISR[1] & 0b1111111) << 23) );
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:464:20: note: each undeclared identifier is reported only once for each function it appears in
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function 'NVIC_clear_all_IRQs_except':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:470:17: error: 'NVIC' undeclared (first use in this function)
470 | NVIC->IRER[0] = (0) & ((1 << IRQn_to_keep));
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function 'NVIC_restore_IRQs':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:482:9: error: 'NVIC' undeclared (first use in this function)
482 | NVIC->IENR[0] = (old_state >> 2) << 12;
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function '__WFI':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:489:9: error: 'NVIC' undeclared (first use in this function)
489 | NVIC->SCTLR &= ~(1<<3); // wfi
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function '__WFE':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:498:7: error: 'NVIC' undeclared (first use in this function)
498 | t = NVIC->SCTLR;
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: At top level:
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:515:48: error: unknown type name 'IRQn_Type'
515 | RV_STATIC_INLINE void SetVTFIRQ(uint32_t addr, IRQn_Type IRQn, uint8_t num, FunctionalState NewState){
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h: In function 'NVIC_SystemReset':
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:532:9: error: 'NVIC' undeclared (first use in this function)
532 | NVIC->CFGR = NVIC_KEY3|(1<<7);
| ^~~~
/Users/phuc/Work/zephyr/master/modules/hal/wch/ch32fun/ch32fun.h:532:22: error: 'NVIC_KEY3' undeclared (first use in this function)
532 | NVIC->CFGR = NVIC_KEY3|(1<<7);
| ^~~~~~~~~
/Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c: In function 'board_late_init_hook':
/Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c:29:17: error: 'RCC' undeclared (first use in this function)
29 | RCC->APB2PCENR |= RCC_AFIOEN;
| ^~~
/Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c:29:35: error: 'RCC_AFIOEN' undeclared (first use in this function)
29 | RCC->APB2PCENR |= RCC_AFIOEN;
| ^~~~~~~~~~
/Users/phuc/Work/zephyr/master/zephyr/boards/wch/ch32v003f4p6_dev_board/board.c:30:25: error: 'AFIO' undeclared (first use in this function)
30 | pcfr1 = AFIO->PCFR1;
| ^~~~
[105/116] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sched.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/homebrew/bin/cmake --build /Users/phuc/Work/zephyr/master/build

Environment (please complete the following information):

  • OS: MacOS
  • Toolchain: Zephyr SDK
  • Commit SHA: 64ac57a (master)

Additional context

@letanphuc letanphuc added the bug The issue is a bug, or the PR is fixing a bug label May 25, 2025
@nzmichaelh
Copy link
Collaborator

Good morning. The cause is the recent ch32vfun.h -> hal_ch32vfun.h rename. I've fixed many of the issues in #90438 and have added this to that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: WinChipHead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants