Skip to content

Commit 8a3386b

Browse files
committed
Bootloader: don't touch RTC memory if it doesn't contain a valid command (#619)
1 parent 633e48f commit 8a3386b

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

bootloaders/eboot/Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
XTENSA_TOOLCHAIN ?= ../../tools/xtensa-lx106-elf/bin/
2-
ESPTOOL ?= ../../tools/esptool
2+
ESPTOOL ?= ../../tools/esptool/esptool
33

44
BIN_DIR := ./
55
TARGET_DIR := ./
66

77
TARGET_OBJ_FILES := \
88
eboot.o \
99
eboot_command.o \
10-
10+
1111

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

@@ -50,4 +50,3 @@ clean:
5050

5151

5252
.PHONY: all clean default
53-

bootloaders/eboot/eboot.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
1+
/* Copyright (c) 2015-2016 Ivan Grokhotkov. All rights reserved.
22
* This file is part of eboot bootloader.
33
*
44
* Redistribution and use is permitted according to the conditions of the
@@ -115,14 +115,16 @@ void main()
115115
int res = 9;
116116
struct eboot_command cmd;
117117

118-
if (eboot_command_read(&cmd)) {
118+
if (eboot_command_read(&cmd) == 0) {
119+
// valid command was passed via RTC_MEM
120+
eboot_command_clear();
121+
ets_putc('@');
122+
} else {
123+
// no valid command found
119124
cmd.action = ACTION_LOAD_APP;
120125
cmd.args[0] = 0;
121126
ets_putc('~');
122-
} else {
123-
ets_putc('@');
124127
}
125-
eboot_command_clear();
126128

127129
if (cmd.action == ACTION_COPY_RAW) {
128130
ets_putc('c'); ets_putc('p'); ets_putc(':');

bootloaders/eboot/eboot.elf

-244 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)