system_LPC177x_8x.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. /***********************************************************************//**
  2. * @file system_LPC177x_8x.c
  3. * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Source File
  4. * for the NXP LPC177x_8x Device Series
  5. * @version V1.11
  6. * @date 10. November. 2010
  7. * @author NXP MCU SW Application Team
  8. **************************************************************************
  9. * Software that is described herein is for illustrative purposes only
  10. * which provides customers with programming information regarding the
  11. * products. This software is supplied "AS IS" without any warranties.
  12. * NXP Semiconductors assumes no responsibility or liability for the
  13. * use of the software, conveys no license or title under any patent,
  14. * copyright, or mask work right to the product. NXP Semiconductors
  15. * reserves the right to make changes in the software without
  16. * notification. NXP Semiconductors also make no representation or
  17. * warranty that such application will be suitable for the specified
  18. * use without further testing or modification.
  19. **********************************************************************/
  20. #include <stdint.h>
  21. #include "LPC177x_8x.h"
  22. #include "system_LPC177x_8x.h"
  23. /*
  24. //-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
  25. */
  26. /*--------------------- Clock Configuration ----------------------------------
  27. //
  28. // <e> Clock Configuration
  29. // <h> System Controls and Status Register (SCS)
  30. // <o1.0> EMC_SHIFT: EMC Shift enable
  31. // <0=> Static CS addresses match bus width; AD[1] = 0 for 32 bit, AD[0] = 0 for 16+32 bit
  32. // <1=> Static CS addresses start at LSB 0 regardless of memory width
  33. // <o1.1> EMC_RESET: EMC Reset disable
  34. // <0=> EMC will be reset by any chip reset
  35. // <1=> Portions of EMC will only be reset by POR or BOR
  36. // <o1.2> EMC_BURST: EMC Burst disable
  37. // <o1.3> MCIPWR_LEVEL: SD card interface signal SD_PWR Active Level selection
  38. // <0=> SD_PWR is active low
  39. // <1=> SD_PWR is active high
  40. // <o1.4> OSCRANGE: Main Oscillator Range Select
  41. // <0=> 1 MHz to 20 MHz
  42. // <1=> 15 MHz to 25 MHz
  43. // <o1.5> OSCEN: Main Oscillator enable
  44. // </h>
  45. //
  46. // <h> Clock Source Select Register (CLKSRCSEL)
  47. // <o2.0> CLKSRC: sysclk and PLL0 clock source selection
  48. // <0=> Internal RC oscillator
  49. // <1=> Main oscillator
  50. // </h>
  51. //
  52. // <e3> PLL0 Configuration (Main PLL)
  53. // <h> PLL0 Configuration Register (PLL0CFG)
  54. // <i> PLL out clock = (F_cco / (2 * P))
  55. // <i> F_cco = (F_in * M * 2 * P)
  56. // <i> F_in must be in the range of 1 MHz to 25 MHz
  57. // <i> F_cco must be in the range of 9.75 MHz to 160 MHz
  58. // <o4.0..4> MSEL: PLL Multiplier Selection
  59. // <i> M Value
  60. // <1-32><#-1>
  61. // <o4.5..6> PSEL: PLL Divider Selection
  62. // <i> P Value
  63. // <0=> 1
  64. // <1=> 2
  65. // <2=> 4
  66. // <3=> 8
  67. // </h>
  68. // </e>
  69. //
  70. // <e5> PLL1 Configuration (Alt PLL)
  71. // <h> PLL1 Configuration Register (PLL1CFG)
  72. // <i> PLL out clock = (F_cco / (2 * P))
  73. // <i> F_cco = (F_in * M * 2 * P)
  74. // <i> F_in must be in the range of 1 MHz to 25 MHz
  75. // <i> F_cco must be in the range of 9.75 MHz to 160 MHz
  76. // <o6.0..4> MSEL: PLL Multiplier Selection
  77. // <i> M Value
  78. // <1-32><#-1>
  79. // <o6.5..6> PSEL: PLL Divider Selection
  80. // <i> P Value
  81. // <0=> 1
  82. // <1=> 2
  83. // <2=> 4
  84. // <3=> 8
  85. // </h>
  86. // </e>
  87. //
  88. // <h> CPU Clock Selection Register (CCLKSEL)
  89. // <o7.0..4> CCLKDIV: CPU clock (CCLK) divider
  90. // <i> 0: The divider is turned off. No clock will be provided to the CPU
  91. // <i> n: The input clock is divided by n to produce the CPU clock
  92. // <0-31>
  93. // <o7.8> CCLKSEL: CPU clock divider input clock selection
  94. // <0=> sysclk clock
  95. // <1=> PLL0 clock
  96. // </h>
  97. //
  98. // <h> USB Clock Selection Register (USBCLKSEL)
  99. // <o8.0..4> USBDIV: USB clock (source PLL0) divider selection
  100. // <0=> USB clock off
  101. // <4=> PLL0 / 4 (PLL0 must be 192Mhz)
  102. // <6=> PLL0 / 6 (PLL0 must be 288Mhz)
  103. // <o8.8..9> USBSEL: USB clock divider input clock selection
  104. // <i> When CPU clock is selected, the USB can be accessed
  105. // <i> by software but cannot perform USB functions
  106. // <0=> CPU clock
  107. // <1=> PLL0 clock
  108. // <2=> PLL1 clock
  109. // </h>
  110. //
  111. // <h> EMC Clock Selection Register (EMCCLKSEL)
  112. // <o9.0> EMCDIV: EMC clock selection
  113. // <0=> CPU clock
  114. // <1=> CPU clock / 2
  115. // </h>
  116. //
  117. // <h> Peripheral Clock Selection Register (PCLKSEL)
  118. // <o10.0..4> PCLKDIV: APB Peripheral clock divider
  119. // <i> 0: The divider is turned off. No clock will be provided to APB peripherals
  120. // <i> n: The input clock is divided by n to produce the APB peripheral clock
  121. // <0-31>
  122. // </h>
  123. //
  124. // <h> Power Control for Peripherals Register (PCONP)
  125. // <o11.0> PCLCD: LCD controller power/clock enable
  126. // <o11.1> PCTIM0: Timer/Counter 0 power/clock enable
  127. // <o11.2> PCTIM1: Timer/Counter 1 power/clock enable
  128. // <o11.3> PCUART0: UART 0 power/clock enable
  129. // <o11.4> PCUART1: UART 1 power/clock enable
  130. // <o11.5> PCPWM0: PWM0 power/clock enable
  131. // <o11.6> PCPWM1: PWM1 power/clock enable
  132. // <o11.7> PCI2C0: I2C 0 interface power/clock enable
  133. // <o11.8> PCUART4: UART 4 power/clock enable
  134. // <o11.9> PCRTC: RTC and Event Recorder power/clock enable
  135. // <o11.10> PCSSP1: SSP 1 interface power/clock enable
  136. // <o11.11> PCEMC: External Memory Controller power/clock enable
  137. // <o11.12> PCADC: A/D converter power/clock enable
  138. // <o11.13> PCCAN1: CAN controller 1 power/clock enable
  139. // <o11.14> PCCAN2: CAN controller 2 power/clock enable
  140. // <o11.15> PCGPIO: IOCON, GPIO, and GPIO interrupts power/clock enable
  141. // <o11.17> PCMCPWM: Motor Control PWM power/clock enable
  142. // <o11.18> PCQEI: Quadrature encoder interface power/clock enable
  143. // <o11.19> PCI2C1: I2C 1 interface power/clock enable
  144. // <o11.20> PCSSP2: SSP 2 interface power/clock enable
  145. // <o11.21> PCSSP0: SSP 0 interface power/clock enable
  146. // <o11.22> PCTIM2: Timer 2 power/clock enable
  147. // <o11.23> PCTIM3: Timer 3 power/clock enable
  148. // <o11.24> PCUART2: UART 2 power/clock enable
  149. // <o11.25> PCUART3: UART 3 power/clock enable
  150. // <o11.26> PCI2C2: I2C 2 interface power/clock enable
  151. // <o11.27> PCI2S: I2S interface power/clock enable
  152. // <o11.28> PCSDC: SD Card interface power/clock enable
  153. // <o11.29> PCGPDMA: GPDMA function power/clock enable
  154. // <o11.30> PCENET: Ethernet block power/clock enable
  155. // <o11.31> PCUSB: USB interface power/clock enable
  156. // </h>
  157. //
  158. // <h> Clock Output Configuration Register (CLKOUTCFG)
  159. // <o12.0..3> CLKOUTSEL: Clock Source for CLKOUT Selection
  160. // <0=> CPU clock
  161. // <1=> Main Oscillator
  162. // <2=> Internal RC Oscillator
  163. // <3=> USB clock
  164. // <4=> RTC Oscillator
  165. // <5=> unused
  166. // <6=> Watchdog Oscillator
  167. // <o12.4..7> CLKOUTDIV: Output Clock Divider
  168. // <1-16><#-1>
  169. // <o12.8> CLKOUT_EN: CLKOUT enable
  170. // </h>
  171. //
  172. // </e>
  173. */
  174. #define CLOCK_SETUP 1
  175. #define SCS_Val 0x00000021
  176. #define CLKSRCSEL_Val 0x00000001
  177. #define PLL0_SETUP 1
  178. #define PLL0CFG_Val 0x00000009
  179. #define PLL1_SETUP 1
  180. #define PLL1CFG_Val 0x00000023
  181. #define CCLKSEL_Val (0x00000001|(1<<8))
  182. #define USBCLK_SETUP 1
  183. #define USBCLKSEL_Val (0x00000001|(0x02<<8))
  184. #define EMCCLKSEL_Val 0x00000001
  185. #define PCLKSEL_Val 0x00000002
  186. #define PCONP_Val 0x042887DE
  187. #define CLKOUTCFG_Val 0x00000100
  188. /*--------------------- Flash Accelerator Configuration ----------------------
  189. //
  190. // <e> Flash Accelerator Configuration
  191. // <o1.12..15> FLASHTIM: Flash Access Time
  192. // <0=> 1 CPU clock (for CPU clock up to 20 MHz)
  193. // <1=> 2 CPU clocks (for CPU clock up to 40 MHz)
  194. // <2=> 3 CPU clocks (for CPU clock up to 60 MHz)
  195. // <3=> 4 CPU clocks (for CPU clock up to 80 MHz)
  196. // <4=> 5 CPU clocks (for CPU clock up to 100 MHz)
  197. // <5=> 6 CPU clocks (for any CPU clock)
  198. // </e>
  199. */
  200. #define FLASH_SETUP 1
  201. #define FLASHCFG_Val 0x00005000
  202. /*----------------------------------------------------------------------------
  203. Check the register settings
  204. *----------------------------------------------------------------------------*/
  205. #define CHECK_RANGE(val, min, max) ((val < min) || (val > max))
  206. #define CHECK_RSVD(val, mask) (val & mask)
  207. /* Clock Configuration -------------------------------------------------------*/
  208. #if (CHECK_RSVD((SCS_Val), ~0x0000003F))
  209. #error "SCS: Invalid values of reserved bits!"
  210. #endif
  211. #if (CHECK_RANGE((CLKSRCSEL_Val), 0, 1))
  212. #error "CLKSRCSEL: Value out of range!"
  213. #endif
  214. #if (CHECK_RSVD((PLL0CFG_Val), ~0x0000007F))
  215. #error "PLL0CFG: Invalid values of reserved bits!"
  216. #endif
  217. #if (CHECK_RSVD((PLL1CFG_Val), ~0x0000007F))
  218. #error "PLL1CFG: Invalid values of reserved bits!"
  219. #endif
  220. #if (CHECK_RSVD((CCLKSEL_Val), ~0x0000011F))
  221. #error "CCLKSEL: Invalid values of reserved bits!"
  222. #endif
  223. #if (CHECK_RSVD((USBCLKSEL_Val), ~0x0000031F))
  224. #error "USBCLKSEL: Invalid values of reserved bits!"
  225. #endif
  226. #if (CHECK_RSVD((EMCCLKSEL_Val), ~0x00000001))
  227. #error "EMCCLKSEL: Invalid values of reserved bits!"
  228. #endif
  229. #if (CHECK_RSVD((PCLKSEL_Val), ~0x0000001F))
  230. #error "PCLKSEL: Invalid values of reserved bits!"
  231. #endif
  232. #if (CHECK_RSVD((PCONP_Val), ~0xFFFEFFFF))
  233. #error "PCONP: Invalid values of reserved bits!"
  234. #endif
  235. #if (CHECK_RSVD((CLKOUTCFG_Val), ~0x000001FF))
  236. #error "CLKOUTCFG: Invalid values of reserved bits!"
  237. #endif
  238. /* Flash Accelerator Configuration -------------------------------------------*/
  239. #if (CHECK_RSVD((FLASHCFG_Val), ~0x0000F000))
  240. #warning "FLASHCFG: Invalid values of reserved bits!"
  241. #endif
  242. /*----------------------------------------------------------------------------
  243. DEFINES
  244. *----------------------------------------------------------------------------*/
  245. /* pll_out_clk = F_cco / (2 × P)
  246. F_cco = pll_in_clk × M × 2 × P */
  247. #define __M ((PLL0CFG_Val & 0x1F) + 1)
  248. #define __PLL0_CLK(__F_IN) (__F_IN * __M)
  249. #define __CCLK_DIV (CCLKSEL_Val & 0x1F)
  250. #define __PCLK_DIV (PCLKSEL_Val & 0x1F)
  251. #define __ECLK_DIV ((EMCCLKSEL_Val & 0x01) + 1)
  252. /* Determine core clock frequency according to settings */
  253. #if (CLOCK_SETUP) /* Clock Setup */
  254. #if ((CLKSRCSEL_Val & 0x01) == 1) && ((SCS_Val & 0x20)== 0)
  255. #error "Main Oscillator is selected as clock source but is not enabled!"
  256. #endif
  257. #if ((CCLKSEL_Val & 0x100) == 0x100) && (PLL0_SETUP == 0)
  258. #error "Main PLL is selected as clock source but is not enabled!"
  259. #endif
  260. #if ((CCLKSEL_Val & 0x100) == 0) /* cclk = sysclk */
  261. #if ((CLKSRCSEL_Val & 0x01) == 0) /* sysclk = irc_clk */
  262. #define __CORE_CLK (IRC_OSC / __CCLK_DIV)
  263. #define __PER_CLK (IRC_OSC/ __PCLK_DIV)
  264. #define __EMC_CLK (IRC_OSC/ __ECLK_DIV)
  265. #else /* sysclk = osc_clk */
  266. #define __CORE_CLK (OSC_CLK / __CCLK_DIV)
  267. #define __PER_CLK (OSC_CLK/ __PCLK_DIV)
  268. #define __EMC_CLK (OSC_CLK/ __ECLK_DIV)
  269. #endif
  270. #else /* cclk = pll_clk */
  271. #if ((CLKSRCSEL_Val & 0x01) == 0) /* sysclk = irc_clk */
  272. #define __CORE_CLK (__PLL0_CLK(IRC_OSC) / __CCLK_DIV)
  273. #define __PER_CLK (__PLL0_CLK(IRC_OSC) / __PCLK_DIV)
  274. #define __EMC_CLK (__PLL0_CLK(IRC_OSC) / __ECLK_DIV)
  275. #else /* sysclk = osc_clk */
  276. #define __CORE_CLK (__PLL0_CLK(OSC_CLK) / __CCLK_DIV)
  277. #define __PER_CLK (__PLL0_CLK(OSC_CLK) / __PCLK_DIV)
  278. #define __EMC_CLK (__PLL0_CLK(OSC_CLK) / __ECLK_DIV)
  279. #endif
  280. #endif
  281. #else
  282. #define __CORE_CLK (IRC_OSC)
  283. #define __PER_CLK (IRC_OSC)
  284. #define __EMC_CLK (IRC_OSC)
  285. #endif
  286. /*----------------------------------------------------------------------------
  287. Clock Variable definitions
  288. *----------------------------------------------------------------------------*/
  289. uint32_t SystemCoreClock = __CORE_CLK;/*!< System Clock Frequency (Core Clock)*/
  290. uint32_t PeripheralClock = __PER_CLK; /*!< Peripheral Clock Frequency (Pclk) */
  291. uint32_t EMCClock = __EMC_CLK; /*!< EMC Clock Frequency */
  292. uint32_t USBClock = (48000000UL); /*!< USB Clock Frequency - this value will
  293. be updated after call SystemCoreClockUpdate, should be 48MHz*/
  294. /*----------------------------------------------------------------------------
  295. Clock functions
  296. *----------------------------------------------------------------------------*/
  297. void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
  298. {
  299. /* Determine clock frequency according to clock register values */
  300. if ((LPC_SC->CCLKSEL &0x100) == 0) { /* cclk = sysclk */
  301. if ((LPC_SC->CLKSRCSEL & 0x01) == 0) { /* sysclk = irc_clk */
  302. SystemCoreClock = (IRC_OSC / (LPC_SC->CCLKSEL & 0x1F));
  303. PeripheralClock = (IRC_OSC / (LPC_SC->PCLKSEL & 0x1F));
  304. EMCClock = (IRC_OSC / ((LPC_SC->EMCCLKSEL & 0x01)+1));
  305. }
  306. else { /* sysclk = osc_clk */
  307. if ((LPC_SC->SCS & 0x40) == 0) {
  308. SystemCoreClock = 0; /* this should never happen! */
  309. PeripheralClock = 0;
  310. EMCClock = 0;
  311. }
  312. else {
  313. SystemCoreClock = (OSC_CLK / (LPC_SC->CCLKSEL & 0x1F));
  314. PeripheralClock = (OSC_CLK / (LPC_SC->PCLKSEL & 0x1F));
  315. EMCClock = (OSC_CLK / ((LPC_SC->EMCCLKSEL & 0x01)+1));
  316. }
  317. }
  318. }
  319. else { /* cclk = pll_clk */
  320. if ((LPC_SC->PLL0STAT & 0x100) == 0) { /* PLL0 not enabled */
  321. SystemCoreClock = 0; /* this should never happen! */
  322. PeripheralClock = 0;
  323. EMCClock = 0;
  324. }
  325. else {
  326. if ((LPC_SC->CLKSRCSEL & 0x01) == 0) { /* sysclk = irc_clk */
  327. SystemCoreClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->CCLKSEL & 0x1F));
  328. PeripheralClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->PCLKSEL & 0x1F));
  329. EMCClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1) / ((LPC_SC->EMCCLKSEL & 0x01)+1));
  330. }
  331. else { /* sysclk = osc_clk */
  332. if ((LPC_SC->SCS & 0x40) == 0) {
  333. SystemCoreClock = 0; /* this should never happen! */
  334. PeripheralClock = 0;
  335. EMCClock = 0;
  336. }
  337. else {
  338. SystemCoreClock = (OSC_CLK * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->CCLKSEL & 0x1F));
  339. PeripheralClock = (OSC_CLK * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->PCLKSEL & 0x1F));
  340. EMCClock = (OSC_CLK * ((LPC_SC->PLL0STAT & 0x1F) + 1) / ((LPC_SC->EMCCLKSEL & 0x01)+1));
  341. }
  342. }
  343. }
  344. }
  345. /* ---update USBClock------------------*/
  346. if(LPC_SC->USBCLKSEL & (0x01<<8))//Use PLL0 as the input to the USB clock divider
  347. {
  348. switch (LPC_SC->USBCLKSEL & 0x1F)
  349. {
  350. case 0:
  351. USBClock = 0; //no clock will be provided to the USB subsystem
  352. break;
  353. case 4:
  354. case 6:
  355. if(LPC_SC->CLKSRCSEL & 0x01) //pll_clk_in = main_osc
  356. USBClock = (OSC_CLK * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->USBCLKSEL & 0x1F));
  357. else //pll_clk_in = irc_clk
  358. USBClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1) / (LPC_SC->USBCLKSEL & 0x1F));
  359. break;
  360. default:
  361. USBClock = 0; /* this should never happen! */
  362. }
  363. }
  364. else if(LPC_SC->USBCLKSEL & (0x02<<8))//usb_input_clk = alt_pll (pll1)
  365. {
  366. if(LPC_SC->CLKSRCSEL & 0x01) //pll1_clk_in = main_osc
  367. USBClock = (OSC_CLK * ((LPC_SC->PLL1STAT & 0x1F) + 1));
  368. else //pll1_clk_in = irc_clk
  369. USBClock = (IRC_OSC * ((LPC_SC->PLL0STAT & 0x1F) + 1));
  370. }
  371. else
  372. USBClock = 0; /* this should never happen! */
  373. }
  374. /* Determine clock frequency according to clock register values */
  375. /**
  376. * Initialize the system
  377. *
  378. * @param none
  379. * @return none
  380. *
  381. * @brief Setup the microcontroller system.
  382. * Initialize the System.
  383. */
  384. void SystemInit (void)
  385. {
  386. #if (CLOCK_SETUP) /* Clock Setup */
  387. LPC_SC->SCS = SCS_Val;
  388. if (SCS_Val & (1 << 5)) { /* If Main Oscillator is enabled */
  389. while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready */
  390. }
  391. LPC_SC->CLKSRCSEL = CLKSRCSEL_Val; /* Select Clock Source for sysclk/PLL0*/
  392. #if (PLL0_SETUP)
  393. LPC_SC->PLL0CFG = PLL0CFG_Val;
  394. LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
  395. LPC_SC->PLL0FEED = 0xAA;
  396. LPC_SC->PLL0FEED = 0x55;
  397. while (!(LPC_SC->PLL0STAT & (1<<10)));/* Wait for PLOCK0 */
  398. #endif
  399. #if (PLL1_SETUP)
  400. LPC_SC->PLL1CFG = PLL1CFG_Val;
  401. LPC_SC->PLL1CON = 0x01; /* PLL1 Enable */
  402. LPC_SC->PLL1FEED = 0xAA;
  403. LPC_SC->PLL1FEED = 0x55;
  404. while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1 */
  405. #endif
  406. LPC_SC->CCLKSEL = CCLKSEL_Val; /* Setup Clock Divider */
  407. LPC_SC->USBCLKSEL = USBCLKSEL_Val; /* Setup USB Clock Divider */
  408. LPC_SC->EMCCLKSEL = EMCCLKSEL_Val; /* EMC Clock Selection */
  409. LPC_SC->PCLKSEL = PCLKSEL_Val; /* Peripheral Clock Selection */
  410. LPC_SC->PCONP = PCONP_Val; /* Power Control for Peripherals */
  411. LPC_SC->CLKOUTCFG = CLKOUTCFG_Val; /* Clock Output Configuration */
  412. #endif
  413. #if (FLASH_SETUP == 1) /* Flash Accelerator Setup */
  414. LPC_SC->FLASHCFG = FLASHCFG_Val|0x03A;
  415. #endif
  416. #ifdef __RAM_MODE__
  417. SCB->VTOR = 0x10000000 & 0x3FFFFF80;
  418. #else
  419. SCB->VTOR = 0x00000000 & 0x3FFFFF80;
  420. #endif
  421. }