stm32-rs / stm32l0xx-hal

A hardware abstraction layer (HAL) for the STM32L0 series microcontrollers written in Rust
BSD Zero Clause License
96 stars 60 forks source link

Support for the STM32L0x0 subfamily #141

Open nbraud opened 3 years ago

nbraud commented 3 years ago

Hi!

Support for the STM32L0x0 subfamily seems to be missing, according to both the README and docs.rs. Presumably, this is because they are also missing from the Peripheral Access Crate, but what would be required (beyond some svd2rust calls) to make this happen?

I suspect @Jglauche and I would be willing to make it happen, if you can point us in the right direction.

nbraud commented 3 years ago

Looks like the SVD descriptors are missing from the files published by ST Micro... >_>'

jglauche commented 3 years ago

I poked ST about it, will post an update if I hear from them.

jglauche commented 3 years ago

They sent me "STM32L0x0.svd Indeed, it seems the zip file is not updated on st.com, I will inform my colleague. For your information, you can also find this file at the following folder location: in STM32CubeProg tool (SVD folder) https://www.st.com/en/development-tools/stm32cubeprog.html or in STM32CubeIDE tool (\plugins\com.st.stm32cube.ide.mcu.productdb.debug_1.5.0.202011051456\resources\cmsis\STMicroelectronics_CMSIS_SVD)."

The file exists there, however it says it's under the "End User License Agreement for STMicroelectronics" license and I am unsure if this is any compatible to share so I asked them if this is okay to publish at this point

jglauche commented 3 years ago

I received an updated today: "Small update on my side. We are taking this into consideration and we will try to deliver new SVD files with license indication for upcoming products.

Regarding you github question, you have to respect the following license:

Copyright (c) 2020 STMicroelectronics.

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."

jglauche commented 3 years ago

for easier access to the file until ST fixes their SVD download package, I created a repo with the file https://github.com/jglauche/STM32L0x0

snakehand commented 3 years ago

I tried making HAL support (specifically serial ports) for STM32L0x0 by hacking around in the stm32f0xx-hal crate. It seems a new io definition is needed as a number of peripherals are missing compared to the L0x1 devices. But still I am pretty stuck, as I can't get simple GPIO / UART code working. I can upload a fork of the repo with my hacks, but I doubt it has much value.

jglauche commented 3 years ago

I tried making HAL support (specifically serial ports) for STM32L0x0 by hacking around in the stm32f0xx-hal crate. It seems a new io definition is needed as a number of peripherals are missing compared to the L0x1 devices. But still I am pretty stuck, as I can't get simple GPIO / UART code working. I can upload a fork of the repo with my hacks, but I doubt it has much value.

Have you tried my fork at https://github.com/jglauche/stm32l0xx-hal ?

snakehand commented 3 years ago

When building for the chip on my dev board, using this feature set : stm32l0xx-hal = { path="../test/stm32l0xx-hal", features = ["mcu-STM32L010R8Tx", "stm32l0x0", "rt"] } - I get compilation errors on the Nr interrupt trait.

error[E0277]: the trait bound stm32l0::stm32l0x0::Interrupt: Nr is not satisfied --> /mnt/c/Users/11138/gitlab/rx_tracksensor2/test/stm32l0xx-hal/src/exti.rs:239:30 239 NVIC::unmask(interrupt); ^^^^^^^^^ the trait Nr is not implemented for stm32l0::stm32l0x0::Interrupt

::: /home/frank/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.6.7/src/peripheral/nvic.rs:125:12 | 125 | I: Nr, | -- required by this bound in nvic::<impl NVIC>::unmask

I removed the exti module from the build, and have managed to get some basics working. ( GPIO + I2C - seems promising )

nikgul commented 2 years ago

Is there any chance of this getting included ? I'm new to rust, working through "The book" atm. so I don't know how much help I would be able to provide.