From 60e47a730f9a0c0eb20ccd067954009c192418c9 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Fri, 7 Mar 2014 19:06:54 -0800 Subject: make the common runtime optional In order to achieve really tiny firmwares, make our runtime (tasks, hooks, muxed timers, GPIO abstraction ...) optional. Add 2 new build options for it : CONFIG_COMMON_RUNTIME and CONFIG_COMMON_GPIO which are enabled by default, and ensure all the source files are built according to the right configuration variable. Signed-off-by: Vincent Palatin BRANCH=none BUG=none TEST=make buildall build a minimal board with no runtime. Change-Id: Icb621cbe0a75b3a320cb53c3267d6e578cd3c32f Reviewed-on: https://chromium-review.googlesource.com/189403 Reviewed-by: Vic Yang Commit-Queue: Vincent Palatin Tested-by: Vincent Palatin --- core/cortex-m/build.mk | 4 +++- core/cortex-m/init.S | 4 ++++ core/cortex-m/task.c | 2 +- core/cortex-m0/build.mk | 4 +++- core/cortex-m0/init.S | 4 ++++ core/cortex-m0/task.c | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk index 741ec005cc..5306865984 100644 --- a/core/cortex-m/build.mk +++ b/core/cortex-m/build.mk @@ -17,6 +17,8 @@ CFLAGS_CPU+=-mthumb -Os -mno-sched-prolog CFLAGS_CPU+=-mno-unaligned-access CFLAGS_CPU+=$(CFLAGS_FPU-y) -core-y=cpu.o init.o panic.o switch.o task.o +core-y=cpu.o init.o +core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o +core-$(CONFIG_COMMON_RUNTIME)+=switch.o task.o core-$(CONFIG_WATCHDOG)+=watchdog.o core-$(CONFIG_MPU)+=mpu.o diff --git a/core/cortex-m/init.S b/core/cortex-m/init.S index 78c2307545..00072c7f0f 100644 --- a/core/cortex-m/init.S +++ b/core/cortex-m/init.S @@ -374,8 +374,12 @@ fini_loop: /* Default exception handler */ .thumb_func default_handler: +#ifdef CONFIG_COMMON_PANIC_OUTPUT b exception_panic +#endif + b reset +.align 2 _bss_start: .long __bss_start _bss_end: diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index c0cbc84d59..5e309ef4cb 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -330,7 +330,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched) task_ *tsk = current_task; task_id_t me = tsk - tasks; uint32_t evt; - int ret; + int ret __attribute__((unused)); ASSERT(!in_interrupt_context()); diff --git a/core/cortex-m0/build.mk b/core/cortex-m0/build.mk index 6ee39c5669..9b5d63bb4d 100644 --- a/core/cortex-m0/build.mk +++ b/core/cortex-m0/build.mk @@ -13,5 +13,7 @@ CROSS_COMPILE?=arm-none-eabi- CFLAGS_CPU+=-mthumb -Os -mno-sched-prolog CFLAGS_CPU+=-mno-unaligned-access -core-y=cpu.o init.o panic.o switch.o task.o thumb_case.o div.o +core-y=cpu.o init.o thumb_case.o div.o +core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o +core-$(CONFIG_COMMON_RUNTIME)+=switch.o task.o core-$(CONFIG_WATCHDOG)+=watchdog.o diff --git a/core/cortex-m0/init.S b/core/cortex-m0/init.S index f868435157..98bdb89e19 100644 --- a/core/cortex-m0/init.S +++ b/core/cortex-m0/init.S @@ -133,8 +133,12 @@ fini_loop: /* Default exception handler */ .thumb_func default_handler: +#ifdef CONFIG_COMMON_PANIC_OUTPUT b exception_panic +#endif + b reset +.align 2 _bss_start: .long __bss_start _bss_end: diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c index 5072a9741e..b067e25f62 100644 --- a/core/cortex-m0/task.c +++ b/core/cortex-m0/task.c @@ -318,7 +318,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched) task_ *tsk = current_task; task_id_t me = tsk - tasks; uint32_t evt; - int ret; + int ret __attribute__((unused)); ASSERT(!in_interrupt_context()); -- cgit v1.2.1