7
31
Fork
You've already forked blackmagic
23

Feature: Improved map generation and handling #2207

Merged
esden merged 3 commits from feature/improved-map-generation-and-handling into main 2026年03月09日 19:20:32 +01:00

Detailed description

In this PR we start digging into the generation of XML by the firmware and the large buffers that are required in places. This also addresses an issue with the target memory map where large and complicated maps could run the firmware out of space to build the complete map which would then result in odd failures in GDB to load the memory map.

We do this in two main steps: Making the map building reentrant with a little extra state in the target structure; Making the map building occur piecemeal so the maximum size of any one chunk of the map is small and easily fits the available buffers.

This is a tiny bit slower than the one large map method, however it does mean that the probe cannot now run out of space.

Your checklist for this pull request

Closing issues

<!-- Filling this template is mandatory --> ## Detailed description In this PR we start digging into the generation of XML by the firmware and the large buffers that are required in places. This also addresses an issue with the target memory map where large and complicated maps could run the firmware out of space to build the complete map which would then result in odd failures in GDB to load the memory map. We do this in two main steps: Making the map building reentrant with a little extra state in the target structure; Making the map building occur piecemeal so the maximum size of any one chunk of the map is small and easily fits the available buffers. This is a tiny bit slower than the one large map method, however it does mean that the probe cannot now run out of space. ## 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). -->
esden left a comment
Copy link

Just one potential, additional, optimization but not a stopper for this PR.

Merging.

Just one potential, additional, optimization but not a stopper for this PR. Merging.
@ -54,6 +54,9 @@ const command_s target_cmd_list[] = {
{NULL, NULL, NULL},
};
static const char map_begin[] = "<memory-map>";
Owner
Copy link

In thery this could be optimized further by just storing the prefix of begin and end tags as well as the body. So something like:

tag_begin[] = "<";
tag_end[] = "</";
map_tag[] = "memory-map>";

Just an idea for the future how to further optimize. Not a blocker here I think.

In thery this could be optimized further by just storing the prefix of begin and end tags as well as the body. So something like: ```c tag_begin[] = "<"; tag_end[] = "</"; map_tag[] = "memory-map>"; ``` Just an idea for the future how to further optimize. Not a blocker here I think.
Author
Owner
Copy link

That's true - unsure how that looks in terms of the cost of rebuilding the completed string, but that is indeed true. It could be interesting to see how that affects Flash size though.

That's true - unsure how that looks in terms of the cost of rebuilding the completed string, but that is indeed true. It could be interesting to see how that affects Flash size though.
esden deleted branch feature/improved-map-generation-and-handling 2026年03月09日 19:20:33 +01:00
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!2207
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "feature/improved-map-generation-and-handling"

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?