1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Bootloader: don't touch RTC memory if it doesn't contain a valid command (#619)

This commit is contained in:
Ivan Grokhotkov 2016-03-28 00:24:27 +03:00 committed by Nat Weerawan
parent 3136c61346
commit cef5abd3cf
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
XTENSA_TOOLCHAIN ?= ../../tools/xtensa-lx106-elf/bin/
ESPTOOL ?= ../../tools/esptool
ESPTOOL ?= ../../tools/esptool/esptool
BIN_DIR := ./
TARGET_DIR := ./
@ -7,7 +7,7 @@ TARGET_DIR := ./
TARGET_OBJ_FILES := \
eboot.o \
eboot_command.o \
TARGET_OBJ_PATHS := $(addprefix $(TARGET_DIR)/,$(TARGET_OBJ_FILES))
@ -50,4 +50,3 @@ clean:
.PHONY: all clean default

View File

@ -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
@ -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(':');

Binary file not shown.