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

Add support for STM32F103 (Blue Pill) #541

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Risca
Copy link

@Risca Risca commented Jan 26, 2025

The Blue Pill board is typically fitted with a STM32F103C8T6, but
reports online seem to indicate that it sometimes can come with its
bigger sibling the STM32F103C8TB as is the case with my board.

This patch adds support for all low- to medium-density STM32F103
devices. All of these devices have their flash divided in 1 KB pages, up
to 128 KB. The high-density and connectivity line of devices, sometimes
called XL devices, use 2 KB pages and are not supported.

Similar to the STM32F4 support, the code will spin up the PLL for
maximum speed during init and turn it off just before booting the
application. the maxium speed is 72 MHz.

Booting with the example config takes around 6 seconds.
Updating takes about 15.

Copy link
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Risca for the proposed port. This looks good so far.

  • Please do get in touch with us at [email protected] to fill our Contributor Agreement form, if you haven't already, mentioning this PR.
  • The hal_flash_write function is not supposed to erase sectors. Please remove all erase commands from hal_flash_write.
  • Please rename the TARGET and file names to stm32f1 for consistency with other ports.
  • Our ports usually include also one paragraph of instructions in docs/Targets.md, and a non-regression build test in github actions, but I could also commit those on top while testing, once the above points are solved.

@Risca
Copy link
Author

Risca commented Jan 29, 2025

Thanks @Risca for the proposed port. This looks good so far.

  • Please do get in touch with us at [email protected] to fill our Contributor Agreement form, if you haven't already, mentioning this PR.

  • The hal_flash_write function is not supposed to erase sectors. Please remove all erase commands from hal_flash_write.

  • Please rename the TARGET and file names to stm32f1 for consistency with other ports.

  • Our ports usually include also one paragraph of instructions in docs/Targets.md, and a non-regression build test in github actions, but I could also commit those on top while testing, once the above points are solved.

I've fixed the rename and (hopefully) the build test. The rest will be a few days

@danielinux
Copy link
Member

Rebasing on master would get rid of the failing tests, which are caused by the deprecation of some v3 APIs we already fixed.

@Risca
Copy link
Author

Risca commented Feb 11, 2025

Rebased without changes to latest master to see if automatic builds now works

@dgarske
Copy link
Contributor

dgarske commented Feb 12, 2025

Tracking in ZD 19403

@dgarske dgarske requested a review from danielinux February 12, 2025 18:35
@dgarske dgarske self-assigned this Feb 14, 2025
@Risca Risca force-pushed the stm32f103 branch 2 times, most recently from e878621 to 2953810 Compare February 15, 2025 21:07
@Risca
Copy link
Author

Risca commented Feb 15, 2025

Fixed an issue in the config file: the wolfboot partition was configured much larger than the space available before the first (boot) partition

@Risca
Copy link
Author

Risca commented Feb 15, 2025

Fixed an issue in the config file: the wolfboot partition was configured much larger than the space available before the first (boot) partition

Sorry for the noise - I misread the docs. Config is fixed now, and the partition sizes trimmed a bit

@dgarske
Copy link
Contributor

dgarske commented Feb 20, 2025

Contributor agreement approved and on file. Thank you @Risca . Daniele please finalize and merge when you are happy with it.

dgarske
dgarske previously approved these changes Feb 20, 2025
Copy link
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The hal implementation looks much better now. I hope you don't mind fixing a few last little details.

The Blue Pill board is typically fitted with a STM32F103C8T6, but
reports online seem to indicate that it sometimes can come with its
bigger sibling the STM32F103C8TB as is the case with my board.

This patch adds support for all low- to medium-density STM32F103
devices. All of these devices have their flash divided in 1 KB pages, up
to 128 KB. The high-density and connectivity line of devices, sometimes
called XL devices, use 2 KB pages and are not supported.

Similar to the STM32F4 support, the code will spin up the PLL for
maximum speed during init and turn it off just before booting the
application. the maxium speed is 72 MHz.

Signed-off-by: Patrik Dahlström <[email protected]>
The test application used during development of STM32F103 support. If
booting version 1 of the software, trigger an update. If running ver. 2,
all is good.

Signed-off-by: Patrik Dahlström <[email protected]>
Config based on the STM32F4 ditto.

Booting takes about 6 seconds and update around 15.

Signed-off-by: Patrik Dahlström <[email protected]>
Signed-off-by: Patrik Dahlström <[email protected]>
@dgarske dgarske requested a review from danielinux February 20, 2025 21:16
@dgarske dgarske assigned dgarske and unassigned Risca and dgarske Feb 20, 2025
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

Successfully merging this pull request may close these issues.

3 participants