Merged in masayuki2009/nuttx.nuttx/fix_cpustart (pull request #1051)

Fix cpustart for Cortex-M SMP

* arch: lc823450: Fix lc823450_cpustart.c

    In Cortex-M, offset 0 in vector table stores initial stack pointer
    and offset 4 stores reset vector.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

* arch: sam34: Fix sam4cm_cpustart.c

    In Cortex-M, offset 0 in vector table stores initial stack pointer
    and offset 4 stores reset vector.

    Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Masayuki Ishikawa 2019-10-16 03:16:48 +00:00 committed by Gregory Nutt
parent 2c16d756cc
commit 78d68fe8cc
2 changed files with 12 additions and 12 deletions

View File

@ -74,8 +74,8 @@
#define DPRINTF(fmt, args...) do {} while (0) #define DPRINTF(fmt, args...) do {} while (0)
#endif #endif
#define CPU1_VECTOR_RESETV 0x00000000 #define CPU1_VECTOR_ISTACK 0x00000000
#define CPU1_VECTOR_ISTACK 0x00000004 #define CPU1_VECTOR_RESETV 0x00000004
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -188,10 +188,10 @@ int up_cpu_start(int cpu)
/* create initial vectors for CPU1 */ /* create initial vectors for CPU1 */
putreg32(0x1, REMAP); /* remap enable */ putreg32(0x1, REMAP); /* remap enable */
backup[0] = getreg32(CPU1_VECTOR_RESETV); backup[0] = getreg32(CPU1_VECTOR_ISTACK);
backup[1] = getreg32(CPU1_VECTOR_ISTACK); backup[1] = getreg32(CPU1_VECTOR_RESETV);
putreg32((uint32_t)tcb->adj_stack_ptr, CPU1_VECTOR_RESETV); putreg32((uint32_t)tcb->adj_stack_ptr, CPU1_VECTOR_ISTACK);
putreg32((uint32_t)cpu1_boot, CPU1_VECTOR_ISTACK); putreg32((uint32_t)cpu1_boot, CPU1_VECTOR_RESETV);
spin_lock(&g_cpu_wait[0]); spin_lock(&g_cpu_wait[0]);
@ -220,8 +220,8 @@ int up_cpu_start(int cpu)
/* restore : after CPU1 boot, CPU1 use normal vectors table. */ /* restore : after CPU1 boot, CPU1 use normal vectors table. */
putreg32(backup[0], CPU1_VECTOR_RESETV); putreg32(backup[0], CPU1_VECTOR_ISTACK);
putreg32(backup[1], CPU1_VECTOR_ISTACK); putreg32(backup[1], CPU1_VECTOR_RESETV);
putreg32(0x0, REMAP); /* remap disable */ putreg32(0x0, REMAP); /* remap disable */
spin_unlock(&g_cpu_wait[0]); spin_unlock(&g_cpu_wait[0]);

View File

@ -72,8 +72,8 @@
# define DPRINTF(fmt, args...) do {} while (0) # define DPRINTF(fmt, args...) do {} while (0)
#endif #endif
#define CPU1_VECTOR_RESETV (SAM_INTSRAM1_BASE) #define CPU1_VECTOR_ISTACK (SAM_INTSRAM1_BASE)
#define CPU1_VECTOR_ISTACK (SAM_INTSRAM1_BASE + 4) #define CPU1_VECTOR_RESETV (SAM_INTSRAM1_BASE + 4)
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
@ -215,8 +215,8 @@ int up_cpu_start(int cpu)
/* Copy initial vectors for CPU1 */ /* Copy initial vectors for CPU1 */
putreg32((uint32_t)tcb->adj_stack_ptr, CPU1_VECTOR_RESETV); putreg32((uint32_t)tcb->adj_stack_ptr, CPU1_VECTOR_ISTACK);
putreg32((uint32_t)cpu1_boot, CPU1_VECTOR_ISTACK); putreg32((uint32_t)cpu1_boot, CPU1_VECTOR_RESETV);
spin_lock(&g_cpu1_boot); spin_lock(&g_cpu1_boot);