Detailed description
In this PR we address a bug we spotted while trying to work with a device that has at least 2 Flash regions in its memory map. The bug would cause the map generator to skip the second region due to an issue in the formatting function itself. This issue is in the input parameter for snprintf() that tells the function how much space it may use for formatting in the provided buffer. When this is improperly tracked from an input of 0 to the map generation function, misexecution results.
This PR also shrinks the Flash usage for the map builder by about 32-40 bytes (depends on platform exactly how much) by simplifying the formatting function, thus fixing this bug. The alternative would have been to have to do a pile of accounting just like in the target description builder functions.
Your checklist for this pull request
Closing issues
<!-- Filling this template is mandatory -->
## Detailed description
In this PR we address a bug we spotted while trying to work with a device that has at least 2 Flash regions in its memory map. The bug would cause the map generator to skip the second region due to an issue in the formatting function itself. This issue is in the input parameter for snprintf() that tells the function how much space it may use for formatting in the provided buffer. When this is improperly tracked from an input of 0 to the map generation function, misexecution results.
This PR also shrinks the Flash usage for the map builder by about 32-40 bytes (depends on platform exactly how much) by simplifying the formatting function, thus fixing this bug. The alternative would have been to have to do a pile of accounting just like in the target description builder functions.
## 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). -->