-
-
Notifications
You must be signed in to change notification settings - Fork 785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Blackpill-F4 and BMP DFU #1508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Principally this looks good. There are a few items that need fixing before we can consider merging this, but they're easy enough to fix.
Thank you for the contribution!
We need to check through one or two things in the makefile changes for sanity, but this looks much better. Please apply your cleanup commit as a fixup to the commit that introduced those |
* BMP DFU uploads are ~2.4x faster than STM32F4x1 BootROM DFU * Use 84MHz clocks in DFU (and in APP), revisit for F411 & 96MHz * Use the PA0 pushbutton active-low and pulled-up to control DFU entry platforms/blackpill-f4: Makefile-switchable BMP DFU * Use makeflags to adjust CFLAGS to pass a macro definition platforms/blackpill-f4: Move bootloader flags to .noinit section * blackpill-f4 inherited _ebss and related hacks from f4discovery * This will not cooperate with BMP DFU, but libopencm3 has a .noinit * Keep #ifdef guards for pure ST DFU by default
V-Bus Sense Disable is required both in DFU and in FW.
* libopencm3 has presets for 84 & 96mhz, use them for f401 and f411 respectively. Same for DFU.
f2a7b83
to
85e285e
Compare
I rebased the entire branch, re-shuffling commits with respective cleanups/fixups, slightly editing commit contents. I decided to drop the ENABLE_DEBUG & rdimon change from this patchset. That stuff needs revisiting in coordination with #1507. Testing the change on my blackpill didn't solve the probe hanging on initalization, moreover the upstream bluepill debugging up hung too (don't know where, it remaps its SWJ-DP). Also, I incorporated the change placing bootloader magic into the The original branch and a few unrelated changes on top of it will stay in my fork for a while. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the bootloader for these platforms fixed, this is looking much better. Thank you! We have just one review comment on this new code and with that fixed it'll be ready for merge.
* Reset unnecessary braces change * Drop last unneeded `#pragma`s * Add a clarification on reboot flows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, merging as soon as the build completes
Detailed description
blackpill-f4
inherited the usbdfu.c fromf4-discovery
with wrong clocks (different HSE 25/8, different core clock 84/96/168), let's stick with 96MHzYour checklist for this pull request
make PROBE_HOST=native
) -- doesn't breakmake PROBE_HOST=hosted
) -- not applicableClosing issues
Not closes per se, but I'd like to mention #1152 from which I took the idea. That was abandoned less than a year ago, so before the big blackpill-f4 migration by @lenvm. Note that the DFU flash sectors' description string is composed at runtime, and the first 16K sector appears read-only (not actually write-protected, though).
Problems
Seeing as there are F401 users, we need to decide on a method of selecting RCC configurations from libopencm3, maybe a macro. F401 will run at 84Mhz with 2ws, F411 at 96Mhz with 3ws (90nm 30Mhz Flash with ART). Not 100 because of USB48. The core is decently powerful, I wouldn't want to limit it especially since the three platform variants have separate headers and linkerscripts.
Upon unlocking the
BMP_BOOTLOADER=1
DFU code I faced weird issues with USBOTG DWC core, like the issues I had when building NuttX for this board. On one patch variant it fails to set up address from PC, on another it doesn't appear at all. Before the patch both BMP firmware and ST BootROM worked and enumerated immediately, after the patch maybe only the DFU works and nothing else can use the DWC USB on jump_to_application or soft-reset into ST BootROM. I have to physically unplug the board and remove power from external debugger. I think it has to do with VBus B-session sensing, PA9/PA10 AF mux and proper reset between consecutiveusbd_init()
's (or upon leaving dfu_f4) instead of simply adjusting SP and jumping to application.I need advice from the reviewers on which
#if 0
-hidden code blocks to drop for good, I simply kept these for context.