Skip to content

Commit

Permalink
Postmortem Debugging to serial port (MarlinFirmware#20492)
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Ryl669 authored and chrisjenda committed Apr 6, 2021
1 parent d66f40b commit 03e45ae
Show file tree
Hide file tree
Showing 34 changed files with 1,420 additions and 754 deletions.
7 changes: 7 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3589,3 +3589,10 @@

// Enable Marlin dev mode which adds some special commands
//#define MARLIN_DEV_MODE

/**
* Postmortem Debugging captures misbehavior and outputs the CPU status and backtrace to serial.
* When running in the debugger it will break for debugging. This is useful to help understand
* a crash from a remote location. Requires ~400 bytes of SRAM and 5Kb of flash.
*/
//#define POSTMORTEM_DEBUGGING
7 changes: 7 additions & 0 deletions Marlin/src/HAL/AVR/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@
#if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS)
#error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
#endif

/**
* Postmortem debugging
*/
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not supported on AVR boards."
#endif
342 changes: 0 additions & 342 deletions Marlin/src/HAL/DUE/DebugMonitor.cpp

This file was deleted.

3 changes: 3 additions & 0 deletions Marlin/src/HAL/DUE/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ uint16_t HAL_adc_result;
// Public functions
// ------------------------

TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());

// HAL initialization task
void HAL_init() {
// Initialize the USB stack
#if ENABLED(SDSUPPORT)
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
usb_task_init();
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
}

// HAL idle task
Expand Down
Loading

0 comments on commit 03e45ae

Please sign in to comment.