esp32: Set CPU pointer on app cpu at startup

It's not enough to wait for a switch, lots of things need this early.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-02-02 11:23:30 -08:00 committed by Anas Nashif
commit 53eceffb7f

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <zephyr.h> #include <zephyr.h>
#include <kernel_structs.h>
#include <soc.h>
#define _REG(base, off) (*(volatile u32_t *)((base) + (off))) #define _REG(base, off) (*(volatile u32_t *)((base) + (off)))
@ -66,6 +68,13 @@ static void appcpu_entry2(void)
__asm__ volatile("wsr.VECBASE %0" : : "r"(start_rec->vecbase)); __asm__ volatile("wsr.VECBASE %0" : : "r"(start_rec->vecbase));
__asm__ volatile("rsync"); __asm__ volatile("rsync");
/* Set up the CPU pointer. Really this should be xtensa arch
* code, not in the ESP-32 layer
*/
_cpu_t *cpu = &_kernel.cpus[1];
__asm__ volatile("wsr.MISC0 %0" : : "r"(cpu));
*start_rec->alive = 1; *start_rec->alive = 1;
start_rec->fn(ps, start_rec->arg); start_rec->fn(ps, start_rec->arg);
} }