[rtems commit] bsp/atsam: Add nocache region support

Sebastian Huber sebh at rtems.org
Thu Mar 31 11:19:45 UTC 2016


Module:    rtems
Branch:    master
Commit:    0bd49f153538be814cd9333a79f920d94c1b7324
Changeset: http://git.rtems.org/rtems/commit/?id=0bd49f153538be814cd9333a79f920d94c1b7324

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Mar 22 08:34:16 2016 +0100

bsp/atsam: Add nocache region support

---

 .../lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c  | 1 +
 c/src/lib/libbsp/arm/atsam/startup/bspstart.c                        | 5 +++++
 c/src/lib/libbsp/arm/atsam/startup/linkcmds                          | 2 +-
 c/src/lib/libbsp/arm/atsam/startup/linkcmds.intsram                  | 2 +-
 c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in                | 3 ++-
 c/src/lib/libbsp/arm/atsam/startup/linkcmds.sdram                    | 2 +-
 6 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c b/c/src/lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c
index 254e529..660d54e 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libboard/source/board_lowlevel.c
@@ -40,6 +40,7 @@
 #ifndef __rtems__
 #include "board.h"
 #else /* __rtems__ */
+#define MPU_HAS_NOCACHE_REGION
 #include <chip.h>
 #include <include/board_lowlevel.h>
 #endif /* __rtems__ */
diff --git a/c/src/lib/libbsp/arm/atsam/startup/bspstart.c b/c/src/lib/libbsp/arm/atsam/startup/bspstart.c
index 55b16cf..b463bab 100644
--- a/c/src/lib/libbsp/arm/atsam/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/atsam/startup/bspstart.c
@@ -16,6 +16,7 @@
 #include <bsp/bootcard.h>
 #include <bsp/irq.h>
 #include <bsp/irq-generic.h>
+#include <bsp/linker-symbols.h>
 
 #include <chip.h>
 
@@ -29,4 +30,8 @@ void bsp_start(void)
   bsp_interrupt_initialize();
   SCB_CleanDCache();
   SCB_InvalidateICache();
+  rtems_cache_coherent_add_area(
+    bsp_section_nocacheheap_begin,
+    (uintptr_t) bsp_section_nocacheheap_size
+  );
 }
diff --git a/c/src/lib/libbsp/arm/atsam/startup/linkcmds b/c/src/lib/libbsp/arm/atsam/startup/linkcmds
index 61aff87..79cdfc2 100644
--- a/c/src/lib/libbsp/arm/atsam/startup/linkcmds
+++ b/c/src/lib/libbsp/arm/atsam/startup/linkcmds
@@ -15,7 +15,7 @@ REGION_ALIAS ("REGION_FAST_DATA_LOAD", INTFLASH);
 REGION_ALIAS ("REGION_BSS", INTSRAM);
 REGION_ALIAS ("REGION_WORK", INTSRAM);
 REGION_ALIAS ("REGION_STACK", INTSRAM);
-REGION_ALIAS ("REGION_NOCACHE", INTSRAM);
+REGION_ALIAS ("REGION_NOCACHE", NOCACHE);
 REGION_ALIAS ("REGION_NOCACHE_LOAD", INTFLASH);
 
 INCLUDE linkcmds.armv7m
diff --git a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.intsram b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.intsram
index 1a17ed3..3e9d07e 100644
--- a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.intsram
+++ b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.intsram
@@ -17,7 +17,7 @@ REGION_ALIAS ("REGION_FAST_DATA_LOAD", INTSRAM);
 REGION_ALIAS ("REGION_BSS", INTSRAM);
 REGION_ALIAS ("REGION_WORK", INTSRAM);
 REGION_ALIAS ("REGION_STACK", INTSRAM);
-REGION_ALIAS ("REGION_NOCACHE", INTSRAM);
+REGION_ALIAS ("REGION_NOCACHE", NOCACHE);
 REGION_ALIAS ("REGION_NOCACHE_LOAD", INTSRAM);
 
 INCLUDE linkcmds.armv7m
diff --git a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in
index 2da1284..6dd70ca 100644
--- a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in
+++ b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.memory.in
@@ -2,6 +2,7 @@ MEMORY {
 	ITCM      : ORIGIN = 0x00000000, LENGTH = @ATSAM_MEMORY_TCM_SIZE@
 	INTFLASH  : ORIGIN = 0x00400000, LENGTH = @ATSAM_MEMORY_INTFLASH_SIZE@
 	DTCM      : ORIGIN = 0x20000000, LENGTH = @ATSAM_MEMORY_TCM_SIZE@
-	INTSRAM   : ORIGIN = 0x20400000, LENGTH = @ATSAM_MEMORY_INTSRAM_SIZE@ - 2 * @ATSAM_MEMORY_TCM_SIZE@
+	INTSRAM   : ORIGIN = 0x20400000, LENGTH = @ATSAM_MEMORY_INTSRAM_SIZE@ - 2 * @ATSAM_MEMORY_TCM_SIZE@ - 4K
+	NOCACHE   : ORIGIN = 0x20400000 + @ATSAM_MEMORY_INTSRAM_SIZE@ - 2 * @ATSAM_MEMORY_TCM_SIZE@ - 4K, LENGTH = 4K
 	SDRAM     : ORIGIN = 0x70000000, LENGTH = @ATSAM_MEMORY_SDRAM_SIZE@
 }
diff --git a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.sdram b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.sdram
index 675e837..958b128 100644
--- a/c/src/lib/libbsp/arm/atsam/startup/linkcmds.sdram
+++ b/c/src/lib/libbsp/arm/atsam/startup/linkcmds.sdram
@@ -15,7 +15,7 @@ REGION_ALIAS ("REGION_FAST_DATA_LOAD", SDRAM);
 REGION_ALIAS ("REGION_BSS", SDRAM);
 REGION_ALIAS ("REGION_WORK", SDRAM);
 REGION_ALIAS ("REGION_STACK", SDRAM);
-REGION_ALIAS ("REGION_NOCACHE", SDRAM);
+REGION_ALIAS ("REGION_NOCACHE", NOCACHE);
 REGION_ALIAS ("REGION_NOCACHE_LOAD", SDRAM);
 
 INCLUDE linkcmds.armv7m



More information about the vc mailing list