Skip to content

Commit

Permalink
blackpill-f4: Provision platform-specific bits for ENABLE_DEBUG=1
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ALTracer authored and dragonmux committed Jan 7, 2024
1 parent 21b2461 commit a97e3a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/platforms/common/blackpill-f4/blackpill-f4.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/scb.h>
#include <libopencm3/cm3/scs.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/exti.h>
#include <libopencm3/stm32/usart.h>
Expand Down Expand Up @@ -103,6 +104,10 @@ void platform_init(void)
#endif

platform_timing_init();
#if ENABLE_DEBUG == 1
/* Allow vectoring to DebugMon exception handler upon semihosting breakpoints */
SCS_DEMCR |= SCS_DEMCR_VC_MON_EN;
#endif
blackmagic_usb_init();
aux_serial_init();

Expand Down
5 changes: 5 additions & 0 deletions src/platforms/common/blackpill-f4/blackpill-f4.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

#define PLATFORM_HAS_TRACESWO

#if ENABLE_DEBUG == 1
#define PLATFORM_HAS_DEBUG
extern bool debug_bmp;
#endif

/*
* If the SHIELD macro is passed to make, other macros are defined.
* Build the code using `make PROBE_HOST=blackpill-f4x1cx SHIELD=1` to define the SHIELD macro.
Expand Down

0 comments on commit a97e3a2

Please sign in to comment.