[PATCH v3] arm/raspberrypi: Fix linker map

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 29 07:07:44 UTC 2019


Add NULL-pointer protection.  Make MMU table read-only.  Move vector
table to start section.

Close #3774.
---
 bsps/arm/raspberrypi/start/bspstarthooks.c |  2 +-
 bsps/arm/raspberrypi/start/linkcmds        | 34 +++++++-----------------------
 2 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/bsps/arm/raspberrypi/start/bspstarthooks.c b/bsps/arm/raspberrypi/start/bspstarthooks.c
index b39c8b1959..3f8c680bc0 100644
--- a/bsps/arm/raspberrypi/start/bspstarthooks.c
+++ b/bsps/arm/raspberrypi/start/bspstarthooks.c
@@ -87,7 +87,7 @@ void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
   arm_cp15_set_translation_table_base_control_register(0);
 
   /* Clear Secure or Non-secure Vector Base Address Register */
-  arm_cp15_set_vector_base_address(0);
+  arm_cp15_set_vector_base_address(bsp_vector_table_begin);
 
 #ifdef RTEMS_SMP
   if (cpu_index_self == 0) {
diff --git a/bsps/arm/raspberrypi/start/linkcmds b/bsps/arm/raspberrypi/start/linkcmds
index 58423abecb..7a1bcbac73 100644
--- a/bsps/arm/raspberrypi/start/linkcmds
+++ b/bsps/arm/raspberrypi/start/linkcmds
@@ -14,35 +14,13 @@
  * @brief Raspberry Pi memory map.
  */
 
-/**
- * <table>
- *   <tr><th>Region Name</th><th>Region Begin</th><th>Region Size</th></tr>
- * <tr><td>VECTOR_RAM</td><td>0x08000000</td><td>8k</td></tr>
- * <tr><td>RAM</td><td>0x80008000</td><td>128M</td></tr>
- * </table>
- *
- * <table>
- *   <tr><th>Section Name</th><th>Section Runtime Region</th><th>Section Load Region</th></tr>
- * <tr><td>.start</td><td>RAM</td><td></td></tr>
- * <tr><td>.vector</td><td>VECTOR_RAM</td><td></td></tr>
- * <tr><td>.text</td><td>RAM</td><td>RAM_EXT</td></tr>
- * <tr><td>.rodata</td><td>RAM</td><td>RAM_EXT</td></tr>
- * <tr><td>.data</td><td>RAM</td><td>RAM_EXT</td></tr>
- * <tr><td>.fast</td><td>RAM</td><td>RAM_EXT</td></tr>
- * <tr><td>.bss</td><td>RAM</td><td></td></tr>
- * <tr><td>.work</td><td>RAM</td><td></td></tr>
- * <tr><td>.stack</td><td>RAM</td><td></td></tr>
- * </table>
- */
-
 MEMORY {
-        VECTOR_RAM     (AIW) : ORIGIN = 0x0       , LENGTH = 16k
-	RAM_MMU        (AIW) : ORIGIN = 0x00004000, LENGTH = 16k
-        RAM            (AIW) : ORIGIN = 0x00008000, LENGTH = 128M - 32k
+        RAM_MMU        (AIW) : ORIGIN = 0x00100000, LENGTH = 16k
+        RAM            (AIW) : ORIGIN = 0x00200000, LENGTH = 128M - 2M
 }
 
 REGION_ALIAS ("REGION_START", RAM);
-REGION_ALIAS ("REGION_VECTOR", VECTOR_RAM);
+REGION_ALIAS ("REGION_VECTOR", RAM);
 REGION_ALIAS ("REGION_TEXT", RAM);
 REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
 REGION_ALIAS ("REGION_RODATA", RAM);
@@ -61,7 +39,11 @@ REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM);
 
 bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024;
 
-bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1M;
+bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M;
+
+bsp_vector_table_in_start_section = 1;
+
 bsp_translation_table_base = ORIGIN (RAM_MMU);
+bsp_translation_table_end = ORIGIN (RAM_MMU) + LENGTH (RAM_MMU);
 
 INCLUDE linkcmds.armv4
-- 
2.16.4



More information about the devel mailing list