void vApplicationStackOverflowHook( TaskHandle_t *pxTask, char *pcTaskName ) { u0_dbg_put("HALTING SYSTEM: Stack overflow by task: "); u0_dbg_put((char*)pcTaskName); u0_dbg_put("\nTry increasing stack memory of this task.\n"); delay_us(3000 * 1000); sys_reboot(); }
void PendSV_Handler(void) { u0_dbg_put("Pend SV Fault\n"); while (1) { } }
void SVC_Handler(void) { u0_dbg_put("SVC Fault\n"); while (1) { } }
void DebugMon_Handler(void) { u0_dbg_put("DebugMon Fault\n"); while (1) { } }
void UsageFault_Handler(void) { u0_dbg_put("Usage Fault\n"); while (1) { } }
void BusFault_Handler(void) { u0_dbg_put("BUS Fault\n"); while (1) { } }
void MemManage_Handler(void) { u0_dbg_put("Mem Fault\n"); while (1) { } }
void NMI_Handler(void) { u0_dbg_put("NMI Fault\n"); while (1) { } }
void SysTick_Handler(void) { u0_dbg_put("Sys Tick Fault\n"); while (1) { } }
void IntDefaultHandler(void) { u0_dbg_put("Unexpected ISR Fault\n"); while (1) { } }
static void isr_reset(void) { // remove compiler warning (void)g_pfnVectors; /** * The hyperload bootloader sets the MSP/PSP upon a true reset, which is when the * LPC17xx (Cortex-M3) sets the values of the stack pointer. But since we are * booting after a bootloader, we have to manually setup the stack pointers ourselves. */ do { const uint32_t topOfStack = (uint32_t) &_vStackTop; __set_PSP(topOfStack); __set_MSP(topOfStack); } while(0); do { // Copy data from FLASH to RAM unsigned int LoadAddr, ExeAddr, SectionLen; unsigned int *SectionTableAddr; // Load base address of Global Section Table SectionTableAddr = &__data_section_table; // Copy the data sections from flash to SRAM. while (SectionTableAddr < &__data_section_table_end) { LoadAddr = *SectionTableAddr++; ExeAddr = *SectionTableAddr++; SectionLen = *SectionTableAddr++; data_init(LoadAddr, ExeAddr, SectionLen); } // At this point, SectionTableAddr = &__bss_section_table; // Zero fill the bss segment while (SectionTableAddr < &__bss_section_table_end) { ExeAddr = *SectionTableAddr++; SectionLen = *SectionTableAddr++; bss_init(ExeAddr, SectionLen); } } while (0) ; #if defined (__cplusplus) __libc_init_array(); // Call C++ library initialization #endif do { low_level_init(); // Initialize minimal system, such as Clock & UART high_level_init(); // Initialize high level board specific features main(); // Finally call main() } while(0); // In case main() exits: uart0_init(SYS_CFG_UART0_BPS); u0_dbg_put("main() should never exit on this system\n"); while (1) { ; } }
void vApplicationMallocFailedHook( void ) { u0_dbg_put("HALTING SYSTEM: Your system ran out of memory (RAM)!\n"); delay_us(3000 * 1000); sys_reboot(); }
void can_BusOffCallback(uint32_t ibits) { const uint32_t errbit = (ibits >> 16) & 0x1F; const char * rxtx = ((ibits >> 21) & 1) ? "RX" : "TX"; const uint32_t errc = (ibits >> 22) & 3; u0_dbg_put("\n\n ***** CAN BUS ENTERED ERROR STATE!\n"); u0_dbg_printf("ERRC = %#x, ERRBIT = %#x while %s\n", errc, errbit, rxtx); }
__attribute__ ((section(".after_vectors"))) void isr_usage_fault(void){ u0_dbg_put("Usage Fault\n"); while(1); }
__attribute__ ((section(".after_vectors"))) void isr_bus_fault(void) { u0_dbg_put("BUS Fault\n"); while(1); }
__attribute__ ((section(".after_vectors"))) void isr_nmi(void) { u0_dbg_put("NMI Fault\n"); while(1); }
__attribute__ ((section(".after_vectors"))) void isr_debug_mon(void) { u0_dbg_put("DBGMON Fault\n"); while(1); }
/// If an IRQ is not registered, we end up at this stub function __attribute__ ((section(".after_vectors"))) void isr_default_handler(void) { u0_dbg_put("IRQ not registered!"); while(1); }
void ResetISR(void) { // remove warning (void)g_pfnVectors; #ifndef USE_OLD_STYLE_DATA_BSS_INIT // // Copy the data sections from flash to SRAM. // unsigned int LoadAddr, ExeAddr, SectionLen; unsigned int *SectionTableAddr; // Load base address of Global Section Table SectionTableAddr = &__data_section_table; // Copy the data sections from flash to SRAM. while (SectionTableAddr < &__data_section_table_end) { LoadAddr = *SectionTableAddr++; ExeAddr = *SectionTableAddr++; SectionLen = *SectionTableAddr++; data_init(LoadAddr, ExeAddr, SectionLen); } // At this point, SectionTableAddr = &__bss_section_table; // Zero fill the bss segment while (SectionTableAddr < &__bss_section_table_end) { ExeAddr = *SectionTableAddr++; SectionLen = *SectionTableAddr++; bss_init(ExeAddr, SectionLen); } #else // Use Old Style Data and BSS section initialization. // This will only initialize a single RAM bank. unsigned int * LoadAddr, *ExeAddr, *EndAddr, SectionLen; // Copy the data segment from flash to SRAM. LoadAddr = &_etext; ExeAddr = &_data; EndAddr = &_edata; SectionLen = (void*)EndAddr - (void*)ExeAddr; data_init((unsigned int)LoadAddr, (unsigned int)ExeAddr, SectionLen); // Zero fill the bss segment ExeAddr = &_bss; EndAddr = &_ebss; SectionLen = (void*)EndAddr - (void*)ExeAddr; bss_init ((unsigned int)ExeAddr, SectionLen); #endif #if defined (__cplusplus) // // Call C++ library initialization // __libc_init_array(); #endif // Functions defined externally to this file: extern void low_level_init(void); extern void high_level_init(void); extern int main(); low_level_init(); // Initialize minimal system, such as Clock & UART high_level_init(); // Initialize any user desired items main(); // Finally call main() // In case main() exits: uart0_init(UART0_DEFAULT_RATE_BPS); u0_dbg_put("main() should never exit on this system\n"); while (1) ; }