[Solved]Build firmware for MicroPython

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ndhuy
Posts: 32
Joined: Mon Nov 04, 2019 8:01 am

[Solved]Build firmware for MicroPython

Post by ndhuy » Mon Nov 04, 2019 8:13 am

Hello,

I am Huy. Currently I am working on a project. I am trying to run MicroPython on STM32L4R9I - Disco.

As I did some researches, MicroPython doesnt not support STM32L4R9I - Disco. So i want to ask is there any solution for this issue??? one of the approaches i found was to build custom firmware for the board.

Thank you very much!!!
Last edited by ndhuy on Thu Dec 05, 2019 1:32 am, edited 1 time in total.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Build firmware for MicroPython

Post by jimmo » Mon Nov 04, 2019 10:13 am

Hi,

I don't know much about the L4+ family, but MicroPython does support the L4, and ST says "Applications developed for the earlier STM32L4 microcontrollers can run unchanged on the new devices", so hopefully it's not too much work.

That said, I don't see any mention of the STM32L4RAI series in the L4 HAL (which is part of the stm32lib submodule), so I think it would need to be updated first (it's on 1.8.1, the latest version is 1.14.0). https://github.com/micropython/stm32lib

Once that's done, the starting point is to create a board definition, which is a directory in ports/stm32/BOARDS, and set up mpconfigboard.h, mpconfigboard.mk, pins.csv and stm32l4xx_hal_conf.h. Start with one of the existing L4 boards as an example.

You'll likely need a linker script too, which you reference from mpconfigboard.mk.

It would probably help to have an existing STM32 board that has MicroPython support just so you can get familiar with things on a working board first.

ndhuy
Posts: 32
Joined: Mon Nov 04, 2019 8:01 am

Re: Build firmware for MicroPython

Post by ndhuy » Wed Nov 06, 2019 3:20 am

jimmo wrote:
Mon Nov 04, 2019 10:13 am
Hi,

I don't know much about the L4+ family, but MicroPython does support the L4, and ST says "Applications developed for the earlier STM32L4 microcontrollers can run unchanged on the new devices", so hopefully it's not too much work.

That said, I don't see any mention of the STM32L4RAI series in the L4 HAL (which is part of the stm32lib submodule), so I think it would need to be updated first (it's on 1.8.1, the latest version is 1.14.0). https://github.com/micropython/stm32lib

Once that's done, the starting point is to create a board definition, which is a directory in ports/stm32/BOARDS, and set up mpconfigboard.h, mpconfigboard.mk, pins.csv and stm32l4xx_hal_conf.h. Start with one of the existing L4 boards as an example.

You'll likely need a linker script too, which you reference from mpconfigboard.mk.

It would probably help to have an existing STM32 board that has MicroPython support just so you can get familiar with things on a working board first.
thank you very much for you response. I will give it a try and update as soon as possible

ndhuy
Posts: 32
Joined: Mon Nov 04, 2019 8:01 am

Re: Build firmware for MicroPython

Post by ndhuy » Thu Nov 07, 2019 4:52 am

jimmo wrote:
Mon Nov 04, 2019 10:13 am
Hi,

I don't know much about the L4+ family, but MicroPython does support the L4, and ST says "Applications developed for the earlier STM32L4 microcontrollers can run unchanged on the new devices", so hopefully it's not too much work.

That said, I don't see any mention of the STM32L4RAI series in the L4 HAL (which is part of the stm32lib submodule), so I think it would need to be updated first (it's on 1.8.1, the latest version is 1.14.0). https://github.com/micropython/stm32lib

Once that's done, the starting point is to create a board definition, which is a directory in ports/stm32/BOARDS, and set up mpconfigboard.h, mpconfigboard.mk, pins.csv and stm32l4xx_hal_conf.h. Start with one of the existing L4 boards as an example.

You'll likely need a linker script too, which you reference from mpconfigboard.mk.

It would probably help to have an existing STM32 board that has MicroPython support just so you can get familiar with things on a working board first.
Hi Jimmo,

It's me again. i did exactly what you said:
- Update the Hal library to 1.14 version.
- Rewrite 4 file for the new board based on the structure of the similar board 32l496 and the datasheet of 32l4r9i: mpconfigboard.h, mpconfigboard.mk, pins.csv, and stm32l4+xx_hal_conf.h
- I also write linker file in boards folder.

The first time i ran "make BOARD=STM32L4R9IDISC", it displayed an error:no rule to make target 'build-STM32L4R9IDISC/modstm_qstr.h' (build-STM32L4R9IDISC is a folder after the line "make BOARD=STM32L4R9IDISC"), needed by 'build-STM32L4R9IDISC/genhdr/qstrdefs.generated.h'. I fixed this error by copying the modstm_qstr.h file from "build-STM32L496G", a similar board belong to L4 series to STM32L4R9.
Now i am handling the error "file:boards/STM32L4R9IDISC/stm32l4+xx_hal_conf.h does not contain a definition of HSE_VALUE. It confused me because I clearly define the HSE_VALUE already in that file.

Now I am trying to fix that.

Post Reply