[rtems commit] bsp/tms570: Initialize and enable caches on demand

Sebastian Huber sebh at rtems.org
Mon Jan 15 09:36:31 UTC 2024


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 21 15:16:49 2023 +0100

bsp/tms570: Initialize and enable caches on demand

Update #4982.

---

 bsps/arm/tms570/start/bspstarthooks.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/bsps/arm/tms570/start/bspstarthooks.c b/bsps/arm/tms570/start/bspstarthooks.c
index 81ad42f449..8dc7fdfdf8 100644
--- a/bsps/arm/tms570/start/bspstarthooks.c
+++ b/bsps/arm/tms570/start/bspstarthooks.c
@@ -40,9 +40,34 @@
  */
 
 #include <bsp/start.h>
+#include <libcpu/arm-cp15.h>
 
 BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
 {
+  uint32_t ctrl;
+  size_t size;
+
+  ctrl = arm_cp15_get_control();
+
+  if ( ( ctrl & ARM_CP15_CTRL_I ) == 0 ) {
+    rtems_cache_invalidate_entire_instruction();
+    ctrl |= ARM_CP15_CTRL_I;
+    arm_cp15_set_control(ctrl);
+  }
+
+  if ( ( ctrl & ARM_CP15_CTRL_C ) == 0 ) {
+    rtems_cache_invalidate_entire_data();
+    ctrl |= ARM_CP15_CTRL_C;
+    arm_cp15_set_control(ctrl);
+  }
+
   bsp_start_copy_sections_compact();
   bsp_start_clear_bss();
+
+  size =(size_t) bsp_section_fast_text_size;
+  RTEMS_OBFUSCATE_VARIABLE( size );
+
+  if ( size != 0 ) {
+    rtems_cache_flush_multiple_data_lines( bsp_section_fast_text_begin, size );
+  }
 }



More information about the vc mailing list