[PATCH 6/6] bsp/mpc55xx: Add custom work area init

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 15 13:13:57 UTC 2012


---
 c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am    |    3 +-
 .../libbsp/powerpc/mpc55xxevb/startup/bspstart.c   |   15 ------
 .../powerpc/mpc55xxevb/startup/bspworkareainit.c   |   48 ++++++++++++++++++++
 .../mpc55xxevb/startup/linkcmds.mpc5643l_evb       |    2 +-
 .../startup/linkcmds.mpc5674f_ecu508_app           |    2 +-
 .../startup/linkcmds.mpc5674f_ecu508_boot          |    2 +-
 6 files changed, 53 insertions(+), 19 deletions(-)
 create mode 100644 c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspworkareainit.c

diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
index ff8edbf..44e1997 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am
@@ -64,12 +64,13 @@ libbsp_a_SOURCES += ../../shared/bspclean.c
 libbsp_a_SOURCES += ../../shared/bsplibc.c
 libbsp_a_SOURCES += ../../shared/bsppost.c
 libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
-libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
+libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
 libbsp_a_SOURCES += ../../shared/src/stackalloc.c
 libbsp_a_SOURCES += ../shared/src/bsp-start-zero.S
 libbsp_a_SOURCES += ../shared/src/memcpy.c
 libbsp_a_SOURCES += ../shared/src/tictac.c
 libbsp_a_SOURCES += startup/bspstart.c
+libbsp_a_SOURCES += startup/bspworkareainit.c
 libbsp_a_SOURCES += startup/exc-vector-base.S
 libbsp_a_SOURCES += startup/get-system-clock.c
 libbsp_a_SOURCES += startup/reset.c
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
index 9bffd45..314930a 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
@@ -41,8 +41,6 @@
 #include <bsp/start.h>
 #include <bsp/mpc55xx-config.h>
 
-extern Heap_Control *RTEMS_Malloc_Heap;
-
 /* Symbols defined in linker command file */
 LINKER_SYMBOL(mpc55xx_exc_vector_base);
 
@@ -142,16 +140,3 @@ void bsp_start(void)
 		mpc55xx_emios_initialize(MPC55XX_EMIOS_PRESCALER);
 	#endif
 }
-
-void bsp_pretasking_hook(void)
-{
-	#if MPC55XX_CHIP_FAMILY == 564
-		_Heap_Extend(
-			RTEMS_Malloc_Heap,
-			bsp_section_rwextra_end,
-			(uintptr_t) bsp_ram_end
-				- (uintptr_t) bsp_section_rwextra_end,
-			NULL
-		);
-	#endif
-}
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspworkareainit.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspworkareainit.c
new file mode 100644
index 0000000..5c2cfee
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspworkareainit.c
@@ -0,0 +1,48 @@
+/**
+ * @file
+ *
+ * @ingroup mpc55xx
+ */
+
+/*
+ * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Obere Lagerstr. 30
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <bsp.h>
+#include <bsp/bootcard.h>
+#include <bsp/linker-symbols.h>
+
+LINKER_SYMBOL(bsp_external_ram_end);
+
+void bsp_work_area_initialize(void)
+{
+  Heap_Area areas [] = {
+    {
+      bsp_section_work_begin,
+      (uintptr_t) bsp_section_work_size
+    }, {
+      bsp_section_rwextra_end,
+      (uintptr_t) bsp_external_ram_end - (uintptr_t) bsp_section_rwextra_end
+    }
+  };
+
+  #ifdef BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
+    areas [0].begin = (char *) areas [0].begin + Configuration.interrupt_stack_size;
+    areas [0].size -= Configuration.interrupt_stack_size;
+  #endif
+
+  bsp_work_area_initialize_with_table(
+    areas,
+    sizeof(areas) / sizeof(areas [0])
+  );
+}
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb
index f9d2dc0..89f44f0 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb
@@ -2,7 +2,7 @@ MEMORY {
 	ROM : ORIGIN = 0x0, LENGTH = 1M
 	RAM : ORIGIN = 0x40000000, LENGTH = 64K
 	RAM_1 : ORIGIN = 0x50000000, LENGTH = 64K
-	RAM_EXT : ORIGIN = 0x0, LENGTH = 0
+	RAM_EXT : ORIGIN = 0x40010000, LENGTH = 0
 	NOCACHE : ORIGIN = 0x0, LENGTH = 0
 }
 
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app
index 662eeef..d2da307 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app
@@ -20,7 +20,7 @@ REGION_ALIAS ("REGION_DATA", RAM);
 REGION_ALIAS ("REGION_DATA_LOAD", ROM);
 REGION_ALIAS ("REGION_BSS", RAM);
 REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT);
-REGION_ALIAS ("REGION_WORK", RAM_EXT);
+REGION_ALIAS ("REGION_WORK", RAM);
 REGION_ALIAS ("REGION_STACK", RAM);
 REGION_ALIAS ("REGION_NOCACHE", NOCACHE);
 REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM);
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot
index 7fbcb2f..7ba0112 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot
@@ -18,7 +18,7 @@ REGION_ALIAS ("REGION_DATA", RAM);
 REGION_ALIAS ("REGION_DATA_LOAD", ROM);
 REGION_ALIAS ("REGION_BSS", RAM);
 REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT);
-REGION_ALIAS ("REGION_WORK", RAM_EXT);
+REGION_ALIAS ("REGION_WORK", RAM);
 REGION_ALIAS ("REGION_STACK", RAM);
 REGION_ALIAS ("REGION_NOCACHE", NOCACHE);
 REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM);
-- 
1.7.7




More information about the devel mailing list