1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2009-01-05 Bernard first implementation 9 * 2014-06-20 xiaonong ported to LPC43xx 10 */ 11 12 #include <rthw.h> 13 #include <rtthread.h> 14 15 #include "board.h" 16 #include "drv_uart.h" 17 18 19 /** 20 * This is the timer interrupt service routine. 21 * 22 */ SysTick_Handler(void)23void SysTick_Handler(void) 24 { 25 /* enter interrupt */ 26 rt_interrupt_enter(); 27 28 rt_tick_increase(); 29 30 /* leave interrupt */ 31 rt_interrupt_leave(); 32 } 33 34 extern void SystemCoreClockUpdate(void); 35 /** 36 * This function will initial LPC43xx board. 37 */ rt_hw_board_init()38void rt_hw_board_init() 39 { 40 #ifdef CORE_M4 41 /* NVIC Configuration */ 42 #define NVIC_VTOR_MASK 0x3FFFFF80 43 #ifdef VECT_TAB_RAM 44 /* Set the Vector Table base location at 0x10000000 */ 45 SCB->VTOR = (0x10000000 & NVIC_VTOR_MASK); 46 #else /* VECT_TAB_FLASH */ 47 /* Set the Vector Table base location at 0x00000000 */ 48 SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK); 49 #endif 50 #endif 51 /* update the core clock */ 52 SystemCoreClockUpdate(); 53 54 /* init systick */ 55 SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); 56 57 /* set pend exception priority */ 58 NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1); 59 60 /* init uart device */ 61 rt_hw_uart_init(); 62 63 /* setup the console device */ 64 rt_console_set_device(RT_CONSOLE_DEVICE_NAME); 65 66 #if LPC_EXT_SDRAM == 1 67 lpc_sdram_hw_init(); 68 mpu_init(); 69 #endif 70 } 71 72 73 74