Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Feature: add log message for flash_prepare() - #2098

Merged
dragonmux merged 1 commit into
blackmagic-debug:mainfrom
ALTracer:feature/flash-prepare-log
Jul 26, 2025
Merged

Feature: add log message for flash_prepare()#2098
dragonmux merged 1 commit into
blackmagic-debug:mainfrom
ALTracer:feature/flash-prepare-log

Conversation

@ALTracer

Copy link
Copy Markdown
Contributor

Detailed description

  • This can be called a minor new feature.
  • The existing problem is flash_prepare() functions of target drivers called transparently but, depending on specific flash controller, double unlocking (for erase, for write) may trigger potentially hard to detect errors.
  • This PR adds a log line highlighting what function with what argument is invoked when in the flashing process.

I've used a similar patch to confirm speed of stlinkv3+STM32H743ZI reflashing operation with help of tio timestamping on ttyBmpTarg.
There could be more such logging extracted from per-target functions into central target_flash.c API layer, but a broader refactoring requires more effort. target_flash_erase() is logged, target_flash_write() isn't. I don't like how less readable this becomes, but this is the best place to log -- when all the conditions are passed but before the actual call (which may fail or hang or throw in future drivers). I could move the string array out of two branch scopes.
C has no enum->string reflection. Not urgent for v2.0.

Your checklist for this pull request

Closing issues

@dragonmux dragonmux added the Enhancement General project improvement label Mar 21, 2025
@ALTracer
ALTracer force-pushed the feature/flash-prepare-log branch from b92f286 to c2b4652 Compare March 23, 2025 13:11
@ALTracer
ALTracer force-pushed the feature/flash-prepare-log branch from c2b4652 to 4c95b1c Compare July 21, 2025 21:28

@dragonmux dragonmux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, and we'll merge this once it's been rebased on main. There is one item we spotted, but we don't think it's a blocker - just a nice to have item to dot I's and cross T's.

Thank you for the contribution and helping improve the debugability of the Target Flash API!

Comment thread src/target/target_flash.c
@dragonmux dragonmux added this to the v2.1 release milestone Jul 26, 2025
@ALTracer
ALTracer force-pushed the feature/flash-prepare-log branch from 4c95b1c to f7985cf Compare July 26, 2025 15:20
@dragonmux
dragonmux merged commit f7985cf into blackmagic-debug:main Jul 26, 2025
35 of 36 checks passed
@ALTracer
ALTracer deleted the feature/flash-prepare-log branch February 21, 2026 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Enhancement General project improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants