Initial commit
This commit is contained in:
		| @@ -0,0 +1,52 @@ | ||||
| /*---------------------------------------------------------------------------- | ||||
|  * Name:    Retarget.c | ||||
|  * Purpose: 'Retarget' layer for target-dependent low level functions | ||||
|  * Note(s): | ||||
|  *---------------------------------------------------------------------------- | ||||
|  * This file is part of the uVision/ARM development tools. | ||||
|  * 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. | ||||
|  * | ||||
|  * This software is supplied "AS IS" without warranties of any kind. | ||||
|  * | ||||
|  * Copyright (c) 2011 Keil - An ARM Company. All rights reserved. | ||||
|  *----------------------------------------------------------------------------*/ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <rt_misc.h> | ||||
| #include "Serial.h" | ||||
|  | ||||
| #pragma import(__use_no_semihosting_swi) | ||||
|  | ||||
|  | ||||
|  | ||||
| struct __FILE { int handle; /* Add whatever you need here */ }; | ||||
| FILE __stdout; | ||||
| FILE __stdin; | ||||
|  | ||||
|  | ||||
| int fputc(int c, FILE *f) { | ||||
|   return (SER_PutChar(c)); | ||||
| } | ||||
|  | ||||
|  | ||||
| int fgetc(FILE *f) { | ||||
|   return (SER_GetChar()); | ||||
| } | ||||
|  | ||||
|  | ||||
| int ferror(FILE *f) { | ||||
|   /* Your implementation of ferror */ | ||||
|   return EOF; | ||||
| } | ||||
|  | ||||
|  | ||||
| void _ttywrch(int c) { | ||||
|   SER_PutChar(c); | ||||
| } | ||||
|  | ||||
|  | ||||
| void _sys_exit(int return_code) { | ||||
| label:  goto label;  /* endless loop */ | ||||
| } | ||||
| @@ -0,0 +1,195 @@ | ||||
| ;/* File: startup_armv6-m.s | ||||
| ; * Purpose: startup file for armv7-m architecture devices. | ||||
| ; *          Should be used with ARMCC | ||||
| ; * Version: V2.00 | ||||
| ; * Date: 16 November 2015 | ||||
| ; * | ||||
| ; */ | ||||
| ;/* Copyright (c) 2011 - 2014 ARM LIMITED | ||||
| ; | ||||
| ;   All rights reserved. | ||||
| ;   Redistribution and use in source and binary forms, with or without | ||||
| ;   modification, are permitted provided that the following conditions are met: | ||||
| ;   - Redistributions of source code must retain the above copyright | ||||
| ;     notice, this list of conditions and the following disclaimer. | ||||
| ;   - Redistributions in binary form must reproduce the above copyright | ||||
| ;     notice, this list of conditions and the following disclaimer in the | ||||
| ;     documentation and/or other materials provided with the distribution. | ||||
| ;   - Neither the name of ARM nor the names of its contributors may be used | ||||
| ;     to endorse or promote products derived from this software without | ||||
| ;     specific prior written permission. | ||||
| ;   * | ||||
| ;   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
| ;   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
| ;   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
| ;   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
| ;   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
| ;   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
| ;   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
| ;   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
| ;   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
| ;   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
| ;   POSSIBILITY OF SUCH DAMAGE. | ||||
| ;   ---------------------------------------------------------------------------*/ | ||||
| ;/* | ||||
| ;  //-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ | ||||
| ;*/ | ||||
|  | ||||
|  | ||||
| ; <h> Stack Configuration | ||||
| ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
| ; </h> | ||||
|  | ||||
| Stack_Size      EQU     0x00000400 | ||||
|  | ||||
|                 AREA    STACK, NOINIT, READWRITE, ALIGN=3 | ||||
| Stack_Mem       SPACE   Stack_Size | ||||
| __initial_sp | ||||
|  | ||||
|  | ||||
| ; <h> Heap Configuration | ||||
| ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
| ; </h> | ||||
|  | ||||
| Heap_Size       EQU     0x00000C00 | ||||
|  | ||||
|                 AREA    HEAP, NOINIT, READWRITE, ALIGN=3 | ||||
| __heap_base | ||||
| Heap_Mem        SPACE   Heap_Size | ||||
| __heap_limit | ||||
|  | ||||
|  | ||||
|                 PRESERVE8 | ||||
|                 THUMB | ||||
|  | ||||
|  | ||||
| ; Vector Table Mapped to Address 0 at Reset | ||||
|  | ||||
|                 AREA    RESET, DATA, READONLY | ||||
|                 EXPORT  __Vectors | ||||
|                 EXPORT  __Vectors_End | ||||
|                 EXPORT  __Vectors_Size | ||||
|  | ||||
| __Vectors       DCD     __initial_sp              ; Top of Stack | ||||
|                 DCD     Reset_Handler             ; Reset Handler | ||||
|                 DCD     NMI_Handler               ; NMI Handler | ||||
|                 DCD     HardFault_Handler         ; Hard Fault Handler | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     SVC_Handler               ; SVCall Handler | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     PendSV_Handler            ; PendSV Handler | ||||
|                 DCD     SysTick_Handler           ; SysTick Handler | ||||
| __Vectors_End | ||||
|  | ||||
| __Vectors_Size  EQU     __Vectors_End - __Vectors | ||||
|  | ||||
|                 AREA    |.text|, CODE, READONLY | ||||
|  | ||||
|  | ||||
| ; Reset Handler | ||||
|  | ||||
| Reset_Handler   PROC | ||||
|                 EXPORT  Reset_Handler             [WEAK] | ||||
|                 IMPORT  SystemInit | ||||
|                 IMPORT  __main | ||||
|                 LDR     R0, =SystemInit | ||||
|                 BLX     R0 | ||||
|                 LDR     R0, =__main | ||||
|                 BX      R0 | ||||
|                 ENDP | ||||
|  | ||||
|  | ||||
| ; Dummy Exception Handlers (infinite loops which can be modified) | ||||
|  | ||||
| NMI_Handler     PROC | ||||
|                 EXPORT  NMI_Handler               [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| HardFault_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  HardFault_Handler         [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| SVC_Handler     PROC | ||||
|                 EXPORT  SVC_Handler               [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
| PendSV_Handler  PROC | ||||
|                 EXPORT  PendSV_Handler            [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
| SysTick_Handler PROC | ||||
|                 EXPORT  SysTick_Handler           [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
|  | ||||
|                 ALIGN | ||||
|  | ||||
| ; User Initial Stack & Heap | ||||
|                 IF      :DEF:__MICROLIB | ||||
|  | ||||
|                 EXPORT  __initial_sp | ||||
|                 EXPORT  __heap_base | ||||
|                 EXPORT  __heap_limit | ||||
|  | ||||
|                 ELSE | ||||
|  | ||||
|                 IMPORT  __use_two_region_memory | ||||
|  | ||||
| ;/* | ||||
| ;  __user_setup_stackheap() returns the: | ||||
| ;     - heap base in r0 (if the program uses the heap) | ||||
| ;     - stack base in sp | ||||
| ;     - heap limit in r2 (if the program uses the heap and uses two-region memory). | ||||
| ; */ | ||||
|                 EXPORT  __user_setup_stackheap | ||||
|  | ||||
| __user_setup_stackheap PROC | ||||
|                 LDR     R0, = __initial_sp | ||||
|                 MOV     SP, R0 | ||||
| 				IF Heap_Size > 0 | ||||
|                 LDR     R2, = __heap_limit | ||||
|                 LDR     R0, = __heap_base | ||||
| 				ELSE | ||||
|                 MOV     R0, #0 | ||||
|                 MOV     R2, #0 | ||||
|                 ENDIF | ||||
|                 BX      LR | ||||
|                 ENDP | ||||
|  | ||||
|  | ||||
| ;/* | ||||
| ;__user_initial_stackheap() returns the: | ||||
| ;   - heap base in r0 | ||||
| ;   - stack base in r1, that is, the highest address in the stack region | ||||
| ;   - heap limit in r2 | ||||
| ;   - stack limit in r3, that is, the lowest address in the stack region. | ||||
| ; */ | ||||
| ; | ||||
| ;/* DEPRICATED | ||||
| ;                EXPORT  __user_initial_stackheap | ||||
| ; | ||||
| ;__user_initial_stackheap PROC | ||||
| ;                LDR     R0, =  Heap_Mem | ||||
| ;                LDR     R1, =(Stack_Mem + Stack_Size) | ||||
| ;                LDR     R2, = (Heap_Mem +  Heap_Size) | ||||
| ;                LDR     R3, = Stack_Mem | ||||
| ;                BX      LR | ||||
| ;                ENDP | ||||
| ; */ | ||||
|  | ||||
|                 ALIGN | ||||
|  | ||||
|                 ENDIF | ||||
|  | ||||
|  | ||||
|                 END | ||||
| @@ -0,0 +1,218 @@ | ||||
| ;/* File: startup_armv7-m.s | ||||
| ; * Purpose: startup file for armv7-m architecture devices. | ||||
| ; *          Should be used with ARMCC | ||||
| ; * Version: V2.00 | ||||
| ; * Date: 16 November 2015 | ||||
| ; * | ||||
| ; */ | ||||
| ;/* Copyright (c) 2011 - 2014 ARM LIMITED | ||||
| ; | ||||
| ;   All rights reserved. | ||||
| ;   Redistribution and use in source and binary forms, with or without | ||||
| ;   modification, are permitted provided that the following conditions are met: | ||||
| ;   - Redistributions of source code must retain the above copyright | ||||
| ;     notice, this list of conditions and the following disclaimer. | ||||
| ;   - Redistributions in binary form must reproduce the above copyright | ||||
| ;     notice, this list of conditions and the following disclaimer in the | ||||
| ;     documentation and/or other materials provided with the distribution. | ||||
| ;   - Neither the name of ARM nor the names of its contributors may be used | ||||
| ;     to endorse or promote products derived from this software without | ||||
| ;     specific prior written permission. | ||||
| ;   * | ||||
| ;   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
| ;   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
| ;   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
| ;   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
| ;   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
| ;   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
| ;   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
| ;   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
| ;   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
| ;   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
| ;   POSSIBILITY OF SUCH DAMAGE. | ||||
| ;   ---------------------------------------------------------------------------*/ | ||||
| ;/* | ||||
| ;  //-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ | ||||
| ;*/ | ||||
|  | ||||
|  | ||||
| ; <h> Stack Configuration | ||||
| ;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
| ; </h> | ||||
|  | ||||
| Stack_Size      EQU     0x00000400 | ||||
|  | ||||
|                 AREA    STACK, NOINIT, READWRITE, ALIGN=3 | ||||
| Stack_Mem       SPACE   Stack_Size | ||||
| __initial_sp | ||||
|  | ||||
|  | ||||
| ; <h> Heap Configuration | ||||
| ;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
| ; </h> | ||||
|  | ||||
| Heap_Size       EQU     0x00000C00 | ||||
|  | ||||
|                 AREA    HEAP, NOINIT, READWRITE, ALIGN=3 | ||||
| __heap_base | ||||
| Heap_Mem        SPACE   Heap_Size | ||||
| __heap_limit | ||||
|  | ||||
|  | ||||
|                 PRESERVE8 | ||||
|                 THUMB | ||||
|  | ||||
|  | ||||
| ; Vector Table Mapped to Address 0 at Reset | ||||
|  | ||||
|                 AREA    RESET, DATA, READONLY | ||||
|                 EXPORT  __Vectors | ||||
|                 EXPORT  __Vectors_End | ||||
|                 EXPORT  __Vectors_Size | ||||
|  | ||||
| __Vectors       DCD     __initial_sp              ; Top of Stack | ||||
|                 DCD     Reset_Handler             ; Reset Handler | ||||
|                 DCD     NMI_Handler               ; NMI Handler | ||||
|                 DCD     HardFault_Handler         ; Hard Fault Handler | ||||
|                 DCD     MemManage_Handler         ; MPU Fault Handler | ||||
|                 DCD     BusFault_Handler          ; Bus Fault Handler | ||||
|                 DCD     UsageFault_Handler        ; Usage Fault Handler | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     SVC_Handler               ; SVCall Handler | ||||
|                 DCD     DebugMon_Handler          ; Debug Monitor Handler | ||||
|                 DCD     0                         ; Reserved | ||||
|                 DCD     PendSV_Handler            ; PendSV Handler | ||||
|                 DCD     SysTick_Handler           ; SysTick Handler | ||||
| __Vectors_End | ||||
|  | ||||
| __Vectors_Size  EQU     __Vectors_End - __Vectors | ||||
|  | ||||
|                 AREA    |.text|, CODE, READONLY | ||||
|  | ||||
|  | ||||
| ; Reset Handler | ||||
|  | ||||
| Reset_Handler   PROC | ||||
|                 EXPORT  Reset_Handler             [WEAK] | ||||
|                 IMPORT  SystemInit | ||||
|                 IMPORT  __main | ||||
|                 LDR     R0, =SystemInit | ||||
|                 BLX     R0 | ||||
|                 LDR     R0, =__main | ||||
|                 BX      R0 | ||||
|                 ENDP | ||||
|  | ||||
|  | ||||
| ; Dummy Exception Handlers (infinite loops which can be modified) | ||||
|  | ||||
| NMI_Handler     PROC | ||||
|                 EXPORT  NMI_Handler               [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| HardFault_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  HardFault_Handler         [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| MemManage_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  MemManage_Handler         [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| BusFault_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  BusFault_Handler          [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| UsageFault_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  UsageFault_Handler        [WEAK] | ||||
|                 BKPT #0 | ||||
|                 B       . | ||||
|                 ENDP | ||||
| SVC_Handler     PROC | ||||
|                 EXPORT  SVC_Handler               [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
| DebugMon_Handler\ | ||||
|                 PROC | ||||
|                 EXPORT  DebugMon_Handler          [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
| PendSV_Handler  PROC | ||||
|                 EXPORT  PendSV_Handler            [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
| SysTick_Handler PROC | ||||
|                 EXPORT  SysTick_Handler           [WEAK] | ||||
|                 B       . | ||||
|                 ENDP | ||||
|  | ||||
|                 ALIGN | ||||
|  | ||||
| ; User Initial Stack & Heap | ||||
|                 IF      :DEF:__MICROLIB | ||||
|  | ||||
|                 EXPORT  __initial_sp | ||||
|                 EXPORT  __heap_base | ||||
|                 EXPORT  __heap_limit | ||||
|  | ||||
|                 ELSE | ||||
|  | ||||
|                 IMPORT  __use_two_region_memory | ||||
|  | ||||
| ;/* | ||||
| ;  __user_setup_stackheap() returns the: | ||||
| ;     - heap base in r0 (if the program uses the heap) | ||||
| ;     - stack base in sp | ||||
| ;     - heap limit in r2 (if the program uses the heap and uses two-region memory). | ||||
| ; */ | ||||
|                 EXPORT  __user_setup_stackheap | ||||
|  | ||||
| __user_setup_stackheap PROC | ||||
|                 LDR     R0, = __initial_sp | ||||
|                 MOV     SP, R0 | ||||
| 				IF Heap_Size > 0 | ||||
|                 LDR     R2, = __heap_limit | ||||
|                 LDR     R0, = __heap_base | ||||
| 				ELSE | ||||
|                 MOV     R0, #0 | ||||
|                 MOV     R2, #0 | ||||
|                 ENDIF | ||||
|                 BX      LR | ||||
|                 ENDP | ||||
|  | ||||
|  | ||||
| ;/* | ||||
| ;__user_initial_stackheap() returns the: | ||||
| ;   - heap base in r0 | ||||
| ;   - stack base in r1, that is, the highest address in the stack region | ||||
| ;   - heap limit in r2 | ||||
| ;   - stack limit in r3, that is, the lowest address in the stack region. | ||||
| ; */ | ||||
| ; | ||||
| ;/* DEPRICATED | ||||
| ;                EXPORT  __user_initial_stackheap | ||||
| ; | ||||
| ;__user_initial_stackheap PROC | ||||
| ;                LDR     R0, =  Heap_Mem | ||||
| ;                LDR     R1, =(Stack_Mem + Stack_Size) | ||||
| ;                LDR     R2, = (Heap_Mem +  Heap_Size) | ||||
| ;                LDR     R3, = Stack_Mem | ||||
| ;                BX      LR | ||||
| ;                ENDP | ||||
| ; */ | ||||
|  | ||||
|                 ALIGN | ||||
|  | ||||
|                 ENDIF | ||||
|  | ||||
|  | ||||
|                 END | ||||
| @@ -0,0 +1,203 @@ | ||||
| /* File: startup_armv6-m.S | ||||
|  * Purpose: startup file for armv6-m architecture devices. | ||||
|  *          Should be used with ARMCLANG | ||||
|  * Version: V2.00 | ||||
|  * Date: 16 November 2015 | ||||
|  * | ||||
|  */ | ||||
| /* Copyright (c) 2011 - 2015 ARM LIMITED | ||||
|  | ||||
|    All rights reserved. | ||||
|    Redistribution and use in source and binary forms, with or without | ||||
|    modification, are permitted provided that the following conditions are met: | ||||
|    - Redistributions of source code must retain the above copyright | ||||
|      notice, this list of conditions and the following disclaimer. | ||||
|    - Redistributions in binary form must reproduce the above copyright | ||||
|      notice, this list of conditions and the following disclaimer in the | ||||
|      documentation and/or other materials provided with the distribution. | ||||
|    - Neither the name of ARM nor the names of its contributors may be used | ||||
|      to endorse or promote products derived from this software without | ||||
|      specific prior written permission. | ||||
|    * | ||||
|    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
|    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|    ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
|    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
|    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
|    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
|    POSSIBILITY OF SUCH DAMAGE. | ||||
|    ---------------------------------------------------------------------------*/ | ||||
| /* | ||||
|   ;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ | ||||
| */ | ||||
|  | ||||
|  | ||||
|     .syntax unified | ||||
|     .arch   armv6-m | ||||
|  | ||||
| /* .eabi_attribute Tag_ABI_align8_preserved,1    www.support.code-red-tech.com/CodeRedWiki/Preserve8 */ | ||||
| .eabi_attribute 25, 1   /* Tag_ABI_align_preserved */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|   ;<h> Stack Configuration | ||||
|   ;  <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
|   ;</h> | ||||
| */ | ||||
|     .equ    Stack_Size, 0x00000400 | ||||
|  | ||||
|     .section STACK, "w" | ||||
|     .align  3 | ||||
|     .globl  __StackTop | ||||
|     .globl  __StackLimit | ||||
| __StackLimit: | ||||
|     .space  Stack_Size | ||||
| __StackTop:   /* formerly known as __initial_sp */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|   ;<h> Heap Configuration | ||||
|   ;  <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
|   ;</h> | ||||
| */ | ||||
|     .equ    Heap_Size, 0x00000C00 | ||||
|  | ||||
|     .section HEAP, "w" | ||||
|     .align  3 | ||||
|     .globl  __HeapBase | ||||
|     .globl  __HeapLimit | ||||
| __HeapBase: | ||||
|     .if Heap_Size | ||||
|     .space  Heap_Size | ||||
|     .endif | ||||
| __HeapLimit: | ||||
|  | ||||
|  | ||||
|     .section RESET, "x" | ||||
|     .align  2 | ||||
|     .globl  __Vectors | ||||
|     .globl  __Vectors_End | ||||
|     .globl  __Vectors_Size | ||||
| __Vectors: | ||||
|     .long   __StackTop            /* Top of Stack */ | ||||
|     .long   Reset_Handler         /* Reset Handler */ | ||||
|     .long   NMI_Handler           /* NMI Handler */ | ||||
|     .long   HardFault_Handler     /* Hard Fault Handler */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   SVC_Handler           /* SVCall Handler */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   PendSV_Handler        /* PendSV Handler */ | ||||
|     .long   SysTick_Handler       /* SysTick Handler */ | ||||
| __Vectors_End: | ||||
|  | ||||
|     .equ    __Vectors_Size, __Vectors_End - __Vectors | ||||
|  | ||||
|  | ||||
|     .text | ||||
|     .thumb | ||||
|     .align  2 | ||||
|  | ||||
|     .globl  Reset_Handler | ||||
|     .weak   Reset_Handler | ||||
|     .type   Reset_Handler, %function | ||||
|     .thumb_func | ||||
| Reset_Handler: | ||||
|     bl      SystemInit | ||||
|     bl      __main | ||||
|  | ||||
|     .globl  NMI_Handler | ||||
|     .weak   NMI_Handler | ||||
|     .type   NMI_Handler, %function | ||||
|     .thumb_func | ||||
| NMI_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  HardFault_Handler | ||||
|     .weak   HardFault_Handler | ||||
|     .type   HardFault_Handler, %function | ||||
|     .thumb_func | ||||
| HardFault_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  SVC_Handler | ||||
|     .weak   SVC_Handler | ||||
|     .type   SVC_Handler, %function | ||||
|     .thumb_func | ||||
| SVC_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  PendSV_Handler | ||||
|     .weak   PendSV_Handler | ||||
|     .type   PendSV_Handler, %function | ||||
|     .thumb_func | ||||
| PendSV_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  SysTick_Handler | ||||
|     .weak   SysTick_Handler | ||||
|     .type   SysTick_Handler, %function | ||||
|     .thumb_func | ||||
| SysTick_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|  | ||||
|     .global __use_two_region_memory | ||||
|  | ||||
| /* | ||||
|   __user_setup_stackheap() returns the: | ||||
|      - heap base in r0 (if the program uses the heap) | ||||
|      - stack base in sp | ||||
|      - heap limit in r2 (if the program uses the heap and uses two-region memory). | ||||
|  */ | ||||
|     .globl  __user_setup_stackheap | ||||
|     .type   __user_setup_stackheap, %function | ||||
|     .thumb_func | ||||
| __user_setup_stackheap: | ||||
|     ldr     r0, =__StackTop | ||||
|     mov     sp, r0 | ||||
|     .if Heap_Size | ||||
|     ldr     r0, =__HeapBase | ||||
|     ldr     r2, =__HeapLimit | ||||
|     .else | ||||
|     mov     r0, #0 | ||||
|     mov     r2, #0 | ||||
|     .endif | ||||
|     bx      lr | ||||
|  | ||||
|  | ||||
| /* | ||||
| __user_initial_stackheap() returns the: | ||||
|    - heap base in r0 | ||||
|    - stack base in r1, that is, the highest address in the stack region | ||||
|    - heap limit in r2 | ||||
|    - stack limit in r3, that is, the lowest address in the stack region. | ||||
|  */ | ||||
| /* DEPRICATED | ||||
|     .globl  __user_initial_stackheap | ||||
|     .type   __user_initial_stackheap, %function | ||||
|     .thumb_func | ||||
| __user_initial_stackheap: | ||||
|     ldr     r0, = __HeapBase | ||||
|     ldr     r1, = __StackTop | ||||
|     ldr     r2, = __HeapLimit | ||||
|     ldr     r3, = __StackLimit | ||||
|     bx      lr | ||||
| */ | ||||
|  | ||||
|     .end | ||||
| @@ -0,0 +1,235 @@ | ||||
| /* File: startup_armv7-m.S | ||||
|  * Purpose: startup file for armv7-m architecture devices. | ||||
|  *          Should be used with ARMCLANG | ||||
|  * Version: V2.00 | ||||
|  * Date: 16 November 2015 | ||||
|  * | ||||
|  */ | ||||
| /* Copyright (c) 2011 - 2015 ARM LIMITED | ||||
|  | ||||
|    All rights reserved. | ||||
|    Redistribution and use in source and binary forms, with or without | ||||
|    modification, are permitted provided that the following conditions are met: | ||||
|    - Redistributions of source code must retain the above copyright | ||||
|      notice, this list of conditions and the following disclaimer. | ||||
|    - Redistributions in binary form must reproduce the above copyright | ||||
|      notice, this list of conditions and the following disclaimer in the | ||||
|      documentation and/or other materials provided with the distribution. | ||||
|    - Neither the name of ARM nor the names of its contributors may be used | ||||
|      to endorse or promote products derived from this software without | ||||
|      specific prior written permission. | ||||
|    * | ||||
|    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
|    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|    ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
|    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
|    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
|    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
|    POSSIBILITY OF SUCH DAMAGE. | ||||
|    ---------------------------------------------------------------------------*/ | ||||
| /* | ||||
|   ;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ | ||||
| */ | ||||
|  | ||||
|  | ||||
|     .syntax unified | ||||
|     .arch   armv6-m | ||||
|  | ||||
| /* .eabi_attribute Tag_ABI_align8_preserved,1    www.support.code-red-tech.com/CodeRedWiki/Preserve8 */ | ||||
| .eabi_attribute 25, 1   /* Tag_ABI_align_preserved */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|   ;<h> Stack Configuration | ||||
|   ;  <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
|   ;</h> | ||||
| */ | ||||
|     .equ    Stack_Size, 0x00000400 | ||||
|  | ||||
|     .section STACK, "w" | ||||
|     .align  3 | ||||
|     .globl  __StackTop | ||||
|     .globl  __StackLimit | ||||
| __StackLimit: | ||||
|     .space  Stack_Size | ||||
| __StackTop:   /* formerly known as __initial_sp */ | ||||
|  | ||||
|  | ||||
| /* | ||||
|   ;<h> Heap Configuration | ||||
|   ;  <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> | ||||
|   ;</h> | ||||
| */ | ||||
|     .equ    Heap_Size, 0x00000C00 | ||||
|  | ||||
|     .section HEAP, "w" | ||||
|     .align  3 | ||||
|     .globl  __HeapBase | ||||
|     .globl  __HeapLimit | ||||
| __HeapBase: | ||||
|     .if Heap_Size | ||||
|     .space  Heap_Size | ||||
|     .endif | ||||
| __HeapLimit: | ||||
|  | ||||
|  | ||||
|     .section RESET, "x" | ||||
|     .align  2 | ||||
|     .globl  __Vectors | ||||
|     .globl  __Vectors_End | ||||
|     .globl  __Vectors_Size | ||||
| __Vectors: | ||||
|     .long   __StackTop            /* Top of Stack */ | ||||
|     .long   Reset_Handler         /* Reset Handler */ | ||||
|     .long   NMI_Handler           /* NMI Handler */ | ||||
|     .long   HardFault_Handler     /* Hard Fault Handler */ | ||||
|     .long   MemManage_Handler     /* MPU Fault Handler */ | ||||
|     .long   BusFault_Handler      /* Bus Fault Handler */ | ||||
|     .long   UsageFault_Handler    /* Usage Fault Handler */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   SVC_Handler           /* SVCall Handler */ | ||||
|     .long   DebugMon_Handler      /* Debug Monitor Handler */ | ||||
|     .long   0                     /* Reserved */ | ||||
|     .long   PendSV_Handler        /* PendSV Handler */ | ||||
|     .long   SysTick_Handler       /* SysTick Handler */ | ||||
| __Vectors_End: | ||||
|  | ||||
|     .equ    __Vectors_Size, __Vectors_End - __Vectors | ||||
|  | ||||
|  | ||||
|     .text | ||||
|     .thumb | ||||
|     .align  2 | ||||
|  | ||||
|     .globl  Reset_Handler | ||||
|     .weak   Reset_Handler | ||||
|     .type   Reset_Handler, %function | ||||
|     .thumb_func | ||||
| Reset_Handler: | ||||
|     bl      SystemInit | ||||
|     bl      __main | ||||
|  | ||||
|     .globl  NMI_Handler | ||||
|     .weak   NMI_Handler | ||||
|     .type   NMI_Handler, %function | ||||
|     .thumb_func | ||||
| NMI_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  HardFault_Handler | ||||
|     .weak   HardFault_Handler | ||||
|     .type   HardFault_Handler, %function | ||||
|     .thumb_func | ||||
| HardFault_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  MemManage_Handler | ||||
|     .weak   MemManage_Handler | ||||
|     .type   MemManage_Handler, %function | ||||
|     .thumb_func | ||||
| MemManage_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  BusFault_Handler | ||||
|     .weak   BusFault_Handler | ||||
|     .type   BusFault_Handler, %function | ||||
|     .thumb_func | ||||
| BusFault_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  UsageFault_Handler | ||||
|     .weak   UsageFault_Handler | ||||
|     .type   UsageFault_Handler, %function | ||||
|     .thumb_func | ||||
| UsageFault_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  SVC_Handler | ||||
|     .weak   SVC_Handler | ||||
|     .type   SVC_Handler, %function | ||||
|     .thumb_func | ||||
| SVC_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  DebugMon_Handler | ||||
|     .weak   DebugMon_Handler | ||||
|     .type   DebugMon_Handler, %function | ||||
|     .thumb_func | ||||
| DebugMon_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  PendSV_Handler | ||||
|     .weak   PendSV_Handler | ||||
|     .type   PendSV_Handler, %function | ||||
|     .thumb_func | ||||
| PendSV_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|     .globl  SysTick_Handler | ||||
|     .weak   SysTick_Handler | ||||
|     .type   SysTick_Handler, %function | ||||
|     .thumb_func | ||||
| SysTick_Handler: | ||||
|     bkpt    #0 | ||||
|     b       . | ||||
|  | ||||
|  | ||||
|     .global __use_two_region_memory | ||||
|  | ||||
| /* | ||||
|   __user_setup_stackheap() returns the: | ||||
|      - heap base in r0 (if the program uses the heap) | ||||
|      - stack base in sp | ||||
|      - heap limit in r2 (if the program uses the heap and uses two-region memory). | ||||
|  */ | ||||
|     .globl  __user_setup_stackheap | ||||
|     .type   __user_setup_stackheap, %function | ||||
|     .thumb_func | ||||
| __user_setup_stackheap: | ||||
|     ldr     r0, =__StackTop | ||||
|     mov     sp, r0 | ||||
|     .if Heap_Size | ||||
|     ldr     r0, =__HeapBase | ||||
|     ldr     r2, =__HeapLimit | ||||
|     .else | ||||
|     mov     r0, #0 | ||||
|     mov     r2, #0 | ||||
|     .endif | ||||
|     bx      lr | ||||
|  | ||||
|  | ||||
| /* | ||||
| __user_initial_stackheap() returns the: | ||||
|    - heap base in r0 | ||||
|    - stack base in r1, that is, the highest address in the stack region | ||||
|    - heap limit in r2 | ||||
|    - stack limit in r3, that is, the lowest address in the stack region. | ||||
|  */ | ||||
| /* DEPRICATED | ||||
|     .globl  __user_initial_stackheap | ||||
|     .type   __user_initial_stackheap, %function | ||||
|     .thumb_func | ||||
| __user_initial_stackheap: | ||||
|     ldr     r0, = __HeapBase | ||||
|     ldr     r1, = __StackTop | ||||
|     ldr     r2, = __HeapLimit | ||||
|     ldr     r3, = __StackLimit | ||||
|     bx      lr | ||||
| */ | ||||
|  | ||||
|     .end | ||||
| @@ -0,0 +1,106 @@ | ||||
| /*---------------------------------------------------------------------------- | ||||
|  * Name:    Retarget.c | ||||
|  * Purpose: 'Retarget' layer for target-dependent low level functions | ||||
|  * Note(s): | ||||
|  *---------------------------------------------------------------------------- | ||||
|  * This file is part of the uVision/ARM development tools. | ||||
|  * 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. | ||||
|  * | ||||
|  * This software is supplied "AS IS" without warranties of any kind. | ||||
|  * | ||||
|  * Copyright (c) 2012 Keil - An ARM Company. All rights reserved. | ||||
|  *----------------------------------------------------------------------------*/ | ||||
|  | ||||
| #include <sys/stat.h> | ||||
| #include <string.h> | ||||
| #include <errno.h> | ||||
|  | ||||
| int SER_PutChar (int c) { | ||||
|  | ||||
|   return (c); | ||||
| } | ||||
|  | ||||
| int SER_GetChar (void) { | ||||
|  | ||||
|   return (-1); | ||||
| } | ||||
|  | ||||
| /*-- GCC - Newlib runtime support --------------------------------------------*/ | ||||
|  | ||||
| extern int  __HeapBase; | ||||
| extern int  __HeapLimit; | ||||
|  | ||||
| int _open (const char * path, int flags, ...)  | ||||
| { | ||||
|   return (-1); | ||||
| } | ||||
|  | ||||
| int _close (int fd)  | ||||
| { | ||||
|   return (-1); | ||||
| } | ||||
|  | ||||
| int _lseek (int fd, int ptr, int dir)  | ||||
| { | ||||
|   return (0); | ||||
| } | ||||
|  | ||||
| int __attribute__((weak)) _fstat (int fd, struct stat * st)  | ||||
| { | ||||
|   memset (st, 0, sizeof (* st)); | ||||
|   st->st_mode = S_IFCHR; | ||||
|   return (0); | ||||
| } | ||||
|  | ||||
| int _isatty (int fd)  | ||||
| { | ||||
|   return (1); | ||||
| } | ||||
|  | ||||
| int _read (int fd, char * ptr, int len)  | ||||
| { | ||||
|   char c; | ||||
|   int  i; | ||||
|  | ||||
|   for (i = 0; i < len; i++)  | ||||
|   { | ||||
|     c = SER_GetChar(); | ||||
|     if (c == 0x0D) break; | ||||
|     *ptr++ = c; | ||||
|     SER_PutChar(c); | ||||
|   } | ||||
|   return (len - i); | ||||
| } | ||||
|  | ||||
| int _write (int fd, char * ptr, int len)  | ||||
| { | ||||
|   int i; | ||||
|  | ||||
|   for (i = 0; i < len; i++) SER_PutChar (*ptr++); | ||||
|   return (i); | ||||
| } | ||||
|  | ||||
| caddr_t _sbrk (int incr)  | ||||
| { | ||||
|   static char * heap; | ||||
|          char * prev_heap; | ||||
|  | ||||
|   if (heap == NULL)  | ||||
|   { | ||||
|     heap = (char *)&__HeapBase; | ||||
|   } | ||||
|    | ||||
|   prev_heap = heap; | ||||
|  | ||||
|   if ((heap + incr) > (char *)&__HeapLimit)  | ||||
|   { | ||||
|     errno = ENOMEM; | ||||
|     return (caddr_t) -1; | ||||
|   } | ||||
|    | ||||
|   heap += incr; | ||||
|  | ||||
|   return (caddr_t) prev_heap; | ||||
| } | ||||
| @@ -0,0 +1,263 @@ | ||||
| /* File: startup_armv6-m.S | ||||
|  * Purpose: startup file for armv6-m architecture devices. | ||||
|  *          Should be used with GCC for ARM Embedded Processors | ||||
|  * Version: V2.00 | ||||
|  * Date: 16 November 2015 | ||||
|  * | ||||
|  */ | ||||
| /* Copyright (c) 2011 - 2015 ARM LIMITED | ||||
|  | ||||
|    All rights reserved. | ||||
|    Redistribution and use in source and binary forms, with or without | ||||
|    modification, are permitted provided that the following conditions are met: | ||||
|    - Redistributions of source code must retain the above copyright | ||||
|      notice, this list of conditions and the following disclaimer. | ||||
|    - Redistributions in binary form must reproduce the above copyright | ||||
|      notice, this list of conditions and the following disclaimer in the | ||||
|      documentation and/or other materials provided with the distribution. | ||||
|    - Neither the name of ARM nor the names of its contributors may be used | ||||
|      to endorse or promote products derived from this software without | ||||
|      specific prior written permission. | ||||
|    * | ||||
|    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
|    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|    ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
|    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
|    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
|    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
|    POSSIBILITY OF SUCH DAMAGE. | ||||
|    ---------------------------------------------------------------------------*/ | ||||
|  | ||||
|  | ||||
| 	.syntax	unified | ||||
| 	.arch	armv6-m | ||||
|  | ||||
| 	.section .stack | ||||
| 	.align	3 | ||||
| #ifdef __STACK_SIZE | ||||
| 	.equ	Stack_Size, __STACK_SIZE | ||||
| #else | ||||
| 	.equ	Stack_Size, 0x00000400 | ||||
| #endif | ||||
| 	.globl	__StackTop | ||||
| 	.globl	__StackLimit | ||||
| __StackLimit: | ||||
| 	.space	Stack_Size | ||||
| 	.size	__StackLimit, . - __StackLimit | ||||
| __StackTop: | ||||
| 	.size	__StackTop, . - __StackTop | ||||
|  | ||||
| 	.section .heap | ||||
| 	.align	3 | ||||
| #ifdef __HEAP_SIZE | ||||
| 	.equ	Heap_Size, __HEAP_SIZE | ||||
| #else | ||||
| 	.equ	Heap_Size, 0x00000C00 | ||||
| #endif | ||||
| 	.globl	__HeapBase | ||||
| 	.globl	__HeapLimit | ||||
| __HeapBase: | ||||
| 	.if	Heap_Size | ||||
| 	.space	Heap_Size | ||||
| 	.endif | ||||
| 	.size	__HeapBase, . - __HeapBase | ||||
| __HeapLimit: | ||||
| 	.size	__HeapLimit, . - __HeapLimit | ||||
|  | ||||
| 	.section .vectors | ||||
| 	.align 2 | ||||
| 	.globl	__Vectors | ||||
| __Vectors: | ||||
| 	.long	__StackTop            /* Top of Stack */ | ||||
| 	.long	Reset_Handler         /* Reset Handler */ | ||||
| 	.long	NMI_Handler           /* NMI Handler */ | ||||
| 	.long	HardFault_Handler     /* Hard Fault Handler */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	SVC_Handler           /* SVCall Handler */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	PendSV_Handler        /* PendSV Handler */ | ||||
| 	.long	SysTick_Handler       /* SysTick Handler */ | ||||
|  | ||||
| 	.size	__Vectors, . - __Vectors | ||||
|  | ||||
| 	.text | ||||
| 	.thumb | ||||
| 	.thumb_func | ||||
| 	.align	1 | ||||
| 	.globl	Reset_Handler | ||||
| 	.type	Reset_Handler, %function | ||||
| Reset_Handler: | ||||
| /*  Firstly it copies data from read only memory to RAM. There are two schemes | ||||
|  *  to copy. One can copy more than one sections. Another can only copy | ||||
|  *  one section.  The former scheme needs more instructions and read-only | ||||
|  *  data to implement than the latter. | ||||
|  *  Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes.  */ | ||||
|  | ||||
| #ifdef __STARTUP_COPY_MULTIPLE | ||||
| /*  Multiple sections scheme. | ||||
|  * | ||||
|  *  Between symbol address __copy_table_start__ and __copy_table_end__, | ||||
|  *  there are array of triplets, each of which specify: | ||||
|  *    offset 0: LMA of start of a section to copy from | ||||
|  *    offset 4: VMA of start of a section to copy to | ||||
|  *    offset 8: size of the section to copy. Must be multiply of 4 | ||||
|  * | ||||
|  *  All addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r4, =__copy_table_start__ | ||||
| 	ldr	r5, =__copy_table_end__ | ||||
|  | ||||
| .L_loop0: | ||||
| 	cmp	r4, r5 | ||||
| 	bge	.L_loop0_done | ||||
| 	ldr	r1, [r4] | ||||
| 	ldr	r2, [r4, #4] | ||||
| 	ldr	r3, [r4, #8] | ||||
|  | ||||
| .L_loop0_0: | ||||
| 	subs	r3, #4 | ||||
| 	blt	.L_loop0_0_done | ||||
| 	ldr	r0, [r1, r3] | ||||
| 	str	r0, [r2, r3] | ||||
| 	b	.L_loop0_0 | ||||
|  | ||||
| .L_loop0_0_done: | ||||
| 	adds	r4, #12 | ||||
| 	b	.L_loop0 | ||||
|  | ||||
| .L_loop0_done: | ||||
| #else | ||||
| /*  Single section scheme. | ||||
|  * | ||||
|  *  The ranges of copy from/to are specified by following symbols | ||||
|  *    __etext: LMA of start of the section to copy from. Usually end of text | ||||
|  *    __data_start__: VMA of start of the section to copy to | ||||
|  *    __data_end__: VMA of end of the section to copy to | ||||
|  * | ||||
|  *  All addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r1, =__etext | ||||
| 	ldr	r2, =__data_start__ | ||||
| 	ldr	r3, =__data_end__ | ||||
|  | ||||
| 	subs	r3, r2 | ||||
| 	ble	.L_loop1_done | ||||
|  | ||||
| .L_loop1: | ||||
| 	subs	r3, #4 | ||||
| 	ldr	r0, [r1,r3] | ||||
| 	str	r0, [r2,r3] | ||||
| 	bgt	.L_loop1 | ||||
|  | ||||
| .L_loop1_done: | ||||
| #endif /*__STARTUP_COPY_MULTIPLE */ | ||||
|  | ||||
| /*  This part of work usually is done in C library startup code. Otherwise, | ||||
|  *  define this macro to enable it in this startup. | ||||
|  * | ||||
|  *  There are two schemes too. One can clear multiple BSS sections. Another | ||||
|  *  can only clear one section. The former is more size expensive than the | ||||
|  *  latter. | ||||
|  * | ||||
|  *  Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former. | ||||
|  *  Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later. | ||||
|  */ | ||||
| #ifdef __STARTUP_CLEAR_BSS_MULTIPLE | ||||
| /*  Multiple sections scheme. | ||||
|  * | ||||
|  *  Between symbol address __copy_table_start__ and __copy_table_end__, | ||||
|  *  there are array of tuples specifying: | ||||
|  *    offset 0: Start of a BSS section | ||||
|  *    offset 4: Size of this BSS section. Must be multiply of 4 | ||||
|  */ | ||||
| 	ldr	r3, =__zero_table_start__ | ||||
| 	ldr	r4, =__zero_table_end__ | ||||
|  | ||||
| .L_loop2: | ||||
| 	cmp	r3, r4 | ||||
| 	bge	.L_loop2_done | ||||
| 	ldr	r1, [r3] | ||||
| 	ldr	r2, [r3, #4] | ||||
| 	movs	r0, 0 | ||||
|  | ||||
| .L_loop2_0: | ||||
| 	subs	r2, #4 | ||||
| 	blt	.L_loop2_0_done | ||||
| 	str	r0, [r1, r2] | ||||
| 	b	.L_loop2_0 | ||||
| .L_loop2_0_done: | ||||
|  | ||||
| 	adds	r3, #8 | ||||
| 	b	.L_loop2 | ||||
| .L_loop2_done: | ||||
| #elif defined (__STARTUP_CLEAR_BSS) | ||||
| /*  Single BSS section scheme. | ||||
|  * | ||||
|  *  The BSS section is specified by following symbols | ||||
|  *    __bss_start__: start of the BSS section. | ||||
|  *    __bss_end__: end of the BSS section. | ||||
|  * | ||||
|  *  Both addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r1, =__bss_start__ | ||||
| 	ldr	r2, =__bss_end__ | ||||
|  | ||||
| 	movs	r0, 0 | ||||
|  | ||||
| 	subs	r2, r1 | ||||
| 	ble	.L_loop3_done | ||||
|  | ||||
| .L_loop3: | ||||
| 	subs	r2, #4 | ||||
| 	str	r0, [r1, r2] | ||||
| 	bgt	.L_loop3 | ||||
| .L_loop3_done: | ||||
| #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */ | ||||
|  | ||||
| #ifndef __NO_SYSTEM_INIT | ||||
| 	bl	SystemInit | ||||
| #endif | ||||
|  | ||||
| #ifndef __START | ||||
| #define __START _start | ||||
| #endif | ||||
| 	bl	__START | ||||
|  | ||||
| 	.pool | ||||
| 	.size	Reset_Handler, . - Reset_Handler | ||||
|  | ||||
| 	.align	1 | ||||
| 	.thumb_func | ||||
| 	.weak	Default_Handler | ||||
| 	.type	Default_Handler, %function | ||||
| Default_Handler: | ||||
|     bkpt #0 | ||||
| 	b	. | ||||
| 	.size	Default_Handler, . - Default_Handler | ||||
|  | ||||
| /*    Macro to define default handlers. Default handler | ||||
|  *    will be weak symbol and just dead loops. They can be | ||||
|  *    overwritten by other handlers */ | ||||
| 	.macro	def_irq_handler	handler_name | ||||
| 	.weak	\handler_name | ||||
| 	.set	\handler_name, Default_Handler | ||||
| 	.endm | ||||
|  | ||||
| 	def_irq_handler	NMI_Handler | ||||
| 	def_irq_handler	HardFault_Handler | ||||
| 	def_irq_handler	SVC_Handler | ||||
| 	def_irq_handler	PendSV_Handler | ||||
| 	def_irq_handler	SysTick_Handler | ||||
|  | ||||
| 	.end | ||||
| @@ -0,0 +1,257 @@ | ||||
| /* File: startup_armv7-m.S | ||||
|  * Purpose: startup file for armv7-m architecture devices. | ||||
|  *          Should be used with GCC for ARM Embedded Processors | ||||
|  * Version: V2.00 | ||||
|  * Date: 16 November 2015 | ||||
|  * | ||||
|  */ | ||||
| /* Copyright (c) 2011 - 2015 ARM LIMITED | ||||
|  | ||||
|    All rights reserved. | ||||
|    Redistribution and use in source and binary forms, with or without | ||||
|    modification, are permitted provided that the following conditions are met: | ||||
|    - Redistributions of source code must retain the above copyright | ||||
|      notice, this list of conditions and the following disclaimer. | ||||
|    - Redistributions in binary form must reproduce the above copyright | ||||
|      notice, this list of conditions and the following disclaimer in the | ||||
|      documentation and/or other materials provided with the distribution. | ||||
|    - Neither the name of ARM nor the names of its contributors may be used | ||||
|      to endorse or promote products derived from this software without | ||||
|      specific prior written permission. | ||||
|    * | ||||
|    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||||
|    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
|    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
|    ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE | ||||
|    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||||
|    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||
|    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||||
|    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
|    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
|    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
|    POSSIBILITY OF SUCH DAMAGE. | ||||
|    ---------------------------------------------------------------------------*/ | ||||
|  | ||||
|  | ||||
| 	.syntax	unified | ||||
| 	.arch	armv7-m | ||||
|  | ||||
| 	.section .stack | ||||
| 	.align	3 | ||||
| #ifdef __STACK_SIZE | ||||
| 	.equ	Stack_Size, __STACK_SIZE | ||||
| #else | ||||
| 	.equ	Stack_Size, 0x00000400 | ||||
| #endif | ||||
| 	.globl	__StackTop | ||||
| 	.globl	__StackLimit | ||||
| __StackLimit: | ||||
| 	.space	Stack_Size | ||||
| 	.size	__StackLimit, . - __StackLimit | ||||
| __StackTop: | ||||
| 	.size	__StackTop, . - __StackTop | ||||
|  | ||||
| 	.section .heap | ||||
| 	.align	3 | ||||
| #ifdef __HEAP_SIZE | ||||
| 	.equ	Heap_Size, __HEAP_SIZE | ||||
| #else | ||||
| 	.equ	Heap_Size, 0x00000C00 | ||||
| #endif | ||||
| 	.globl	__HeapBase | ||||
| 	.globl	__HeapLimit | ||||
| __HeapBase: | ||||
| 	.if	Heap_Size | ||||
| 	.space	Heap_Size | ||||
| 	.endif | ||||
| 	.size	__HeapBase, . - __HeapBase | ||||
| __HeapLimit: | ||||
| 	.size	__HeapLimit, . - __HeapLimit | ||||
|  | ||||
| 	.section .vectors | ||||
| 	.align	2 | ||||
| 	.globl	__Vectors | ||||
| __Vectors: | ||||
| 	.long	__StackTop            /* Top of Stack */ | ||||
| 	.long	Reset_Handler         /* Reset Handler */ | ||||
| 	.long	NMI_Handler           /* NMI Handler */ | ||||
| 	.long	HardFault_Handler     /* Hard Fault Handler */ | ||||
| 	.long	MemManage_Handler     /* MPU Fault Handler */ | ||||
| 	.long	BusFault_Handler      /* Bus Fault Handler */ | ||||
| 	.long	UsageFault_Handler    /* Usage Fault Handler */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	SVC_Handler           /* SVCall Handler */ | ||||
| 	.long	DebugMon_Handler      /* Debug Monitor Handler */ | ||||
| 	.long	0                     /* Reserved */ | ||||
| 	.long	PendSV_Handler        /* PendSV Handler */ | ||||
| 	.long	SysTick_Handler       /* SysTick Handler */ | ||||
|  | ||||
| 	.size	__Vectors, . - __Vectors | ||||
|  | ||||
| 	.text | ||||
| 	.thumb | ||||
| 	.thumb_func | ||||
| 	.align	2 | ||||
| 	.globl	Reset_Handler | ||||
| 	.type	Reset_Handler, %function | ||||
| Reset_Handler: | ||||
| /*  Firstly it copies data from read only memory to RAM. There are two schemes | ||||
|  *  to copy. One can copy more than one sections. Another can only copy | ||||
|  *  one section.  The former scheme needs more instructions and read-only | ||||
|  *  data to implement than the latter. | ||||
|  *  Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes.  */ | ||||
|  | ||||
| #ifdef __STARTUP_COPY_MULTIPLE | ||||
| /*  Multiple sections scheme. | ||||
|  * | ||||
|  *  Between symbol address __copy_table_start__ and __copy_table_end__, | ||||
|  *  there are array of triplets, each of which specify: | ||||
|  *    offset 0: LMA of start of a section to copy from | ||||
|  *    offset 4: VMA of start of a section to copy to | ||||
|  *    offset 8: size of the section to copy. Must be multiply of 4 | ||||
|  * | ||||
|  *  All addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r4, =__copy_table_start__ | ||||
| 	ldr	r5, =__copy_table_end__ | ||||
|  | ||||
| .L_loop0: | ||||
| 	cmp	r4, r5 | ||||
| 	bge	.L_loop0_done | ||||
| 	ldr	r1, [r4] | ||||
| 	ldr	r2, [r4, #4] | ||||
| 	ldr	r3, [r4, #8] | ||||
|  | ||||
| .L_loop0_0: | ||||
| 	subs	r3, #4 | ||||
| 	ittt	ge | ||||
| 	ldrge	r0, [r1, r3] | ||||
| 	strge	r0, [r2, r3] | ||||
| 	bge	.L_loop0_0 | ||||
|  | ||||
| 	adds	r4, #12 | ||||
| 	b	.L_loop0 | ||||
|  | ||||
| .L_loop0_done: | ||||
| #else | ||||
| /*  Single section scheme. | ||||
|  * | ||||
|  *  The ranges of copy from/to are specified by following symbols | ||||
|  *    __etext: LMA of start of the section to copy from. Usually end of text | ||||
|  *    __data_start__: VMA of start of the section to copy to | ||||
|  *    __data_end__: VMA of end of the section to copy to | ||||
|  * | ||||
|  *  All addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r1, =__etext | ||||
| 	ldr	r2, =__data_start__ | ||||
| 	ldr	r3, =__data_end__ | ||||
|  | ||||
| .L_loop1: | ||||
| 	cmp	r2, r3 | ||||
| 	ittt	lt | ||||
| 	ldrlt	r0, [r1], #4 | ||||
| 	strlt	r0, [r2], #4 | ||||
| 	blt	.L_loop1 | ||||
| #endif /*__STARTUP_COPY_MULTIPLE */ | ||||
|  | ||||
| /*  This part of work usually is done in C library startup code. Otherwise, | ||||
|  *  define this macro to enable it in this startup. | ||||
|  * | ||||
|  *  There are two schemes too. One can clear multiple BSS sections. Another | ||||
|  *  can only clear one section. The former is more size expensive than the | ||||
|  *  latter. | ||||
|  * | ||||
|  *  Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former. | ||||
|  *  Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later. | ||||
|  */ | ||||
| #ifdef __STARTUP_CLEAR_BSS_MULTIPLE | ||||
| /*  Multiple sections scheme. | ||||
|  * | ||||
|  *  Between symbol address __copy_table_start__ and __copy_table_end__, | ||||
|  *  there are array of tuples specifying: | ||||
|  *    offset 0: Start of a BSS section | ||||
|  *    offset 4: Size of this BSS section. Must be multiply of 4 | ||||
|  */ | ||||
| 	ldr	r3, =__zero_table_start__ | ||||
| 	ldr	r4, =__zero_table_end__ | ||||
|  | ||||
| .L_loop2: | ||||
| 	cmp	r3, r4 | ||||
| 	bge	.L_loop2_done | ||||
| 	ldr	r1, [r3] | ||||
| 	ldr	r2, [r3, #4] | ||||
| 	movs	r0, 0 | ||||
|  | ||||
| .L_loop2_0: | ||||
| 	subs	r2, #4 | ||||
| 	itt	ge | ||||
| 	strge	r0, [r1, r2] | ||||
| 	bge	.L_loop2_0 | ||||
|  | ||||
| 	adds	r3, #8 | ||||
| 	b	.L_loop2 | ||||
| .L_loop2_done: | ||||
| #elif defined (__STARTUP_CLEAR_BSS) | ||||
| /*  Single BSS section scheme. | ||||
|  * | ||||
|  *  The BSS section is specified by following symbols | ||||
|  *    __bss_start__: start of the BSS section. | ||||
|  *    __bss_end__: end of the BSS section. | ||||
|  * | ||||
|  *  Both addresses must be aligned to 4 bytes boundary. | ||||
|  */ | ||||
| 	ldr	r1, =__bss_start__ | ||||
| 	ldr	r2, =__bss_end__ | ||||
|  | ||||
| 	movs	r0, 0 | ||||
| .L_loop3: | ||||
| 	cmp	r1, r2 | ||||
| 	itt	lt | ||||
| 	strlt	r0, [r1], #4 | ||||
| 	blt	.L_loop3 | ||||
| #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */ | ||||
|  | ||||
| #ifndef __NO_SYSTEM_INIT | ||||
| 	bl	SystemInit | ||||
| #endif | ||||
|  | ||||
| #ifndef __START | ||||
| #define __START _start | ||||
| #endif | ||||
| 	bl	__START | ||||
|  | ||||
| 	.pool | ||||
| 	.size	Reset_Handler, . - Reset_Handler | ||||
|  | ||||
| 	.align	1 | ||||
| 	.thumb_func | ||||
| 	.weak	Default_Handler | ||||
| 	.type	Default_Handler, %function | ||||
| Default_Handler: | ||||
|     bkpt #0 | ||||
| 	b	. | ||||
| 	.size	Default_Handler, . - Default_Handler | ||||
|  | ||||
| /*    Macro to define default handlers. Default handler | ||||
|  *    will be weak symbol and just dead loops. They can be | ||||
|  *    overwritten by other handlers */ | ||||
| 	.macro	def_irq_handler	handler_name | ||||
| 	.weak	\handler_name | ||||
| 	.set	\handler_name, Default_Handler | ||||
| 	.endm | ||||
|  | ||||
| 	def_irq_handler	NMI_Handler | ||||
| 	def_irq_handler	HardFault_Handler | ||||
| 	def_irq_handler	MemManage_Handler | ||||
| 	def_irq_handler	BusFault_Handler | ||||
| 	def_irq_handler	UsageFault_Handler | ||||
| 	def_irq_handler	SVC_Handler | ||||
| 	def_irq_handler	DebugMon_Handler | ||||
| 	def_irq_handler	PendSV_Handler | ||||
| 	def_irq_handler	SysTick_Handler | ||||
|  | ||||
| 	.end | ||||
| @@ -0,0 +1,62 @@ | ||||
|  | ||||
| #if defined (__CC_ARM) | ||||
|   #if   (defined (ARM_MATH_CM0)) | ||||
|     #include "ARMCC\startup_armv6-m.s" | ||||
|   #elif (defined (ARM_MATH_CM0P)) | ||||
|     #include "ARMCC\startup_armv6-m.s" | ||||
|   #elif (defined (ARM_MATH_CM3)) | ||||
|     #include "ARMCC\startup_armv7-m.s" | ||||
|   #elif (defined (ARM_MATH_CM4)) | ||||
|     #include "ARMCC\startup_armv7-m.s" | ||||
|   #elif (defined (ARM_MATH_CM7)) | ||||
|     #include "ARMCC\startup_armv7-m.s" | ||||
|   #elif (defined (ARM_MATH_ARMV8MBL)) | ||||
|     #include "ARMCC\startup_armv6-m.s" | ||||
|   #elif (defined (ARM_MATH_ARMV8MML)) | ||||
|     #include "ARMCC\startup_armv7-m.s" | ||||
|   #else | ||||
|     #error "No appropriate startup file found!" | ||||
|   #endif | ||||
|  | ||||
| #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) | ||||
|   #if   (defined (ARM_MATH_CM0)) | ||||
|     #include "ARMCLANG\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_CM0P)) | ||||
|     #include "ARMCLANG\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_CM3)) | ||||
|     #include "ARMCLANG\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_CM4)) | ||||
|     #include "ARMCLANG\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_CM7)) | ||||
|     #include "ARMCLANG\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_ARMV8MBL)) | ||||
|     #include "ARMCLANG\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_ARMV8MML)) | ||||
|     #include "ARMCLANG\startup_armv7-m.S" | ||||
|   #else | ||||
|     #error "No appropriate startup file found!" | ||||
|   #endif | ||||
|  | ||||
| #elif defined (__GNUC__) | ||||
|   #if   (defined (ARM_MATH_CM0)) | ||||
|     #include "GCC\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_CM0P)) | ||||
|     #include "GCC\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_CM3)) | ||||
|     #include "GCC\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_CM4)) | ||||
|     #include "GCC\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_CM7)) | ||||
|     #include "GCC\startup_armv7-m.S" | ||||
|   #elif (defined (ARM_MATH_ARMV8MBL)) | ||||
|     #include "GCC\startup_armv6-m.S" | ||||
|   #elif (defined (ARM_MATH_ARMV8MML)) | ||||
|     #include "GCC\startup_armv7-m.S" | ||||
|   #else | ||||
|     #error "No appropriate startup file found!" | ||||
|   #endif | ||||
|  | ||||
| #else | ||||
|   #error "Compiler not supported!" | ||||
| #endif | ||||
|  | ||||
| @@ -0,0 +1,56 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM0.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM0 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #include "ARMCM0.h" | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,82 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM23.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM23 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     21. October 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #if defined (ARMCM23) | ||||
|   #include "ARMCM23.h" | ||||
| #elif defined (ARMCM23_TZ) | ||||
|   #include "ARMCM23_TZ.h" | ||||
|  | ||||
|   #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||
|     #include "partition_ARMCM23.h" | ||||
|   #endif | ||||
| #else | ||||
|   #error device not specified! | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||
|   TZ_SAU_Setup(); | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,68 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM3.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM3 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #include "ARMCM3.h" | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,99 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM33.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM33 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     02. November 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #if defined (ARMCM33) | ||||
|   #include "ARMCM33.h" | ||||
| #elif defined (ARMCM33_TZ) | ||||
|   #include "ARMCM33_TZ.h" | ||||
|  | ||||
|   #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||
|     #include "partition_ARMCM33.h" | ||||
|   #endif | ||||
| #elif defined (ARMCM33_DSP_FP) | ||||
|   #include "ARMCM33_DSP_FP.h" | ||||
| #elif defined (ARMCM33_DSP_FP_TZ) | ||||
|   #include "ARMCM33_DSP_FP_TZ.h" | ||||
|  | ||||
|   #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||
|     #include "partition_ARMCM33.h" | ||||
|   #endif | ||||
| #else | ||||
|   #error device not specified! | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__FPU_USED) && (__FPU_USED == 1U) | ||||
|   SCB->CPACR |= ((3U << 10U*2U) |           /* set CP10 Full Access */ | ||||
|                  (3U << 11U*2U)  );         /* set CP11 Full Access */ | ||||
| #endif | ||||
|  | ||||
| #ifdef UNALIGNED_SUPPORT_DISABLE | ||||
|   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; | ||||
| #endif | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||
|   TZ_SAU_Setup(); | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,83 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM4.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM4 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #if defined (ARMCM4) | ||||
|   #include "ARMCM4.h" | ||||
| #elif defined (ARMCM4_FP) | ||||
|   #include "ARMCM4_FP.h" | ||||
| #else | ||||
|   #error device not specified! | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__FPU_USED) && (__FPU_USED == 1U) | ||||
|   SCB->CPACR |= ((3U << 10U*2U) |           /* set CP10 Full Access */ | ||||
|                  (3U << 11U*2U)  );         /* set CP11 Full Access */ | ||||
| #endif | ||||
|  | ||||
| #ifdef UNALIGNED_SUPPORT_DISABLE | ||||
|   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,85 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMCM7.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMCM7 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #if defined (ARMCM7) | ||||
|   #include "ARMCM7.h" | ||||
| #elif defined (ARMCM7_SP) | ||||
|   #include "ARMCM7_SP.h" | ||||
| #elif defined (ARMCM7_DP) | ||||
|   #include "ARMCM7_DP.h" | ||||
| #else | ||||
|   #error device not specified! | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__FPU_USED) && (__FPU_USED == 1U) | ||||
|   SCB->CPACR |= ((3U << 10U*2U) |           /* set CP10 Full Access */ | ||||
|                  (3U << 11U*2U)  );         /* set CP11 Full Access */ | ||||
| #endif | ||||
|  | ||||
| #ifdef UNALIGNED_SUPPORT_DISABLE | ||||
|   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,56 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMSC000.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           for ARMSC000 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #include "ARMSC000.h" | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,72 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMSC300.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMSC300 Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #include "ARMSC300.h" | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #ifdef UNALIGNED_SUPPORT_DISABLE | ||||
|   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,76 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMv8MBL.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMv8MBL Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     07. September 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #include "ARMv8MBL.h" | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||
|   #include "partition_ARMv8MBL.h" | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||
|   TZ_SAU_Setup(); | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,99 @@ | ||||
| /**************************************************************************//** | ||||
|  * @file     system_ARMv8MML.c | ||||
|  * @brief    CMSIS Device System Source File for | ||||
|  *           ARMv8MML Device Series | ||||
|  * @version  V5.00 | ||||
|  * @date     02. November 2016 | ||||
|  ******************************************************************************/ | ||||
| /* | ||||
|  * Copyright (c) 2009-2016 ARM Limited. All rights reserved. | ||||
|  * | ||||
|  * SPDX-License-Identifier: Apache-2.0 | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the License); you may | ||||
|  * not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  * http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||||
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| #if defined (ARMv8MML) | ||||
|   #include "ARMv8MML.h" | ||||
| #elif defined (ARMv8MML_DSP) | ||||
|   #include "ARMv8MML_DSP.h" | ||||
| #elif defined (ARMv8MML_SP) | ||||
|   #include "ARMv8MML_SP.h" | ||||
| #elif defined (ARMv8MML_DSP_SP) | ||||
|   #include "ARMv8MML_DSP_SP.h" | ||||
| #elif defined (ARMv8MML_DP) | ||||
|   #include "ARMv8MML_DP.h" | ||||
| #elif defined (ARMv8MML_DSP_DP) | ||||
|   #include "ARMv8MML_DSP_DP.h" | ||||
| #else | ||||
|   #error device not specified! | ||||
| #endif | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) &&  (__ARM_FEATURE_CMSE == 3U) | ||||
|   #include "partition_ARMv8MML.h" | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Define clocks | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #define  XTAL            ( 5000000UL)      /* Oscillator frequency */ | ||||
|  | ||||
| #define  SYSTEM_CLOCK    (5U * XTAL) | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   Externals | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   extern uint32_t __Vectors; | ||||
| #endif | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock Variable | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| uint32_t SystemCoreClock = SYSTEM_CLOCK; | ||||
|  | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System Core Clock update function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemCoreClockUpdate (void) | ||||
| { | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
|  | ||||
| /*---------------------------------------------------------------------------- | ||||
|   System initialization function | ||||
|  *----------------------------------------------------------------------------*/ | ||||
| void SystemInit (void) | ||||
| { | ||||
|  | ||||
| #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) | ||||
|   SCB->VTOR = (uint32_t) &__Vectors; | ||||
| #endif | ||||
|  | ||||
| #if defined (__FPU_USED) && (__FPU_USED == 1U) | ||||
|   SCB->CPACR |= ((3U << 10U*2U) |           /* set CP10 Full Access */ | ||||
|                  (3U << 11U*2U)  );         /* set CP11 Full Access */ | ||||
| #endif | ||||
|  | ||||
| #ifdef UNALIGNED_SUPPORT_DISABLE | ||||
|   SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; | ||||
| #endif | ||||
|  | ||||
| #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) | ||||
|   TZ_SAU_Setup(); | ||||
| #endif | ||||
|  | ||||
|   SystemCoreClock = SYSTEM_CLOCK; | ||||
| } | ||||
| @@ -0,0 +1,27 @@ | ||||
|  | ||||
| #if   (defined (ARMCM0)) | ||||
|   #include "system_ARMCM0.c" | ||||
|  | ||||
| #elif (defined (ARMCM0P)) | ||||
|   #include "system_ARMCM0plus.c" | ||||
|  | ||||
| #elif (defined (ARMCM3)) | ||||
|   #include "system_ARMCM3.c" | ||||
|  | ||||
| #elif (defined (ARMCM4) || defined (ARMCM4_FP)) | ||||
|   #include "system_ARMCM4.c" | ||||
|  | ||||
| #elif (defined (ARMCM7) || defined (ARMCM7_SP) || defined (ARMCM7_DP)) | ||||
|   #include "system_ARMCM7.c" | ||||
|  | ||||
| #elif defined (ARMv8MBL) | ||||
|   #include "system_ARMv8MBL.c" | ||||
|  | ||||
| #elif (defined (ARMv8MML)    || defined (ARMv8MML_DSP)    || \ | ||||
|        defined (ARMv8MML_SP) || defined (ARMv8MML_DSP_SP) || \ | ||||
|        defined (ARMv8MML_DP) || defined (ARMv8MML_DSP_DP)   ) | ||||
|   #include "system_ARMv8MML.c" | ||||
|  | ||||
| #else | ||||
|   #error "No appropriate system file found!" | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user