mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-20 06:58:39 +03:00
Initial commit
This commit is contained in:
77
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC5/ARMCA9.sct
vendored
Normal file
77
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC5/ARMCA9.sct
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
#! armcc -E
|
||||
;**************************************************
|
||||
; Copyright (c) 2017 ARM Ltd. All rights reserved.
|
||||
;**************************************************
|
||||
|
||||
; Scatter-file for RTX Example on Versatile Express
|
||||
|
||||
; This scatter-file places application code, data, stack and heap at suitable addresses in the memory map.
|
||||
|
||||
; This platform has 2GB SDRAM starting at 0x80000000.
|
||||
|
||||
#include "mem_ARMCA9.h"
|
||||
|
||||
SDRAM __ROM_BASE __ROM_SIZE ; load region size_region
|
||||
{
|
||||
VECTORS __ROM_BASE __ROM_SIZE ; load address = execution address
|
||||
{
|
||||
* (RESET, +FIRST) ; Vector table and other startup code
|
||||
* (InRoot$$Sections) ; All (library) code that must be in a root region
|
||||
* (+RO-CODE) ; Application RO code (.text)
|
||||
* (+RO-DATA) ; Application RO data (.constdata)
|
||||
}
|
||||
|
||||
RW_DATA __RAM_BASE __RW_DATA_SIZE
|
||||
{ * (+RW) } ; Application RW data (.data)
|
||||
|
||||
ZI_DATA (__RAM_BASE+
|
||||
__RW_DATA_SIZE) __ZI_DATA_SIZE
|
||||
{ * (+ZI) } ; Application ZI data (.bss)
|
||||
|
||||
ARM_LIB_HEAP (__RAM_BASE
|
||||
+__RW_DATA_SIZE
|
||||
+__ZI_DATA_SIZE) EMPTY __HEAP_SIZE ; Heap region growing up
|
||||
{ }
|
||||
|
||||
ARM_LIB_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE
|
||||
-__ABT_STACK_SIZE
|
||||
-__UND_STACK_SIZE) EMPTY -__STACK_SIZE ; Stack region growing down
|
||||
{ }
|
||||
|
||||
UND_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE
|
||||
-__ABT_STACK_SIZE) EMPTY -__UND_STACK_SIZE ; UND mode stack
|
||||
{ }
|
||||
|
||||
ABT_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE) EMPTY -__ABT_STACK_SIZE ; ABT mode stack
|
||||
{ }
|
||||
|
||||
SVC_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE) EMPTY -__SVC_STACK_SIZE ; SVC mode stack
|
||||
{ }
|
||||
|
||||
IRQ_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE) EMPTY -__IRQ_STACK_SIZE ; IRQ mode stack
|
||||
{ }
|
||||
|
||||
FIQ_STACK (__RAM_BASE
|
||||
+__RAM_SIZE) EMPTY -__FIQ_STACK_SIZE ; FIQ mode stack
|
||||
{ }
|
||||
|
||||
TTB __TTB_BASE EMPTY __TTB_SIZE ; Level-1 Translation Table for MMU
|
||||
{ }
|
||||
}
|
151
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC5/startup_ARMCA9.c
vendored
Normal file
151
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC5/startup_ARMCA9.c
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
/******************************************************************************
|
||||
* @file startup_ARMCA9.c
|
||||
* @brief CMSIS Device System Source File for Arm Cortex-A9 Device Series
|
||||
* @version V1.00
|
||||
* @date 10. January 2018
|
||||
*
|
||||
* @note
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2018 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
|
||||
*
|
||||
* 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 <ARMCA9.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define USR_MODE 0x10 // User mode
|
||||
#define FIQ_MODE 0x11 // Fast Interrupt Request mode
|
||||
#define IRQ_MODE 0x12 // Interrupt Request mode
|
||||
#define SVC_MODE 0x13 // Supervisor mode
|
||||
#define ABT_MODE 0x17 // Abort mode
|
||||
#define UND_MODE 0x1B // Undefined Instruction mode
|
||||
#define SYS_MODE 0x1F // System mode
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Internal References
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Vectors (void) __attribute__ ((section("RESET")));
|
||||
void Reset_Handler (void);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Handler
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Undef_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void DAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void FIQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector Table
|
||||
*----------------------------------------------------------------------------*/
|
||||
__ASM void Vectors(void) {
|
||||
PRESERVE8
|
||||
|
||||
IMPORT Undef_Handler
|
||||
IMPORT SVC_Handler
|
||||
IMPORT PAbt_Handler
|
||||
IMPORT DAbt_Handler
|
||||
IMPORT IRQ_Handler
|
||||
IMPORT FIQ_Handler
|
||||
LDR PC, =Reset_Handler
|
||||
LDR PC, =Undef_Handler
|
||||
LDR PC, =SVC_Handler
|
||||
LDR PC, =PAbt_Handler
|
||||
LDR PC, =DAbt_Handler
|
||||
NOP
|
||||
LDR PC, =IRQ_Handler
|
||||
LDR PC, =FIQ_Handler
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Reset Handler called on controller reset
|
||||
*----------------------------------------------------------------------------*/
|
||||
__ASM void Reset_Handler(void) {
|
||||
PRESERVE8
|
||||
|
||||
// Mask interrupts
|
||||
CPSID if
|
||||
|
||||
// Put any cores other than 0 to sleep
|
||||
MRC p15, 0, R0, c0, c0, 5 // Read MPIDR
|
||||
ANDS R0, R0, #3
|
||||
goToSleep
|
||||
WFINE
|
||||
BNE goToSleep
|
||||
|
||||
// Reset SCTLR Settings
|
||||
MRC p15, 0, R0, c1, c0, 0 // Read CP15 System Control register
|
||||
BIC R0, R0, #(0x1 << 12) // Clear I bit 12 to disable I Cache
|
||||
BIC R0, R0, #(0x1 << 2) // Clear C bit 2 to disable D Cache
|
||||
BIC R0, R0, #0x1 // Clear M bit 0 to disable MMU
|
||||
BIC R0, R0, #(0x1 << 11) // Clear Z bit 11 to disable branch prediction
|
||||
BIC R0, R0, #(0x1 << 13) // Clear V bit 13 to disable hivecs
|
||||
MCR p15, 0, R0, c1, c0, 0 // Write value back to CP15 System Control register
|
||||
ISB
|
||||
|
||||
// Configure ACTLR
|
||||
MRC p15, 0, r0, c1, c0, 1 // Read CP15 Auxiliary Control Register
|
||||
ORR r0, r0, #(1 << 1) // Enable L2 prefetch hint (UNK/WI since r4p1)
|
||||
MCR p15, 0, r0, c1, c0, 1 // Write CP15 Auxiliary Control Register
|
||||
|
||||
// Set Vector Base Address Register (VBAR) to point to this application's vector table
|
||||
LDR R0, =Vectors
|
||||
MCR p15, 0, R0, c12, c0, 0
|
||||
|
||||
// Setup Stack for each exceptional mode
|
||||
IMPORT |Image$$FIQ_STACK$$ZI$$Limit|
|
||||
IMPORT |Image$$IRQ_STACK$$ZI$$Limit|
|
||||
IMPORT |Image$$SVC_STACK$$ZI$$Limit|
|
||||
IMPORT |Image$$ABT_STACK$$ZI$$Limit|
|
||||
IMPORT |Image$$UND_STACK$$ZI$$Limit|
|
||||
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||
CPS #0x11
|
||||
LDR SP, =|Image$$FIQ_STACK$$ZI$$Limit|
|
||||
CPS #0x12
|
||||
LDR SP, =|Image$$IRQ_STACK$$ZI$$Limit|
|
||||
CPS #0x13
|
||||
LDR SP, =|Image$$SVC_STACK$$ZI$$Limit|
|
||||
CPS #0x17
|
||||
LDR SP, =|Image$$ABT_STACK$$ZI$$Limit|
|
||||
CPS #0x1B
|
||||
LDR SP, =|Image$$UND_STACK$$ZI$$Limit|
|
||||
CPS #0x1F
|
||||
LDR SP, =|Image$$ARM_LIB_STACK$$ZI$$Limit|
|
||||
|
||||
// Call SystemInit
|
||||
IMPORT SystemInit
|
||||
BL SystemInit
|
||||
|
||||
// Unmask interrupts
|
||||
CPSIE if
|
||||
|
||||
// Call __main
|
||||
IMPORT __main
|
||||
BL __main
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Default Handler for Exceptions / Interrupts
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Default_Handler(void) {
|
||||
while(1);
|
||||
}
|
77
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC6/ARMCA9.sct
vendored
Normal file
77
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC6/ARMCA9.sct
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-a9 -xc
|
||||
;**************************************************
|
||||
; Copyright (c) 2017 ARM Ltd. All rights reserved.
|
||||
;**************************************************
|
||||
|
||||
; Scatter-file for RTX Example on Versatile Express
|
||||
|
||||
; This scatter-file places application code, data, stack and heap at suitable addresses in the memory map.
|
||||
|
||||
; This platform has 2GB SDRAM starting at 0x80000000.
|
||||
|
||||
#include "mem_ARMCA9.h"
|
||||
|
||||
SDRAM __ROM_BASE __ROM_SIZE ; load region size_region
|
||||
{
|
||||
VECTORS __ROM_BASE __ROM_SIZE ; load address = execution address
|
||||
{
|
||||
* (RESET, +FIRST) ; Vector table and other startup code
|
||||
* (InRoot$$Sections) ; All (library) code that must be in a root region
|
||||
* (+RO-CODE) ; Application RO code (.text)
|
||||
* (+RO-DATA) ; Application RO data (.constdata)
|
||||
}
|
||||
|
||||
RW_DATA __RAM_BASE __RW_DATA_SIZE
|
||||
{ * (+RW) } ; Application RW data (.data)
|
||||
|
||||
ZI_DATA (__RAM_BASE+
|
||||
__RW_DATA_SIZE) __ZI_DATA_SIZE
|
||||
{ * (+ZI) } ; Application ZI data (.bss)
|
||||
|
||||
ARM_LIB_HEAP (__RAM_BASE
|
||||
+__RW_DATA_SIZE
|
||||
+__ZI_DATA_SIZE) EMPTY __HEAP_SIZE ; Heap region growing up
|
||||
{ }
|
||||
|
||||
ARM_LIB_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE
|
||||
-__ABT_STACK_SIZE
|
||||
-__UND_STACK_SIZE) EMPTY -__STACK_SIZE ; Stack region growing down
|
||||
{ }
|
||||
|
||||
UND_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE
|
||||
-__ABT_STACK_SIZE) EMPTY -__UND_STACK_SIZE ; UND mode stack
|
||||
{ }
|
||||
|
||||
ABT_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE
|
||||
-__SVC_STACK_SIZE) EMPTY -__ABT_STACK_SIZE ; ABT mode stack
|
||||
{ }
|
||||
|
||||
SVC_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE
|
||||
-__IRQ_STACK_SIZE) EMPTY -__SVC_STACK_SIZE ; SVC mode stack
|
||||
{ }
|
||||
|
||||
IRQ_STACK (__RAM_BASE
|
||||
+__RAM_SIZE
|
||||
-__FIQ_STACK_SIZE) EMPTY -__IRQ_STACK_SIZE ; IRQ mode stack
|
||||
{ }
|
||||
|
||||
FIQ_STACK (__RAM_BASE
|
||||
+__RAM_SIZE) EMPTY -__FIQ_STACK_SIZE ; FIQ mode stack
|
||||
{ }
|
||||
|
||||
TTB __TTB_BASE EMPTY __TTB_SIZE ; Level-1 Translation Table for MMU
|
||||
{ }
|
||||
}
|
136
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC6/startup_ARMCA9.c
vendored
Normal file
136
external/CMSIS_5/Device/ARM/ARMCA9/Source/AC6/startup_ARMCA9.c
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
/******************************************************************************
|
||||
* @file startup_ARMCA9.c
|
||||
* @brief CMSIS Device System Source File for Arm Cortex-A9 Device Series
|
||||
* @version V1.0.1
|
||||
* @date 10. January 2021
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2021 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
|
||||
*
|
||||
* 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 <ARMCA9.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define USR_MODE 0x10 // User mode
|
||||
#define FIQ_MODE 0x11 // Fast Interrupt Request mode
|
||||
#define IRQ_MODE 0x12 // Interrupt Request mode
|
||||
#define SVC_MODE 0x13 // Supervisor mode
|
||||
#define ABT_MODE 0x17 // Abort mode
|
||||
#define UND_MODE 0x1B // Undefined Instruction mode
|
||||
#define SYS_MODE 0x1F // System mode
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Internal References
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Vectors (void) __attribute__ ((naked, section("RESET")));
|
||||
void Reset_Handler (void) __attribute__ ((naked));
|
||||
void Default_Handler(void) __attribute__ ((noreturn));
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Handler
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Undef_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void DAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void FIQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector Table
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Vectors(void) {
|
||||
__ASM volatile(
|
||||
"LDR PC, =Reset_Handler \n"
|
||||
"LDR PC, =Undef_Handler \n"
|
||||
"LDR PC, =SVC_Handler \n"
|
||||
"LDR PC, =PAbt_Handler \n"
|
||||
"LDR PC, =DAbt_Handler \n"
|
||||
"NOP \n"
|
||||
"LDR PC, =IRQ_Handler \n"
|
||||
"LDR PC, =FIQ_Handler \n"
|
||||
);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Reset Handler called on controller reset
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Reset_Handler(void) {
|
||||
__ASM volatile(
|
||||
|
||||
// Mask interrupts
|
||||
"CPSID if \n"
|
||||
|
||||
// Put any cores other than 0 to sleep
|
||||
"MRC p15, 0, R0, c0, c0, 5 \n" // Read MPIDR
|
||||
"ANDS R0, R0, #3 \n"
|
||||
"goToSleep: \n"
|
||||
"WFINE \n"
|
||||
"BNE goToSleep \n"
|
||||
|
||||
// Reset SCTLR Settings
|
||||
"MRC p15, 0, R0, c1, c0, 0 \n" // Read CP15 System Control register
|
||||
"BIC R0, R0, #(0x1 << 12) \n" // Clear I bit 12 to disable I Cache
|
||||
"BIC R0, R0, #(0x1 << 2) \n" // Clear C bit 2 to disable D Cache
|
||||
"BIC R0, R0, #0x1 \n" // Clear M bit 0 to disable MMU
|
||||
"BIC R0, R0, #(0x1 << 11) \n" // Clear Z bit 11 to disable branch prediction
|
||||
"BIC R0, R0, #(0x1 << 13) \n" // Clear V bit 13 to disable hivecs
|
||||
"MCR p15, 0, R0, c1, c0, 0 \n" // Write value back to CP15 System Control register
|
||||
"ISB \n"
|
||||
|
||||
// Configure ACTLR
|
||||
"MRC p15, 0, r0, c1, c0, 1 \n" // Read CP15 Auxiliary Control Register
|
||||
"ORR r0, r0, #(1 << 1) \n" // Enable L2 prefetch hint (UNK/WI since r4p1)
|
||||
"MCR p15, 0, r0, c1, c0, 1 \n" // Write CP15 Auxiliary Control Register
|
||||
|
||||
// Set Vector Base Address Register (VBAR) to point to this application's vector table
|
||||
"LDR R0, =Vectors \n"
|
||||
"MCR p15, 0, R0, c12, c0, 0 \n"
|
||||
|
||||
// Setup Stack for each exceptional mode
|
||||
"CPS #0x11 \n"
|
||||
"LDR SP, =Image$$FIQ_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x12 \n"
|
||||
"LDR SP, =Image$$IRQ_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x13 \n"
|
||||
"LDR SP, =Image$$SVC_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x17 \n"
|
||||
"LDR SP, =Image$$ABT_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x1B \n"
|
||||
"LDR SP, =Image$$UND_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x1F \n"
|
||||
"LDR SP, =Image$$ARM_LIB_STACK$$ZI$$Limit \n"
|
||||
|
||||
// Call SystemInit
|
||||
"BL SystemInit \n"
|
||||
|
||||
// Unmask interrupts
|
||||
"CPSIE if \n"
|
||||
|
||||
// Call __main
|
||||
"BL __main \n"
|
||||
);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Default Handler for Exceptions / Interrupts
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Default_Handler(void) {
|
||||
while(1);
|
||||
}
|
181
external/CMSIS_5/Device/ARM/ARMCA9/Source/GCC/ARMCA9.ld
vendored
Normal file
181
external/CMSIS_5/Device/ARM/ARMCA9/Source/GCC/ARMCA9.ld
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
#include "mem_ARMCA9.h"
|
||||
|
||||
MEMORY
|
||||
{
|
||||
ROM (rx) : ORIGIN = __ROM_BASE, LENGTH = __ROM_SIZE
|
||||
L_TTB (rw) : ORIGIN = __TTB_BASE, LENGTH = __TTB_SIZE
|
||||
RAM (rwx) : ORIGIN = __RAM_BASE, LENGTH = __RAM_SIZE
|
||||
}
|
||||
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
|
||||
Image$$VECTORS$$Base = .;
|
||||
* (RESET)
|
||||
KEEP(*(.isr_vector))
|
||||
Image$$VECTORS$$Limit = .;
|
||||
|
||||
*(SVC_TABLE)
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
Image$$RO_DATA$$Base = .;
|
||||
*(.rodata*)
|
||||
Image$$RO_DATA$$Limit = .;
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > ROM
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > ROM
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > ROM
|
||||
__exidx_end = .;
|
||||
|
||||
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > ROM
|
||||
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > ROM
|
||||
|
||||
__etext = .;
|
||||
|
||||
.ttb :
|
||||
{
|
||||
Image$$TTB$$ZI$$Base = .;
|
||||
. += __TTB_SIZE;
|
||||
Image$$TTB$$ZI$$Limit = .;
|
||||
} > L_TTB
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
Image$$RW_DATA$$Base = .;
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
Image$$RW_DATA$$Limit = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
|
||||
.bss ALIGN(0x400):
|
||||
{
|
||||
Image$$ZI_DATA$$Base = .;
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
__bss_end__ = .;
|
||||
Image$$ZI_DATA$$Limit = .;
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
} > RAM
|
||||
|
||||
#if defined(__HEAP_SIZE) && (__HEAP_SIZE > 0)
|
||||
.heap (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
Image$$HEAP$$ZI$$Base = .;
|
||||
. += __HEAP_SIZE;
|
||||
Image$$HEAP$$ZI$$Limit = .;
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
#endif
|
||||
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ORIGIN(RAM) + LENGTH(RAM) - __STACK_SIZE - __FIQ_STACK_SIZE - __IRQ_STACK_SIZE - __SVC_STACK_SIZE - __ABT_STACK_SIZE - __UND_STACK_SIZE;
|
||||
. = ALIGN(8);
|
||||
|
||||
__StackTop = .;
|
||||
Image$$SYS_STACK$$ZI$$Base = .;
|
||||
. += __STACK_SIZE;
|
||||
Image$$SYS_STACK$$ZI$$Limit = .;
|
||||
__stack = .;
|
||||
|
||||
Image$$FIQ_STACK$$ZI$$Base = .;
|
||||
. += __FIQ_STACK_SIZE;
|
||||
Image$$FIQ_STACK$$ZI$$Limit = .;
|
||||
|
||||
Image$$IRQ_STACK$$ZI$$Base = .;
|
||||
. += __IRQ_STACK_SIZE;
|
||||
Image$$IRQ_STACK$$ZI$$Limit = .;
|
||||
|
||||
Image$$SVC_STACK$$ZI$$Base = .;
|
||||
. += __SVC_STACK_SIZE;
|
||||
Image$$SVC_STACK$$ZI$$Limit = .;
|
||||
|
||||
Image$$ABT_STACK$$ZI$$Base = .;
|
||||
. += __ABT_STACK_SIZE;
|
||||
Image$$ABT_STACK$$ZI$$Limit = .;
|
||||
|
||||
Image$$UND_STACK$$ZI$$Base = .;
|
||||
. += __UND_STACK_SIZE;
|
||||
Image$$UND_STACK$$ZI$$Limit = .;
|
||||
|
||||
} > RAM
|
||||
}
|
136
external/CMSIS_5/Device/ARM/ARMCA9/Source/GCC/startup_ARMCA9.c
vendored
Normal file
136
external/CMSIS_5/Device/ARM/ARMCA9/Source/GCC/startup_ARMCA9.c
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
/******************************************************************************
|
||||
* @file startup_ARMCA9.c
|
||||
* @brief CMSIS Device System Source File for Arm Cortex-A9 Device Series
|
||||
* @version V1.0.1
|
||||
* @date 10. January 2021
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2021 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
|
||||
*
|
||||
* 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 <ARMCA9.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define USR_MODE 0x10 // User mode
|
||||
#define FIQ_MODE 0x11 // Fast Interrupt Request mode
|
||||
#define IRQ_MODE 0x12 // Interrupt Request mode
|
||||
#define SVC_MODE 0x13 // Supervisor mode
|
||||
#define ABT_MODE 0x17 // Abort mode
|
||||
#define UND_MODE 0x1B // Undefined Instruction mode
|
||||
#define SYS_MODE 0x1F // System mode
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Internal References
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Vectors (void) __attribute__ ((naked, section("RESET")));
|
||||
void Reset_Handler (void) __attribute__ ((naked));
|
||||
void Default_Handler(void);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Handler
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Undef_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void PAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void DAbt_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void IRQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
void FIQ_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector Table
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Vectors(void) {
|
||||
__ASM volatile(
|
||||
"LDR PC, =Reset_Handler \n"
|
||||
"LDR PC, =Undef_Handler \n"
|
||||
"LDR PC, =SVC_Handler \n"
|
||||
"LDR PC, =PAbt_Handler \n"
|
||||
"LDR PC, =DAbt_Handler \n"
|
||||
"NOP \n"
|
||||
"LDR PC, =IRQ_Handler \n"
|
||||
"LDR PC, =FIQ_Handler \n"
|
||||
);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Reset Handler called on controller reset
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Reset_Handler(void) {
|
||||
__ASM volatile(
|
||||
|
||||
// Mask interrupts
|
||||
"CPSID if \n"
|
||||
|
||||
// Put any cores other than 0 to sleep
|
||||
"MRC p15, 0, R0, c0, c0, 5 \n" // Read MPIDR
|
||||
"ANDS R0, R0, #3 \n"
|
||||
"goToSleep: \n"
|
||||
"WFINE \n"
|
||||
"BNE goToSleep \n"
|
||||
|
||||
// Reset SCTLR Settings
|
||||
"MRC p15, 0, R0, c1, c0, 0 \n" // Read CP15 System Control register
|
||||
"BIC R0, R0, #(0x1 << 12) \n" // Clear I bit 12 to disable I Cache
|
||||
"BIC R0, R0, #(0x1 << 2) \n" // Clear C bit 2 to disable D Cache
|
||||
"BIC R0, R0, #0x1 \n" // Clear M bit 0 to disable MMU
|
||||
"BIC R0, R0, #(0x1 << 11) \n" // Clear Z bit 11 to disable branch prediction
|
||||
"BIC R0, R0, #(0x1 << 13) \n" // Clear V bit 13 to disable hivecs
|
||||
"MCR p15, 0, R0, c1, c0, 0 \n" // Write value back to CP15 System Control register
|
||||
"ISB \n"
|
||||
|
||||
// Configure ACTLR
|
||||
"MRC p15, 0, r0, c1, c0, 1 \n" // Read CP15 Auxiliary Control Register
|
||||
"ORR r0, r0, #(1 << 1) \n" // Enable L2 prefetch hint (UNK/WI since r4p1)
|
||||
"MCR p15, 0, r0, c1, c0, 1 \n" // Write CP15 Auxiliary Control Register
|
||||
|
||||
// Set Vector Base Address Register (VBAR) to point to this application's vector table
|
||||
"LDR R0, =Vectors \n"
|
||||
"MCR p15, 0, R0, c12, c0, 0 \n"
|
||||
|
||||
// Setup Stack for each exceptional mode
|
||||
"CPS #0x11 \n"
|
||||
"LDR SP, =Image$$FIQ_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x12 \n"
|
||||
"LDR SP, =Image$$IRQ_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x13 \n"
|
||||
"LDR SP, =Image$$SVC_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x17 \n"
|
||||
"LDR SP, =Image$$ABT_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x1B \n"
|
||||
"LDR SP, =Image$$UND_STACK$$ZI$$Limit \n"
|
||||
"CPS #0x1F \n"
|
||||
"LDR SP, =Image$$SYS_STACK$$ZI$$Limit \n"
|
||||
|
||||
// Call SystemInit
|
||||
"BL SystemInit \n"
|
||||
|
||||
// Unmask interrupts
|
||||
"CPSIE if \n"
|
||||
|
||||
// Call __main
|
||||
"BL _start \n"
|
||||
);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Default Handler for Exceptions / Interrupts
|
||||
*----------------------------------------------------------------------------*/
|
||||
void Default_Handler(void) {
|
||||
while(1);
|
||||
}
|
67
external/CMSIS_5/Device/ARM/ARMCA9/Source/IAR/ARMCA9.icf
vendored
Normal file
67
external/CMSIS_5/Device/ARM/ARMCA9/Source/IAR/ARMCA9.icf
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_IROM1_start__ = 0x80000000;
|
||||
define symbol __ICFEDIT_region_IROM1_end__ = 0x801FFFFF;
|
||||
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IRAM1_start__ = 0x80200000;
|
||||
define symbol __ICFEDIT_region_IRAM1_end__ = 0x803FFFFF;
|
||||
define symbol __ICFEDIT_region_IRAM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_IRAM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM1_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM1_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM2_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_TTB_start__ = 0x80500000;
|
||||
define symbol __ICFEDIT_region_TTB_end__ = 0x805FFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x8000;
|
||||
define symbol __ICFEDIT_size_ttb__ = 0x4000;
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region IROM_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__]
|
||||
| mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
|
||||
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
|
||||
| mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
|
||||
define region ERAM_region = mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
|
||||
| mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
|
||||
| mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
|
||||
define region TTB_region = mem:[from __ICFEDIT_region_TTB_start__ to __ICFEDIT_region_TTB_end__ ];
|
||||
|
||||
define block USR_STACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
define block TTB with alignment = 8, size = __ICFEDIT_size_ttb__ { section TTB };
|
||||
|
||||
do not initialize { section .noinit };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
|
||||
{
|
||||
// Required in a multi-threaded application
|
||||
initialize by copy with packing = none { section __DLIB_PERTHREAD };
|
||||
}
|
||||
|
||||
place at address mem:__ICFEDIT_region_IROM1_start__ { readonly section RESET };
|
||||
place in IROM_region { readonly };
|
||||
place in IRAM_region { readwrite, block HEAP, block USR_STACK, block IRQ_STACK, block FIQ_STACK, block SVC_STACK, block ABT_STACK, block UND_STACK };
|
||||
place in TTB_region { block TTB };
|
140
external/CMSIS_5/Device/ARM/ARMCA9/Source/IAR/startup_ARMCA9.s
vendored
Normal file
140
external/CMSIS_5/Device/ARM/ARMCA9/Source/IAR/startup_ARMCA9.s
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
/******************************************************************************
|
||||
* @file startup_ARMCA9.s
|
||||
* @brief CMSIS Device System Source File for ARM Cortex-A9 Device Series
|
||||
* @version V1.00
|
||||
* @date 01 Nov 2017
|
||||
*
|
||||
* @note
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2017 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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
MODULE ?startup_ARMCA9
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Handler
|
||||
*----------------------------------------------------------------------------*/
|
||||
PUBLIC Reset_Handler
|
||||
PUBWEAK Undef_Handler
|
||||
PUBWEAK SVC_Handler
|
||||
PUBWEAK PAbt_Handler
|
||||
PUBWEAK DAbt_Handler
|
||||
PUBWEAK IRQ_Handler
|
||||
PUBWEAK FIQ_Handler
|
||||
|
||||
SECTION SVC_STACK:DATA:NOROOT(3)
|
||||
SECTION IRQ_STACK:DATA:NOROOT(3)
|
||||
SECTION FIQ_STACK:DATA:NOROOT(3)
|
||||
SECTION ABT_STACK:DATA:NOROOT(3)
|
||||
SECTION UND_STACK:DATA:NOROOT(3)
|
||||
SECTION USR_STACK:DATA:NOROOT(3)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Exception / Interrupt Vector Table
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
section RESET:CODE:NOROOT(2)
|
||||
PUBLIC Vectors
|
||||
|
||||
Vectors:
|
||||
LDR PC, =Reset_Handler
|
||||
LDR PC, =Undef_Handler
|
||||
LDR PC, =SVC_Handler
|
||||
LDR PC, =PAbt_Handler
|
||||
LDR PC, =DAbt_Handler
|
||||
NOP
|
||||
LDR PC, =IRQ_Handler
|
||||
LDR PC, =FIQ_Handler
|
||||
|
||||
|
||||
section .text:CODE:NOROOT(2)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Reset Handler called on controller reset
|
||||
*----------------------------------------------------------------------------*/
|
||||
EXTERN SystemInit
|
||||
EXTERN __iar_program_start
|
||||
|
||||
Reset_Handler:
|
||||
|
||||
// Mask interrupts
|
||||
CPSID if
|
||||
|
||||
// Put any cores other than 0 to sleep
|
||||
MRC p15, 0, R0, c0, c0, 5
|
||||
ANDS R0, R0, #3
|
||||
goToSleep:
|
||||
WFINE
|
||||
BNE goToSleep
|
||||
|
||||
// Reset SCTLR Settings
|
||||
MRC p15, 0, R0, c1, c0, 0 // Read CP15 System Control register
|
||||
BIC R0, R0, #(0x1 << 12) // Clear I bit 12 to disable I Cache
|
||||
BIC R0, R0, #(0x1 << 2) // Clear C bit 2 to disable D Cache
|
||||
BIC R0, R0, #0x1 // Clear M bit 0 to disable MMU
|
||||
BIC R0, R0, #(0x1 << 11) // Clear Z bit 11 to disable branch prediction
|
||||
BIC R0, R0, #(0x1 << 13) // Clear V bit 13 to disable hivecs
|
||||
MCR p15, 0, R0, c1, c0, 0 // Write value back to CP15 System Control register
|
||||
ISB
|
||||
|
||||
// Configure ACTLR
|
||||
MRC p15, 0, r0, c1, c0, 1 // Read CP15 Auxiliary Control Register
|
||||
ORR r0, r0, #(1 << 1) // Enable L2 prefetch hint (UNK/WI since r4p1)
|
||||
MCR p15, 0, r0, c1, c0, 1 // Write CP15 Auxiliary Control Register
|
||||
|
||||
// Set Vector Base Address Register (VBAR) to point to this application's vector table
|
||||
LDR R0, =Vectors
|
||||
MCR p15, 0, R0, c12, c0, 0
|
||||
|
||||
// Setup Stack for each exception mode
|
||||
CPS #0x11
|
||||
LDR SP, =SFE(FIQ_STACK)
|
||||
CPS #0x12
|
||||
LDR SP, =SFE(IRQ_STACK)
|
||||
CPS #0x13
|
||||
LDR SP, =SFE(SVC_STACK)
|
||||
CPS #0x17
|
||||
LDR SP, =SFE(ABT_STACK)
|
||||
CPS #0x1B
|
||||
LDR SP, =SFE(UND_STACK)
|
||||
CPS #0x1F
|
||||
LDR SP, =SFE(USR_STACK)
|
||||
|
||||
// Call SystemInit
|
||||
BL SystemInit
|
||||
|
||||
// Unmask interrupts
|
||||
CPSIE if
|
||||
|
||||
// Call __iar_program_start
|
||||
BL __iar_program_start
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Default Handler for Exceptions / Interrupts
|
||||
*----------------------------------------------------------------------------*/
|
||||
Undef_Handler:
|
||||
SVC_Handler:
|
||||
PAbt_Handler:
|
||||
DAbt_Handler:
|
||||
IRQ_Handler:
|
||||
FIQ_Handler:
|
||||
Default_Handler:
|
||||
B .
|
||||
|
||||
END
|
232
external/CMSIS_5/Device/ARM/ARMCA9/Source/mmu_ARMCA9.c
vendored
Normal file
232
external/CMSIS_5/Device/ARM/ARMCA9/Source/mmu_ARMCA9.c
vendored
Normal file
@ -0,0 +1,232 @@
|
||||
/**************************************************************************//**
|
||||
* @file mmu_ARMCA9.c
|
||||
* @brief MMU Configuration for Arm Cortex-A9 Device Series
|
||||
* @version V1.2.0
|
||||
* @date 15. May 2019
|
||||
*
|
||||
* @note
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2019 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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Memory map description from: DUI0447G_v2m_p1_trm.pdf 4.2.2 Arm Cortex-A Series memory map
|
||||
|
||||
Memory Type
|
||||
0xffffffff |--------------------------| ------------
|
||||
| FLAG SYNC | Device Memory
|
||||
0xfffff000 |--------------------------| ------------
|
||||
| Fault | Fault
|
||||
0xfff00000 |--------------------------| ------------
|
||||
| | Normal
|
||||
| |
|
||||
| Daughterboard |
|
||||
| memory |
|
||||
| |
|
||||
0x80505000 |--------------------------| ------------
|
||||
|TTB (L2 Sync Flags ) 4k | Normal
|
||||
0x80504C00 |--------------------------| ------------
|
||||
|TTB (L2 Peripherals-B) 16k| Normal
|
||||
0x80504800 |--------------------------| ------------
|
||||
|TTB (L2 Peripherals-A) 16k| Normal
|
||||
0x80504400 |--------------------------| ------------
|
||||
|TTB (L2 Priv Periphs) 4k | Normal
|
||||
0x80504000 |--------------------------| ------------
|
||||
| TTB (L1 Descriptors) | Normal
|
||||
0x80500000 |--------------------------| ------------
|
||||
| Stack | Normal
|
||||
|--------------------------| ------------
|
||||
| Heap | Normal
|
||||
0x80400000 |--------------------------| ------------
|
||||
| ZI Data | Normal
|
||||
0x80300000 |--------------------------| ------------
|
||||
| RW Data | Normal
|
||||
0x80200000 |--------------------------| ------------
|
||||
| RO Data | Normal
|
||||
|--------------------------| ------------
|
||||
| RO Code | USH Normal
|
||||
0x80000000 |--------------------------| ------------
|
||||
| Daughterboard | Fault
|
||||
| HSB AXI buses |
|
||||
0x40000000 |--------------------------| ------------
|
||||
| Daughterboard | Fault
|
||||
| test chips peripherals |
|
||||
0x2c002000 |--------------------------| ------------
|
||||
| Private Address | Device Memory
|
||||
0x2c000000 |--------------------------| ------------
|
||||
| Daughterboard | Fault
|
||||
| test chips peripherals |
|
||||
0x20000000 |--------------------------| ------------
|
||||
| Peripherals | Device Memory RW/RO
|
||||
| | & Fault
|
||||
0x00000000 |--------------------------|
|
||||
*/
|
||||
|
||||
// L1 Cache info and restrictions about architecture of the caches (CCSIR register):
|
||||
// Write-Through support *not* available
|
||||
// Write-Back support available.
|
||||
// Read allocation support available.
|
||||
// Write allocation support available.
|
||||
|
||||
//Note: You should use the Shareable attribute carefully.
|
||||
//For cores without coherency logic (such as SCU) marking a region as shareable forces the processor to not cache that region regardless of the inner cache settings.
|
||||
//Cortex-A versions of RTX use LDREX/STREX instructions relying on Local monitors. Local monitors will be used only when the region gets cached, regions that are not cached will use the Global Monitor.
|
||||
//Some Cortex-A implementations do not include Global Monitors, so wrongly setting the attribute Shareable may cause STREX to fail.
|
||||
|
||||
//Recall: When the Shareable attribute is applied to a memory region that is not Write-Back, Normal memory, data held in this region is treated as Non-cacheable.
|
||||
//When SMP bit = 0, Inner WB/WA Cacheable Shareable attributes are treated as Non-cacheable.
|
||||
//When SMP bit = 1, Inner WB/WA Cacheable Shareable attributes are treated as Cacheable.
|
||||
|
||||
|
||||
//Following MMU configuration is expected
|
||||
//SCTLR.AFE == 1 (Simplified access permissions model - AP[2:1] define access permissions, AP[0] is an access flag)
|
||||
//SCTLR.TRE == 0 (TEX remap disabled, so memory type and attributes are described directly by bits in the descriptor)
|
||||
//Domain 0 is always the Client domain
|
||||
//Descriptors should place all memory in domain 0
|
||||
|
||||
#include "ARMCA9.h"
|
||||
#include "mem_ARMCA9.h"
|
||||
|
||||
// TTB base address
|
||||
#define TTB_BASE ((uint32_t*)__TTB_BASE)
|
||||
|
||||
// L2 table pointers
|
||||
//----------------------------------------
|
||||
#define TTB_L1_SIZE (0x00004000) // The L1 translation table divides the full 4GB address space of a 32-bit core
|
||||
// into 4096 equally sized sections, each of which describes 1MB of virtual memory space.
|
||||
// The L1 translation table therefore contains 4096 32-bit (word-sized) entries.
|
||||
|
||||
#define PRIVATE_TABLE_L2_BASE_4k (__TTB_BASE + TTB_L1_SIZE) // Map 4k Private Address space
|
||||
#define PERIPHERAL_A_TABLE_L2_BASE_64k (__TTB_BASE + TTB_L1_SIZE + 0x400) // Map 64k Peripheral #1 0x1C000000 - 0x1C00FFFFF
|
||||
#define PERIPHERAL_B_TABLE_L2_BASE_64k (__TTB_BASE + TTB_L1_SIZE + 0x800) // Map 64k Peripheral #2 0x1C100000 - 0x1C1FFFFFF
|
||||
#define SYNC_FLAGS_TABLE_L2_BASE_4k (__TTB_BASE + TTB_L1_SIZE + 0xC00) // Map 4k Flag synchronization
|
||||
|
||||
//--------------------- PERIPHERALS -------------------
|
||||
#define PERIPHERAL_A_FAULT (0x00000000 + 0x1c000000) //0x1C000000-0x1C00FFFF (1M)
|
||||
#define PERIPHERAL_B_FAULT (0x00100000 + 0x1c000000) //0x1C100000-0x1C10FFFF (1M)
|
||||
|
||||
//--------------------- SYNC FLAGS --------------------
|
||||
#define FLAG_SYNC 0xFFFFF000
|
||||
#define F_SYNC_BASE 0xFFF00000 //1M aligned
|
||||
|
||||
static uint32_t Sect_Normal; //outer & inner wb/wa, non-shareable, executable, rw, domain 0, base addr 0
|
||||
static uint32_t Sect_Normal_Cod; //outer & inner wb/wa, non-shareable, executable, ro, domain 0, base addr 0
|
||||
static uint32_t Sect_Normal_RO; //as Sect_Normal_Cod, but not executable
|
||||
static uint32_t Sect_Normal_RW; //as Sect_Normal_Cod, but writeable and not executable
|
||||
static uint32_t Sect_Device_RO; //device, non-shareable, non-executable, ro, domain 0, base addr 0
|
||||
static uint32_t Sect_Device_RW; //as Sect_Device_RO, but writeable
|
||||
|
||||
/* Define global descriptors */
|
||||
static uint32_t Page_L1_4k = 0x0; //generic
|
||||
static uint32_t Page_L1_64k = 0x0; //generic
|
||||
static uint32_t Page_4k_Device_RW; //Shared device, not executable, rw, domain 0
|
||||
static uint32_t Page_64k_Device_RW; //Shared device, not executable, rw, domain 0
|
||||
|
||||
void MMU_CreateTranslationTable(void)
|
||||
{
|
||||
mmu_region_attributes_Type region;
|
||||
|
||||
//Create 4GB of faulting entries
|
||||
MMU_TTSection (TTB_BASE, 0, 4096, DESCRIPTOR_FAULT);
|
||||
|
||||
/*
|
||||
* Generate descriptors. Refer to core_ca.h to get information about attributes
|
||||
*
|
||||
*/
|
||||
//Create descriptors for Vectors, RO, RW, ZI sections
|
||||
section_normal(Sect_Normal, region);
|
||||
section_normal_cod(Sect_Normal_Cod, region);
|
||||
section_normal_ro(Sect_Normal_RO, region);
|
||||
section_normal_rw(Sect_Normal_RW, region);
|
||||
//Create descriptors for peripherals
|
||||
section_device_ro(Sect_Device_RO, region);
|
||||
section_device_rw(Sect_Device_RW, region);
|
||||
//Create descriptors for 64k pages
|
||||
page64k_device_rw(Page_L1_64k, Page_64k_Device_RW, region);
|
||||
//Create descriptors for 4k pages
|
||||
page4k_device_rw(Page_L1_4k, Page_4k_Device_RW, region);
|
||||
|
||||
|
||||
/*
|
||||
* Define MMU flat-map regions and attributes
|
||||
*
|
||||
*/
|
||||
|
||||
//Define Image
|
||||
MMU_TTSection (TTB_BASE, __ROM_BASE, __ROM_SIZE/0x100000, Sect_Normal_Cod); // multiple of 1MB sections
|
||||
MMU_TTSection (TTB_BASE, __RAM_BASE, __RAM_SIZE/0x100000, Sect_Normal_RW); // multiple of 1MB sections
|
||||
|
||||
//--------------------- PERIPHERALS -------------------
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_FLASH_BASE0 , 64, Sect_Device_RO); // 64MB NOR
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_FLASH_BASE1 , 64, Sect_Device_RO); // 64MB NOR
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_SRAM_BASE , 32, Sect_Device_RW); // 32MB RAM
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_VRAM_BASE , 32, Sect_Device_RW); // 32MB RAM
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_ETHERNET_BASE , 16, Sect_Device_RW);
|
||||
MMU_TTSection (TTB_BASE, VE_A9_MP_USB_BASE , 16, Sect_Device_RW);
|
||||
|
||||
// Create (16 * 64k)=1MB faulting entries to cover peripheral range 0x1C000000-0x1C00FFFF
|
||||
MMU_TTPage64k(TTB_BASE, PERIPHERAL_A_FAULT , 16, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, DESCRIPTOR_FAULT);
|
||||
// Define peripheral range 0x1C000000-0x1C00FFFF
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_DAP_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_SYSTEM_REG_BASE, 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_SERIAL_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_AACI_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_MMCI_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_KMI0_BASE , 2, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_UART_BASE , 4, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_WDT_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_A_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
|
||||
// Create (16 * 64k)=1MB faulting entries to cover peripheral range 0x1C100000-0x1C10FFFF
|
||||
MMU_TTPage64k(TTB_BASE, PERIPHERAL_B_FAULT , 16, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, DESCRIPTOR_FAULT);
|
||||
// Define peripheral range 0x1C100000-0x1C10FFFF
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_TIMER_BASE , 2, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_DVI_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_RTC_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_UART4_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
MMU_TTPage64k(TTB_BASE, VE_A9_MP_CLCD_BASE , 1, Page_L1_64k, (uint32_t *)PERIPHERAL_B_TABLE_L2_BASE_64k, Page_64k_Device_RW);
|
||||
|
||||
// Create (256 * 4k)=1MB faulting entries to cover private address space. Needs to be marked as Device memory
|
||||
MMU_TTPage4k (TTB_BASE, __get_CBAR() ,256, Page_L1_4k, (uint32_t *)PRIVATE_TABLE_L2_BASE_4k, DESCRIPTOR_FAULT);
|
||||
// Define private address space entry.
|
||||
MMU_TTPage4k (TTB_BASE, __get_CBAR() , 2, Page_L1_4k, (uint32_t *)PRIVATE_TABLE_L2_BASE_4k, Page_4k_Device_RW);
|
||||
// Define L2CC entry. Uncomment if PL310 is present
|
||||
// MMU_TTPage4k (TTB_BASE, VE_A5_MP_PL310_BASE , 1, Page_L1_4k, (uint32_t *)PRIVATE_TABLE_L2_BASE_4k, Page_4k_Device_RW);
|
||||
|
||||
// Create (256 * 4k)=1MB faulting entries to synchronization space (Useful if some non-cacheable DMA agent is present in the SoC)
|
||||
MMU_TTPage4k (TTB_BASE, F_SYNC_BASE , 256, Page_L1_4k, (uint32_t *)SYNC_FLAGS_TABLE_L2_BASE_4k, DESCRIPTOR_FAULT);
|
||||
// Define synchronization space entry.
|
||||
MMU_TTPage4k (TTB_BASE, FLAG_SYNC , 1, Page_L1_4k, (uint32_t *)SYNC_FLAGS_TABLE_L2_BASE_4k, Page_4k_Device_RW);
|
||||
|
||||
/* Set location of level 1 page table
|
||||
; 31:14 - Translation table base addr (31:14-TTBCR.N, TTBCR.N is 0 out of reset)
|
||||
; 13:7 - 0x0
|
||||
; 6 - IRGN[0] 0x1 (Inner WB WA)
|
||||
; 5 - NOS 0x0 (Non-shared)
|
||||
; 4:3 - RGN 0x01 (Outer WB WA)
|
||||
; 2 - IMP 0x0 (Implementation Defined)
|
||||
; 1 - S 0x0 (Non-shared)
|
||||
; 0 - IRGN[1] 0x0 (Inner WB WA) */
|
||||
__set_TTBR0(__TTB_BASE | 0x48);
|
||||
__ISB();
|
||||
|
||||
/* Set up domain access control register
|
||||
; We set domain 0 to Client and all other domains to No Access.
|
||||
; All translation table entries specify domain 0 */
|
||||
__set_DACR(1);
|
||||
__ISB();
|
||||
}
|
93
external/CMSIS_5/Device/ARM/ARMCA9/Source/system_ARMCA9.c
vendored
Normal file
93
external/CMSIS_5/Device/ARM/ARMCA9/Source/system_ARMCA9.c
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
/******************************************************************************
|
||||
* @file system_ARMCA9.c
|
||||
* @brief CMSIS Device System Source File for Arm Cortex-A9 Device Series
|
||||
* @version V1.0.1
|
||||
* @date 13. February 2019
|
||||
*
|
||||
* @note
|
||||
*
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2019 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
|
||||
*
|
||||
* 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 "RTE_Components.h"
|
||||
#include CMSIS_device_header
|
||||
#include "irq_ctrl.h"
|
||||
|
||||
#define SYSTEM_CLOCK 12000000U
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
System Core Clock Variable
|
||||
*----------------------------------------------------------------------------*/
|
||||
uint32_t SystemCoreClock = SYSTEM_CLOCK;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
System Core Clock update function
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemCoreClockUpdate (void)
|
||||
{
|
||||
SystemCoreClock = SYSTEM_CLOCK;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
System Initialization
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemInit (void)
|
||||
{
|
||||
/* do not use global variables because this function is called before
|
||||
reaching pre-main. RW section may be overwritten afterwards. */
|
||||
|
||||
// Invalidate entire Unified TLB
|
||||
__set_TLBIALL(0);
|
||||
|
||||
// Invalidate entire branch predictor array
|
||||
__set_BPIALL(0);
|
||||
__DSB();
|
||||
__ISB();
|
||||
|
||||
// Invalidate instruction cache and flush branch target cache
|
||||
__set_ICIALLU(0);
|
||||
__DSB();
|
||||
__ISB();
|
||||
|
||||
// Invalidate data cache
|
||||
L1C_InvalidateDCacheAll();
|
||||
|
||||
#if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
|
||||
// Enable FPU
|
||||
__FPU_Enable();
|
||||
#endif
|
||||
|
||||
// Create Translation Table
|
||||
MMU_CreateTranslationTable();
|
||||
|
||||
// Enable MMU
|
||||
MMU_Enable();
|
||||
|
||||
// Enable Caches
|
||||
L1C_EnableCaches();
|
||||
L1C_EnableBTAC();
|
||||
|
||||
#if (__L2C_PRESENT == 1)
|
||||
// Enable GIC
|
||||
L2C_Enable();
|
||||
#endif
|
||||
|
||||
// IRQ Initialize
|
||||
IRQ_Initialize();
|
||||
}
|
Reference in New Issue
Block a user