From 59f7861bcb7431fcaac1c85ce3ac6e8d589c19db Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 20 May 2018 01:33:21 -0500 Subject: [PATCH] Move backtrace to the HAL folder (#10790) --- Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp | 13 +++++++------ Marlin/src/{ => HAL}/backtrace/backtrace.cpp | 4 +++- Marlin/src/{ => HAL}/backtrace/backtrace.h | 0 Marlin/src/{ => HAL}/backtrace/unwarm.cpp | 2 +- Marlin/src/{ => HAL}/backtrace/unwarm.h | 6 +----- Marlin/src/{ => HAL}/backtrace/unwarm_arm.cpp | 3 ++- Marlin/src/{ => HAL}/backtrace/unwarm_thumb.cpp | 3 +-- Marlin/src/{ => HAL}/backtrace/unwarmbytab.cpp | 3 +-- Marlin/src/{ => HAL}/backtrace/unwarmbytab.h | 4 +--- Marlin/src/{ => HAL}/backtrace/unwarmmem.cpp | 4 ++-- Marlin/src/{ => HAL}/backtrace/unwarmmem.h | 0 Marlin/src/{ => HAL}/backtrace/unwinder.cpp | 0 Marlin/src/{ => HAL}/backtrace/unwinder.h | 0 Marlin/src/{ => HAL}/backtrace/unwmemaccess.cpp | 0 Marlin/src/{ => HAL}/backtrace/unwmemaccess.h | 0 15 files changed, 19 insertions(+), 23 deletions(-) rename Marlin/src/{ => HAL}/backtrace/backtrace.cpp (97%) rename Marlin/src/{ => HAL}/backtrace/backtrace.h (100%) rename Marlin/src/{ => HAL}/backtrace/unwarm.cpp (99%) rename Marlin/src/{ => HAL}/backtrace/unwarm.h (99%) rename Marlin/src/{ => HAL}/backtrace/unwarm_arm.cpp (99%) rename Marlin/src/{ => HAL}/backtrace/unwarm_thumb.cpp (99%) rename Marlin/src/{ => HAL}/backtrace/unwarmbytab.cpp (99%) rename Marlin/src/{ => HAL}/backtrace/unwarmbytab.h (97%) rename Marlin/src/{ => HAL}/backtrace/unwarmmem.cpp (99%) rename Marlin/src/{ => HAL}/backtrace/unwarmmem.h (100%) rename Marlin/src/{ => HAL}/backtrace/unwinder.cpp (100%) rename Marlin/src/{ => HAL}/backtrace/unwinder.h (100%) rename Marlin/src/{ => HAL}/backtrace/unwmemaccess.cpp (100%) rename Marlin/src/{ => HAL}/backtrace/unwmemaccess.h (100%) diff --git a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp index a2322e27e6..d4c21c9810 100644 --- a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp @@ -22,10 +22,12 @@ #ifdef ARDUINO_ARCH_SAM -#include "../../inc/MarlinConfig.h" -#include "../../Marlin.h" -#include "../../backtrace/unwinder.h" -#include "../../backtrace/unwmemaccess.h" +#include "../../core/macros.h" +#include "../../core/serial.h" +#include + +#include "../backtrace/unwinder.h" +#include "../backtrace/unwmemaccess.h" // Debug monitor that dumps to the Programming port all status when // an exception or WDT timeout happens - And then resets the board @@ -66,7 +68,6 @@ static void TXBegin(void) { UART->UART_CR = UART_CR_RXEN | UART_CR_TXEN; } - // Send character through UART with no interrupts static void TX(char c) { while (!(UART->UART_SR & UART_SR_TXRDY)) { WDT_Restart(WDT); sw_barrier(); }; @@ -333,4 +334,4 @@ __attribute__((naked)) void RSTC_Handler(void) { ); } -#endif +#endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/backtrace/backtrace.cpp b/Marlin/src/HAL/backtrace/backtrace.cpp similarity index 97% rename from Marlin/src/backtrace/backtrace.cpp rename to Marlin/src/HAL/backtrace/backtrace.cpp index 07cb0692f9..4a688b369c 100644 --- a/Marlin/src/backtrace/backtrace.cpp +++ b/Marlin/src/HAL/backtrace/backtrace.cpp @@ -26,7 +26,9 @@ #include "unwinder.h" #include "unwmemaccess.h" -#include "../Marlin.h" + +#include "../../core/serial.h" +#include // Dump a backtrace entry static bool UnwReportOut(void* ctx, const UnwReport* bte) { diff --git a/Marlin/src/backtrace/backtrace.h b/Marlin/src/HAL/backtrace/backtrace.h similarity index 100% rename from Marlin/src/backtrace/backtrace.h rename to Marlin/src/HAL/backtrace/backtrace.h diff --git a/Marlin/src/backtrace/unwarm.cpp b/Marlin/src/HAL/backtrace/unwarm.cpp similarity index 99% rename from Marlin/src/backtrace/unwarm.cpp rename to Marlin/src/HAL/backtrace/unwarm.cpp index fded7b31b2..f6d85b708b 100644 --- a/Marlin/src/backtrace/unwarm.cpp +++ b/Marlin/src/HAL/backtrace/unwarm.cpp @@ -171,5 +171,5 @@ bool UnwMemReadRegister(UnwState * const state, const uint32_t addr, RegData * c } else return false; // Not in the hash, and failed to read from memory } -#endif +#endif // __arm__ || __thumb__ diff --git a/Marlin/src/backtrace/unwarm.h b/Marlin/src/HAL/backtrace/unwarm.h similarity index 99% rename from Marlin/src/backtrace/unwarm.h rename to Marlin/src/HAL/backtrace/unwarm.h index 90e3cd391e..8ecdeba8a5 100644 --- a/Marlin/src/backtrace/unwarm.h +++ b/Marlin/src/HAL/backtrace/unwarm.h @@ -140,8 +140,4 @@ bool UnwMemWriteRegister(UnwState * const state, const uint32_t addr, const RegD bool UnwMemReadRegister(UnwState * const state, const uint32_t addr, RegData * const reg); void UnwMemHashGC(UnwState * const state); -#endif /* UNWARM_H */ - -/* END OF FILE */ - - +#endif // UNWARM_H diff --git a/Marlin/src/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/backtrace/unwarm_arm.cpp similarity index 99% rename from Marlin/src/backtrace/unwarm_arm.cpp rename to Marlin/src/HAL/backtrace/unwarm_arm.cpp index 692c6a9699..09528885f7 100644 --- a/Marlin/src/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/backtrace/unwarm_arm.cpp @@ -593,4 +593,5 @@ UnwResult UnwStartArm(UnwState * const state) { return UNWIND_UNSUPPORTED; } -#endif + +#endif // __arm__ || __thumb__ diff --git a/Marlin/src/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/backtrace/unwarm_thumb.cpp similarity index 99% rename from Marlin/src/backtrace/unwarm_thumb.cpp rename to Marlin/src/HAL/backtrace/unwarm_thumb.cpp index 33e14f15cf..a4afbeaf8d 100644 --- a/Marlin/src/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/backtrace/unwarm_thumb.cpp @@ -1124,5 +1124,4 @@ UnwResult UnwStartThumb(UnwState * const state) { return UNWIND_SUCCESS; } -#endif - +#endif // __arm__ || __thumb__ diff --git a/Marlin/src/backtrace/unwarmbytab.cpp b/Marlin/src/HAL/backtrace/unwarmbytab.cpp similarity index 99% rename from Marlin/src/backtrace/unwarmbytab.cpp rename to Marlin/src/HAL/backtrace/unwarmbytab.cpp index 4c083fd097..db49dcad7f 100644 --- a/Marlin/src/backtrace/unwarmbytab.cpp +++ b/Marlin/src/HAL/backtrace/unwarmbytab.cpp @@ -438,5 +438,4 @@ UnwResult UnwindByTableStart(UnwindFrame* frame, const UnwindCallbacks *cb, void return err; } -#endif - +#endif // __arm__ || __thumb__ diff --git a/Marlin/src/backtrace/unwarmbytab.h b/Marlin/src/HAL/backtrace/unwarmbytab.h similarity index 97% rename from Marlin/src/backtrace/unwarmbytab.h rename to Marlin/src/HAL/backtrace/unwarmbytab.h index a17a6f7d66..527d3a6c72 100644 --- a/Marlin/src/backtrace/unwarmbytab.h +++ b/Marlin/src/HAL/backtrace/unwarmbytab.h @@ -31,6 +31,4 @@ typedef struct { UnwResult UnwindByTableStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data); -#endif - -/* END OF FILE */ +#endif // UNWARMBYTAB_H diff --git a/Marlin/src/backtrace/unwarmmem.cpp b/Marlin/src/HAL/backtrace/unwarmmem.cpp similarity index 99% rename from Marlin/src/backtrace/unwarmmem.cpp rename to Marlin/src/HAL/backtrace/unwarmmem.cpp index 17e0fa280a..7453fdb8db 100644 --- a/Marlin/src/backtrace/unwarmmem.cpp +++ b/Marlin/src/HAL/backtrace/unwarmmem.cpp @@ -19,7 +19,6 @@ #include "unwarmmem.h" #include "unwarm.h" - #define M_IsIdxUsed(a, v) (((a)[v >> 3] & (1 << (v & 0x7))) ? true : false) #define M_SetIdxUsed(a, v) ((a)[v >> 3] |= (1 << (v & 0x7))) #define M_ClrIdxUsed(a, v) ((a)[v >> 3] &= ~(1 << (v & 0x7))) @@ -115,4 +114,5 @@ void UnwMemHashGC(UnwState * const state) { } } } -#endif + +#endif // __arm__ || __thumb__ diff --git a/Marlin/src/backtrace/unwarmmem.h b/Marlin/src/HAL/backtrace/unwarmmem.h similarity index 100% rename from Marlin/src/backtrace/unwarmmem.h rename to Marlin/src/HAL/backtrace/unwarmmem.h diff --git a/Marlin/src/backtrace/unwinder.cpp b/Marlin/src/HAL/backtrace/unwinder.cpp similarity index 100% rename from Marlin/src/backtrace/unwinder.cpp rename to Marlin/src/HAL/backtrace/unwinder.cpp diff --git a/Marlin/src/backtrace/unwinder.h b/Marlin/src/HAL/backtrace/unwinder.h similarity index 100% rename from Marlin/src/backtrace/unwinder.h rename to Marlin/src/HAL/backtrace/unwinder.h diff --git a/Marlin/src/backtrace/unwmemaccess.cpp b/Marlin/src/HAL/backtrace/unwmemaccess.cpp similarity index 100% rename from Marlin/src/backtrace/unwmemaccess.cpp rename to Marlin/src/HAL/backtrace/unwmemaccess.cpp diff --git a/Marlin/src/backtrace/unwmemaccess.h b/Marlin/src/HAL/backtrace/unwmemaccess.h similarity index 100% rename from Marlin/src/backtrace/unwmemaccess.h rename to Marlin/src/HAL/backtrace/unwmemaccess.h