Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eboot: .RODATA, upstream uzlib, move CRC, save 112 bytes #7844

Merged
merged 7 commits into from
Feb 8, 2021

Conversation

earlephilhower
Copy link
Collaborator

@earlephilhower earlephilhower commented Jan 27, 2021

RODATA can be copied automatically by the bootrom, so no reason not to
allow its use for strings and constants in eboot.c

Revert to pfalcon's original uzlib since the single patch to remove
RODATA is not required.

Rationalize eboot.ld linker script, clean up BSS and init it in code.

Saves 112 bytes of space in the bootloader sector by removing the
extra code associated with literal loads.

Move CRC out of bootload sector

We added protection to only erase the bootload sector when flashing an
image when the new sector != the old sector. This was intended to
minimize the chance of bricking (i.e. if there was a powerfail during
flashing of the boot sector the chip would be dead).

Unfortunately, by placing the CRC inside the eboot sector every
application will have a unique eboot sector (due to the crc/len), so
this protection doesn't work.

Move the CRC into the first 8 bytes of IROM itself. This frees up extra
space in the boot sector and ensures that eboot won't be reflashed
unless there really is an eboot change.

@earlephilhower

This comment has been minimized.

RODATA can be copied automatically by the bootrom, so no reason not to
allow its use for strings and constants in eboot.c

Revert to pfalcon's original uzlib since the single patch to remove
RODATA is not required.

Rationalize eboot.ld linker script, clean up BSS and init it in code.

Saves 112 bytes of space in the bootloader sector by removing the
extra code associated with literal loads.
@earlephilhower earlephilhower changed the title Allow .RODATA in eboot, upstream uzlib, save IROM eboot: .RODATA, upstream uzlib, save 112 bytes Jan 29, 2021
We added protection to only erase the bootload sector when flashing an
image when the new sector != the old sector.  This was intended to
minimize the chance of bricking (i.e. if there was a powerfail during
flashing of the boot sector the chip would be dead).

Unfortunately, by placing the CRC inside the eboot sector *every*
application will have a unique eboot sector (due to the crc/len), so
this protection doesn't work.

Move the CRC into the first 8 bytes of IROM itself.  This frees up extra
space in the boot sector and ensures that eboot won't be reflashed
unless there really is an eboot change.
@earlephilhower earlephilhower changed the title eboot: .RODATA, upstream uzlib, save 112 bytes eboot: .RODATA, upstream uzlib, move CRC, save 112 bytes Jan 29, 2021
@earlephilhower earlephilhower added this to the 3.0.0 milestone Feb 1, 2021
mcspr added a commit to mcspr/esp8266-Arduino that referenced this pull request Feb 3, 2021
cores/esp8266/Esp.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WorksForMe!

@earlephilhower earlephilhower merged commit 07b4c09 into esp8266:master Feb 8, 2021
@earlephilhower earlephilhower deleted the eboot-rodata1 branch February 8, 2021 00:33
@DriekdeGadgetfreak
Copy link

Move CRC out of bootload sector

The consequence of this move is that "checksum" (in write_bin) is not valid anymore, because the data is changed afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants