Advertisement
Guest User

Untitled

a guest
Dec 25th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*****************************************************************************/
  2. /* startup_LPC17xx.s: Startup file for LPC17xx device series                 */
  3. /*****************************************************************************/
  4. /* Version: CodeSourcery Sourcery G++ Lite (with CS3)                        */
  5. /*****************************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. /*
  11. //*** <<< Use Configuration Wizard in Context Menu >>> ***
  12. */
  13.  
  14.  
  15.  
  16.  
  17. /*
  18. // <h> Stack Configuration
  19. //   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  20. // </h>
  21. */
  22.  
  23.  
  24.     .equ    Stack_Size, 0x00000100
  25.     .section ".stack", "w"
  26.     .align  3
  27.     .globl  __cs3_stack_mem
  28.     .globl  __cs3_stack_size
  29. __cs3_stack_mem:
  30.     .if     Stack_Size
  31.     .space  Stack_Size
  32.     .endif
  33.     .size   __cs3_stack_mem,  . - __cs3_stack_mem
  34.     .set    __cs3_stack_size, . - __cs3_stack_mem
  35.  
  36.  
  37.  
  38.  
  39. /*
  40. // <h> Heap Configuration
  41. //   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  42. // </h>
  43. */
  44.  
  45.  
  46.     .equ    Heap_Size,  0x00001000
  47.  
  48.  
  49.     .section ".heap", "w"
  50.     .align  3
  51.     .globl  __cs3_heap_start
  52.     .globl  __cs3_heap_end
  53. __cs3_heap_start:
  54.     .if     Heap_Size
  55.     .space  Heap_Size
  56.     .endif
  57. __cs3_heap_end:
  58.  
  59.  
  60.  
  61.  
  62. /* Vector Table */
  63.  
  64.  
  65.     .section ".cs3.interrupt_vector"
  66.     .globl  __cs3_interrupt_vector_cortex_m
  67.     .type   __cs3_interrupt_vector_cortex_m, %object
  68.  
  69.  
  70. __cs3_interrupt_vector_cortex_m:
  71.     .long   __cs3_stack                 /* Top of Stack                 */
  72.     .long   __cs3_reset                 /* Reset Handler                */
  73.     .long   NMI_Handler                 /* NMI Handler                  */
  74.     .long   HardFault_Handler           /* Hard Fault Handler           */
  75.     .long   MemManage_Handler           /* MPU Fault Handler            */
  76.     .long   BusFault_Handler            /* Bus Fault Handler            */
  77.     .long   UsageFault_Handler          /* Usage Fault Handler          */
  78.     .long   0                           /* Reserved                     */
  79.     .long   0                           /* Reserved                     */
  80.     .long   0                           /* Reserved                     */
  81.     .long   0                           /* Reserved                     */
  82.     .long   SVC_Handler                 /* SVCall Handler               */
  83.     .long   DebugMon_Handler            /* Debug Monitor Handler        */
  84.     .long   0                           /* Reserved                     */
  85.     .long   PendSV_Handler              /* PendSV Handler               */
  86.     .long   SysTick_Handler             /* SysTick Handler              */
  87.  
  88.  
  89.     /* External Interrupts */
  90.     .long   WDT_IRQHandler              /* 16: Watchdog Timer               */
  91.     .long   TIMER0_IRQHandler           /* 17: Timer0                       */
  92.     .long   TIMER1_IRQHandler           /* 18: Timer1                       */
  93.     .long   TIMER2_IRQHandler           /* 19: Timer2                       */
  94.     .long   TIMER3_IRQHandler           /* 20: Timer3                       */
  95.     .long   UART0_IRQHandler            /* 21: UART0                        */
  96.     .long   UART1_IRQHandler            /* 22: UART1                        */
  97.     .long   UART2_IRQHandler            /* 23: UART2                        */
  98.     .long   UART3_IRQHandler            /* 24: UART3                        */
  99.     .long   PWM1_IRQHandler             /* 25: PWM1                         */
  100.     .long   I2C0_IRQHandler             /* 26: I2C0                         */
  101.     .long   I2C1_IRQHandler             /* 27: I2C1                         */
  102.     .long   I2C2_IRQHandler             /* 28: I2C2                         */
  103.     .long   SPIFI_IRQHandler            /* 29: SPIFI                        */
  104.     .long   SSP0_IRQHandler             /* 30: SSP0                         */
  105.     .long   SSP1_IRQHandler             /* 31: SSP1                         */
  106.     .long   PLL0_IRQHandler             /* 32: PLL0 Lock (Main PLL)         */
  107.     .long   RTC_IRQHandler              /* 33: Real Time Clock              */
  108.     .long   EINT0_IRQHandler            /* 34: External Interrupt 0         */
  109.     .long   EINT1_IRQHandler            /* 35: External Interrupt 1         */
  110.     .long   EINT2_IRQHandler            /* 36: External Interrupt 2         */
  111.     .long   EINT3_IRQHandler            /* 37: External Interrupt 3         */
  112.     .long   ADC_IRQHandler              /* 38: A/D Converter                */
  113.     .long   BOD_IRQHandler              /* 39: Brown-Out Detect             */
  114.     .long   USB_IRQHandler              /* 40: USB                          */
  115.     .long   CAN_IRQHandler              /* 41: CAN                          */
  116.     .long   DMA_IRQHandler              /* 42: General Purpose DMA          */
  117.     .long   I2S_IRQHandler              /* 43: I2S                          */
  118.     .long   ENET_IRQHandler             /* 44: Ethernet                     */
  119.     .long   MCI_IRQHandler              /* 45: SD/MMC Card                  */
  120.     .long   MCPWM_IRQHandler            /* 46: Motor Control PWM            */
  121.     .long   QEI_IRQHandler              /* 47: Quadrature Encoder Interface */
  122.     .long   PLL1_IRQHandler             /* 48: PLL1 Lock (USB PLL)          */
  123.     .long   USBActivity_IRQHandler      /* 49: USB Activity                 */
  124.     .long   CANActivity_IRQHandler      /* 50: CAN Activity                 */
  125.     .long   UART4_IRQHandler            /* 51: UART4                        */
  126.     .long   SSP2_IRQHandler             /* 52: SSP2                         */
  127.     .long   LCD_IRQHandler              /* 53: LCD                          */
  128.     .long   GPIO_IRQHandler             /* 54: GPIO                         */
  129.     .long   PWM0_IRQHandler             /* 55: PWM0                         */
  130.     .long   EEPROM_IRQHandler           /* 56: EEPROM                       */
  131.  
  132.  
  133.     .size   __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
  134.  
  135.  
  136.  
  137.  
  138.     .thumb
  139.  
  140.  
  141.  
  142.  
  143. /* Reset Handler */
  144.  
  145.  
  146.     .section .cs3.reset,"x",%progbits
  147.     .thumb_func
  148.     .globl  __cs3_reset_cortex_m
  149.     .type   __cs3_reset_cortex_m, %function
  150. __cs3_reset_cortex_m:
  151.     .fnstart
  152. #if (RAM_MODE)
  153. /* Clear .bss section (Zero init) */
  154.     MOV     R0, #0
  155.     LDR     R1, =__bss_start__
  156.     LDR     R2, =__bss_end__
  157.     CMP     R1,R2
  158.     BEQ     BSSIsEmpty
  159. LoopZI:
  160.     CMP     R1, R2
  161.     BHS     BSSIsEmpty
  162.     STR     R0, [R1]
  163.     ADD     R1, #4
  164.     BLO     LoopZI
  165. BSSIsEmpty:
  166.     LDR     R0, =SystemInit
  167.     BLX     R0
  168.     LDR     R0,=main
  169.     BX      R0
  170. #else
  171.     LDR     R0, =SystemInit
  172.     BLX     R0
  173.     LDR     R0,=_start
  174.     BX      R0
  175. #endif
  176.     .pool
  177.     .cantunwind
  178.     .fnend
  179.     .size   __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
  180.  
  181.  
  182.     .section ".text"
  183.  
  184.  
  185. /* Exception Handlers */
  186.  
  187.  
  188.     .weak   NMI_Handler
  189.     .type   NMI_Handler, %function
  190. NMI_Handler:
  191.     B       .
  192.     .size   NMI_Handler, . - NMI_Handler
  193.  
  194.  
  195.     .weak   HardFault_Handler
  196.     .type   HardFault_Handler, %function
  197. HardFault_Handler:
  198.     B       .
  199.     .size   HardFault_Handler, . - HardFault_Handler
  200.  
  201.  
  202.     .weak   MemManage_Handler
  203.     .type   MemManage_Handler, %function
  204. MemManage_Handler:
  205.     B       .
  206.     .size   MemManage_Handler, . - MemManage_Handler
  207.  
  208.  
  209.     .weak   BusFault_Handler
  210.     .type   BusFault_Handler, %function
  211. BusFault_Handler:
  212.     B       .
  213.     .size   BusFault_Handler, . - BusFault_Handler
  214.  
  215.  
  216.     .weak   UsageFault_Handler
  217.     .type   UsageFault_Handler, %function
  218. UsageFault_Handler:
  219.     B       .
  220.     .size   UsageFault_Handler, . - UsageFault_Handler
  221.  
  222.  
  223.     .weak   SVC_Handler
  224.     .type   SVC_Handler, %function
  225. SVC_Handler:
  226.     B       .
  227.     .size   SVC_Handler, . - SVC_Handler
  228.  
  229.  
  230.     .weak   DebugMon_Handler
  231.     .type   DebugMon_Handler, %function
  232. DebugMon_Handler:
  233.     B       .
  234.     .size   DebugMon_Handler, . - DebugMon_Handler
  235.  
  236.  
  237.     .weak   PendSV_Handler
  238.     .type   PendSV_Handler, %function
  239. PendSV_Handler:
  240.     B       .
  241.     .size   PendSV_Handler, . - PendSV_Handler
  242.  
  243.  
  244.     .weak   SysTick_Handler
  245.     .type   SysTick_Handler, %function
  246. SysTick_Handler:
  247.     B       .
  248.     .size   SysTick_Handler, . - SysTick_Handler
  249.  
  250.  
  251.  
  252.  
  253. /* IRQ Handlers */
  254.  
  255.  
  256.     .globl  Default_Handler
  257.     .type   Default_Handler, %function
  258. Default_Handler:
  259.     B       .
  260.     .size   Default_Handler, . - Default_Handler
  261.  
  262.  
  263.     .macro  IRQ handler
  264.     .weak   \handler
  265.     .set    \handler, Default_Handler
  266.     .endm
  267.  
  268.  
  269.     IRQ     WDT_IRQHandler
  270.     IRQ     TIMER0_IRQHandler
  271.     IRQ     TIMER1_IRQHandler
  272.     IRQ     TIMER2_IRQHandler
  273.     IRQ     TIMER3_IRQHandler
  274.     IRQ     UART0_IRQHandler
  275.     IRQ     UART1_IRQHandler
  276.     IRQ     UART2_IRQHandler
  277.     IRQ     UART3_IRQHandler
  278.     IRQ     PWM1_IRQHandler
  279.     IRQ     I2C0_IRQHandler
  280.     IRQ     I2C1_IRQHandler
  281.     IRQ     I2C2_IRQHandler
  282.     IRQ     SPIFI_IRQHandler
  283.     IRQ     SSP0_IRQHandler
  284.     IRQ     SSP1_IRQHandler
  285.     IRQ     PLL0_IRQHandler
  286.     IRQ     RTC_IRQHandler
  287.     IRQ     EINT0_IRQHandler
  288.     IRQ     EINT1_IRQHandler
  289.     IRQ     EINT2_IRQHandler
  290.     IRQ     EINT3_IRQHandler
  291.     IRQ     ADC_IRQHandler
  292.     IRQ     BOD_IRQHandler
  293.     IRQ     USB_IRQHandler
  294.     IRQ     CAN_IRQHandler
  295.     IRQ     DMA_IRQHandler
  296.     IRQ     I2S_IRQHandler
  297.     IRQ     ENET_IRQHandler
  298.     IRQ     MCI_IRQHandler
  299.     IRQ     MCPWM_IRQHandler
  300.     IRQ     QEI_IRQHandler
  301.     IRQ     PLL1_IRQHandler
  302.     IRQ     USBActivity_IRQHandler
  303.     IRQ     CANActivity_IRQHandler
  304.     IRQ     UART4_IRQHandler
  305.     IRQ     SSP2_IRQHandler
  306.     IRQ     LCD_IRQHandler
  307.     IRQ     GPIO_IRQHandler
  308.     IRQ     PWM0_IRQHandler
  309.     IRQ     EEPROM_IRQHandler
  310.  
  311.  
  312.     .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement