diff --git a/Makefile b/Makefile index 365c50f27..a01707a25 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ MAKEFLAGS += --no-print-directory include ../phoenix-rtos-build/Makefile.common -CFLAGS += -I. +CFLAGS += -I. -ffreestanding CPPFLAGS += -DVERSION=\"$(VERSION)\" # uncomment to enable stack canary checking diff --git a/hal/tlb/tlb.c b/hal/tlb/tlb.c index 92c1c9172..374fc0d0d 100644 --- a/hal/tlb/tlb.c +++ b/hal/tlb/tlb.c @@ -82,6 +82,11 @@ void hal_tlbInvalidateEntry(const pmap_t *pmap, const void *vaddr, size_t count) size_t tasks_size; spinlock_ctx_t sc; + if (id >= MAX_CPU_COUNT) { + /* Impossible make gcc array bound checker happy. */ + return; + } + hal_spinlockSet(&tlb_common.tlbs[id].task_spinlock, &sc); tasks_size = tlb_common.tlbs[id].tasks_size;