/* Set up and initialize hardware prior to call to main */ void SystemInit(void) { #if defined(__CODE_RED) extern void(*const g_pfnVectors[]) (void); SCB->VTOR = (uint32_t) &g_pfnVectors; #else extern void *__Vectors; SCB->VTOR = (uint32_t) &__Vectors; #endif #if defined(CORE_M4) #if defined(__FPU_PRESENT) && __FPU_PRESENT == 1 fpuInit(); #endif #endif #if !defined(__MULTICORE_M0SLAVE) && !defined(__MULTICORE_M4SLAVE) #if defined(NO_BOARD_LIB) /* Chip specific SystemInit */ Chip_SystemInit(); #else /* Board specific SystemInit */ Board_SystemInit(); #endif #endif }
/* Set up and initialize hardware prior to call to main */ void SystemInit(void) { unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08; #if defined(__IAR_SYSTEMS_ICC__) extern void *__vector_table; *pSCB_VTOR = (unsigned int) &__vector_table; #elif defined(__CODE_RED) extern void *g_pfnVectors; *pSCB_VTOR = (unsigned int) &g_pfnVectors; #elif defined(__ARMCC_VERSION) extern void *__Vectors; *pSCB_VTOR = (unsigned int) &__Vectors; #endif #if defined(__FPU_PRESENT) && __FPU_PRESENT == 1 fpuInit(); #endif #if defined(NO_BOARD_LIB) /* Chip specific SystemInit */ Chip_SystemInit(); #else /* Setup system clocking and muxing */ Board_SystemInit(); #endif }
/** * This brings up enough clocks to allow the processor to run quickly while initialising memory. * Other platform specific clock init can be done in init_platform() or init_architecture() */ WEAK void init_clocks( void ){ /** This brings up enough clocks to allow the processor to run quickly while initialising memory. * Other platform specific clock init can be done in init_platform() or init_architecture() */ //LPC54xx clock initialized in SystemInit(). #ifdef BOOTLOADER LPC_SYSCTL->SYSAHBCLKCTRL[0] |= 0x00000018; // Magicoe #if defined(__FPU_PRESENT) && __FPU_PRESENT == 1 fpuInit(); #endif #if defined(NO_BOARD_LIB) /* Chip specific SystemInit */ Chip_SystemInit(); #else /* Enable RAM 2 clock */ Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SRAM2); /* Board specific SystemInit */ Board_SystemInit(); //init pin muxing and clock. #endif LPC_SYSCTL->SYSAHBCLKCTRL[0] |= 0x00000018; // Magicoe Chip_SYSCTL_PowerUp(PDRUNCFG_PD_IRC_OSC_EN|PDRUNCFG_PD_IRC_EN); /* Configure PIN0.21 as CLKOUT with pull-up, monitor the MAINCLK on scope */ Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 21, IOCON_MODE_PULLUP | IOCON_FUNC1 | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF); Chip_Clock_SetCLKOUTSource(SYSCTL_CLKOUTSRC_RTC, 1); Chip_Clock_EnableRTCOsc(); Chip_RTC_Init(LPC_RTC); Chip_RTC_Enable1KHZ(LPC_RTC); Chip_RTC_Enable(LPC_RTC); #endif }
void startup(void) { init_memory(); Chip_SystemInit(); main(); while(1); }
/* Set up and initialize hardware prior to call to main */ void SystemInit(void) { #if defined(NO_BOARD_LIB) /* Chip specific SystemInit */ Chip_SystemInit(); #else /* Board specific SystemInit */ Board_SystemInit(); #endif }
/* Set up and initialize hardware prior to call to main */ void SystemInit(void) { #if defined(NO_BOARD_LIB) /* Chip specific SystemInit */ Chip_SystemInit(); #else /* Setup system clocking and muxing */ Board_SystemInit(); #endif }
int main() { Chip_SystemInit(); nOS_Init(); nOS_ThreadSetName(NULL, "main"); nOS_SemCreate(&semA, 0, 1); nOS_SemCreate(&semB, 0, 1); nOS_SemCreate(&semC, 0, 1); nOS_ThreadCreate(&threadA, ThreadA, 0, stackA, THREAD_STACK_SIZE, NOS_CONFIG_HIGHEST_THREAD_PRIO, NOS_THREAD_READY, "ThreadA"); nOS_ThreadCreate(&threadB, ThreadB, 0, stackB, THREAD_STACK_SIZE, NOS_CONFIG_HIGHEST_THREAD_PRIO-1, NOS_THREAD_READY, "ThreadB"); nOS_ThreadCreate(&threadC, ThreadC, 0, stackC, THREAD_STACK_SIZE, NOS_CONFIG_HIGHEST_THREAD_PRIO-2, NOS_THREAD_READY, "ThreadC"); nOS_Start(SysTick_Init); while (1) { nOS_SemGive(&semC); } }
/* This file contains the entry point (Reset_Handler) of your firmware project. The reset handled initializes the RAM and calls system library initializers as well as the platform-specific initializer and the main() function. */ void SystemInit(void) { Chip_SystemInit(); }