From 3da3022dff04e2fe99437e3c11b9fc9220f794c9 Mon Sep 17 00:00:00 2001 From: aanper Date: Tue, 20 Oct 2020 08:45:38 +0300 Subject: [PATCH] fix build flag --- applications/app-loader/app-loader.c | 13 +---- applications/{startup.h => applications.h} | 18 +++++++ applications/applications.mk | 63 +++++++++++++++++----- core/app.cpp | 2 +- 4 files changed, 70 insertions(+), 26 deletions(-) rename applications/{startup.h => applications.h} (79%) diff --git a/applications/app-loader/app-loader.c b/applications/app-loader/app-loader.c index 11aed885..fb5768d9 100644 --- a/applications/app-loader/app-loader.c +++ b/applications/app-loader/app-loader.c @@ -1,6 +1,7 @@ #include "flipper_v2.h" #include #include "menu/menu.h" +#include "applications.h" typedef struct { FuriApp* handler; @@ -48,18 +49,6 @@ static void handle_menu(void* _ctx) { ctx->state->handler = furiac_start(ctx->app->app, ctx->app->name, NULL); } -void application_blink(void* p); -void application_uart_write(void* p); -void application_input_dump(void* p); -void cc1101_workaround(void* p); - -const FlipperStartupApp FLIPPER_APPS[] = { - {.app = application_blink, .name = "blink", .libs = {0}}, - {.app = application_uart_write, .name = "uart write", .libs = {0}}, - {.app = application_input_dump, .name = "input dump", .libs = {1, FURI_LIB{"input_task"}}}, - {.app = cc1101_workaround, .name = "cc1101 workaround", .libs = {1, FURI_LIB{"gui_task"}}}, -}; - void app_loader(void* p) { osThreadId_t self_id = osThreadGetId(); assert(self_id); diff --git a/applications/startup.h b/applications/applications.h similarity index 79% rename from applications/startup.h rename to applications/applications.h index aaf55c64..7d8162dc 100644 --- a/applications/startup.h +++ b/applications/applications.h @@ -74,3 +74,21 @@ const FlipperStartupApp FLIPPER_STARTUP[] = { {.app = u8g2_example, .name = "u8g2_example", .libs = {1, FURI_LIB{"display_u8g2"}}}, #endif }; + +const FlipperStartupApp FLIPPER_APPS[] = { +#ifdef BUILD_EXAMPLE_BLINK + {.app = application_blink, .name = "blink", .libs = {0}}, +#endif + +#ifdef BUILD_EXAMPLE_UART_WRITE + {.app = application_uart_write, .name = "uart write", .libs = {0}}, +#endif + +#ifdef BUILD_EXAMPLE_INPUT_DUMP + {.app = application_input_dump, .name = "input dump", .libs = {1, FURI_LIB{"input_task"}}}, +#endif + +#ifdef BUILD_CC1101 + {.app = cc1101_workaround, .name = "cc1101 workaround", .libs = {1, FURI_LIB{"gui_task"}}}, +#endif +}; \ No newline at end of file diff --git a/applications/applications.mk b/applications/applications.mk index 001f812f..6f0ae763 100644 --- a/applications/applications.mk +++ b/applications/applications.mk @@ -3,24 +3,30 @@ LIB_DIR = $(PROJECT_ROOT)/lib CFLAGS += -I$(APP_DIR) +# Use APP_* for autostart app +# Use BUILD_* for add app to build + APP_RELEASE ?= 0 ifeq ($(APP_RELEASE), 1) -APP_GUI = 1 -APP_INPUT = 1 APP_MENU = 1 +BUILD_EXAMPLE_BLINK = 1 +BUILD_EXAMPLE_UART_WRITE = 1 +BUILD_EXAMPLE_INPUT_DUMP = 1 +BUILD_CC1101 = 1 endif APP_MENU ?= 0 ifeq ($(APP_MENU), 1) +CFLAGS += -DAPP_MENU +BUILD_MENU = 1 +endif +BUILD_MENU ?= 0 +ifeq ($(BUILD_MENU), 1) APP_INPUT = 1 APP_GUI = 1 -CFLAGS += -DAPP_MENU +CFLAGS += -DBUILD_MENU C_SOURCES += $(wildcard $(APP_DIR)/menu/*.c) C_SOURCES += $(wildcard $(APP_DIR)/app-loader/*.c) - -APP_EXAMPLE_BLINK = 1 -APP_EXAMPLE_UART_WRITE = 1 -APP_EXAMPLE_INPUT_DUMP = 1 endif APP_TEST ?= 0 @@ -38,24 +44,44 @@ endif APP_EXAMPLE_BLINK ?= 0 ifeq ($(APP_EXAMPLE_BLINK), 1) CFLAGS += -DAPP_EXAMPLE_BLINK +BUILD_EXAMPLE_BLINK = 1 +endif +BUILD_EXAMPLE_BLINK ?= 0 +ifeq ($(BUILD_EXAMPLE_BLINK), 1) +CFLAGS += -DBUILD_EXAMPLE_BLINK C_SOURCES += $(APP_DIR)/examples/blink.c endif APP_EXAMPLE_UART_WRITE ?= 0 ifeq ($(APP_EXAMPLE_UART_WRITE), 1) CFLAGS += -DAPP_EXAMPLE_UART_WRITE +BUILD_EXAMPLE_UART_WRITE = 1 +endif +BUILD_EXAMPLE_UART_WRITE ?= 0 +ifeq ($(BUILD_EXAMPLE_UART_WRITE), 1) +CFLAGS += -DBUILD_EXAMPLE_UART_WRITE C_SOURCES += $(APP_DIR)/examples/uart_write.c endif APP_EXAMPLE_IPC ?= 0 ifeq ($(APP_EXAMPLE_IPC), 1) CFLAGS += -DAPP_EXAMPLE_IPC +BUILD_EXAMPLE_IPC = 1 +endif +BUILD_EXAMPLE_IPC ?= 0 +ifeq ($(BUILD_EXAMPLE_IPC), 1) +CFLAGS += -DBUILD_EXAMPLE_IPC C_SOURCES += $(APP_DIR)/examples/ipc.c endif APP_EXAMPLE_INPUT_DUMP ?= 0 ifeq ($(APP_EXAMPLE_INPUT_DUMP), 1) CFLAGS += -DAPP_EXAMPLE_INPUT_DUMP +BUILD_EXAMPLE_INPUT_DUMP = 1 +endif +BUILD_EXAMPLE_INPUT_DUMP ?= 0 +ifeq ($(BUILD_EXAMPLE_INPUT_DUMP), 1) +CFLAGS += -DBUILD_EXAMPLE_INPUT_DUMP C_SOURCES += $(APP_DIR)/examples/input_dump.c APP_INPUT = 1 endif @@ -63,11 +89,17 @@ endif APP_EXAMPLE_QRCODE ?= 0 ifeq ($(APP_EXAMPLE_QRCODE), 1) CFLAGS += -DAPP_EXAMPLE_QRCODE +BUILD_EXAMPLE_QRCODE = 1 +endif +BUILD_EXAMPLE_QRCODE ?= 0 +ifeq ($(BUILD_EXAMPLE_QRCODE), 1) +CFLAGS += -DBUILD_EXAMPLE_QRCODE C_SOURCES += $(APP_DIR)/examples/u8g2_qrcode.c C_SOURCES += $(LIB_DIR)/qrcode/qrcode.c APP_DISPLAY = 1 endif +# deprecated APP_EXAMPLE_DISPLAY ?= 0 ifeq ($(APP_EXAMPLE_DISPLAY), 1) CFLAGS += -DAPP_EXAMPLE_DISPLAY @@ -78,6 +110,11 @@ endif APP_EXAMPLE_FATFS ?= 0 ifeq ($(APP_EXAMPLE_FATFS), 1) CFLAGS += -DAPP_EXAMPLE_FATFS +BUILD_EXAMPLE_FATFS = 1 +endif +BUILD_EXAMPLE_FATFS ?= 0 +ifeq ($(BUILD_EXAMPLE_FATFS), 1) +CFLAGS += -DBUILD_EXAMPLE_FATFS C_SOURCES += $(APP_DIR)/examples/fatfs_list.c APP_INPUT = 1 APP_DISPLAY = 1 @@ -86,13 +123,11 @@ endif APP_CC1101 ?= 0 ifeq ($(APP_CC1101), 1) CFLAGS += -DAPP_CC1101 -C_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.c) -CPP_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.cpp) -APP_INPUT = 1 -APP_GUI = 1 +BUILD_CC1101 = 1 endif - -ifeq ($(APP_RELEASE), 1) +BUILD_CC1101 ?= 0 +ifeq ($(BUILD_CC1101), 1) +CFLAGS += -DBUILD_CC1101 C_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.c) CPP_SOURCES += $(wildcard $(APP_DIR)/cc1101-workaround/*.cpp) APP_INPUT = 1 @@ -100,6 +135,7 @@ APP_GUI = 1 endif # device drivers + APP_GUI ?= 0 ifeq ($(APP_GUI), 1) CFLAGS += -DAPP_GUI @@ -107,6 +143,7 @@ C_SOURCES += $(wildcard $(APP_DIR)/gui/*.c) C_SOURCES += $(wildcard $(APP_DIR)/backlight-control/*.c) endif +# deprecated ifeq ($(APP_DISPLAY), 1) CFLAGS += -DAPP_DISPLAY C_SOURCES += $(APP_DIR)/display-u8g2/display-u8g2.c diff --git a/core/app.cpp b/core/app.cpp index cda52a41..ff179510 100644 --- a/core/app.cpp +++ b/core/app.cpp @@ -3,7 +3,7 @@ extern "C" { #include "flipper.h" #include "log.h" -#include "startup.h" +#include "applications.h" #include "tty_uart.h" }