Skip to content

New module creation: hal_wch [was: External source integration for soc/wch/ch32v00x/ch32v003fun.h] #76261

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

Closed
fabiobaltieri opened this issue Jul 24, 2024 · 12 comments
Assignees
Labels
RFC Request For Comments: want input from the community

Comments

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Jul 24, 2024

Origin

This is to request the creation of a hal_wch repository, as a direct fork of initially containing few selected headers from https://github.com/cnlohr/ch32v003fun. Current repo: https://github.com/kholia/hal_wch

Purpose

Allow Zephyr code to access the register map files of WCH CH32V family of microcontrollers, no plan to use it as an actual HAL, at least initially.

Will include more parts in the future, ble binary blobs if needed etc, same as other hal modules.

Mode of integration

Module, importing https://github.com/kholia/hal_wch as a starting point.

Maintainership

@kholia @nzmichaelh

Pull Request

#76540 (just the module)
#73761 (initial soc support)

Description

The repo is a selection of relevant files from https://github.com/cnlohr/ch32v003fun, for now just the register map for the initial device, MIT licensed.

Future scope would be to have more register maps for other parts from the same vendor, potentially ble support blobs and whatever is needed for supporting these devices.

Dependencies

None.

Revision

kholia/hal_wch@1de9d3e

License

MIT

Notes

Alternatives considered were to import the file directly in the main repository, but that was ruled out due to coding style and license differences. Then it was proposed to track ch32v003fun directly, but that turns out to also be problematic as the repository hosts some extra binary files and other sources with stray licenses. So here we are blank repo, just the files and license.

@fabiobaltieri fabiobaltieri added the RFC Request For Comments: want input from the community label Jul 24, 2024
@fabiobaltieri fabiobaltieri added the TSC Topics that need TSC discussion label Jul 24, 2024
@nzmichaelh
Copy link
Collaborator

I'm happy to be a maintainer.

@MaureenHelm MaureenHelm moved this from Todo to In Progress in TSC Attention Needed Jul 30, 2024
@cnlohr
Copy link

cnlohr commented Jul 31, 2024

Please be aware I'm happy to upstream any files or direct changes that would make this easier, and to minimize the forkyness of your branch.

@fabiobaltieri
Copy link
Member Author

fabiobaltieri commented Jul 31, 2024

Thanks folks, ok based on the conversation in #73761, and in light of the file license and intention to at support for more parts it seems like forking https://github.com/cnlohr/ch32v003fun into a hal_wch repo may be the the way to go. @kholia if you agree with that and can make the PR back in that form (using the whole https://github.com/cnlohr/ch32v003fun with just the extra module.yml file) I can modify this proposal to request the fork from the TSC and then we can take it from there, any further update (new device files etc) will be just a sync of the fork and west.yml update.

@kholia
Copy link
Contributor

kholia commented Jul 31, 2024

@fabiobaltieri Roger - I will get this done later today.

Update:

I will create the PR later today.

@kholia
Copy link
Contributor

kholia commented Jul 31, 2024

@fabiobaltieri PR is up now @ #76540. Thanks!

@fabiobaltieri fabiobaltieri changed the title External source integration for soc/wch/ch32v00x/ch32v003fun.h New module creation: hal_wch [was: External source integration for soc/wch/ch32v00x/ch32v003fun.h] Jul 31, 2024
@nandojve
Copy link
Member

nandojve commented Aug 1, 2024

The RFC is to add 1 item but the whole hal and manufacturer details should be introduced in a way that allow the ARM and RISCV MCUs together, otherwise it does not scale up.

Questions:

1- How I should add pinctrl auto-generated files in the hal?
2- How should we add the BLE blobs for ch32v208? There will be a group that will start to work with this in Ago/24.
3- How ARM chips will be used?
4- What happen if manufacturer wants to be part of Zephyr in the future and assume the their own repos?

This is moving in a very odd way. All parts that are supported by community are simple hosted in the ZephyrProject. See, for instance GigaDevices and Atmel (MCHP).

@fabiobaltieri
Copy link
Member Author

fabiobaltieri commented Aug 1, 2024

Blobs would go in the module zephyr.yml file like for any other module, don't see any particular problem with that.

Pinctrl, any issue with those going in the main Zephyr repository? There's other SoC that have them there, seems easier to manage as well.

for ARM and if the vendor wants to take control, if and when that will happen we can always reconsider the architecture of the whole repo, push whatever sha will be current at the time in a branch so that GitHub would keep it for backward compatibility and start with a new architecture in the main branch. I think it's been done before, not a problem.

I'm not saying this approach is perfect or will work forever, but I think it's the simplest with what people are working on now, and it shouldn't preclude any type of rework in the future if it turns out to be suboptimal.

@fabiobaltieri
Copy link
Member Author

Updated the description, this is now a blank repo with just the relevant files. Comments welcome.

@nzmichaelh
Copy link
Collaborator

I've started a PR to add minichlink to the Zephyr toolchain: zephyrproject-rtos/sdk-ng#773

@cnlohr FYI

@fabiobaltieri
Copy link
Member Author

Hey, this was approved by the TSC, can we get the repo created? @nashif @stephanosio

@fabiobaltieri fabiobaltieri removed the TSC Topics that need TSC discussion label Aug 21, 2024
@stephanosio
Copy link
Member

https://github.com/zephyrproject-rtos/hal_wch has been created.

@fabiobaltieri
Copy link
Member Author

Thanks folks.

@github-project-automation github-project-automation bot moved this from In Progress to Done in TSC Attention Needed Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments: want input from the community
Projects
Status: Done
Status: Done
Development

No branches or pull requests

7 participants