Skip to content

[2.0.x] STM32F7 HAL using the official STM32 Arduino Core#11750

Merged
thinkyhead merged 3 commits intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead:bf2_STM32F7xx_HAL
Oct 3, 2018
Merged

[2.0.x] STM32F7 HAL using the official STM32 Arduino Core#11750
thinkyhead merged 3 commits intoMarlinFirmware:bugfix-2.0.xfrom
thinkyhead:bf2_STM32F7xx_HAL

Conversation

@thinkyhead
Copy link
Member

@thinkyhead thinkyhead force-pushed the bf2_STM32F7xx_HAL branch 6 times, most recently from 95023f6 to 1cd607c Compare September 7, 2018 00:16
@hasenbanck
Copy link
Contributor

There are also currently some issues left with my HAL implementation:

@thinkyhead thinkyhead added the T: HAL & APIs Topic related to the HAL and internal APIs. label Sep 8, 2018
@thinkyhead
Copy link
Member Author

@hasenbanck — Do you want to add your changes onto this PR (by checking out my working branch) or just carry on and wait until everything is nicely integrated into a unified STM32 HAL by @xC0000005 ?

@hasenbanck
Copy link
Contributor

hasenbanck commented Sep 8, 2018

@thinkyhead I think I will add my changes onto this PR. It could act as a reference for @xC0000005 on how to use the official branch. If I solve the open issues before the unified STM32 HAL is integrated, we could think about merging this PR.

Can I push my future changes to your branch?

@thinkyhead
Copy link
Member Author

You can submit your changes as PRs to my branch, but not push to it directly.

@thinkyhead thinkyhead force-pushed the bf2_STM32F7xx_HAL branch 2 times, most recently from cbb4f05 to 979ec75 Compare September 9, 2018 09:28
@SJ-Innovation
Copy link
Contributor

Just wondering what the build strategy with this would be, PlatformIO / ArduinoIDE-beta? Other?

@hasenbanck
Copy link
Contributor

