7
31
Fork
You've already forked blackmagic
23

stm32c5: initial commit adding stm32c5 support to stm32h5 driver. #2242

Merged
dragonmux merged 3 commits from emeb/blackmagic:stm32c5 into main 2026年04月29日 01:09:52 +02:00
Contributor
Copy link

This PR adds support for the STM32C53x/54x/55x/56x/59x/5Ax series devices to the STM32H5 driver.

Your checklist for this pull request

Closing issues

<!-- Filling this template is mandatory --> ## This PR adds support for the STM32C53x/54x/55x/56x/59x/5Ax series devices to the STM32H5 driver. <!-- * The only new feature is a new stm32c5_probe() function which builds the appropriate RAM and Flash maps for the newly supported devices, as well as ID and revision reporting. --> ## Your checklist for this pull request * [x] I've read the [Code of Conduct](https://codeberg.org/blackmagic-debug/blackmagic/src/CODE_OF_CONDUCT.md) * [x] I've read the [guidelines for contributing](https://codeberg.org/blackmagic-debug/blackmagic/src/CONTRIBUTING.md) to this repository * [x] It builds for hardware native (see [Building the firmware](https://codeberg.org/blackmagic-debug/blackmagic?tab=readme-ov-file#building-the-firmware)) * [x] It builds as BMDA (see [Building the BMDA](https://codeberg.org/blackmagic-debug/blackmagic?tab=readme-ov-file#building-black-magic-debug-app)) * [x] I've tested it to the best of my ability * [x] My commit messages provide a useful short description of what the commits do ## Closing issues <!-- put "fixes #XXXX" here to auto-close the issue(s) that your PR fixes (if any). -->
stm32c5: initial commit adding stm32c5 support to stm32h5 driver.
Some checks failed
ci/woodpecker/pr/build-firmware/4 Pipeline was successful
ci/woodpecker/pr/build-firmware/5 Pipeline was successful
ci/woodpecker/pr/build-firmware/2 Pipeline was successful
ci/woodpecker/pr/build-firmware/6 Pipeline was successful
ci/woodpecker/pr/build-firmware/3 Pipeline was successful
ci/woodpecker/pr/build-firmware/7 Pipeline was successful
ci/woodpecker/pr/build-firmware/1 Pipeline was successful
ci/woodpecker/pr/build-firmware/13 Pipeline failed
ci/woodpecker/pr/build-firmware/10 Pipeline was successful
ci/woodpecker/pr/build-firmware/8 Pipeline failed
ci/woodpecker/pr/build-firmware/11 Pipeline was successful
ci/woodpecker/pr/build-firmware/12 Pipeline was successful
ci/woodpecker/pr/build-firmware/14 Pipeline was successful
ci/woodpecker/pr/build-firmware/9 Pipeline was successful
ci/woodpecker/pr/build-linux/1 Pipeline was successful
ci/woodpecker/pr/build-firmware/16 Pipeline was successful
ci/woodpecker/pr/build-firmware/15 Pipeline was successful
ci/woodpecker/pr/build-firmware/18 Pipeline failed
ci/woodpecker/pr/build-firmware/17 Pipeline was successful
ci/woodpecker/pr/build-firmware/20 Pipeline was successful
ci/woodpecker/pr/build-firmware/19 Pipeline was successful
ci/woodpecker/pr/build-linux/2 Pipeline was successful
ci/woodpecker/pr/build-windows Pipeline was successful
3b325641ab
Author
Contributor
Copy link

Whoops - I guess I kinda mangled the markdown for this PR. Details are that I just add a new stm32c5_probe() function which builds the proper RAM and Flash maps as per the memory layout info in RM0522 section 2.2.2. The flash controller in the C5 family appears to be sufficiently similar to that in the H5 devices that I didn't need to make any changes to the rest of the driver. I've tested this on the only C542 device that I have and it is able to load code correctly. Other C5xx devices should work but haven't been tested yet.

Whoops - I guess I kinda mangled the markdown for this PR. Details are that I just add a new stm32c5_probe() function which builds the proper RAM and Flash maps as per the memory layout info in RM0522 section 2.2.2. The flash controller in the C5 family appears to be sufficiently similar to that in the H5 devices that I didn't need to make any changes to the rest of the driver. I've tested this on the only C542 device that I have and it is able to load code correctly. Other C5xx devices *should* work but haven't been tested yet.
dragonmux requested changes 2026年04月29日 00:30:44 +02:00
Dismissed
dragonmux left a comment
Copy link

Couple of notes, but with them taken care of we'll be happy to merge this. Nice work!

Couple of notes, but with them taken care of we'll be happy to merge this. Nice work!
@ -83,2 +85,4 @@
#define STM32H523_SRAM123_SIZE (STM32H523_SRAM1_SIZE + STM32H523_SRAM2_SIZE + STM32H523_SRAM3_SIZE)
/* Memory map constants for STM32C53x/C54x */
#define STM32C53X_FLASH_BANK1_BASE 0x08000000U

we're presuming the X's are for substitutions such as 534, 535, etc? If so, please make them lower-case - we know this makes some of the checking angry right now (we need to work out how to fix this), but the preference is, eg, STM32C53x_FLASH_BANK1_BASE as it's easier then to tell and read where the substitution points are vs actual letters of the part number.

we're presuming the `X`'s are for substitutions such as `534`, `535`, etc? If so, please make them lower-case - we know this makes some of the checking angry right now (we need to work out how to fix this), but the preference is, eg, `STM32C53x_FLASH_BANK1_BASE` as it's easier then to tell and read where the substitution points are vs actual letters of the part number.
dragonmux marked this conversation as resolved
@ -300,0 +349,4 @@
if (!stm32h5_configure_dbgmcu(target))
return false;
target->driver = "STM32H5";

Might wish to use the string STM32C5 here so the part looks correctly identified in GDB - while the variable is called driver, it should really be something like name as it's intended to be the part's identification string.

Might wish to use the string `STM32C5` here so the part looks correctly identified in GDB - while the variable is called `driver`, it should really be something like `name` as it's intended to be the part's identification string.
dragonmux marked this conversation as resolved
@ -433,3 +564,3 @@
const uint16_t rev_id = (idcode & STM32H5_DBGMCU_IDCODE_REV_MASK) >> STM32H5_DBGMCU_IDCODE_REV_SHIFT;
const uint16_t dev_id = idcode & STM32H5_DBGMCU_IDCODE_DEV_MASK;
uint8_t isC5 = 0;

is_c5 please - lower_snake_case is the code base's nomenclature preference for variables. We're in C11, so this can be a bool with true and false as values.

`is_c5` please - lower_snake_case is the code base's nomenclature preference for variables. We're in C11, so this can be a `bool` with `true` and `false` as values.
dragonmux marked this conversation as resolved
stm32c5: Fix bug in C5 revision reporting.
Some checks are pending
ci/woodpecker/pr/build-firmware/1 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/2 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/3 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/4 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/5 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/6 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/7 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/8 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/9 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/10 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/11 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/12 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/13 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/14 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/15 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/16 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/17 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/18 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/19 Pipeline is pending approval
ci/woodpecker/pr/build-firmware/20 Pipeline is pending approval
ci/woodpecker/pr/build-linux/1 Pipeline is pending approval
ci/woodpecker/pr/build-linux/2 Pipeline is pending approval
ci/woodpecker/pr/build-windows Pipeline is pending approval
88434c1255
Author
Contributor
Copy link

Thanks for the review. I'll fix those issues (was wondering about the capitalization & int8_t vs bool stuff).

