This repository contains the source code and slides from my GreHack presentation
The project is a simple STM32CubeMX project built for a STM32F103 (like the blue pill)
Simply clone the repo, cd source
and run make
. This will build all the examples.
Detects a debugger by looking at the C_DEBUGEN
bit in DHCSR
Source is in source/Core/Src/main.dhcsr.c
and compiles into source/build/main.dhcsr.elf
Detects if the FPB is enabled, meaning that a hardware breakpoint might be set.
Source is in source/Core/Src/main.fpb.c
and compiles into source/build/main.fpb.elf
This shows how to use the FPB remap capabilities by switching called function at runtime.
Source is in source/Core/Src/main.remap.c
and compiles into source/build/main.remap.elf
This example shows how to use a custom hardfault handler to detect a bkpt
instruction with no debugger attached.
Source is in source/Core/Src/main.hardfault.c
and compiles into source/build/main.hardfault.elf