@SJ-Innovation I personally use Arduino (I'm currently not sure of the version) and Eclipse CDT with Sloeber to build this. PlatformIO has currently a blocker as far as I know, since there still needs to be some upstream support for building the official core (but I could be out of the loop on this).

But you need to install the official STM32 core for this (https://github.com/stm32duino/Arduino_Core_STM32). The core provides examples on how to configure the IDE.

To build for my board, you need to pull my branch though, since my board definition is not yet upstreamed (stm32duino/Arduino_Core_STM32#287).

@SJ-Innovation
Copy link
Contributor

@hasenbanck Explains why ive spent the last 3 days smashing my head against a wall with PlatformIO then. xD. Ive got everything building with ArduinoIDE1.9-beta with CLion as my primary IDE. Just wasnt sure if i was missing something.

Ill take a look into Sloeber, it looks more appropriate for this kind of dev than CLion.

Any idea what the blocker with PIO is? Im more than happy to put the work in to fix it if its fixable, any experience youve had would be greatly appreciated for that though.

@hasenbanck
Copy link
Contributor

@SJ-Innovation Sloeber is nice, since I can use the full CDT feature set (like using a J-LINK for debugging). I use symlinks to link to my Marlin sources.

I don't have a status on the blocker. It seems that Platform IO simply hasen't targeted the official core yet (stm32duino/Arduino_Core_STM32#262).

@hasenbanck
Copy link
Contributor

Update on the progress of open issues:

Following PR are are merged:

  • Upstream PR for the board definition
  • Upstream PR for the more efficient EEPROM emulation over flash (buffered)

Following issues are still open:

  • Upstream support for Serial over USB (using CDC / VCOM)
  • Finding a way to let the board define which timer to use for the the temp / stepper timer (They are hard coded right now, but a board has valid reasons to use different timers, for example "The BORG" and my board "REMRAM" are using differnt timers)

@thinkyhead thinkyhead force-pushed the bugfix-2.0.x branch 2 times, most recently from 9d867f9 to 849dea9 Compare September 24, 2018 03:23
@thinkyhead
Copy link
Member Author

Thanks for the PR to this PR, @hasenbanck ! I'm still unsure whether to merge this PR now, or to wait for the work by @xC0000005, which is supposed to supersede this. In either case, I'll continue to leave this here as a reference for anyone working on STM32F7 stuff.

@hasenbanck
Copy link
Contributor

hasenbanck commented Sep 29, 2018

Hi @thinkyhead, it's fine to not merge this PR yet. But it should definitely act as a reference for @xC0000005. The official STM32 core will soon (sometime in October) have a dedicated hardware timer library, that abstracts the usage of the timers on the STM32 chip. With that change, 95% of the current STM32 HALs will be essentially the same, which should make his work even easier.

I will also work "soon" on the Virtual COM Port support, which is the last real blocker for this HAL.

@thinkyhead
Copy link
Member Author

Good news. I'm gratified to hear that the cores are being so actively developed.

@xC0000005
Copy link
Contributor

xC0000005 commented Sep 30, 2018 via email

@hasenbanck
Copy link
Contributor

@thinkyhead @xC0000005 Okay, then here is my proposal how we should proceed:

  • I would like to rename the HAL folder to something more generic: "STM32" would be most suited, since the official HAL can handle everything from a F0 to a L4.
  • The changes that @xC0000005 made will be integrated (mainly macros)
  • Change the include macros to support all existing STM32 HAL (F1, F4, F7)
  • A one-liner change to support CDC will be added (I'm currently working on the CDC part upstream)
  • README.md will be updated to reflect the changes

With these changes the HAL should support of F1, F4 and F7 boards fine.

Since only RemRam has a board definition in the upstream core as of right now, only it would have a pin file that uses this HAL as of right now.

I would propose, that we then port the other boards to the new HAL as we have time. This would enable us to deprecate the other HALs as soon as they are working just as fine.

I would offer myself to work with the upstream STM32 core to implement the needed changes and create the board variants. As far as I see, we currently have the following STM32 based boards on the market:

  • Chitu3D V3.9
  • Malyan M200 (This this include the Maker Select Mini?)
  • STEVAL-3DP001V1
  • RemRam

"THE BORG" is still not available yet. So it would be out of scope for my work.

@hasenbanck
Copy link
Contributor

I implemented my proposed changes here: thinkyhead#36

@Phr3d13
Copy link
Contributor

Phr3d13 commented Oct 1, 2018

I'd like to chime in and add a board to that list: GTM32_PRO_VB and the yet to be worked on GTM32_MINI.

@p3p
Copy link
Member

p3p commented Oct 1, 2018

Do you not just need the mcu rather than board support upstream, requiring the framework to support any board that has an stm32 mcu seems a bit onerous on the upkeep.

@Phr3d13
Copy link
Contributor

Phr3d13 commented Oct 1, 2018

Yes, just the MCU should be enough, I don't know if the F103VET6 that it uses is too different from the F103RET6 that's already in place, though.

@hasenbanck
Copy link
Contributor

@p3p @Phr3d13 You need the support of the core on a board level. Have a look at the upstream resources (https://github.com/stm32duino/wiki/wiki/Add-a-new-variant-(board)) and my example definition (https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/REMRAM_V1).

MCU support is not enough, since you have to configure stuff like timer, pin definitions and HAL configuration for the board. There are cases were people use different peripherals on the same MCU and these need to be configure these on the board level.

But in the end it's the same as we had with STM32generic and also some AVR boards (like Rambo).

hasenbanck and others added 3 commits October 3, 2018 02:20
The official STM32 arduino core now supports buffered access to the EEPROM emulated over flash.

This makes writing data much more efficient.
@thinkyhead
Copy link
Member Author

Do we have pretty high confidence that this is ready to merge now?

@hasenbanck
Copy link
Contributor

hasenbanck commented Oct 3, 2018 via email

@thinkyhead thinkyhead merged commit 348004c into MarlinFirmware:bugfix-2.0.x Oct 3, 2018
@thinkyhead thinkyhead deleted the bf2_STM32F7xx_HAL branch October 3, 2018 08:26
@AlexanderAmelkin
Copy link
Contributor

@p3p, @Phr3d13, regarding GTM32 Pro please see the discussion in #10898
Also please see my request here:
platformio/platform-ststm32#145

MCU support is not enough as GTM32 Pro does not have a USB serial (FT232 attached to normal UART is used instead) and uses PA11/PA12 pins for driving Y axis.

However, I think that discussing GTM32 Pro (based on STM32F103VET6) is a bit out of context of a pull request called "STM32F7..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T: HAL & APIs Topic related to the HAL and internal APIs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants