mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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 <vpalatin@chromium.org> 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 <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
727b4e4e0d
commit
60e47a730f
@@ -25,11 +25,14 @@ I2C_FAMILY=$(subst stm32f0,stm32l,$(CHIP_FAMILY))
|
||||
# Select between 16-bit and 32-bit timer for clock source
|
||||
TIMER_TYPE=$(if $(CONFIG_STM_HWTIMER32),32,)
|
||||
|
||||
chip-y=dma.o hwtimer$(TIMER_TYPE).o system.o uart.o
|
||||
chip-y+=jtag-$(CHIP_FAMILY).o clock-$(CHIP_FAMILY).o gpio-$(CHIP_FAMILY).o
|
||||
chip-y=dma.o system.o
|
||||
chip-y+=jtag-$(CHIP_FAMILY).o clock-$(CHIP_FAMILY).o
|
||||
chip-$(CONFIG_SPI)+=spi.o
|
||||
chip-$(CONFIG_COMMON_GPIO)+=gpio-$(CHIP_FAMILY).o
|
||||
chip-$(CONFIG_COMMON_TIMER)+=hwtimer$(TIMER_TYPE).o
|
||||
chip-$(CONFIG_I2C)+=i2c-$(I2C_FAMILY).o
|
||||
chip-$(CONFIG_WATCHDOG)+=watchdog.o
|
||||
chip-$(HAS_TASK_CONSOLE)+=uart.o
|
||||
chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o
|
||||
chip-$(HAS_TASK_POWERLED)+=power_led.o
|
||||
chip-$(CONFIG_FLASH)+=flash-$(FLASH_FAMILY).o
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
# Common files build
|
||||
#
|
||||
|
||||
common-y=main.o util.o console_output.o uart_buffering.o
|
||||
common-y+=memory_commands.o shared_mem.o system.o hooks.o
|
||||
common-y+=gpio.o version.o printf.o queue.o
|
||||
common-y=util.o
|
||||
common-y+=version.o printf.o queue.o
|
||||
|
||||
common-$(CONFIG_ACCEL_CALIBRATE)+=motion_calibrate.o
|
||||
common-$(CONFIG_ADC)+=adc.o
|
||||
@@ -30,7 +29,9 @@ common-$(CONFIG_CHARGER_V2)+=charge_state_v2.o
|
||||
# for ARM, not the charger driver for the tps65090. Rename.
|
||||
common-$(CONFIG_CHARGER_TPS65090)+=pmu_tps65090_charger.o
|
||||
common-$(CONFIG_CMD_I2CWEDGE)+=i2c_wedge.o
|
||||
common-$(CONFIG_COMMON_GPIO)+=gpio.o
|
||||
common-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic_output.o
|
||||
common-$(CONFIG_COMMON_RUNTIME)+=hooks.o main.o system.o shared_mem.o
|
||||
common-$(CONFIG_COMMON_TIMER)+=timer.o
|
||||
common-$(CONFIG_PMU_POWERINFO)+=pmu_tps65090_powerinfo.o
|
||||
common-$(CONFIG_PMU_TPS65090)+=pmu_tps65090.o
|
||||
@@ -64,7 +65,8 @@ common-$(CONFIG_USB_PORT_POWER_SMART)+=usb_port_power_smart.o
|
||||
common-$(CONFIG_VBOOT_HASH)+=sha256.o vboot_hash.o
|
||||
common-$(CONFIG_WIRELESS)+=wireless.o
|
||||
common-$(HAS_TASK_CHIPSET)+=chipset.o throttle_ap.o
|
||||
common-$(HAS_TASK_CONSOLE)+=console.o
|
||||
common-$(HAS_TASK_CONSOLE)+=console.o console_output.o uart_buffering.o
|
||||
common-$(HAS_TASK_CONSOLE)+=memory_commands.o
|
||||
common-$(HAS_TASK_HOSTCMD)+=acpi.o host_command.o host_event_commands.o
|
||||
common-$(HAS_TASK_KEYSCAN)+=keyboard_scan.o
|
||||
common-$(HAS_TASK_LIGHTBAR)+=lightbar.o
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -267,6 +267,18 @@
|
||||
/* Provide common core code to output panic information without interrupts. */
|
||||
#define CONFIG_COMMON_PANIC_OUTPUT
|
||||
|
||||
/*
|
||||
* Provide the default GPIO abstraction layer.
|
||||
* You want this unless you are doing a really tiny firmware.
|
||||
*/
|
||||
#define CONFIG_COMMON_GPIO
|
||||
|
||||
/*
|
||||
* Provide common runtime layer code (tasks, hooks ...)
|
||||
* You want this unless you are doing a really tiny firmware.
|
||||
*/
|
||||
#define CONFIG_COMMON_RUNTIME
|
||||
|
||||
/* Provide common core code to handle the operating system timers. */
|
||||
#define CONFIG_COMMON_TIMER
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ void hook_notify(enum hook_type type);
|
||||
*/
|
||||
int hook_call_deferred(void (*routine)(void), int us);
|
||||
|
||||
#ifdef CONFIG_COMMON_RUNTIME
|
||||
/**
|
||||
* Register a hook routine.
|
||||
*
|
||||
@@ -248,4 +249,9 @@ struct deferred_data {
|
||||
__attribute__((section(".rodata.deferred"))) \
|
||||
= {routine}
|
||||
|
||||
#else /* CONFIG_COMMON_RUNTIME */
|
||||
#define DECLARE_HOOK(t, func, p) void unused_hook_##func(void) { func(); }
|
||||
#define DECLARE_DEFERRED(func) void unused_deferred_##func(void) { func(); }
|
||||
#endif /* CONFIG_COMMON_RUNTIME */
|
||||
|
||||
#endif /* __CROS_EC_HOOKS_H */
|
||||
|
||||
@@ -205,6 +205,10 @@ struct irq_priority {
|
||||
* Implement the DECLARE_IRQ(irq, routine, priority) macro which is
|
||||
* a core specific helper macro to declare an interrupt handler "routine".
|
||||
*/
|
||||
#ifdef CONFIG_COMMON_RUNTIME
|
||||
#include "irq_handler.h"
|
||||
#else
|
||||
#define DECLARE_IRQ(irq, routine, priority)
|
||||
#endif
|
||||
|
||||
#endif /* __CROS_EC_TASK_H */
|
||||
|
||||
Reference in New Issue
Block a user