kossnikita / at32f4xx-hal

4 stars 2 forks source link

Add F435/437 support #3

Open qff233 opened 7 months ago

qff233 commented 7 months ago

As the title says.

qff233 commented 7 months ago

May do this is so hard. It is different from another chip, because it has different register. AT company rewrite a new library for F435/437, should we F435/437 support as another project?

kossnikita commented 7 months ago

Indeed, Artery has collected all their MCUs in the F4 family, although they are fundamentally different.

Parts of the project are compiled depending on the configuration, this allows to reuse the code for different MCUs depending on the set of peripherals. So far I don’t know any reason to divide into several crates.

While the entire family in one crate provides the same HAL syntax and behavior for any MCU, since changes affect all MCUs at once. It is simpler and more obvious to the user in the first place. But it makes the development of a HAL crate very difficult.

You might be interested in some development tools for peripheral comparison:

svdtools htmlcompare

also check https://github.com/rust-embedded/svdtools/pull/177#issuecomment-1783749772

qff233 commented 7 months ago

It's a good idea! So I can not find the library written by C, and I can simply find the different of F4 family!

qff233 commented 7 months ago

Should I create other mod that save in other folder to save the F435/F437 support? Or I put it into same file?

kossnikita commented 7 months ago

No, you don't need to create another modules. To implement support, first of all you need to add pins to src/gpio/f4.rs Next there is a big problem. I have only implemented STM32F1-like GPIO which is used in AT32F415. But F435/7 uses STM32F3-like GPIO. We will have to implement it first of all.

qff233 commented 7 months ago

https://github.com/kossnikita/at32f4xx-hal/blob/03911f227cd1c4c5a56aaecafff3b94eecceac76/src/gpio.rs#L618

What the parameter PEPin in this line do? And what does PEPin mean?

kossnikita commented 7 months ago

Not sure. Just copy of https://github.com/stm32-rs/stm32f4xx-hal/blob/d567d5f6951ff01ca1e2c4c4957d0c7256b46171/src/gpio.rs#L547

EDIT: PE stands for Partially Erased

qff233 commented 7 months ago

I add some at32f435/437 support. Please check and pull the commit.

kossnikita commented 7 months ago

Thank you very much, I saw it. I'll write a review when I find time