From e3d3f4845ad200c25c5ce0cc32feecdae2d6e139 Mon Sep 17 00:00:00 2001 From: tuyuyang <1163589503@qq.com> Date: Mon, 8 Jul 2024 22:04:29 +0800 Subject: [PATCH] Sync secondary core bootup. --- Ubiquitous/XiZi_AIoT/services/app/Makefile | 2 +- Ubiquitous/XiZi_AIoT/softkernel/main.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/services/app/Makefile b/Ubiquitous/XiZi_AIoT/services/app/Makefile index 52ec24bee..bb27401a7 100644 --- a/Ubiquitous/XiZi_AIoT/services/app/Makefile +++ b/Ubiquitous/XiZi_AIoT/services/app/Makefile @@ -13,7 +13,7 @@ endif ifeq ($(BOARD), 3568) toolchain ?= aarch64-none-elf- user_ldflags = -N -Ttext 0 -cflags = -Wall -O0 -g -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie +cflags = -Wall -O2 -std=c11 -mtune=cortex-a55 -nostdlib -nodefaultlibs -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie board_specs = stub.o endif diff --git a/Ubiquitous/XiZi_AIoT/softkernel/main.c b/Ubiquitous/XiZi_AIoT/softkernel/main.c index f06bc4a15..d3a03e4ba 100644 --- a/Ubiquitous/XiZi_AIoT/softkernel/main.c +++ b/Ubiquitous/XiZi_AIoT/softkernel/main.c @@ -70,6 +70,7 @@ int main(void) spinlock_unlock(&whole_kernel_lock); } + core_init_done |= (1 << cpu_id); spinlock_lock(&whole_kernel_lock); if (cpu_id == 0) { /* init softkernel */ @@ -80,7 +81,9 @@ int main(void) for (int i = 1; i < NR_CPU; i++) { // start secondary cpus - cpu_start_secondary(i); + if (core_init_done & (1 << (i - 1)) != 0) { + cpu_start_secondary(i); + } } /* start first task */ @@ -93,7 +96,6 @@ int main(void) struct SchedulerRightGroup scheduler_rights; assert(AchieveResourceTag(&scheduler_rights.mmu_driver_tag, &hardkernel_tag, "mmu-ac-resource")); assert(AchieveResourceTag(&scheduler_rights.intr_driver_tag, &hardkernel_tag, "intr-ac-resource")); - core_init_done |= (1 << cpu_id); LOG_PRINTF("CPU %d init done\n", cpu_id); spinlock_unlock(&whole_kernel_lock);