cpu/esp8266: build the SDK bootloader from source #19073
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR is a takeover of PR #17043, which is rebased to the current master and includes some corrections that became necessary after rebasing.
Copied from description of PR #17043:
We had four versions of pre-built bootloaders for the esp8266 with different settings of logging and color logging. These bootloaders were manually built from the SDK and shipped with RIOT-OS source code. However there are more settings that affect the bootloader build that are relevant to the app or final board that uses this bootloader. In particular, flash size and flash speed is important for the bootloader to be able to load an app from a large partition table at the fastest speed supported by the board layout and flash chip.
Another example is the UART baudrate of the logging output from the bootloader. The boot ROM will normally start at a baud rate of 74880 (depending on the crystal installed), so it might make sense to keep the UART output at the same speed so we can debug boot modes and bootloader with the same terminal.
This patch builds the
bootloader.bin
file from the ESP8266 SDK source code. The code is built as a module (esp8266_bootloader
) which at the moment doesn't generate any object code for the application and only produces abootloader.bin
file set to theBOOTLOADER_BIN
make variable for theesptool.inc.mk
to flash.The code needs to be compiled and linked with custom rules defined in the module's Makefile since the
bootloader.bin
is its own separate application.The
BOOTLOADER_BIN
variable is changed from a path relative to the$(RIOTCPU)/$(CPU)/bin/
directory to be full path. This makes it easier for applications or board to provide their own bootloader binary if needed.As a result of building the bootloader from source we fixed the issue of having a large partition table.
Testing procedure
Use following command to flash the application with STDIO UART baudrate of 115200 baud.
Connect with a terminal programm of your choice (unfortunatly
picocom
andsocat
don't support a baudrate close to 74880), for example:On reset, the
esp8266-esp-12x
node shows the ROM bootloader log outputas well as the second-stage bootloader built by this PR (
ESP-IDF v3.1-51-g913a06a9ac3
) at 74880 baudrate.The application output is seen as garbage since the
esp8266-esp-12x
uses 115200 as baurate by default.To see all output at a baudrate of 74880 baud, you can use the following command:
If the application is built without options, the ROOM bootloader output will be 74880 baud and the second stage bootloader and application output will be 115200 baud.
Issues/PRs references
Fixes issue #16402