Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM HAL drivers are out of date #439

Closed
dingyifei opened this issue Oct 7, 2020 · 12 comments
Closed

STM HAL drivers are out of date #439

dingyifei opened this issue Oct 7, 2020 · 12 comments

Comments

@dingyifei
Copy link

dingyifei commented Oct 7, 2020

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:

build_flags =
  +  -I Drivers/STM32F4xx_HAL_Driver/Inc
lib_extra_dirs = 
 +   Drivers/STM32F4xx_HAL_Driver

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):

"C:\Users\13676\.platformio\packages\framework-stm32cube\f4\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pcd.c: In function 'HAL_PCD_ActivateRemoteWakeup':
Drivers\STM32F4xx_HAL_Driver\Inc/stm32f4xx_ll_usb.h:397:52: error: 'USBx_BASE' undeclared (first use in this function);
did you mean 'SCB_BASE'?
 #define USBx_DEVICE     ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))"

Is there any way to partially replace FRAMEWORK_DIR in the python script stm32cube.py or update the framework package?

@gmcn42
Copy link

gmcn42 commented Oct 8, 2020

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'.

@dingyifei
Copy link
Author

dingyifei commented Oct 8, 2020

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

@dingyifei dingyifei changed the title HAL drivers are out of date STM HAL drivers are out of date Oct 8, 2020
@dingyifei
Copy link
Author

dingyifei commented Oct 8, 2020

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?
develop...dingyifei:develop
https://github.com/dingyifei/platform-ststm32

@gudnimg
Copy link
Contributor

gudnimg commented Oct 21, 2020

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

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Oct 21, 2020

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 #226 even, but wasn't further working on it.

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Oct 22, 2020

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.

@gudnimg
Copy link
Contributor

gudnimg commented Oct 23, 2020

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?

@arrowcircle
Copy link

Hey! Any updates on this?

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Nov 19, 2020

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 :)

@valeros
Copy link
Member

valeros commented Nov 26, 2020

Resolved in ec29fab. Sorry for such a late update.

@valeros valeros closed this as completed Nov 26, 2020
@arrowcircle
Copy link

@valeros Thanks!
Is HAL updated to latest versions? When this will be released and available for use?

@maxgerhardt
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants