[rtems commit] bsp/leon3: Fix LEON3_Cpu_Index initialization

Sebastian Huber sebh at rtems.org
Tue Jun 21 13:55:04 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 21 09:10:28 2016 +0200

bsp/leon3: Fix LEON3_Cpu_Index initialization

---

 c/src/lib/libbsp/sparc/leon3/amba/amba.c              |  2 +-
 c/src/lib/libbsp/sparc/leon3/console/printk_support.c |  2 +-
 c/src/lib/libbsp/sparc/leon3/startup/bspstart.c       | 14 ++++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
index f1598b8..4b55a49 100644
--- a/c/src/lib/libbsp/sparc/leon3/amba/amba.c
+++ b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
@@ -162,5 +162,5 @@ static void amba_initialize(void)
 RTEMS_SYSINIT_ITEM(
   amba_initialize,
   RTEMS_SYSINIT_BSP_START,
-  RTEMS_SYSINIT_ORDER_FIRST
+  RTEMS_SYSINIT_ORDER_SECOND
 );
diff --git a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
index 1af0efd..27c2a72 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
@@ -80,7 +80,7 @@ static void bsp_debug_uart_init(void)
 RTEMS_SYSINIT_ITEM(
   bsp_debug_uart_init,
   RTEMS_SYSINIT_BSP_START,
-  RTEMS_SYSINIT_ORDER_THIRD
+  RTEMS_SYSINIT_ORDER_FOURTH
 );
 
 /* putchar/getchar for printk */
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
index ec041f1..35fe233 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
@@ -19,6 +19,7 @@
 #include <bsp.h>
 #include <leon.h>
 #include <bsp/bootcard.h>
+#include <rtems/sysinit.h>
 
 #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
 /* Irq used by shared memory driver and for inter-processor interrupts.
@@ -58,12 +59,21 @@ void bsp_start( void )
 {
   CPU_SPARC_HAS_SNOOPING = set_snooping();
 
+  leon3_cpu_counter_initialize();
+}
+
+static void leon3_cpu_index_init(void)
+{
   /* Get the LEON3 CPU index, normally 0, but for MP systems we do
    * _not_ assume that this is CPU0. One may run another OS on CPU0
    * and RTEMS on this CPU, and AMP system with mixed operating
    * systems
    */
   LEON3_Cpu_Index = _LEON3_Get_current_processor();
-
-  leon3_cpu_counter_initialize();
 }
+
+RTEMS_SYSINIT_ITEM(
+  leon3_cpu_index_init,
+  RTEMS_SYSINIT_BSP_START,
+  RTEMS_SYSINIT_ORDER_FIRST
+);



More information about the vc mailing list