7
32
Fork
You've already forked blackmagic
23

Fix: target: Deduplicate message strings #1527

Merged
ALTracer merged 2 commits from msgstr_dedup into main 2023年06月29日 21:29:40 +02:00
ALTracer commented 2023年06月29日 19:12:51 +02:00 (Migrated from github.com)
Copy link

Detailed description

  • No new feature implemented.
  • This pull request is aimed at flash size/footprint reduction.
  • Repeated parts of message strings in stm32l4 & samx5x could be output via %s of tc_printf/gdb_voutf/vasprintf, and this allows GCC to fold string literal constants, saving 200 bytes in .rodata.

Disclaimer: I don't have targets handled by stm32l4 code available (and certainly not samx5x), so I can't runtime-test whether the probe now crashes at this stack depth etc.
Additionally, I didn't find a tc_puts() or something similar to print simple \n0円-terminated string literals. GCC is known to optimise such calls of printf("...\n") to puts("...") (see gimple_fold_builtin_printf()). Some of the changes could be alternatively split into two print statements, the second printing the common/folded message part.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do
## Detailed description * No new feature implemented. * This pull request is aimed at flash size/footprint reduction. * Repeated parts of message strings in stm32l4 & samx5x could be output via `%s` of tc_printf/gdb_voutf/vasprintf, and this allows GCC to fold string literal constants, saving 200 bytes in `.rodata`. Disclaimer: I don't have targets handled by stm32l4 code available (and certainly not samx5x), so I can't runtime-test whether the probe now crashes at this stack depth etc. Additionally, I didn't find a `tc_puts()` or something similar to print simple `\n0円`-terminated string literals. GCC is known to optimise such calls of `printf("...\n")` to `puts("...")` (see `gimple_fold_builtin_printf()`). Some of the changes could be alternatively split into two print statements, the second printing the common/folded message part. ## Your checklist for this pull request * [x] I've read the [Code of Conduct](https://github.com/blackmagic-debug/blackmagic/blob/main/CODE_OF_CONDUCT.md) * [x] I've read the [guidelines for contributing](https://github.com/blackmagic-debug/blackmagic/blob/main/CONTRIBUTING.md) to this repository * [x] It builds for hardware native (`make PROBE_HOST=native`) * [x] It builds as BMDA (`make PROBE_HOST=hosted`) * [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
dragonmux left a comment
Copy link

This looks good to us, and we would not expect any stack issues here regardless. Merging

This looks good to us, and we would not expect any stack issues here regardless. Merging
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!1527
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "msgstr_dedup"

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?