aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/startup/ARM
diff options
context:
space:
mode:
Diffstat (limited to 'os/common/startup/ARM')
-rwxr-xr-xos/common/startup/ARM/compilers/GCC/ld/SAMA5D2bvddr.ld46
-rwxr-xr-xos/common/startup/ARM/compilers/GCC/ld/SAMA5D2ddr.ld39
-rw-r--r--os/common/startup/ARM/devices/SAMA5D2/mmu.c27
3 files changed, 57 insertions, 55 deletions
diff --git a/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2bvddr.ld b/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2bvddr.ld
deleted file mode 100755
index efa2f63d9..000000000
--- a/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2bvddr.ld
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
-
- 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.
-*/
-
-/*
- * SAMA5D2 memory setup in non trusted mode.
- */
-MEMORY
-{
- flash : org = 0x21000000, len = 16M
- ram0 : org = 0x22000000, len = 96M
- ram1 : org = 0x00000000, len = 0
- ram2 : org = 0x00000000, len = 0
- ram3 : org = 0x00000000, len = 0
- ram4 : org = 0x00000000, len = 0
- ram5 : org = 0x00000000, len = 0
- ram6 : org = 0x00000000, len = 0
- ram7 : org = 0x00000000, len = 0
-}
-
-/* RAM region to be used for stacks. This stack accommodates the processing
- of all exceptions and interrupts*/
-REGION_ALIAS("STACKS_RAM", ram0);
-
-/* RAM region to be used for data segment.*/
-REGION_ALIAS("DATA_RAM", ram0);
-
-/* RAM region to be used for BSS segment.*/
-REGION_ALIAS("BSS_RAM", ram0);
-
-INCLUDE rules.ld
-
-ENTRY(Boot_Handler);
-
diff --git a/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2ddr.ld b/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2ddr.ld
index e2bcb004a..087234cbf 100755
--- a/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2ddr.ld
+++ b/os/common/startup/ARM/compilers/GCC/ld/SAMA5D2ddr.ld
@@ -19,10 +19,10 @@
*/
MEMORY
{
- flash : org = 0x20000000, len = 16M
- ram0 : org = 0x21000000, len = 96M
- ram1 : org = 0x00000000, len = 0
- ram2 : org = 0x00000000, len = 0
+ flash : org = 0x21000000, len = 16M
+ ram0 : org = 0x22000000, len = 78M
+ ram1 : org = 0x26E00000, len = 1M
+ ram2 : org = 0x26F00000, len = 1M
ram3 : org = 0x00000000, len = 0
ram4 : org = 0x00000000, len = 0
ram5 : org = 0x00000000, len = 0
@@ -40,6 +40,37 @@ REGION_ALIAS("DATA_RAM", ram0);
/* RAM region to be used for BSS segment.*/
REGION_ALIAS("BSS_RAM", ram0);
+/* RAM region to be used for lcd frame buffer. */
+REGION_ALIAS("FB_RAM", ram1);
+
+/* RAM region to be used for no cache area. */
+REGION_ALIAS("NO_CACHE", ram2);
+
+SECTIONS
+{
+ /* Special section for frame buffer area.*/
+ .fbram (NOLOAD) : ALIGN(4)
+ {
+ __fbram_base__ = .;
+ *(.fbram)
+ *(.fbram.*)
+ *(.bss.__fbram_*)
+ . = ALIGN(4);
+ __fbram_end__ = .;
+ } > FB_RAM
+
+ /* Special section for no cache area.*/
+ .nocache (NOLOAD) : ALIGN(4)
+ {
+ __nocache_base__ = .;
+ *(.nocache)
+ *(.nocache.*)
+ *(.bss.__nocache_*)
+ . = ALIGN(4);
+ __nocache_end__ = .;
+ } > NO_CACHE
+}
+
INCLUDE rules.ld
ENTRY(Boot_Handler);
diff --git a/os/common/startup/ARM/devices/SAMA5D2/mmu.c b/os/common/startup/ARM/devices/SAMA5D2/mmu.c
index a4f3b0ea0..449019526 100644
--- a/os/common/startup/ARM/devices/SAMA5D2/mmu.c
+++ b/os/common/startup/ARM/devices/SAMA5D2/mmu.c
@@ -48,9 +48,17 @@
#define SAMA_L2CC_ENABLE 0
#endif
+#if (SAMA_L2CC_ASSUME_ENABLED && SAMA_L2CC_ENABLE)
+#error "These macros are mutually exclusive"
+#endif
+
/*===========================================================================*/
/* Module local definitions. */
/*===========================================================================*/
+/*
+ * @brief No cacheable memory start address.
+ */
+#define NO_CACHE_MEMORY_START_ADDR ((uint8_t *) 0x26F00000)
/*===========================================================================*/
/* Module exported variables. */
@@ -77,7 +85,7 @@
* +---------+--+-+--+-+-----+--------+-------+-+------+--+-+-+-+---+
* | section |NS|0|nG|S|AP[2]|TEX[2:0]|AP[1:0]| |domain|XN|C|B|1|PXN|
* +---------+--+-+--+-+-----+--------+-------+-+------+--+-+-+-+---+
- * | |0 |0|0 |1|0 |111 |11 |0|0000 |0 |1|1|1|0 | == normal, cacheable
+ * | |X |0|0 |0|0 |111 |11 |0|0000 |0 |1|1|1|0 | == normal, cacheable, write back, no write allocate
* | |0 |0|0 |1|0 |100 |11 |0|0000 |0 |0|0|1|0 | == normal, no-cacheable
* | |0 |0|0 |1|0 |000 |11 |0|0000 |0 |0|1|1|0 | == device
* | |0 |0|0 |1|0 |000 |11 |0|0000 |0 |0|0|1|0 | == strongly-ordered
@@ -121,8 +129,8 @@ void __core_init(void) {
Invalidate a disabled L1 D Cache.*/
pm = __get_SCTLR();
if ((pm & SCTLR_C_Msk)) {
- L1C_CleanInvalidateCache(DCISW_CLEAN);
L1C_DisableCaches();
+ L1C_CleanInvalidateCache(DCISW_CLEAN);
}
/* Disable the MMU and invalidate TLB.*/
@@ -164,7 +172,7 @@ void __core_init(void) {
TTE_SECT_MEM_CACHEABLE |
TTE_SECT_RW_ACCESS |
TTE_SECT_DOM(0x00) |
- TTE_SECT_S | TTE_TYPE_SECT;
+ TTE_TYPE_SECT;
/*
* UDPHS RAM region
*
@@ -264,7 +272,7 @@ void __core_init(void) {
TTE_SECT_MEM_CACHEABLE |
TTE_SECT_RW_ACCESS |
TTE_SECT_DOM(0x00) |
- TTE_SECT_S | TTE_TYPE_SECT;
+ TTE_TYPE_SECT;
/*
* DDR AESB regions
*
@@ -275,7 +283,7 @@ void __core_init(void) {
TTE_SECT_MEM_CACHEABLE |
TTE_SECT_RW_ACCESS |
TTE_SECT_DOM(0x00) |
- TTE_SECT_S | TTE_TYPE_SECT;
+ TTE_TYPE_SECT;
/*
* EBI 1, 2 and 3 regions
*
@@ -360,6 +368,9 @@ void __core_init(void) {
TTE_SECT_EXE_NEVER |
TTE_SECT_S | TTE_TYPE_SECT;
+ /* Make a NO CACHE AREA */
+ MMU_MemorySection((mmuTable + ((uint32_t)NO_CACHE_MEMORY_START_ADDR >> 20)), NORMAL, NON_CACHEABLE, NON_CACHEABLE);
+
/* Invalidate TLB and L1 I cache
Enable caches and MMU.*/
MMU_InvalidateTLB();
@@ -395,11 +406,17 @@ void __core_init(void) {
/* Invalidate and enable L2 cache.*/
L2C_InvAllByWay();
+ L2C_310->AUX_CNT = L2CC_ACR_DPEN | L2CC_ACR_IPEN;
+
+ /* Prefetch control register. Double linefeed, instr and data enabled.*/
+ *((uint32_t *)((char *)L2C_310+0x0F60)) = 0x75800001;
L2C_Enable();
__DSB();
__ISB();
}
#endif
+
+
#endif
}