Closed dingyifei closed 3 years ago
I am running into the same problem with a Nucleo STM32H743 board. Current stable framework version in CubeMX is 1.8.0 from May 29, 2020. In platformio, newest update is 1.3.0 from July 4, 2018. So more than 2 years and 5 releases old. Right now, a bare minimum project for the Nucleo board generated in CubeMX will not compile due to unimplemented functions and undeclared constants.
Some error messages from the failed compilation:
src/main.c:276:15: error: 'UART_InitTypeDef {aka struct <anonymous>}' has no member named 'ClockPrescaler'; did you mean 'Prescaler'?
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
src/system_stm32h7xx.c:153:6: error: 'FLASH_LATENCY_DEFAULT' undeclared (first use in this function); did you mean 'FLASH_LATENCY_1'?
if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY)))
^~~~~~~~~~~~~~~~~~~~~
FLASH_LATENCY_1
src/system_stm32h7xx.c:153:6: note: each undeclared identifier is reported only once for each function it appears in
src/system_stm32h7xx.c:261:3: error: 'FMC_Bank1_R' undeclared (first use in this function); did you mean 'FMC_Bank5_6'?
FMC_Bank1_R->BTCR[0] = 0x000030D2;
^~~~~~~~~~~
FMC_Bank5_6
*** [.pio/build/nucleo_h743zi/src/system_stm32h7xx.o] Error 1
....et cetera. Seems it's high time, the libraries get updated.
At [https://community.platformio.org/t/it-looks-like-package-framework-stm32cube-f4-is-outdated/12886/6] a user posted a workaround involving a self-made repository to let platformio pull in the newer sources from there but this should really be fixed 'officially'.
I am running into the same problem with a Nucleo STM32H743 board. Current stable framework version in CubeMX is 1.8.0 from May 29, 2020. In platformio, newest update is 1.3.0 from July 4, 2018. So more than 2 years and 5 releases old. Right now, a bare minimum project for the Nucleo board generated in CubeMX will not compile due to unimplemented functions and undeclared constants.
Some error messages from the failed compilation:
src/main.c:276:15: error: 'UART_InitTypeDef {aka struct <anonymous>}' has no member named 'ClockPrescaler'; did you mean 'Prescaler'? huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1; src/system_stm32h7xx.c:153:6: error: 'FLASH_LATENCY_DEFAULT' undeclared (first use in this function); did you mean 'FLASH_LATENCY_1'? if(FLASH_LATENCY_DEFAULT > (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))) ^~~~~~~~~~~~~~~~~~~~~ FLASH_LATENCY_1 src/system_stm32h7xx.c:153:6: note: each undeclared identifier is reported only once for each function it appears in src/system_stm32h7xx.c:261:3: error: 'FMC_Bank1_R' undeclared (first use in this function); did you mean 'FMC_Bank5_6'? FMC_Bank1_R->BTCR[0] = 0x000030D2; ^~~~~~~~~~~ FMC_Bank5_6 *** [.pio/build/nucleo_h743zi/src/system_stm32h7xx.o] Error 1
....et cetera. Seems it's high time, the libraries get updated.
At [https://community.platformio.org/t/it-looks-like-package-framework-stm32cube-f4-is-outdated/12886/6] a user posted a workaround involving a self-made repository to let platformio pull in the newer sources from there but this should really be fixed 'officially'.
If anyone in platformio dev team would publish the package on Github it would be awesome. The stm32cube fw is released on Git and making it a submodule of the fw package solve it ig? https://github.com/STMicroelectronics/STM32CubeF4/releases
Or some small changes can be done on the build script.....
@valeros
I made some rough changes that might solve the problem, not sure I correctly implemented them since I didn't read main.py... NOTE: I haven't tested it..... (I'll test it after I get free time or something xD) Anyone wants to test it? https://github.com/platformio/platform-ststm32/compare/develop...dingyifei:develop https://github.com/dingyifei/platform-ststm32
Just took a look myself and wow everything is out of date. Below is an overview of the different STM32 series and their release notes.
Package | PIO version | Newest version | Github link | Release notes preview |
---|---|---|---|---|
F0 | 1.9.0 | 1.11.1 | https://github.com/STMicroelectronics/STM32CubeF0 | Github Preview |
F1 | 1.7.0 | 1.8.3 | https://github.com/STMicroelectronics/STM32CubeF1 | Github Preview |
F2 | 1.7.0 | 1.9.2 | https://github.com/STMicroelectronics/STM32CubeF2 | Github Preview |
F3 | 1.10.0 | 1.11.1 | https://github.com/STMicroelectronics/STM32CubeF3 | Github Preview |
F4 | 1.23.0 | 1.25.2 | https://github.com/STMicroelectronics/STM32CubeF4 | Github Preview |
F7 | 1.14.0 | 1.16.0 | https://github.com/STMicroelectronics/STM32CubeF7 | Github Preview |
H7 | 1.3.0 | 1.8.0 | https://github.com/STMicroelectronics/STM32CubeH7 | Github Preview |
L0 | 1.11.0 | 1.11.3 | https://github.com/STMicroelectronics/STM32CubeL0 | Github Preview |
L1 | 1.8.1 | 1.10.2 | https://github.com/STMicroelectronics/STM32CubeL1 | Github Preview |
L4 | 1.13.0 | 1.16.0 | https://github.com/STMicroelectronics/STM32CubeL4 | Github Preview |
I noticed when going through these versions that framework-stm32cube
does not include STM32L5, STM32WB, STM32G4, STM32G0
This will also fix issue #368
Edit: Added Github links to table
Edit 2: Updated new version for F1 and F2
Edit 3: STM has also now added a new series STM32WL
Yeah these versions are ancient. I'll just cut it short and generate a new package version of framework-stm32cube
. I'll then hope for quick integration by @valeros . The same issue also goes for the framework-spl
package, but it's less used so this doesn't pop up as often. I've had a PR open for SPL in https://github.com/platformio/platform-ststm32/pull/226 even, but wasn't further working on it.
I've created a script which can automatically download the latest versions of STM32Cube packages for every available series (including G0, G4, L5, MP1 and WB which PIO's package doesn't have) and create a framework-stm32cube
package from it: https://github.com/maxgerhardt/pio-stm32cube-package-creator
I'm currently testing the created packet. Compilation of the current STM32Cube-HAL-Blink example goes through for all boards plus a custom STM32H750VB board of mine.
Environment Status Duration
------------------ -------- ------------
stm32h750vb SUCCESS 00:00:09.863
nucleo_f072rb SUCCESS 00:00:04.779
nucleo_f103rb SUCCESS 00:00:04.914
nucleo_f207zg SUCCESS 00:00:05.948
nucleo_f334r8 SUCCESS 00:00:06.216
genericSTM32F303CB SUCCESS 00:00:05.659
nucleo_f401re SUCCESS 00:00:07.233
nucleo_f746zg SUCCESS 00:00:07.626
nucleo_l053r8 SUCCESS 00:00:05.872
nucleo_l152re SUCCESS 00:00:05.996
nucleo_l476rg SUCCESS 00:00:09.707
cloud_jam SUCCESS 00:00:07.443
cloud jam l4 SUCCESS 00:00:09.440
The FW works for my board. Whether they work in all other cases is another question. I'll test as much as possible.
Is there anything else we can do to help them update this?
Maybe we should create a separate issue for the G0, G4, L5, MP1 and WB?
Hey! Any updates on this?
I wasn't really able to find time to do extensive testing of my framework package, so I'm appreciating support and testing from others regarding all the example projects here and more STM32CubeMX generated projects with like an RTOS etc. Also hoping for integration by @valeros :)
Resolved in https://github.com/platformio/platform-ststm32/commit/ec29fab5f4e75ad7664cefcfc723e3acc6e22592. Sorry for such a late update.
@valeros Thanks! Is HAL updated to latest versions? When this will be released and available for use?
Since it's in the dev branch you should be able to use it in a PlatformIO project just by replacing the platform =
line in the platformio.ini
to
platform = https://github.com/platformio/platform-ststm32.git
I found framework-stm32cube\f4\Drivers\STM32F4xx_HAL_Driver haven't get updated for a year. This leads to some incompatability with code generated by STM32CubeMx using the newest framework from https://github.com/STMicroelectronics/STM32CubeF4. For example, htim2.Init.AutoReloadPreload is not defined in the old framework package and had to comment out manually.
I tried to manually include the newest driver but it wasn't working. Here are the edits I made to my ini file:
They didn't work and I believe it was firmware package related because I got the following error (I only copied a section of it):
Is there any way to partially replace
FRAMEWORK_DIR
in the python scriptstm32cube.py
or update the framework package?