Feature: Working logs on blackpill-f4 via DebugMon#1715
Conversation
dragonmux
left a comment
There was a problem hiding this comment.
This all LGTM. We haven't the hardware to test it, so if you say this works (and hey, this explains some things in the native platform too that didn't have comments!) we'll trust you on that.
Given your PR #1716 which deals with the bootloader space complaint, we'll provisionally approve this but intend to merge it after that other PR so main doesn't wind up broken for an indeterminate amount of time for this platform.
|
Eh, I don't feel so confident about the Makefile.inc change. Is --nosys.specs handled right and is it better/proper way than -lnosys? There is another variant of the commit in PR1717 as third in series, but somewhy I though appending --nano.specs was a good idea (not bootloader space constraints but feature/libc/impl parity of firmware with other platforms, or making it fit below 0x08020000), and I didn't rebase it out of there. |
|
|
* Propagate nosys for BMPBootloader into the makefile target because it conflicts with rdimon * Switch between nosys.specs and rdimon.specs for payload firmware * Bump DFU serial length to 12+1 to match MaskROM DFU and once utoa_upper is available * Keep both parts full newlib (not nano) because we're not space-constrained and it's faster and has more libc features
|
Now that the other PR is merged, if you want to check over this one still functions then we're happy to merge this and clear the way for #1717 |
* Flip `SCS->DEMCR |= MON_EN` for DebugMon to catch semihosting breakpoints when there is no upstream debugger and we want to log * Declare PLATFORM_HAS_DEBUG to pull conditionally compiled statements
f3bc806 to
b82a3b4
Compare
|
This PR of two commits provides/enables the mentioned feature. I swapped the commit order because my pre-commit hook indicated a build of one of four combinations failing to link make -C src/ clean
make -C src/ PROBE_HOST=blackpill-f411ce CROSS_COMPILE="ccache arm-none-eabi-" -j4 || exit 13
make -C src/ clean
make -C src/ PROBE_HOST=blackpill-f411ce CROSS_COMPILE="ccache arm-none-eabi-" ENABLE_DEBUG=1 -j4 || exit 14
make -C src/ clean
make -C src/ PROBE_HOST=blackpill-f411ce CROSS_COMPILE="ccache arm-none-eabi-" BMP_BOOTLOADER=1 -j4 || exit 15
make -C src/ clean
make -C src/ PROBE_HOST=blackpill-f411ce CROSS_COMPILE="ccache arm-none-eabi-" BMP_BOOTLOADER=1 ENABLE_DEBUG=1 -j4 || exit 16
... probably because it goes through Update: I downgraded from ARM toolchain 12.2.Rel1 to Ubuntu/jammy GCC 10.3-2021.07.4, and because I rebuilt in-repo libnewlib-arm-none-eabi keeping the debugging symbols info (2.0 GiB for 20+ target flavours), I get to see into newlib internals when hot-attaching to a hung probe with a second BMP-compatible. So indeed enabling DebugMon vector is the solution. |
|
That sounds like a fully working patch to us! We'll get this merged then, thank you 🙂 |
Detailed description
blackpill-f4family of platforms.How to reproduce the issue: build with
PROBE_HOST=blackpill-f411ce ENABLE_DEBUG=1, optionally also withBMP_BOOTLOADER=1, upgrade/flash to the board, open gdb, ask formonitor debug_bmp enable(aka "mon debug en") --Target does not support this command.Even though the binary is 40 KiB bigger.I've been carrying the patches to use logging on my platform of choice since probably June 2023, which is when I started using the project, and I'm tired of unstashing them on top of every feature branch I'm testing just to see some important
DEBUG_INFO()s. Bothstlinkandswlinkwork without such changes (but they can't fit both logs and default targets, which is a separate problem solved by an edited Makefile dirtying the working copy).After another round through reading up on semihosting and debugging down through how it actually works, I now understand how this optional BMP feature was implemented on
nativeall the way back in 2016 in PR151 966f360Note two things: 1) I do not intend to downgrade to newlib-nano in BMPbootloader or in BMF, because it provides a faster memcpy and actual working mallopt+malloc_trim. 2) That means that the bootloader with 12-symbol serialno will no longer fit under 16 KiB, but I have a proposal in a separate PR to deal with it. Platform MaskROM generates a 12-symbol serial number when enumerating on USB, and I would like to enforce feature parity with it.
Your checklist for this pull request
make PROBE_HOST=native)make PROBE_HOST=hosted)Closing issues