Thanks for the review. I'll fix those issues (was wondering about the capitalization & int8_t vs bool stuff).
stm32c5: address issues raised in review
Some checks failed
ci/woodpecker/pr/build-firmware/12 Pipeline was successful
ci/woodpecker/pr/build-linux/2 Pipeline was successful
ci/woodpecker/pr/build-linux/1 Pipeline was successful
ci/woodpecker/pr/build-firmware/19 Pipeline was successful
ci/woodpecker/pr/build-firmware/18 Pipeline failed
ci/woodpecker/pr/build-firmware/20 Pipeline was successful
ci/woodpecker/pr/build-windows Pipeline was successful
ci/woodpecker/push/build-firmware/8 Pipeline failed
ci/woodpecker/push/build-firmware/2 Pipeline was successful
ci/woodpecker/push/build-firmware/7 Pipeline was successful
ci/woodpecker/push/build-firmware/4 Pipeline was successful
ci/woodpecker/push/build-firmware/1 Pipeline was successful
ci/woodpecker/push/build-firmware/5 Pipeline was successful
ci/woodpecker/push/build-firmware/6 Pipeline was successful
ci/woodpecker/push/build-firmware/3 Pipeline was successful
ci/woodpecker/push/build-firmware/9 Pipeline was successful
ci/woodpecker/push/build-firmware/10 Pipeline was successful
ci/woodpecker/push/build-firmware/12 Pipeline was successful
ci/woodpecker/push/build-firmware/11 Pipeline was successful
ci/woodpecker/push/build-firmware/13 Pipeline failed
ci/woodpecker/push/build-firmware/14 Pipeline was successful
ci/woodpecker/push/build-firmware/15 Pipeline was successful
ci/woodpecker/push/build-firmware/16 Pipeline was successful
ci/woodpecker/push/build-linux/1 Pipeline was successful
ci/woodpecker/push/build-firmware/18 Pipeline failed
ci/woodpecker/push/build-firmware/17 Pipeline was successful
ci/woodpecker/push/build-firmware/20 Pipeline was successful
ci/woodpecker/push/build-firmware/19 Pipeline was successful
ci/woodpecker/push/build-linux/2 Pipeline was successful
ci/woodpecker/push/build-windows Pipeline was successful
d22b393945
Author
Contributor
Copy link

All three issues have been corrected. Code has been tested on the bench and now reports proper STM32C5 name during connection.

All three issues have been corrected. Code has been tested on the bench and now reports proper STM32C5 name during connection.
dragonmux left a comment
Copy link

All LGTM, merging once CI completes. Thank you for the contribution and getting STM32C5 support into BMD already! Very happy to see it 😄

All LGTM, merging once CI completes. Thank you for the contribution and getting STM32C5 support into BMD already! Very happy to see it 😄
Sign in to join this conversation.
No reviewers
Labels
Clear labels
BMD App
Black Magic Debug App (aka. PC hosted) (not firmware)
BMP Firmware
Black Magic Probe Firmware (not PC hosted software)
Bug
Confirmed bug
Build system
Build system
Can't reproduce
Maintainers can't reproduce this problem
CI
Continuous Integration System
Contribution wanted
User contributions welcome
Documentation
Project documentation
Draft
Work in progress draft
Duplicate
This issue or pull request already exists
Enhancement
General project improvement
Feedback wanted
Requires additional submitter feedback
Foreign Host Board
Non Native hardware to runing Black Magic firmware on
GDB
Issue/PR related to GDB
Good first issue
Good for newcommers
HwIssue Mitigation
Solving or mitigating a Hardware issue in Software
Information Needed
Maintainers need more information
NativeHardware
Official Black Magic Debug Hardware
New Host Board
New hardware to run Black Magic firmware on
New Target
New debug target
Off Topic
Something that does not involve the project in any way
Potential Bug
A potential, unconfirmed or very special circumstance bug
Regression
Bug caused by a regression
User Interest Needed
More user interest required before consideration
User Testing Needed
Looking for user testing reports
Won't fix
Outside of the project scope or works as intended
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/blackmagic!2242
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "emeb/blackmagic:stm32c5"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?