| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072 | ;/*****************************************************************************/;/* S3C44B0X.S: Startup file for Samsung S3C44B0X                             */;/*****************************************************************************/;/* <<< Use Configuration Wizard in Context Menu >>>                          */ ;/*****************************************************************************/;/* This file is part of the uVision/ARM development tools.                   */;/* Copyright (c) 2005-2006 Keil Software. All rights reserved.               */;/* This software may only be used under the terms of a valid, current,       */;/* end user licence from KEIL for a compatible version of KEIL software      */;/* development tools. Nothing else gives you the right to use this software. */;/*****************************************************************************/; *** Startup Code (executed after Reset) ***; Standard definitions of Mode bits and Interrupt (I & F) flags in PSRsMode_USR        EQU     0x10Mode_FIQ        EQU     0x11Mode_IRQ        EQU     0x12Mode_SVC        EQU     0x13Mode_ABT        EQU     0x17Mode_UND        EQU     0x1BMode_SYS        EQU     0x1FI_Bit           EQU     0x80            ; when I bit is set, IRQ is disabledF_Bit           EQU     0x40            ; when F bit is set, FIQ is disabled;// <h> Stack Configuration (Stack Sizes in Bytes);//   <o0> Undefined Mode      <0x0-0xFFFFFFFF:8>;//   <o1> Supervisor Mode     <0x0-0xFFFFFFFF:8>;//   <o2> Abort Mode          <0x0-0xFFFFFFFF:8>;//   <o3> Fast Interrupt Mode <0x0-0xFFFFFFFF:8>;//   <o4> Interrupt Mode      <0x0-0xFFFFFFFF:8>;//   <o5> User/System Mode    <0x0-0xFFFFFFFF:8>;// </h>UND_Stack_Size  EQU     0x00000000SVC_Stack_Size  EQU     0x00000100ABT_Stack_Size  EQU     0x00000000FIQ_Stack_Size  EQU     0x00000000IRQ_Stack_Size  EQU     0x00000100USR_Stack_Size  EQU     0x00000100ISR_Stack_Size  EQU     (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \                         FIQ_Stack_Size + IRQ_Stack_Size)                AREA    STACK, NOINIT, READWRITE, ALIGN=3Stack_Mem       SPACE   USR_Stack_Size__initial_sp    SPACE   ISR_Stack_SizeStack_Top;// <h> Heap Configuration;//   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF>;// </h>Heap_Size       EQU     0x00000000                AREA    HEAP, NOINIT, READWRITE, ALIGN=3__heap_baseHeap_Mem        SPACE   Heap_Size__heap_limit; CPU Wrapper and Bus Priorities definitionsCPUW_BASE       EQU     0x01C00000      ; CPU Wrapper Base AddressSYSCFG_OFS      EQU     0x00            ; SYSCFG OffsetNCACHBE0_OFS    EQU     0x04            ; NCACHBE0 OffsetNCACHBE1_OFS    EQU     0x08            ; NCACHBE0 OffsetBUSP_BASE       EQU     0x01C40000      ; Bus Priority Base AddressSBUSCON_OFS     EQU     0x00            ; SBUSCON Offset;// <e> CPU Wrapper and Bus Priorities;//   <h> CPU Wrapper;//     <o1.0>      SE: Stall Enable;//     <o1.1..2>   CM: Cache Mode;//                 <0=> Disable Cache (8kB SRAM);//                 <1=> Half Cache Enable (4kB Cache, 4kB SRAM);//                 <2=> Reserved;//                 <3=> Full Cache Enable (8kB Cache);//     <o1.3>      WE: Write Buffer Enable;//     <o1.4>      RSE: Read Stall Enable;//     <o1.5>      DA: Data Abort  <0=> Enable <1=> Disable;//     <h> Non-cacheable Area 0;//       <o2.0..15>  Start Address     <0x0-0x0FFFF000:0x1000><#/0x1000>;//                   <i> SA = (Start Address) / 4k;//       <o2.16..31> End Address + 1   <0x0-0x10000000:0x1000><#/0x1000>;//                   <i> SE = (End Address + 1) / 4k;//     </h>;//     <h> Non-cacheable Area 1;//       <o3.0..15>  Start Address     <0x0-0x0FFFF000:0x1000><#/0x1000>;//                   <i> SA = (Start Address) / 4k;//       <o3.16..31> End Address + 1   <0x0-0x10000000:0x1000><#/0x1000>;//                   <i> SE = (End Address + 1) / 4k;//     </h>;//   </h>;//   <h> Bus Priorities;//     <o4.31>       FIX: Fixed Priorities;//     <o4.6..7>     LCD_DMA    <0=> 1st  <1=> 2nd  <2=> 3rd  <3=> 4th;//     <o4.4..5>     ZDMA       <0=> 1st  <1=> 2nd  <2=> 3rd  <3=> 4th;//     <o4.2..3>     BDMA       <0=> 1st  <1=> 2nd  <2=> 3rd  <3=> 4th;//     <o4.0..1>     nBREQ      <0=> 1st  <1=> 2nd  <2=> 3rd  <3=> 4th;//   </h>;// </e>SYS_SETUP       EQU     0SYSCFG_Val      EQU     0x00000001NCACHBE0_Val    EQU     0x00000000NCACHBE1_Val    EQU     0x00000000SBUSCON_Val     EQU     0x80001B1B;// <e> Vectored Interrupt Mode (for IRQ);//   <o1.25> EINT0      <i> External Interrupt 0;//   <o1.24> EINT1      <i> External Interrupt 1;//   <o1.23> EINT2      <i> External Interrupt 2                        ;//   <o1.22> EINT3      <i> External Interrupt 3;//   <o1.21> EINT4567   <i> External Interrupt 4/5/6/7;//   <o1.20> TICK       <i> RTC Time Tick Interrupt;//   <o1.19> ZDMA0      <i> General DMA0 Interrupt;//   <o1.18> ZDMA1      <i> General DMA1 Interrupt;//   <o1.17> BDMA0      <i> Bridge DMA0 Interrupt;//   <o1.16> BDMA1      <i> Bridge DMA1 Interrupt;//   <o1.15> WDT        <i> Watchdog Timer Interrupt;//   <o1.14> UERR01     <i> UART0/1 Error Interrupt;//   <o1.13> TIMER0     <i> Timer0 Interrupt;//   <o1.12> TIMER1     <i> Timer1 Interrupt;//   <o1.11> TIMER2     <i> Timer2 Interrupt;//   <o1.10> TIMER3     <i> Timer3 Interrupt;//   <o1.9>  TIMER4     <i> Timer4 Interrupt;//   <o1.8>  TIMER5     <i> Timer5 Interrupt;//   <o1.7>  URXD0      <i> UART0 Rx Interrupt;//   <o1.6>  URXD1      <i> UART1 Rx Interrupt;//   <o1.5>  IIC        <i> IIC Interrupt;//   <o1.4>  SIO        <i> SIO Interrupt;//   <o1.3>  UTXD0      <i> UART0 Tx Interrupt;//   <o1.2>  UTXD1      <i> UART1 Tx Interrupt;//   <o1.1>  RTC        <i> RTC Alarm Interrupt;//   <o1.0>  ADC        <i> ADC EOC Interrupt;// </e>VIM_SETUP       EQU     0VIM_CFG         EQU     0x00000000; Clock Management definitionsCLK_BASE        EQU     0x01D80000      ; Clock Base AddressPLLCON_OFS      EQU     0x00            ; PLLCON OffsetCLKCON_OFS      EQU     0x04            ; CLKCON OffsetCLKSLOW_OFS     EQU     0x08            ; CLKSLOW OffsetLOCKTIME_OFS    EQU     0x0C            ; LOCKTIME Offset;// <e> Clock Management;//   <h> PLL Settings;//   <i> Fpllo = (m * Fin) / (p * 2^s), 20MHz < Fpllo < 66MHz;//     <o1.12..19> MDIV: Main divider <0x0-0xFF>;//                 <i> m = MDIV + 8;//     <o1.4..9>   PDIV: Pre-divider  <0x0-0x3F>;//                 <i> p = PDIV + 2, 1MHz <= Fin/p < 2MHz;//     <o1.0..1>   SDIV: Post Divider <0x0-0x03>;//                 <i> s = SDIV, Fpllo * 2^s < 170MHz;//     <o4.0..11>  LTIME CNT: PLL Lock Time Count  <0x0-0x0FFF>;//   </h>;//   <h> Master Clock;//   <i> PLL Clock:  Fout = Fpllo;//   <i> Slow Clock: Fout = Fin / (2 * SLOW_VAL), SLOW_VAL > 0;//   <i> Slow Clock: Fout = Fin, SLOW_VAL = 0;//     <o3.5>      PLL_OFF: PLL Off;//                 <i> PLL is turned Off only when SLOW_BIT = 1;//     <o3.4>      SLOW_BIT: Slow Clock;//     <o3.0..3>   SLOW_VAL: Slow Clock divider    <0x0-0x0F>;//   </h>;//   <h> Clock Generation;//     <o2.14>     IIS       <0=> Disable  <1=> Enable;//     <o2.13>     IIC       <0=> Disable  <1=> Enable;//     <o2.12>     ADC       <0=> Disable  <1=> Enable;//     <o2.11>     RTC       <0=> Disable  <1=> Enable;//     <o2.10>     GPIO      <0=> Disable  <1=> Enable;//     <o2.9>      UART1     <0=> Disable  <1=> Enable;//     <o2.8>      UART0     <0=> Disable  <1=> Enable;//     <o2.7>      BDMA0,1   <0=> Disable  <1=> Enable;//     <o2.6>      LCDC      <0=> Disable  <1=> Enable;//     <o2.5>      SIO       <0=> Disable  <1=> Enable;//     <o2.4>      ZDMA0,1   <0=> Disable  <1=> Enable;//     <o2.3>      PWMTIMER  <0=> Disable  <1=> Enable;//   </h>;// </e>CLK_SETUP       EQU     1PLLCON_Val      EQU     0x00038080CLKCON_Val      EQU     0x00007FF8CLKSLOW_Val     EQU     0x00000009LOCKTIME_Val    EQU     0x00000FFF; Watchdog Timer definitionsWT_BASE         EQU     0x01D30000      ; WT Base AddressWTCON_OFS       EQU     0x00            ; WTCON OffsetWTDAT_OFS       EQU     0x04            ; WTDAT OffsetWTCNT_OFS       EQU     0x08            ; WTCNT Offset;// <e> Watchdog Timer;//   <o1.5>      Watchdog Timer Enable/Disable;//   <o1.0>      Reset Enable/Disable;//   <o1.2>      Interrupt Enable/Disable;//   <o1.3..4>   Clock Select  ;//               <0=> 1/16  <1=> 1/32  <2=> 1/64  <3=> 1/128;//               <i> Clock Division Factor;//   <o1.8..15>  Prescaler Value <0x0-0xFF>;//   <o2.0..15>  Time-out Value  <0x0-0xFFFF>;// </e>WT_SETUP        EQU     1WTCON_Val       EQU     0x00008000WTDAT_Val       EQU     0x00008000; Memory Controller definitionsMC_BASE         EQU     0x01C80000      ; Memory Controller Base Address;// <e> Memory ControllerMC_SETUP        EQU     1;//   <h> Bank 0;//     <o0.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o0.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o0.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o0.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o0.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o0.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o0.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 1;//     <o8.4..5>   DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.6>      WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.7>      ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o1.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o1.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o1.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o1.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o1.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o1.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o1.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 2;//     <o8.8..9>   DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.10>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.11>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o2.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o2.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o2.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o2.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o2.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o2.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o2.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 3;//     <o8.12..13> DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.14>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.15>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o3.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o3.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o3.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o3.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o3.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o3.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o3.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 4;//     <o8.16..17> DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.18>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.19>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o4.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o4.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o4.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o4.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o4.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o4.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o4.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 5;//     <o8.20..21> DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.22>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.23>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o5.0..1>   PMC: Page Mode Configuration;//                 <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//     <o5.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//     <o5.4..5>   Tcah: Address Holding Time after nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o5.6..7>   Toch: Chip Select Hold on nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o5.8..10>  Tacc: Access Cycle;//                 <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                 <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//     <o5.11..12> Tcos: Chip Select Set-up nOE;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     <o5.13..14> Tacs: Address Set-up before nGCSn;//                 <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//   </h>;//;//   <h> Bank 6;//     <o10.0..2>  BK76MAP: Bank 6/7 Memory Map;//                 <0=> 32M  <4=> 2M   <5=> 4M   <6=> 8M   <7=> 16M;//     <o8.24..25> DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.26>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.27>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o6.15..16> MT: Memory Type;//                 <0=> ROM or SRAM;//                 <1=> FP DRAMP;//                 <2=> EDO DRAM;//                 <3=> SDRAM;//     <h> ROM or SRAM;//       <o6.0..1>   PMC: Page Mode Configuration;//                   <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//       <o6.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//       <o6.4..5>   Tcah: Address Holding Time after nGCSn;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o6.6..7>   Toch: Chip Select Hold on nOE;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o6.8..10>  Tacc: Access Cycle;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                   <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//       <o6.11..12> Tcos: Chip Select Set-up nOE;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o6.13..14> Tacs: Address Set-up before nGCSn;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     </h>;//     <h> FP DRAM or EDO DRAM;//       <o6.0..1>   CAN: Columnn Address Number;//                   <0=> 8-bit   <1=> 9-bit   <2=> 10-bit  <3=> 11-bit;//       <o6.2>      Tcp: CAS Pre-charge;//                   <0=> 1 clk   <1=> 2 clks;//       <o6.3>      Tcas: CAS Pulse Width;//                   <0=> 1 clk   <1=> 2 clks;//       <o6.4..5>   Trcd: RAS to CAS Delay;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//     </h>;//     <h> SDRAM;//       <o6.0..1>   SCAN: Columnn Address Number;//                   <0=> 8-bit   <1=> 9-bit   <2=> 10-bit  <3=> Rsrvd;//       <o6.2..3>   Trcd: RAS to CAS Delay;//                   <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> Rsrvd;//       <o10.4>     SCLKEN: SCLK Selection (Bank 6/7);//                   <0=> Normal;//                   <1=> Reduced Power ;//       <o11.0..2>  BL: Burst Length;//                   <0=> 1;//       <o11.3>     BT: Burst Type;//                   <0=> Sequential;//       <o11.4..6>  CL: CAS Latency;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks;//       <o11.7..8>  TM: Test Mode;//                   <0=> Mode Register Set;//       <o11.9>     WBL: Write Burst Length;//                   <0=> 0;//     </h>;//   </h>;//;//   <h> Bank 7;//     <o10.0..2>  BK76MAP: Bank 6/7 Memory Map;//                 <0=> 32M  <4=> 2M   <5=> 4M   <6=> 8M   <7=> 16M;//     <o8.28..29> DW: Data Bus Width;//                 <0=> 8-bit   <1=> 16-bit  <2=> 32-bit  <3=> Rsrvd;//     <o8.30>     WS: WAIT Status;//                 <0=> WAIT Disable;//                 <1=> WAIT Enable;//     <o8.31>     ST: SRAM Type;//                 <0=> Not using UB/LB;//                 <1=> Using UB/LB;//     <o7.15..16> MT: Memory Type;//                 <0=> ROM or SRAM;//                 <1=> FP DRAMP;//                 <2=> EDO DRAM;//                 <3=> SDRAM;//     <h> ROM or SRAM;//       <o7.0..1>   PMC: Page Mode Configuration;//                   <0=> 1 Data  <1=> 4 Data  <2=> 8 Data  <3=> 16 Data;//       <o7.2..3>   Tpac: Page Mode Access Cycle;//                 <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> 6 clks;//       <o7.4..5>   Tcah: Address Holding Time after nGCSn;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o7.6..7>   Toch: Chip Select Hold on nOE;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o7.8..10>  Tacc: Access Cycle;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//                   <4=> 6 clk   <5=> 8 clks  <6=> 10 clks <7=> 14 clks;//       <o7.11..12> Tcos: Chip Select Set-up nOE;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//       <o7.13..14> Tacs: Address Set-up before nGCSn;//                   <0=> 0 clk   <1=> 1 clk   <2=> 2 clks  <3=> 4 clks;//     </h>;//     <h> FP DRAM or EDO DRAM;//       <o7.0..1>   CAN: Columnn Address Number;//                   <0=> 8-bit   <1=> 9-bit   <2=> 10-bit  <3=> 11-bit;//       <o7.2>      Tcp: CAS Pre-charge;//                   <0=> 1 clk   <1=> 2 clks;//       <o7.3>      Tcas: CAS Pulse Width;//                   <0=> 1 clk   <1=> 2 clks;//       <o7.4..5>   Trcd: RAS to CAS Delay;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//     </h>;//     <h> SDRAM;//       <o7.0..1>   SCAN: Columnn Address Number;//                   <0=> 8-bit   <1=> 9-bit   <2=> 10-bit  <3=> Rsrvd;//       <o7.2..3>   Trcd: RAS to CAS Delay;//                   <0=> 2 clks  <1=> 3 clks  <2=> 4 clks  <3=> Rsrvd;//       <o10.4>     SCLKEN: SCLK Selection (Bank 6/7);//                   <0=> Normal;//                   <1=> Reduced Power ;//       <o12.0..2>  BL: Burst Length;//                   <0=> 1;//       <o12.3>     BT: Burst Type;//                   <0=> Sequential;//       <o12.4..6>  CL: CAS Latency;//                   <0=> 1 clk   <1=> 2 clks  <2=> 3 clks;//       <o12.7..8>  TM: Test Mode;//                   <0=> Mode Register Set;//       <o12.9>     WBL: Write Burst Length;//                   <0=> 0;//     </h>;//   </h>;//;//   <h> Refresh;//     <o9.23>     REFEN: DRAM/SDRAM Refresh;//                 <0=> Disable <1=> Enable;//     <o9.22>     TREFMD: DRAM/SDRAM Refresh Mode;//                 <0=> CBR/Auto Refresh;//                 <1=> Self Refresh;//     <o9.20..21> Trp: DRAM/SDRAM RAS Pre-charge Time;//                 <0=> 1.5 clks (DRAM) / 2 clks (SDRAM);//                 <1=> 2.5 clks (DRAM) / 3 clks (SDRAM);//                 <2=> 3.5 clks (DRAM) / 4 clks (SDRAM);//                 <3=> 4.5 clks (DRAM) / Rsrvd (SDRAM);//     <o9.18..19> Trc: SDRAM RC Min Time;//                 <0=> 4 clks  <1=> 5 clks  <2=> 6 clks  <3=> 7 clks;//     <o9.16..17> Tchr: DRAM CAS Hold Time;//                 <0=> 1 clks  <1=> 2 clks  <2=> 3 clks  <3=> 4 clks;//     <o9.0..10>  Refresh Counter <0x0-0x07FF>;//                 <i> Refresh Period = (2^11 - Refresh Count + 1) / MCLK;//   </h>BANKCON0_Val    EQU     0x00000700BANKCON1_Val    EQU     0x00000700BANKCON2_Val    EQU     0x00000700BANKCON3_Val    EQU     0x00000700BANKCON4_Val    EQU     0x00000700BANKCON5_Val    EQU     0x00000700BANKCON6_Val    EQU     0x00018008BANKCON7_Val    EQU     0x00018008BWSCON_Val      EQU     0x00000000REFRESH_Val     EQU     0x00AC0000BANKSIZE_Val    EQU     0x00000000MRSRB6_Val      EQU     0x00000000MRSRB7_Val      EQU     0x00000000;// </e> End of MC; I/O Ports definitionsPIO_BASE        EQU     0x01D20000      ; PIO Base AddressPCONA_OFS       EQU     0x00            ; PCONA OffsetPCONB_OFS       EQU     0x08            ; PCONB OffsetPCONC_OFS       EQU     0x10            ; PCONC OffsetPCOND_OFS       EQU     0x1C            ; PCOND OffsetPCONE_OFS       EQU     0x28            ; PCONE OffsetPCONF_OFS       EQU     0x34            ; PCONF OffsetPCONG_OFS       EQU     0x40            ; PCONG OffsetPUPC_OFS        EQU     0x18            ; PUPC OffsetPUPD_OFS        EQU     0x24            ; PUPD OffsetPUPE_OFS        EQU     0x30            ; PUPE OffsetPUPF_OFS        EQU     0x3C            ; PUPF OffsetPUPG_OFS        EQU     0x48            ; PUPG OffsetSPUCR_OFS       EQU     0x4C            ; SPUCR Offset;// <e> I/O ConfigurationPIO_SETUP       EQU     0;//   <e> Port A;//     <o1.0>      PA0  <0=> Output   <1=> ADDR0;//     <o1.1>      PA1  <0=> Output   <1=> ADDR16;//     <o1.2>      PA2  <0=> Output   <1=> ADDR17;//     <o1.3>      PA3  <0=> Output   <1=> ADDR18;//     <o1.4>      PA4  <0=> Output   <1=> ADDR19;//     <o1.5>      PA5  <0=> Output   <1=> ADDR20;//     <o1.6>      PA6  <0=> Output   <1=> ADDR21;//     <o1.7>      PA7  <0=> Output   <1=> ADDR22;//     <o1.8>      PA8  <0=> Output   <1=> ADDR23;//     <o1.9>      PA9  <0=> Output   <1=> ADDR24;//   </e>PIOA_SETUP      EQU     1PCONA_Val       EQU     0x000003FF;//   <e> Port B;//     <o1.0>      PB0  <0=> Output   <1=> SCKE;//     <o1.1>      PB1  <0=> Output   <1=> CKLK;//     <o1.2>      PB2  <0=> Output   <1=> nSCAS/nCAS2;//     <o1.3>      PB3  <0=> Output   <1=> nSRAS/nCAS3;//     <o1.4>      PB4  <0=> Output   <1=> nWBE2/nBE2/DQM2;//     <o1.5>      PB5  <0=> Output   <1=> nWBE3/nBE3/DQM3;//     <o1.6>      PB6  <0=> Output   <1=> nGCS1;//     <o1.7>      PB7  <0=> Output   <1=> nGCS2;//     <o1.8>      PB8  <0=> Output   <1=> nGCS3;//     <o1.9>      PB9  <0=> Output   <1=> nGCS4;//     <o1.10>     PB10 <0=> Output   <1=> nGCS5;//   </e>PIOB_SETUP      EQU     1PCONB_Val       EQU     0x000007FF;//   <e> Port C;//     <o1.0..1>   PC0  <0=> Input    <1=> Output   <2=> DATA16   <3=> IISLRCK;//     <o1.2..3>   PC1  <0=> Input    <1=> Output   <2=> DATA17   <3=> IISDO;//     <o1.4..5>   PC2  <0=> Input    <1=> Output   <2=> DATA18   <3=> IISDI;//     <o1.6..7>   PC3  <0=> Input    <1=> Output   <2=> DATA19   <3=> IISCLK;//     <o1.8..9>   PC4  <0=> Input    <1=> Output   <2=> DATA20   <3=> VD7;//     <o1.10..11> PC5  <0=> Input    <1=> Output   <2=> DATA21   <3=> VD6;//     <o1.12..13> PC6  <0=> Input    <1=> Output   <2=> DATA22   <3=> VD5;//     <o1.14..15> PC7  <0=> Input    <1=> Output   <2=> DATA23   <3=> VD4;//     <o1.16..17> PC8  <0=> Input    <1=> Output   <2=> DATA24   <3=> nXDACK1;//     <o1.18..19> PC9  <0=> Input    <1=> Output   <2=> DATA25   <3=> nXDREQ1;//     <o1.20..21> PC10 <0=> Input    <1=> Output   <2=> DATA26   <3=> nRTS1;//     <o1.22..23> PC11 <0=> Input    <1=> Output   <2=> DATA27   <3=> nCTS1;//     <o1.24..25> PC12 <0=> Input    <1=> Output   <2=> DATA28   <3=> TxD1;//     <o1.26..27> PC13 <0=> Input    <1=> Output   <2=> DATA29   <3=> RxD1;//     <o1.28..29> PC14 <0=> Input    <1=> Output   <2=> DATA30   <3=> nRTS0;//     <o1.30..31> PC15 <0=> Input    <1=> Output   <2=> DATA31   <3=> nCTS0;//     <h> Pull-up Resistors;//       <o2.0>    PC0 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.1>    PC1 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.2>    PC2 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.3>    PC3 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.4>    PC4 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.5>    PC5 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.6>    PC6 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.7>    PC7 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.8>    PC8 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.9>    PC9 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.10>   PC10 Pull-up       <0=> Enabled  <1=> Disabled;//       <o2.11>   PC11 Pull-up       <0=> Enabled  <1=> Disabled;//       <o2.12>   PC12 Pull-up       <0=> Enabled  <1=> Disabled;//       <o2.13>   PC13 Pull-up       <0=> Enabled  <1=> Disabled;//       <o2.14>   PC14 Pull-up       <0=> Enabled  <1=> Disabled;//       <o2.15>   PC15 Pull-up       <0=> Enabled  <1=> Disabled;//     </h>;//   </e>PIOC_SETUP      EQU     1PCONC_Val       EQU     0xAAAAAAAAPUPC_Val        EQU     0x00000000;//   <e> Port D;//     <o1.0..1>   PD0  <0=> Input    <1=> Output   <2=> VD0      <3=> Reserved;//     <o1.2..3>   PD1  <0=> Input    <1=> Output   <2=> VD1      <3=> Reserved;//     <o1.4..5>   PD2  <0=> Input    <1=> Output   <2=> VD2      <3=> Reserved;//     <o1.6..7>   PD3  <0=> Input    <1=> Output   <2=> VD3      <3=> Reserved;//     <o1.8..9>   PD4  <0=> Input    <1=> Output   <2=> VCLK     <3=> Reserved;//     <o1.10..11> PD5  <0=> Input    <1=> Output   <2=> VLINE    <3=> Reserved;//     <o1.12..13> PD6  <0=> Input    <1=> Output   <2=> VM       <3=> Reserved;//     <o1.14..15> PD7  <0=> Input    <1=> Output   <2=> VFRAME   <3=> Reserved;//     <h> Pull-up Resistors;//       <o2.0>    PD0 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.1>    PD1 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.2>    PD2 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.3>    PD3 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.4>    PD4 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.5>    PD5 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.6>    PD6 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.7>    PD7 Pull-up        <0=> Enabled  <1=> Disabled;//     </h>;//   </e>PIOD_SETUP      EQU     1PCOND_Val       EQU     0x00000000PUPD_Val        EQU     0x00000000;//   <e> Port E;//     <o1.0..1>   PE0  <0=> Input    <1=> Output   <2=> Fpllo    <3=> Fout;//     <o1.2..3>   PE1  <0=> Input    <1=> Output   <2=> TxD0     <3=> Reserved;//     <o1.4..5>   PE2  <0=> Input    <1=> Output   <2=> RxD0     <3=> Reserved;//     <o1.6..7>   PE3  <0=> Input    <1=> Output   <2=> TOUT0    <3=> Reserved;//     <o1.8..9>   PE4  <0=> Input    <1=> Output   <2=> TOUT1    <3=> TCLK;//     <o1.10..11> PE5  <0=> Input    <1=> Output   <2=> TOUT2    <3=> TCLK;//     <o1.12..13> PE6  <0=> Input    <1=> Output   <2=> TOUT3    <3=> VD6;//     <o1.14..15> PE7  <0=> Input    <1=> Output   <2=> TOUT4    <3=> VD7;//     <o1.16..17> PE8  <0=> Input    <1=> Output   <2=> CODECLK  <3=> Reserved;//     <h> Pull-up Resistors;//       <o2.0>    PE0 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.1>    PE1 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.2>    PE2 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.3>    PE3 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.4>    PE4 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.5>    PE5 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.6>    PE6 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.7>    PE7 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.8>    PE8 Pull-up        <0=> Enabled  <1=> Disabled;//     </h>;//   </e>PIOE_SETUP      EQU     1PCONE_Val       EQU     0x00000000PUPE_Val        EQU     0x00000000;//   <e> Port F;//     <o1.0..1>   PF0  <0=> Input    <1=> Output   <2=> IICSCL   <3=> Reserved;//     <o1.2..3>   PF1  <0=> Input    <1=> Output   <2=> IICSDA   <3=> Reserved;//     <o1.4..5>   PF2  <0=> Input    <1=> Output   <2=> nWAIT    <3=> Reserved;//     <o1.6..7>   PF3  <0=> Input    <1=> Output   <2=> nXBACK   <3=> nXDACK0;//     <o1.8..9>   PF4  <0=> Input    <1=> Output   <2=> nXBREQ   <3=> nXDREQ0;//     <o1.10..12> PF5  <0=> Input    <1=> Output   <2=> nRTS1    <3=> SIOTxD;//                      <4=> IISLRCK  <5=> Reserved <6=> Reserved <7=> Reserved;//     <o1.13..15> PF6  <0=> Input    <1=> Output   <2=> TxD1     <3=> SIORDY;//                      <4=> IISDO    <5=> Reserved <6=> Reserved <7=> Reserved;//     <o1.16..18> PF7  <0=> Input    <1=> Output   <2=> RxD1     <3=> SIORxD;//                      <4=> IISDI    <5=> Reserved <6=> Reserved <7=> Reserved;//     <o1.19..21> PF8  <0=> Input    <1=> Output   <2=> nCTS1    <3=> SIOCLK;//                      <4=> IISCLK   <5=> Reserved <6=> Reserved <7=> Reserved;//     <h> Pull-up Resistors;//       <o2.0>    PF0 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.1>    PF1 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.2>    PF2 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.3>    PF3 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.4>    PF4 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.5>    PF5 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.6>    PF6 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.7>    PF7 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.8>    PF8 Pull-up        <0=> Enabled  <1=> Disabled;//     </h>;//   </e>PIOF_SETUP      EQU     1PCONF_Val       EQU     0x00000000PUPF_Val        EQU     0x00000000;//   <e> Port G;//     <o1.0..1>   PG0  <0=> Input    <1=> Output   <2=> VD4      <3=> EINT0;//     <o1.2..3>   PG1  <0=> Input    <1=> Output   <2=> VD5      <3=> EINT1;//     <o1.4..5>   PG2  <0=> Input    <1=> Output   <2=> nCTS0    <3=> EINT2;//     <o1.6..7>   PG3  <0=> Input    <1=> Output   <2=> nRTS0    <3=> EINT3;//     <o1.8..9>   PG4  <0=> Input    <1=> Output   <2=> IISCLK   <3=> EINT4;//     <o1.10..11> PG5  <0=> Input    <1=> Output   <2=> IISDI    <3=> EINT5;//     <o1.12..13> PG6  <0=> Input    <1=> Output   <2=> IISDO    <3=> EINT6;//     <o1.14..15> PG7  <0=> Input    <1=> Output   <2=> IISLRCK  <3=> EINT7;//     <h> Pull-up Resistors;//       <o2.0>    PG0 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.1>    PG1 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.2>    PG2 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.3>    PG3 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.4>    PG4 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.5>    PG5 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.6>    PG6 Pull-up        <0=> Enabled  <1=> Disabled;//       <o2.7>    PG7 Pull-up        <0=> Enabled  <1=> Disabled;//     </h>;//   </e>PIOG_SETUP      EQU     1PCONG_Val       EQU     0x00000000PUPG_Val        EQU     0x00000000;//   <e> Special Pull-up;//     <o1.0>    SPUCR0: DATA[7:0] Pull-up Resistor    ;//               <0=> Enabled  <1=> Disabled;//     <o1.1>    SPUCR1: DATA[15:8] Pull-up Resistor    ;//               <0=> Enabled  <1=> Disabled;//     <o1.2>    HZ@STOP;//               <0=> Prevoius state of PAD;//               <1=> HZ @ Stop;//   </e>PSPU_SETUP      EQU     1SPUCR_Val       EQU     0x00000004;// </e>                  PRESERVE8                ; Area Definition and Entry Point;  Startup Code must be linked first at Address at which it expects to run.                AREA    RESET, CODE, READONLY                ARM; Exception Vectors;  Mapped to Address 0.;  Absolute addressing mode must be used.;  Dummy Handlers are implemented as infinite loops which can be modified.Vectors         LDR     PC, Reset_Addr                         LDR     PC, Undef_Addr                LDR     PC, SWI_Addr                LDR     PC, PAbt_Addr                LDR     PC, DAbt_Addr                NOP                            ; Reserved Vector                 LDR     PC, IRQ_Addr                LDR     PC, FIQ_AddrReset_Addr      DCD     Reset_HandlerUndef_Addr      DCD     Undef_HandlerSWI_Addr        DCD     SWI_HandlerPAbt_Addr       DCD     PAbt_HandlerDAbt_Addr       DCD     DAbt_Handler                DCD     0                      ; Reserved Address IRQ_Addr        DCD     IRQ_HandlerFIQ_Addr        DCD     FIQ_HandlerUndef_Handler   B       Undef_HandlerSWI_Handler     B       SWI_HandlerPAbt_Handler    B       PAbt_HandlerDAbt_Handler    B       DAbt_HandlerFIQ_Handler     B       FIQ_Handler; CPU Wrapper and Bus Priorities Configuration                IF      SYS_SETUP <> 0SYS_CFG                DCD     CPUW_BASE                DCD     BUSP_BASE                        DCD     SYSCFG_Val                DCD     NCACHBE0_Val                DCD     NCACHBE1_Val                DCD     SBUSCON_Val                ENDIF; Memory Controller Configuration                IF      MC_SETUP <> 0MC_CFG                DCD     BWSCON_Val                DCD     BANKCON0_Val                DCD     BANKCON1_Val                DCD     BANKCON2_Val                DCD     BANKCON3_Val                DCD     BANKCON4_Val                DCD     BANKCON5_Val                DCD     BANKCON6_Val                DCD     BANKCON7_Val                DCD     REFRESH_Val                DCD     BANKSIZE_Val                DCD     MRSRB6_Val                DCD     MRSRB7_Val                ENDIF; Clock Management Configuration                IF      CLK_SETUP <> 0CLK_CFG                DCD     CLK_BASE                        DCD     PLLCON_Val                DCD     CLKCON_Val                DCD     CLKSLOW_Val                DCD     LOCKTIME_Val                ENDIF; I/O Configuration                IF      PIO_SETUP <> 0PIO_CFG                        DCD     PCONA_Val                DCD     PCONB_Val                DCD     PCONC_Val                DCD     PCOND_Val                DCD     PCONE_Val                DCD     PCONF_Val                DCD     PCONG_Val                DCD     PUPC_Val                DCD     PUPD_Val                DCD     PUPE_Val                DCD     PUPF_Val                DCD     PUPG_Val                DCD     SPUCR_Val                ENDIF; Reset Handler                EXPORT  Reset_HandlerReset_Handler                   IF      SYS_SETUP <> 0                ADR     R8, SYS_CFG                LDMIA   R8, {R0-R5}                STMIA   R0, {R2-R4}                STR     R5, [R1]                ENDIF                IF      MC_SETUP <> 0                ADR     R14, MC_CFG                LDMIA   R14, {R0-R12}                LDR     R14, =MC_BASE                STMIA   R14, {R0-R12}                ENDIF                IF      CLK_SETUP <> 0                ADR     R8, CLK_CFG                LDMIA   R8, {R0-R4}                STR     R4, [R0, #LOCKTIME_OFS]                STR     R1, [R0, #PLLCON_OFS]                STR     R3, [R0, #CLKSLOW_OFS]                STR     R2, [R0, #CLKCON_OFS]                ENDIF                IF      WT_SETUP <> 0                LDR     R0, =WT_BASE                LDR     R1, =WTCON_Val                LDR     R2, =WTDAT_Val                STR     R2, [R0, #WTCNT_OFS]                STR     R2, [R0, #WTDAT_OFS]                STR     R1, [R0, #WTCON_OFS]                ENDIF                IF      PIO_SETUP <> 0                ADR     R14, PIO_CFG                LDMIA   R14, {R0-R12}                LDR     R14, =PIO_BASE                IF      PIOA_SETUP <> 0                STR     R0, [R14, #PCONA_OFS]                ENDIF                IF      PIOB_SETUP <> 0                STR     R1, [R14, #PCONB_OFS]                ENDIF                IF      PIOC_SETUP <> 0                STR     R2, [R14, #PCONC_OFS]                STR     R7, [R14, #PUPC_OFS]                ENDIF                IF      PIOD_SETUP <> 0                STR     R3, [R14, #PCOND_OFS]                STR     R8, [R14, #PUPD_OFS]                ENDIF                IF      PIOE_SETUP <> 0                STR     R4, [R14, #PCONE_OFS]                STR     R9, [R14, #PUPE_OFS]                ENDIF                IF      PIOF_SETUP <> 0                STR     R5, [R14, #PCONF_OFS]                STR     R10,[R14, #PUPF_OFS]                ENDIF                IF      PIOG_SETUP <> 0                STR     R6, [R14, #PCONG_OFS]                STR     R11,[R14, #PUPG_OFS]                ENDIF                IF      PSPU_SETUP <> 0                STR     R12,[R14, #SPUCR_OFS]                ENDIF                ENDIF; Setup Stack for each mode                LDR     R0, =Stack_Top;  Enter Undefined Instruction Mode and set its Stack Pointer                MSR     CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit                MOV     SP, R0                SUB     R0, R0, #UND_Stack_Size;  Enter Abort Mode and set its Stack Pointer                MSR     CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit                MOV     SP, R0                SUB     R0, R0, #ABT_Stack_Size;  Enter FIQ Mode and set its Stack Pointer                MSR     CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit                MOV     SP, R0                SUB     R0, R0, #FIQ_Stack_Size;  Enter IRQ Mode and set its Stack Pointer                MSR     CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit                MOV     SP, R0                SUB     R0, R0, #IRQ_Stack_Size;  Enter Supervisor Mode and set its Stack Pointer                MSR     CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit                MOV     SP, R0                SUB     R0, R0, #SVC_Stack_Size;  Enter User Mode and set its Stack Pointer                ; MSR     CPSR_c, #Mode_USR                IF      :DEF:__MICROLIB                EXPORT __initial_sp                ELSE                ; MOV     SP, R0                ; SUB     SL, SP, #USR_Stack_Size                ENDIF; Enter the C code                IMPORT  __main                LDR     R0, =__main                BX      R0				IMPORT rt_interrupt_enter				IMPORT rt_interrupt_leave				IMPORT rt_thread_switch_interrupt_flag				IMPORT rt_interrupt_from_thread				IMPORT rt_interrupt_to_thread				IMPORT rt_hw_trap_irq				IRQ_Handler		PROC				EXPORT IRQ_Handler				STMFD	sp!, {r0-r12,lr}				BL	rt_interrupt_enter				BL	rt_hw_trap_irq				BL	rt_interrupt_leave				; if rt_thread_switch_interrupt_flag set, jump to				; rt_hw_context_switch_interrupt_do and don't return				LDR	r0, =rt_thread_switch_interrupt_flag				LDR	r1, [r0]				CMP	r1, #1				BEQ	rt_hw_context_switch_interrupt_do				LDMFD	sp!, {r0-r12,lr}				SUBS	pc, lr, #4				ENDP; /*; * void rt_hw_context_switch_interrupt_do(rt_base_t flag); */rt_hw_context_switch_interrupt_do	PROC				EXPORT rt_hw_context_switch_interrupt_do				MOV		r1,  #0			; clear flag				STR		r1,  [r0]				LDMFD	sp!, {r0-r12,lr}; reload saved registers				STMFD	sp!, {r0-r3}	; save r0-r3				MOV		r1,  sp				ADD		sp,  sp, #16	; restore sp				SUB		r2,  lr, #4		; save old task's pc to r2				MRS		r3,  spsr		; get cpsr of interrupt thread				; switch to SVC mode and no interrupt                MSR     cpsr_c, #I_Bit|F_Bit|Mode_SVC				STMFD	sp!, {r2}		; push old task's pc				STMFD	sp!, {r4-r12,lr}; push old task's lr,r12-r4				MOV		r4,  r1			; Special optimised code below				MOV		r5,  r3				LDMFD	r4!, {r0-r3}				STMFD	sp!, {r0-r3}	; push old task's r3-r0				STMFD	sp!, {r5}		; push old task's cpsr				MRS		r4,  spsr				STMFD	sp!, {r4}		; push old task's spsr				LDR		r4,  =rt_interrupt_from_thread				LDR		r5,  [r4]				STR		sp,  [r5]		; store sp in preempted tasks's TCB				LDR		r6,  =rt_interrupt_to_thread				LDR		r6,  [r6]				LDR		sp,  [r6]		; get new task's stack pointer							LDMFD	sp!, {r4}		; pop new task's spsr				MSR		spsr_cxsf, r4				LDMFD	sp!, {r4}		; pop new task's psr				MSR		cpsr_cxsf, r4				LDMFD	sp!, {r0-r12,lr,pc}	; pop new task's r0-r12,lr & pc				ENDP                IF      :DEF:__MICROLIB                EXPORT  __heap_base                EXPORT  __heap_limit                ELSE; User Initial Stack & Heap                AREA    |.text|, CODE, READONLY                IMPORT  __use_two_region_memory                EXPORT  __user_initial_stackheap__user_initial_stackheap                LDR     R0, =  Heap_Mem                LDR     R1, =(Stack_Mem + USR_Stack_Size)                LDR     R2, = (Heap_Mem +      Heap_Size)                LDR     R3, = Stack_Mem                BX      LR                ENDIF                END
 |