Skip to content

BenBE/stm32-crashreporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32 Crash Reporter

This library implements a basic crash reporter for Cortex-M3 and Cortex-M4 based STM32 microcontrollers. Its aim is to be small and helpful for debugging runtime issues on-chip.

The library is not intended for use with some on-chip RTOS and will likely need some modifications to work correctly in such environments.

Usage

This library assumes you've a STM32 CubeMX project set up. The easiest way to do this is cubemx.cmake.

In your project configuration you need to ensure, that no code is generated by STM32CubeMX for the following fault handler symbols:

  • NMI_Handler
  • HardFault_Handler
  • MemManage_Handler
  • BusFault_Handler
  • UsageFault_Handler

If you need some of those handlers handled by your own code you can drop the appropriate assembly file that implements that respective handler. All the handler_*.s files are stubs that collect the necessary information needed to handle those interrupts in high-level C.

To replace any of those handlers, but still retain the overall functionality you can easily do so: In your handler you need to save the full register context on ISR entry into the global variable cpustate and call the appropriate high-level handler cr_handle_* from your code.

To communicate the crash report to the outside world this library assumes the controller has been initialized properly and there's one UART properly set-up for communication. This library wont initialize the communication interface, but rather use the existing communication means. Please note, that the routines for doing so are called from within interrupt context. All communication must be done in a synchronuous fashion. If your own application port performs communication asynchronuously on this interface, be aware that switching over may happen at any point. In particular this library will clear TC IT and enable TXE IT (with TXE still pending).

License

This library was written by Benny "BenBE" Baumann and is licensed under AGPLv3. See the LICENSE file for more details.

About

Crash Reporting Handler for STM32 MCUs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published