This commit is contained in:
rusefi 2018-01-23 13:18:59 -05:00
parent 220949f0fa
commit 80df4a5a01
3 changed files with 27 additions and 12 deletions

View File

@ -170,6 +170,15 @@ uint32_t lastLockTime;
*/
uint32_t maxLockedDuration = 0;
/**
* this depends on chdebug.h patch
#if CH_DBG_SYSTEM_STATE_CHECK == TRUE
-#define _dbg_enter_lock() (ch.dbg.lock_cnt = (cnt_t)1)
-#define _dbg_leave_lock() (ch.dbg.lock_cnt = (cnt_t)0)
+#define _dbg_enter_lock() {(ch.dbg.lock_cnt = (cnt_t)1); ON_LOCK_HOOK;}
+#define _dbg_leave_lock() {ON_UNLOCK_HOOK;(ch.dbg.lock_cnt = (cnt_t)0);}
#endif
*/
void onLockHook(void) {
lastLockTime = GET_TIMESTAMP();
}

View File

@ -2,28 +2,25 @@ rusEfi is trying to use latest stable ChibiOS with minimal changes
At the moment rusEfi custom version of ChibiOS has the following changes:
1) LSE auto-detection, see rusefi_lse_fix.h see LSE_TIMEOUT
*) minor OS monitoring and maintainability fixes:
chDbgStackOverflowPanic allows to know which thread has stack overflow
maxNesting good to know maximum ISR depth
ON_LOCK_HOOK is used to measure durations of critical sections
2) Changed "STM32_ADC_ADC2_DMA_STREAM" in demos/STM32/RT-STM32F334R8-NUCLEO/mcuconf.h
*) LSE auto-detection, see rusefi_lse_fix.h see LSE_TIMEOUT
*) Support for half/timeout-ISR for UART-DMA in /os/hal/include/uart.h and os/hal/ports/STM32/LLD/USARTv1/uart_lld.* by andreika
Weird changes without an explanation:
3) Uncommented "ASMXOBJS" support in os/common/ports/ARMCMx/compilers/GCC/rules.mk
5) Support for half/timeout-ISR for UART-DMA in /os/hal/include/uart.h and os/hal/ports/STM32/LLD/USARTv1/uart_lld.*
6) Changes around "FLOAT_PRECISION" and ftoa() in os/hal/lib/streams/chprintf.c
8) Use local "struct tm *t" in os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c
11) Fixes for UART4-UART8, USART_ISR_* flags USART_CR1_M in os/hal/ports/STM32/LLD/USARTv2/serial_lld.c and os/hal/ports/STM32/LLD/USARTv2/uart_lld.c
13) ON_LOCK_HOOK fix in os/rt/include/chdebug.h
14) Use chSysHalt() instead of chDbgStackOverflowPanic() in os/rt/ports/ARM/chcore.h
15) Use QueryPerformanceCounter() instead of POSIX gettimeofday() in os/rt/ports/SIMIA32/chcore.c
16) Change chSysHalt() and remove maxNesting in os/rt/src/chdebug.c
New files:
os/common/startup/SIMIA32/compilers/GCC/rules.mk
os/hal/ports/STM32/LLD/RTCv2/rusefi_lse_fix.h

View File

@ -235,6 +235,15 @@ void runRusEfi(void) {
}
}
/**
* this depends on chcore.h patch
+void chDbgStackOverflowPanic(thread_t *otp);
+
- chSysHalt("stack overflow"); \
+ chDbgStackOverflowPanic(otp); \
*
*/
void chDbgStackOverflowPanic(thread_t *otp) {
(void)otp;
strcpy(panicMessage, "stack overflow: ");