cnlohr / ch32v003fun

Open source minimal stack for the ch32 line of WCH processors, including the ch32v003, a 10¢ 48 MHz RISC-V Microcontroller - as well as many other chips within the ch32v/x line.
MIT License
913 stars 142 forks source link

Add support for Zephyr #364

Closed kholia closed 2 months ago

kholia commented 2 months ago

This PR adds the glue file required by the Zephyr build system.

Context: https://github.com/zephyrproject-rtos/zephyr/pull/76540#discussion_r1698294983

Thanks!

kholia commented 2 months ago

Thank you @fabiobaltieri.

I have now tested the changes with the following commands:

$ west update
...
=== updating hal_wch (modules/hal/wch):
--- hal_wch: initializing
Initialized empty Git repository in /home/user/zephyrproject/modules/hal/wch/.git/
--- hal_wch: fetching, need revision 04cadf3a80afce5c3c00878fb1d0e66451c3b6c7
remote: Enumerating objects: 5562, done.
remote: Counting objects: 100% (331/331), done.
remote: Compressing objects: 100% (167/167), done.
remote: Total 5562 (delta 183), reused 282 (delta 162), pack-reused 5231
Receiving objects: 100% (5562/5562), 7.33 MiB | 4.05 MiB/s, done.
Resolving deltas: 100% (3341/3341), done.
From github.com:kholia/hal_wch
 * [new branch]      master     -> refs/west/master
HEAD is now at 04cadf3 Add support for Zephyr
HEAD is now at 04cadf3 Add support for Zephyr
...
$ west build -p always -b wch_ch32v003evt samples/basic/blinky
...
[102/102] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
             ROM:       10192 B        16 KB     62.21%
             RAM:        1524 B         2 KB     74.41%
        IDT_LIST:          0 GB         2 KB      0.00%

So far so good!

cnlohr commented 2 months ago

Thank you for getting this PR this is totally cool with me!