Skip to content

Commit

Permalink
Bootloader: don't touch RTC memory if it doesn't contain a valid comm…
Browse files Browse the repository at this point in the history
…and (esp8266#619)
  • Loading branch information
igrr committed Mar 27, 2016
1 parent 633e48f commit 8a3386b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions bootloaders/eboot/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
XTENSA_TOOLCHAIN ?= ../../tools/xtensa-lx106-elf/bin/
ESPTOOL ?= ../../tools/esptool
ESPTOOL ?= ../../tools/esptool/esptool

BIN_DIR := ./
TARGET_DIR := ./

TARGET_OBJ_FILES := \
eboot.o \
eboot_command.o \


TARGET_OBJ_PATHS := $(addprefix $(TARGET_DIR)/,$(TARGET_OBJ_FILES))

Expand Down Expand Up @@ -50,4 +50,3 @@ clean:


.PHONY: all clean default

12 changes: 7 additions & 5 deletions bootloaders/eboot/eboot.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
/* Copyright (c) 2015-2016 Ivan Grokhotkov. All rights reserved.
* This file is part of eboot bootloader.
*
* Redistribution and use is permitted according to the conditions of the
Expand Down Expand Up @@ -115,14 +115,16 @@ void main()
int res = 9;
struct eboot_command cmd;

if (eboot_command_read(&cmd)) {
if (eboot_command_read(&cmd) == 0) {
// valid command was passed via RTC_MEM
eboot_command_clear();
ets_putc('@');
} else {
// no valid command found
cmd.action = ACTION_LOAD_APP;
cmd.args[0] = 0;
ets_putc('~');
} else {
ets_putc('@');
}
eboot_command_clear();

if (cmd.action == ACTION_COPY_RAW) {
ets_putc('c'); ets_putc('p'); ets_putc(':');
Expand Down
Binary file modified bootloaders/eboot/eboot.elf
Binary file not shown.

0 comments on commit 8a3386b

Please sign in to comment.