diff --git a/Makefile b/Makefile index 055e548e2..cd809461f 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,6 @@ endef .PHONY: info info: @echo "EPSILON_VERSION = $(EPSILON_VERSION)" - @echo "EPSILON_ONBOARDING_APP = $(EPSILON_ONBOARDING_APP)" @echo "EPSILON_BOOT_PROMPT = $(EPSILON_BOOT_PROMPT)" @echo "EPSILON_APPS = $(EPSILON_APPS)" @echo "EPSILON_I18N = $(EPSILON_I18N)" @@ -82,11 +81,13 @@ all_objs = $(call object_for,$(all_src)) # but allows correct yet optimal incremental builds. -include $(all_objs:.o=.d) -executables = epsilon test +executables = epsilon epsilon.on-boarding test #define platform generic targets -$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(src) $(ion_device_dfu_relocated_src) $(epsilon_src)) +$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(src) $(epsilon_src) $(ion_device_dfu_relocated_src) $(apps_launch_default_src)) + +$(BUILD_DIR)/epsilon.on-boarding.$(EXE): $(call object_for,$(src) $(epsilon_src) $(ion_device_dfu_relocated_src) $(apps_launch_on_boarding_src)) $(BUILD_DIR)/test.$(EXE): $(BUILD_DIR)/quiz/src/tests_symbols.o $(call object_for,$(src) $(ion_device_dfu_relocated_src) $(tests) $(runner_src)) diff --git a/apps/Makefile b/apps/Makefile index 48470645b..1ca0ffa6c 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -30,6 +30,9 @@ app_src += $(addprefix apps/,\ variable_box_empty_controller.cpp \ ) +apps_launch_on_boarding_src = apps/apps_container_launch_on_boarding.cpp +apps_launch_default_src = apps/apps_container_launch_default.cpp + snapshots_declaration = $(foreach i,$(apps),$(i)::Snapshot m_snapshot$(subst :,,$(i))Snapshot;) apps_declaration = $(foreach i,$(apps),$(i) m_$(subst :,,$(i));) snapshots_construction = $(foreach i,$(apps),,m_snapshot$(subst :,,$(i))Snapshot()) @@ -89,7 +92,7 @@ epsilon_src += $(addprefix apps/, \ i18n.py \ ) -all_app_src = $(app_src) $(epsilon_src) +all_app_src = $(app_src) $(epsilon_src) $(apps_launch_on_boarding_src) $(apps_launch_default_src) $(call object_for,$(all_app_src)): $(BUILD_DIR)/apps/i18n.h $(call object_for,$(all_app_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index e167639b8..86c0d06b7 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -267,12 +267,7 @@ void AppsContainer::run() { /* Normal execution. The exception checkpoint must be created before * switching to the first app, because the first app might create nodes on * the pool. */ - bool switched = -#if EPSILON_ONBOARDING_APP - switchTo(onBoardingAppSnapshot()); -#else - switchTo(appSnapshotAtIndex(numberOfApps() == 2 ? 1 : 0)); -#endif + bool switched = switchTo(initialAppSnapshot()); assert(switched); (void) switched; // Silence compilation warning about unused variable. } else { diff --git a/apps/apps_container.h b/apps/apps_container.h index d08346e5a..78afb96ce 100644 --- a/apps/apps_container.h +++ b/apps/apps_container.h @@ -29,6 +29,7 @@ public: static bool poincareCircuitBreaker(); virtual int numberOfApps() = 0; virtual App::Snapshot * appSnapshotAtIndex(int index) = 0; + App::Snapshot * initialAppSnapshot(); App::Snapshot * hardwareTestAppSnapshot(); App::Snapshot * onBoardingAppSnapshot(); App::Snapshot * usbConnectedAppSnapshot(); diff --git a/apps/apps_container_launch_default.cpp b/apps/apps_container_launch_default.cpp new file mode 100644 index 000000000..ce36dc509 --- /dev/null +++ b/apps/apps_container_launch_default.cpp @@ -0,0 +1,7 @@ +#include "apps_container.h" + +App::Snapshot * AppsContainer::initialAppSnapshot() { + // The backlight has not been initialized + Ion::Backlight::init(); + return appSnapshotAtIndex(numberOfApps() == 2 ? 1 : 0); +} diff --git a/apps/apps_container_launch_on_boarding.cpp b/apps/apps_container_launch_on_boarding.cpp new file mode 100644 index 000000000..18adecc70 --- /dev/null +++ b/apps/apps_container_launch_on_boarding.cpp @@ -0,0 +1,5 @@ +#include "apps_container.h" + +App::Snapshot * AppsContainer::initialAppSnapshot() { + return onBoardingAppSnapshot(); +} diff --git a/apps/main.cpp b/apps/main.cpp index fd19a7901..ed4d56e89 100644 --- a/apps/main.cpp +++ b/apps/main.cpp @@ -6,6 +6,8 @@ #if DUMMY_MAIN void ion_main(int argc, char * argv[]) { + // Initialize the backlight + Ion::Backlight::init(); while (1) { Ion::Display::pushRectUniform(KDRect(0,0,10,10), KDColorRed); Ion::Timing::msleep(100); diff --git a/apps/on_boarding/logo_controller.cpp b/apps/on_boarding/logo_controller.cpp index 45d942451..197a29e7b 100644 --- a/apps/on_boarding/logo_controller.cpp +++ b/apps/on_boarding/logo_controller.cpp @@ -33,9 +33,9 @@ void LogoController::viewWillAppear() { m_didPerformTests = true; m_previousLEDColor = PowerOnSelfTest::Perform(); } - /* If EPSILON_ONBOARDING_APP == 1, the backlight is not initialized in - * Ion::Device::Board::initPeripherals, so that the LCD test is not visible to - * the user. We thus need to initialize the backlight after the test.*/ + /* The backlight was not initialized in Ion::Device::Board::initPeripherals, + * so that the LCD test is not visible to the user. We thus need to initialize + * the backlight after the test.*/ if (!backlightInitialized) { Ion::Backlight::init(); } diff --git a/ion/src/device/bench/runner.cpp b/ion/src/device/bench/runner.cpp index d76c82c3c..17bc2b604 100644 --- a/ion/src/device/bench/runner.cpp +++ b/ion/src/device/bench/runner.cpp @@ -1,5 +1,8 @@ #include +#include void ion_main(int argc, char * argv[]) { + // Initialize the backlight + Ion::Backlight::init(); Ion::Device::Bench::run(); } diff --git a/ion/src/device/flasher/main.cpp b/ion/src/device/flasher/main.cpp index 82859456d..ff80ff9e8 100644 --- a/ion/src/device/flasher/main.cpp +++ b/ion/src/device/flasher/main.cpp @@ -3,6 +3,9 @@ #include void ion_main(int argc, char * argv[]) { + // Initialize the backlight + Ion::Backlight::init(); + // Initialize Flasher display Flasher::Display::init(); while (true) { Ion::USB::enable(); diff --git a/ion/src/device/shared/boot/rt0.cpp b/ion/src/device/shared/boot/rt0.cpp index 2f6baaba9..8e8f2e39e 100644 --- a/ion/src/device/shared/boot/rt0.cpp +++ b/ion/src/device/shared/boot/rt0.cpp @@ -31,14 +31,12 @@ void __attribute__((noinline)) abort() { * forbid inlining it.*/ static void __attribute__((noinline)) external_flash_start() { - /* Init the peripherals. If there is the on boarding app, do not initialize the - * backlight so that the user does not see the LCD tests. The backlight will - * be initialized after the Power-On Self-Test.*/ -#if EPSILON_ONBOARDING_APP == 0 - Ion::Device::Board::initPeripherals(true); -#else + /* Init the peripherals. We do not initialize the backlight in case there is + * an on boarding app: indeed, we don't want the user to see the LCD tests + * happening during the on boarding app. The backlight will be initialized + * after the Power-On Self-Test if there is one or before switching to the + * home app otherwise. */ Ion::Device::Board::initPeripherals(false); -#endif return ion_main(0, nullptr); } diff --git a/quiz/src/runner.cpp b/quiz/src/runner.cpp index 454fd51f0..3ac3d1cb0 100644 --- a/quiz/src/runner.cpp +++ b/quiz/src/runner.cpp @@ -45,6 +45,8 @@ static inline void ion_main_inner() { } void ion_main(int argc, char * argv[]) { + // Initialize the backlight + Ion::Backlight::init(); // Initialize Poincare::TreePool::sharedPool Poincare::Init(); diff --git a/scripts/config.mak b/scripts/config.mak index 92165fe7c..3b0556d29 100644 --- a/scripts/config.mak +++ b/scripts/config.mak @@ -4,7 +4,6 @@ PLATFORM ?= device DEBUG ?= 0 EPSILON_VERSION ?= 11.1.0 -EPSILON_ONBOARDING_APP ?= 0 # Valid values are "none", "update", "beta" EPSILON_BOOT_PROMPT ?= none EPSILON_APPS ?= calculation graph code statistics probability solver sequence regression settings @@ -23,7 +22,6 @@ endif include scripts/toolchain.$(TOOLCHAIN).mak SFLAGS += -DDEBUG=$(DEBUG) -SFLAGS += -DEPSILON_ONBOARDING_APP=$(EPSILON_ONBOARDING_APP) SFLAGS += -DEPSILON_GETOPT=$(EPSILON_GETOPT) EPSILON_BETA_PROMPT := 1 EPSILON_UPDATE_PROMPT := 2 diff --git a/scripts/platform.blackbox.mak b/scripts/platform.blackbox.mak index d678f9501..244c172ad 100644 --- a/scripts/platform.blackbox.mak +++ b/scripts/platform.blackbox.mak @@ -2,7 +2,6 @@ TOOLCHAIN ?= host-gcc USE_LIBA ?= 0 ION_KEYBOARD_LAYOUT = layout_B2 EXE = bin -EPSILON_ONBOARDING_APP = 0 ifeq ($(DEBUG),1) else diff --git a/scripts/platform.emscripten.mak b/scripts/platform.emscripten.mak index a19578a05..168748053 100644 --- a/scripts/platform.emscripten.mak +++ b/scripts/platform.emscripten.mak @@ -2,5 +2,4 @@ TOOLCHAIN = emscripten USE_LIBA = 0 ION_KEYBOARD_LAYOUT = layout_B2 EXE = js -EPSILON_ONBOARDING_APP = 0 EPSILON_GETOPT = 1 diff --git a/scripts/platform.sdl.mak b/scripts/platform.sdl.mak index 0624babe6..786cb5069 100644 --- a/scripts/platform.sdl.mak +++ b/scripts/platform.sdl.mak @@ -1,6 +1,5 @@ USE_LIBA = 0 ION_KEYBOARD_LAYOUT = layout_B2 -EPSILON_ONBOARDING_APP = 0 EPSILON_GETOPT = 1 SFLAGS += -fPIE diff --git a/scripts/targets.device.mak b/scripts/targets.device.mak index 456993e0a..8d1e85cd1 100644 --- a/scripts/targets.device.mak +++ b/scripts/targets.device.mak @@ -71,9 +71,9 @@ $(BUILD_DIR)/bench.ram.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram.ld $(BUILD_DIR)/bench.flash.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/$(MODEL)/internal_flash.ld $(BUILD_DIR)/bench.%.$(EXE): $(call object_for,$(src) $(bench_src) $(ion_device_dfu_xip_src)) -ifeq ($(EPSILON_ONBOARDING_APP)$(EPSILON_BOOT_PROMPT),1update) -.PHONY: %_two_binaries -%_two_binaries: %.elf +ifeq ($(EPSILON_BOOT_PROMPT),update) +.PHONY: %.two_binaries +%.two_binaries: %.elf @echo "Building an internal and an external binary for $<" $(Q) $(OBJCOPY) -O binary -j .text.external -j .rodata.external $< $(basename $<).external.bin $(Q) $(OBJCOPY) -O binary -R .text.external -R .rodata.external $< $(basename $<).internal.bin @@ -82,7 +82,7 @@ ifeq ($(EPSILON_ONBOARDING_APP)$(EPSILON_BOOT_PROMPT),1update) $(Q) printf "\xFF\xFF\xFF\xFF" >> $(basename $<).internal.bin else %_two_binaries: - @echo "Error: two_binaries requires EPSILON_ONBOARDING_APP=1 EPSILON_BOOT_PROMPT=update" + @echo "Error: two_binaries requires EPSILON_BOOT_PROMPT=update" endif .PHONY: binpack @@ -97,9 +97,9 @@ binpack: make -j8 $(BUILD_DIR)/bench.ram.bin cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin build/binpack make clean - make -j8 EPSILON_ONBOARDING_APP=1 EPSILON_BOOT_PROMPT=update $(BUILD_DIR)/epsilon_two_binaries - cp $(BUILD_DIR)/epsilon.internal.bin $(BUILD_DIR)/epsilon.external.bin build/binpack + make -j8 EPSILON_BOOT_PROMPT=update $(BUILD_DIR)/epsilon.on-boarding.two_binaries + cp $(BUILD_DIR)/epsilon.on-boarding.internal.bin $(BUILD_DIR)/epsilon.on-boarding.external.bin build/binpack make clean - cd build && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.internal.bin epsilon.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done + cd build && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.on-boarding.internal.bin epsilon.on-boarding.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done cd build && tar cvfz binpack-`git rev-parse HEAD | head -c 7`.tgz binpack rm -rf build/binpack