#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "LPC17xx.h"
#include "uart0_min.h"
#include "printf_lib.h"
#include "lpc_sys.h"
#include "fault_registers.h"

Typedefs | |
typedef void(* | isr_func_t) (void) |
Variables | |
void(*const | g_pfnVectors [])(void) |
unsigned int | start |
unsigned int unsigned int | len |
unsigned int * | pulSrc = (unsigned int*) romstart |
unsigned int | loop |
unsigned int | __data_section_table |
unsigned int | __data_section_table_end |
unsigned int | __bss_section_table_end |
#define | WEAK __attribute__ ((weak)) |
#define | ALIAS(f) __attribute__ ((weak, alias (#f))) |
WEAK void | isr_nmi (void) |
WEAK void | isr_hard_fault (void) |
WEAK void | isr_mem_fault (void) |
WEAK void | isr_bus_fault (void) |
WEAK void | isr_usage_fault (void) |
WEAK void | isr_debug_mon (void) |
WEAK void | isr_sys_tick (void) |
Macro Definition Documentation
#define ALIAS | ( | f | ) | __attribute__ ((weak, alias (#f))) |
#define WEAK __attribute__ ((weak)) |
Weak ISR handlers; these are over-riden when user defines them elsewhere
Typedef Documentation
typedef void(* isr_func_t) (void) |
Array of IRQs that the user can register, which we default to the weak ISR handler. The user can either define the real one to override the weak handler, or the user can call the isr_register() API to change the function pointer at this array.
Function Documentation
__attribute__ | ( | (section(".isr_vector")) | ) | const |
__attribute__ | ( | (section(".after_vectors")) | ) |
If an IRQ is not registered, we end up at this stub function.
Wrap the FreeRTOS tick function such that we get a true measure of how much CPU tasks are using.
__attribute__ | ( | (section(".after_vectors"), naked) | ) |
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.
void _vStackTop | ( | void | ) |
Linker script (loader.ld) defines the initial stack pointer that we set at the interrupt vector.
void ADC_IRQHandler | ( | void | ) |
This is the ADC interrupt mapped to startup.cpp IRQ name. This is called by the CPU core when ADC interrupt occurs.
void BOD_IRQHandler | ( | void | ) |
void CAN_IRQHandler | ( | void | ) |
Actual ISR Handler (mapped to startup file's interrupt vector function name) This interrupt is shared between CAN1, and CAN2
void CANAct_IRQHandler | ( | void | ) |
void DMA_IRQHandler | ( | void | ) |
void EINT0_IRQHandler | ( | void | ) |
void EINT1_IRQHandler | ( | void | ) |
void EINT2_IRQHandler | ( | void | ) |
void EINT3_IRQHandler | ( | void | ) |
Actual ISR Handler (mapped to startup file's interrupt vector function name)
void ENET_IRQHandler | ( | void | ) |
for | ( | ) |
void high_level_init | ( | void | ) |
void I2C0_IRQHandler | ( | void | ) |
void I2C1_IRQHandler | ( | void | ) |
void I2C2_IRQHandler | ( | void | ) |
IRQ Handler needs to be enclosed in extern "C" because this is C++ file, and we don't want C++ to "mangle" this function name. This ISR Function need needs to be named precisely to override "WEAK" ISR handler defined at startup.cpp
void I2S_IRQHandler | ( | void | ) |
WEAK void isr_bus_fault | ( | void | ) |
WEAK void isr_debug_mon | ( | void | ) |
void isr_default_handler | ( | void | ) |
isr_forwarder_routine() will call this function unless user interrupt is registered
WEAK void isr_hard_fault | ( | void | ) |
void isr_hard_fault_handler | ( | unsigned long * | hardfault_args | ) |
The hard fault handler.
This is called from the HardFault_HandlerAsm with a pointer the Fault stack as the parameter. We can then read the values from the stack and place them into local variables for ease of reading. We then read the various Fault Status and Address Registers to help decode cause of the fault. The function ends with a BKPT instruction to force control back into the debugger
WEAK void isr_mem_fault | ( | void | ) |
WEAK void isr_nmi | ( | void | ) |
void isr_register | ( | IRQn_Type | num, |
void(*)(void) | isr_func_ptr | ||
) |
This function allows the user to register a function for the interrupt service routine. Registration of an IRQ is not necessary if the weak ISR has been over-riden.
void isr_reset | ( | void | ) |
CPU execution begins from this function.
WEAK void isr_sys_tick | ( | void | ) |
WEAK void isr_usage_fault | ( | void | ) |
void low_level_init | ( | void | ) |
External functions that we will call
Initializes the minimal system including CPU Clock, UART, and Flash accelerator Be careful of the order of the operations!!!
Turn off I/O buffering otherwise sometimes printf/scanf doesn't behave correctly due to strange buffering and/or flushing effects.
int main | ( | ) |
void MCPWM_IRQHandler | ( | void | ) |
void PLL0_IRQHandler | ( | void | ) |
void PLL1_IRQHandler | ( | void | ) |
void PWM1_IRQHandler | ( | void | ) |
void QEI_IRQHandler | ( | void | ) |
void RIT_IRQHandler | ( | void | ) |
RIT Interrupt function (see startup.cpp)
void RTC_IRQHandler | ( | void | ) |
void SPI_IRQHandler | ( | void | ) |
void SSP0_IRQHandler | ( | void | ) |
void SSP1_IRQHandler | ( | void | ) |
void TIMER0_IRQHandler | ( | void | ) |
Actual ISR function (
- See also
- startup.cpp)
void TIMER1_IRQHandler | ( | void | ) |
void TIMER2_IRQHandler | ( | void | ) |
void TIMER3_IRQHandler | ( | void | ) |
void UART0_IRQHandler | ( | void | ) |
IRQ Handler needs to be enclosed in extern "C" because this is C++ file, and we don't want C++ to "mangle" our function name. This ISR Function need needs to be named precisely to override "WEAK" ISR handler defined at startup.cpp
void UART1_IRQHandler | ( | void | ) |
void UART2_IRQHandler | ( | void | ) |
IRQ Handler needs to be enclosed in extern "C" because this is C++ file, and we don't want C++ to "mangle" our function name. This ISR Function need needs to be named precisely to override "WEAK" ISR handler defined at startup.cpp
void UART3_IRQHandler | ( | void | ) |
IRQ Handler needs to be enclosed in extern "C" because this is C++ file, and we don't want C++ to "mangle" our function name. This ISR Function need needs to be named precisely to override "WEAK" ISR handler defined at startup.cpp
void USB_IRQHandler | ( | void | ) |
void USBAct_IRQHandler | ( | void | ) |
void vPortSVCHandler | ( | void | ) |
OS "supervisor" call to start first FreeRTOS task.
void WDT_IRQHandler | ( | void | ) |
Weak ISR handlers; these are over-riden when the user defines them elsewhere
void xPortPendSVHandler | ( | void | ) |
Context switch is performed using this interrupt.
void xPortSysTickHandler | ( | void | ) |
OS timer or tick interrupt (for time slicing tasks)
FreeRTOS Interrupt Handlers
Variable Documentation
unsigned int __bss_section_table_end |
unsigned int __data_section_table |
unsigned int __data_section_table_end |
void(* const g_pfnVectors[])(void) |
CPU interrupt vector table that is loaded at the beginning of the CPU start location by using the linker script that will place it at the isr_vector location. CPU loads the stack pointer and begins execution from Reset vector.
unsigned int len |
unsigned int loop |
unsigned int* pulSrc = (unsigned int*) romstart |
unsigned int start |