Thanks to visit codestin.com
Credit goes to github.com

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

Feature: BMP platform Cortex-M exception handlers#1957

Open
ALTracer wants to merge 275 commits into
blackmagic-debug:mainfrom
ALTracer:feature/fault_handlers
Open

Feature: BMP platform Cortex-M exception handlers#1957
ALTracer wants to merge 275 commits into
blackmagic-debug:mainfrom
ALTracer:feature/fault_handlers

Conversation

@ALTracer

Copy link
Copy Markdown
Contributor

Detailed description

  • This is a new feature.
  • The existing problem is BMPs hanging upon a HardFault etc. with no indication of that happening.
  • This PR solves it by overriding default libopencm3-provided weak blocking_handler()'s with meaningful handlers which set a morse message and spin the systick (because of priority) for 10 seconds then reboot the probe.

I'm not sure if platform_request_boot() to request "stay in DFU" is better than just rebooting the probe, or if USB D+ pulse low is needed to trigger re-enumeration on some platforms, so I coded a direct scb_reset_system() instead. Future PRs could unwind the stack (I have tried implementing just that) and/or record crash dumps to SRAM or SPI flash or UART. If MPU is enabled by platform, to e.g. catch NULL dereferences, then there's a simple handler for that, too. Platforms should enable separate SCB->SHCSR BusFault and UsageFault bits for this code to distinguish between them.

Note I don't spin the UART/DMA/TIM or USB device IRQ handlers, but it technically could also be done to keep UART DMA and USB (DFU runtime stub, CDC-ACM, suspend/reset) working for a while for logging purposes. Notably sys_tick_handler() on native indirectly checks for Vtpwr undervoltage. I have not tested how this behaves yet.

Your checklist for this pull request

Closing issues

@ALTracer ALTracer force-pushed the feature/fault_handlers branch 2 times, most recently from 1e868ae to 3dd0927 Compare November 1, 2024 17:26
@ALTracer ALTracer force-pushed the feature/fault_handlers branch from 3dd0927 to 75968ed Compare December 30, 2024 11:32
@ALTracer ALTracer force-pushed the feature/fault_handlers branch from 75968ed to 928fb9f Compare February 9, 2025 18:39
@ALTracer ALTracer mentioned this pull request Mar 30, 2025
6 tasks
dragonmux added 25 commits March 8, 2026 16:27
…adability in the USB configuration setup code
…per use of atomics, resulting in smaller and more correct code
…roper use of atomics, resulting in smaller and more correct code
…change notifications so it's a little more responsive without being overwhelming for traffic
…correctly and the pins are driven suitably hard
@ALTracer ALTracer force-pushed the feature/fault_handlers branch from fcbf2e2 to f713ebb Compare May 22, 2026 19:16
ALTracer and others added 19 commits May 22, 2026 22:26
…K blocks as found on the Lattice Versa boards
…ommand

This was found by looking at the JTAG traffic the lattice diamond programmer generated when programming the ispCLOCK device, and the name was extracted from a JED for the ispCLOCK being converted to an svf file, as the name for this command was included in a comment in the resulting file.
…_done`

These now properly handle the setup and exit for programming ispCLOCK devices
…e attached ispCLOCK device.

After much mucking about and trying to figure out what the lattice programmer was doing and how much of it is required, the method for properly programming the ispCLOCK devices was figured out, which does include wiggling TCK, for some reason....
This is used so we can verify the contents of the the ispCLOCK device and ensure that the correct configuration for it was written
* Extract the memory write into a dedicated helper function
* Wrap it into TRY-CATCH macros
* Drop the extraneous 10ms delay introduced back in PR2072
@ALTracer ALTracer force-pushed the feature/fault_handlers branch from f713ebb to 901bcdd Compare June 13, 2026 20:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants