diff options
Diffstat (limited to 'vendor')
| -rw-r--r-- | vendor/freertos/FreeRTOSConfig.h | 24 | ||||
| -rw-r--r-- | vendor/freertos/freertos_hook.c | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/vendor/freertos/FreeRTOSConfig.h b/vendor/freertos/FreeRTOSConfig.h index 09b78988a..fa1707f99 100644 --- a/vendor/freertos/FreeRTOSConfig.h +++ b/vendor/freertos/FreeRTOSConfig.h @@ -1,12 +1,12 @@ #ifndef __FREERTOS_CONFIG__H #define __FREERTOS_CONFIG__H -#include "common/assertion.h" - //--------------------------------------------------------------------+ // See http://www.freertos.org/a00110.html. //--------------------------------------------------------------------+ #if TUSB_CFG_MCU == MCU_LPC43XX + // TODO remove + #include "lpc43xx_cgu.h" #define configCPU_CLOCK_HZ CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) #else #define configCPU_CLOCK_HZ SystemCoreClock @@ -72,7 +72,25 @@ #define INCLUDE_xTimerPendFunctionCall 0 /* Define to trap errors during development. */ -#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); hal_debugger_breakpoint(); } + +// Halt CPU (breakpoint) when hitting error, only apply for Cortex M3, M4, M7 +#if defined(__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) + +static inline void configASSERT_breakpoint(void) +{ + // Cortex M CoreDebug->DHCSR + volatile uint32_t* ARM_CM_DHCSR = ((volatile uint32_t*) 0xE000EDF0UL); + + // Only halt mcu if debugger is attached + if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); +} + +#else +#define configASSERT_breakpoint() +#endif + + +#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); configASSERT_breakpoint(); } /* FreeRTOS hooks to NVIC vectors */ #define xPortPendSVHandler PendSV_Handler diff --git a/vendor/freertos/freertos_hook.c b/vendor/freertos/freertos_hook.c index 0800ca0df..6672f72bf 100644 --- a/vendor/freertos/freertos_hook.c +++ b/vendor/freertos/freertos_hook.c @@ -41,7 +41,7 @@ //--------------------------------------------------------------------+ #include "FreeRTOS.h" #include "task.h" -#include "common/common.h" +#include "common/tusb_common.h" //#include "board.h" //--------------------------------------------------------------------+ @@ -58,7 +58,7 @@ void vApplicationMallocFailedHook(void) { taskDISABLE_INTERRUPTS(); - ASSERT_FAILED_MSG(VOID_RETURN, "freeRTOS run out of heap memory"); + TU_ASSERT(false, ); } void vApplicationIdleHook(void) @@ -72,7 +72,7 @@ void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) (void) pxTask; taskDISABLE_INTERRUPTS(); - ASSERT_FAILED_MSG(VOID_RETURN, pcTaskName); + TU_ASSERT(false, ); } // executes from within an ISR |
