Use latest upstream rboot, always build with OTA - use prebuilt rboot if
none is compiled locally.
This commit is contained in:
parent
1f1881a452
commit
d9202af2aa
20 changed files with 216 additions and 364 deletions
|
@ -1,34 +1,17 @@
|
|||
# This is a wrapper around the rboot makefile, which gives us the parameters
|
||||
# we need to use rboot with esp-open-rtos
|
||||
# we need to use rboot with esp-open-rtos.
|
||||
#
|
||||
# Use 'make bootloader' to build a custom bootloader.
|
||||
#
|
||||
# 'make flash' for any esp-open-rtos program will use the compiled
|
||||
# bootloader if it exists, or a prebuilt bootloader if no custom
|
||||
# bootloader was compiled.
|
||||
#
|
||||
# The wrapper means we don't require esptool2 in the build process, so we can just use
|
||||
# esptool.py (still need xxd, grep, sed to generate the header - see below.)
|
||||
BOOTLOADER_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
BUILD_DIR ?= build
|
||||
FIRMWARE_DIR ?= firmware
|
||||
|
||||
# RBOOT configuration parameters.
|
||||
# RBOOT_BIG_FLASH is required for esp-open-rtos.
|
||||
export RBOOT_BIG_FLASH = 1
|
||||
|
||||
export RBOOT_BUILD_BASE=$(abspath $(BUILD_DIR))
|
||||
|
||||
# Default ESPTOOL params, all the same as when using normal esp-open-rtos makefiles
|
||||
ESPTOOL ?= esptool.py
|
||||
ESPPORT ?= /dev/ttyUSB0
|
||||
ESPBAUD ?= 115200
|
||||
|
||||
FLASH_SIZE ?= 16
|
||||
FLASH_MODE ?= qio
|
||||
FLASH_SPEED ?= 40
|
||||
|
||||
ESPTOOL_ARGS=-fs $(FLASH_SIZE)m -fm $(FLASH_MODE) -ff $(FLASH_SPEED)m
|
||||
|
||||
ifeq ("$(V)","1")
|
||||
Q :=
|
||||
else
|
||||
Q := @
|
||||
endif
|
||||
include ../parameters.mk
|
||||
|
||||
all: $(FIRMWARE_DIR)/rboot.bin
|
||||
|
||||
|
@ -52,14 +35,19 @@ $(BUILD_DIR)/rboot-hex2a.h: $(BUILD_DIR)/rboot-stage2a.elf $(BUILD_DIR)
|
|||
$(Q) echo "const uint32 _text_addr = 0x$$(xtensa-lx106-elf-objdump -h -j .text $< | grep ".text" | grep -o '401.....' | head -n1);" >> $@.in
|
||||
$(Q) mv $@.in $@
|
||||
|
||||
|
||||
RBOOT_BUILD_BASE="$(abspath $(BUILD_DIR))"
|
||||
RBOOT_FW_BASE="$(abspath $(FIRMWARE_DIR))"
|
||||
MAKE_VARS=RBOOT_EXTRA_INCDIR=$(BOOTLOADER_DIR) RBOOT_BUILD_BASE=$(RBOOT_BUILD_BASE) RBOOT_FW_BASE=$(RBOOT_FW_BASE)
|
||||
|
||||
$(BUILD_DIR)/rboot-stage2a.elf: $(BUILD_DIR)
|
||||
$(Q) $(MAKE) -C rboot $(RBOOT_BUILD_BASE)/rboot-stage2a.elf
|
||||
$(Q) $(MAKE) -C rboot $(RBOOT_BUILD_BASE)/rboot-stage2a.elf $(MAKE_VARS)
|
||||
|
||||
$(BUILD_DIR)/rboot.elf: $(BUILD_DIR)/rboot-hex2a.h
|
||||
$(Q) $(MAKE) -C rboot $(RBOOT_BUILD_BASE)/rboot.elf
|
||||
$(Q) $(MAKE) -C rboot $(RBOOT_BUILD_BASE)/rboot.elf $(MAKE_VARS)
|
||||
|
||||
$(BUILD_DIR) $(FIRMWARE_DIR):
|
||||
$(Q) mkdir -p "$@"
|
||||
mkdir -p $@
|
||||
|
||||
flash: $(FIRMWARE_DIR)/rboot.bin
|
||||
$(Q) $(ESPTOOL) -p $(ESPPORT) -b $(ESPBAUD) write_flash $(ESPTOOL_ARGS) 0x0 $<
|
||||
|
@ -68,4 +56,4 @@ clean:
|
|||
$(Q) rm -rf $(BUILD_DIR)
|
||||
$(Q) rm -rf $(FIRMWARE_DIR)
|
||||
|
||||
.PHONY: all clean flash erase_config
|
||||
.PHONY: all
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
OTA Bootloader (rboot) source module and support files.
|
||||
|
||||
Can be used to build an esp-open-rtos compatible rboot bootloader, for use when OTA=1.
|
||||
|
||||
It is also possible to use the upstream rboot verbatim, but *ensure that the `RBOOT_BIG_FLASH` option is enabled or images in slots other than 0 won't work correctly.
|
||||
|
||||
rboot is an open source bootloader by Richard Burton:
|
||||
https://github.com/raburton/rboot
|
||||
|
||||
See the contents of the 'rboot' directory for more information.
|
||||
Can be used to build an esp-open-rtos compatible rboot bootloader. Run 'make bootloader' in this directory to compile a new bootloader.
|
||||
|
||||
Compiling a new bootloader is optional, there's a prebuilt one in the "firmware_prebuilt" directory that will be used if no new bootloader was compiled.
|
||||
|
||||
It is also possible to use rboot from upstream verbatim, but *ensure that the `RBOOT_BIG_FLASH` option is enabled or images in slots other than 0 won't work correctly.
|
||||
|
||||
See the contents of the 'rboot' directory for more information on rboot.
|
||||
|
|
BIN
bootloader/firmware_prebuilt/blank_config.bin
Normal file
BIN
bootloader/firmware_prebuilt/blank_config.bin
Normal file
Binary file not shown.
BIN
bootloader/firmware_prebuilt/rboot.bin
Normal file
BIN
bootloader/firmware_prebuilt/rboot.bin
Normal file
Binary file not shown.
|
@ -1 +1 @@
|
|||
Subproject commit 4cf6132f6ee624318c04b2a8d9e37da64b7c283c
|
||||
Subproject commit 30afbaa777e00abf9d7d469fb3345f118c4975c1
|
23
bootloader/rboot.h
Normal file
23
bootloader/rboot.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* rboot header overrides
|
||||
|
||||
This "wrapper" header contains default values for building rboot
|
||||
on/for esp-open-rtos. It gets included both when building the
|
||||
bootloader and when building extras/rboot-ota support. It includes
|
||||
the default bootloader/rboot/rboot.h header via the gcc
|
||||
include_next mechanism.
|
||||
*/
|
||||
#ifndef __RBOOT_H__
|
||||
|
||||
// Big flash support is required for esp-open-rtos (we use 8Mbit
|
||||
// "slots" only.)
|
||||
#define BOOT_BIG_FLASH
|
||||
|
||||
// enable 2 way communication between
|
||||
// rBoot and the user app via the esp rtc data area
|
||||
#define BOOT_RTC_ENABLED
|
||||
|
||||
// Call 'main' rboot.h to pick up defaults for other parameters
|
||||
#include_next "rboot.h"
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue