Giter Club home page Giter Club logo

ch32-metapac's Introduction

ch32-data

ch32-data is a project that aims to provide structured, machine-readable data for WCH's 32-bit microcontrollers.

This project is highly inspired by the stm32-data project. With the following modifications:

  • WCH's documentation and tools are not as good as ST's, so the data is not as clean and complete as ST's.
  • This project does't have much auto-generated data, most of the chip definitions are manually written.
  • A "include" mechanism is used to reduce the amount of duplicated data, spliting device families into separate files.

All Issues/PRs are accepted at https://github.com/ch32-rs/ch32-data, not the nightly metapac repo.

Data sources

Families

  • CH32V0, Low price (V2A/V2C)
  • CH32V1, General purpose (V3A)
  • CH32V203/CH32V303, General purpose (V4B)
  • CH32V305/CH32V307/CH32V317, High speed interconnect (V4F)
  • CH32V208, BLE 5.3 (V4C)
  • CH32X0, PDUSB (V4C)
  • CH32L1, Low power, PDUSB (V4C)
  • CH643, RGB driver (V4C)
  • CH641, USB PD, (V2A)

Families that not implemented yet(planing to implement using another crate, as they are using different peripherals and features):

  • CH57x, BLE 4.2 (V3A)
  • CH58x, BLE 5.3 (V4A)
  • CH59x, BLE 5.4 (V4C)
  • CH569/CH565, USBSS, SerDes (V3A)

For CH58X, you might want to check out my experimental project ch58x-hal, which is a HAL for CH58X series chips, with BLE support.

Families that are not yet released(require more info):

  • CH564, USBHS, 100M Ethernet (V4J)
  • CH645, USB HUB, SerDes (V4C)
  • CH32M, Motor control (V2C)

IP Cores

The CH32 RISC-V series chips are using the Qingke(้’็จž) IP Core.

Common features:

  • Hardware Push Enable (HPE)
  • Vector Table Free (VTF)
  • 2-wire or single-wire debug interface

Cores:

  • V2 (no pmp, no user mode)
    • V2A: rv32ec, +xw
    • V2C: rv32ec, +xw, +Zmmul
  • V3 (no pmp)
    • V3A: rv32imac
  • V4
    • V4A: rv32imac
    • V4B: rv32imac (no pmp)
    • V4C: rv32imac, +xw
    • V4F: rv32imafc, +xw
    • V4J: rv32imac, I-cache, +xw

Minimum supported Rust version(MSRV)

This project is developed with a recent nightly version of Rust compiler. And is expected to work with beta versions of Rust.

Feel free to change this if you did some testing with some version of Rust.

Contributing

All kinds of contributions are welcome.

  • Bug fixes are welcomed: wrong naming, missing register, typo, translations, etc
  • Adding new peripherals requires the following:
    • Use fixed SVD files from ch32-rs project
    • Use the script d to extract the peripheral yaml file from the SVD file (chiptool from embassy project)
    • Editing the yaml file to match the chip's peripherals
    • "transforms" for chiptool are also useful, you can check the stm32-data project for examples
    • Better not writing raw yaml from scratch, copy from existing peripherals and modify it
    • Peripheral files from stm32-data is also acceptable, but make sure to modify it to match the chip's peripherals, and register names
  • Editing existing peripherals requires the following:
    • Refer both EVT demo code and datasheet to make sure the data is correct, ref: openwch project
      • Use the newest version of the datasheet! (and Chinese version might be newer than English version)
    • Make sure the editing does not breaks ch32-hal

License

This project is licensed under the MIT or Apache-2.0 license, at your option.

ch32-metapac's People

Contributors

actions-user avatar

Watchers

Andelf avatar Cydget avatar Yilin Sun avatar

Forkers

cydget

ch32-metapac's Issues

DMA1_CHANNEL8 and crate::timer different between releases. Causes compilation errors with ch32-hal examples

It appears like the latest commit broke the ability to build the examples in ch32-hal for the ch32v002 and other chip examples.

When checking out commit of ch32-hal, it goes to only the DMA1_CHANNEL issue, but latest version of ch32-hal has both the DMA1 and crate::timer issues. I'm a rust novice and don't know if/how I can override these two issues with reexporting the timer module from crate::tiemr to ch32_metapac::timer.

Is it possible to keep revision history for this github and not have it wiped every commit? I think that would allow us with issues to downgrade as needed. I did attempt to build this metapack with an older checkout of ch32-data but I think there may be a required svd folder that is missing.

cydget@Kubuntu-Cloud:~/Desktop/test/ch32-hal/examples/ch32v003$ cargo build -r Compiling ch32-hal v0.1.0 (/home/cydget/Desktop/test/ch32-hal) error[E0412]: cannot find type DMA1_CHANNEL8in modulecrate::interrupt::typelevel--> /home/cydget/Desktop/test/ch32-hal/examples/ch32v003/target/riscv32ec-unknown-none-elf/release/build/ch32-hal-7be48bcc9ae895f5/out/_generated.rs:1:11295 | 1 | ... type CH8 = crate :: interrupt :: typelevel :: DMA1_CHANNEL8 ; } pub mod AFIO { } pub mod GPIOA { } pub mod GPIOC { } pub mod GPIOD { } pub mod TIM1 { pub type UP = ... | ^^^^^^^^^^^^^ help: an enum with a similar name exists:DMA1_CHANNEL1| ::: /home/cydget/Desktop/test/ch32-hal/src/interrupt_ext.rs:105:21 | 105 | pub enum $irqs {} | -------------- similarly named enumDMA1_CHANNEL1` defined here

warning: unused import: FLASH
--> /home/cydget/Desktop/test/ch32-hal/src/rcc/v0.rs:4:24
|
4 | use crate::pac::{AFIO, FLASH, RCC};
| ^^^^^
|
`

dget@Kubuntu-Cloud:~/Desktop/test/ch32-hal/examples/ch32v003$ cargo build -r Compiling ch32-hal v0.1.0 (/home/cydget/Desktop/test/ch32-hal) error[E0433]: failed to resolve: unresolved import --> /home/cydget/Desktop/test/ch32-hal/examples/ch32v003/target/riscv32ec-unknown-none-elf/release/build/ch32-hal-7be48bcc9ae895f5/out/_generated.rs:1:8017 | 1 | ... w . set_iopden (true)) ; } pin_trait_impl ! (crate :: timer :: ExternalTriggerPin , TIM1 , PC5 , 0u8) ; pin_trait_impl ! (crate :: timer :: Channel1Pin , TIM1 , PD2 ... | ^^^^^ | | | unresolved import | help: a similar path exists: ch32_metapac::timer`
|
note: found an item that was configured out
--> /home/cydget/Desktop/test/ch32-hal/src/lib.rs:40:9
|
40 | pub mod timer;
| ^^^^^

error[E0433]: failed to resolve: unresolved import

`
I dont want to deal with formatting issues so here is screenshots:.
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.