mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-24 19:42:27 +03:00
* Add a CRC32 over progmem and ESP.checkFlashCRC Automatically embed a CRC32 of the program memory (including bootloader but excluding any filesystems) in all images in unused space in the bootloader block. Add a call, ESP.checkFlashCRC() which returns false if the calculated CRC doesn't match the one stored in the image (i.e. flash corruption). Fixes #4165 * Add example that corrupts itself, comments Show CRC checking catch a 1-bit error in program code by corrupting a large array, and then return it to clean and verify the CRC matches once again. Add comments to the CRC check routine Clean up pylint complaints on crc32bin.py * Check linker script for CRC space in bootsector Add an assertion in the eboot linker file to guarantee that we have at least 8 bytes of unused space at the end of the boot sector to patch in the CRC. If not, the eboot link will fail. * Add note about what to do if CRC check fails Per discussion with @d-a-v. When the CRC check fails, you could *try* to do certain things (but may not succeed since there is known flash corruption at that point). List a few ideas for application authors. * Only single, flash/ram friendly crc32() function * Combine the CRC calc and bin generation in 1 step Per discussion w/@mcspr, combine the CRC calculation with the binary generation, removing the additional build step.
184 lines
4.7 KiB
Plaintext
184 lines
4.7 KiB
Plaintext
/* This linker script generated from xt-genldscripts.tpp for LSP . */
|
|
/* Linker Script for ld -N */
|
|
MEMORY
|
|
{
|
|
dport0_0_seg : org = 0x3FF00000, len = 0x10
|
|
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
|
|
iram1_0_seg : org = 0x4010f000, len = 0x1000
|
|
irom0_0_seg : org = 0x40240000, len = 0x32000
|
|
}
|
|
|
|
PHDRS
|
|
{
|
|
dport0_0_phdr PT_LOAD;
|
|
dram0_0_phdr PT_LOAD;
|
|
dram0_0_bss_phdr PT_LOAD;
|
|
iram1_0_phdr PT_LOAD;
|
|
irom0_0_phdr PT_LOAD;
|
|
}
|
|
|
|
|
|
/* Default entry point: */
|
|
ENTRY(main)
|
|
PROVIDE(_memmap_vecbase_reset = 0x40000000);
|
|
/* Various memory-map dependent cache attribute settings: */
|
|
_memmap_cacheattr_wb_base = 0x00000110;
|
|
_memmap_cacheattr_wt_base = 0x00000110;
|
|
_memmap_cacheattr_bp_base = 0x00000220;
|
|
_memmap_cacheattr_unused_mask = 0xFFFFF00F;
|
|
_memmap_cacheattr_wb_trapnull = 0x2222211F;
|
|
_memmap_cacheattr_wba_trapnull = 0x2222211F;
|
|
_memmap_cacheattr_wbna_trapnull = 0x2222211F;
|
|
_memmap_cacheattr_wt_trapnull = 0x2222211F;
|
|
_memmap_cacheattr_bp_trapnull = 0x2222222F;
|
|
_memmap_cacheattr_wb_strict = 0xFFFFF11F;
|
|
_memmap_cacheattr_wt_strict = 0xFFFFF11F;
|
|
_memmap_cacheattr_bp_strict = 0xFFFFF22F;
|
|
_memmap_cacheattr_wb_allvalid = 0x22222112;
|
|
_memmap_cacheattr_wt_allvalid = 0x22222112;
|
|
_memmap_cacheattr_bp_allvalid = 0x22222222;
|
|
PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
|
|
|
|
SECTIONS
|
|
{
|
|
|
|
.dport0.rodata : ALIGN(4)
|
|
{
|
|
_dport0_rodata_start = ABSOLUTE(.);
|
|
*(.dport0.rodata)
|
|
*(.dport.rodata)
|
|
_dport0_rodata_end = ABSOLUTE(.);
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
.dport0.literal : ALIGN(4)
|
|
{
|
|
_dport0_literal_start = ABSOLUTE(.);
|
|
*(.dport0.literal)
|
|
*(.dport.literal)
|
|
_dport0_literal_end = ABSOLUTE(.);
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
.dport0.data : ALIGN(4)
|
|
{
|
|
_dport0_data_start = ABSOLUTE(.);
|
|
*(.dport0.data)
|
|
*(.dport.data)
|
|
_dport0_data_end = ABSOLUTE(.);
|
|
} >dport0_0_seg :dport0_0_phdr
|
|
|
|
.data : ALIGN(4)
|
|
{
|
|
*(COMMON) /* Global vars */
|
|
. = ALIGN(4);
|
|
_heap_start = ABSOLUTE(.);
|
|
/* _stack_sentry = ALIGN(0x8); */
|
|
} >dram0_0_seg :dram0_0_bss_phdr
|
|
/* __stack = 0x3ffc8000; */
|
|
|
|
.text : ALIGN(4)
|
|
{
|
|
_stext = .;
|
|
_text_start = ABSOLUTE(.);
|
|
*(.entry.text)
|
|
*(.init.literal)
|
|
*(.init)
|
|
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
|
*(.fini.literal)
|
|
*(.fini)
|
|
*(.gnu.version)
|
|
_text_end = ABSOLUTE(.);
|
|
_etext = .;
|
|
. = ALIGN (8);
|
|
_data_start = ABSOLUTE(.);
|
|
*(.data)
|
|
*(.data.*)
|
|
*(.gnu.linkonce.d.*)
|
|
*(.data1)
|
|
*(.sdata)
|
|
*(.sdata.*)
|
|
*(.gnu.linkonce.s.*)
|
|
*(.sdata2)
|
|
*(.sdata2.*)
|
|
*(.gnu.linkonce.s2.*)
|
|
*(.jcr)
|
|
_data_end = ABSOLUTE(.);
|
|
. = ALIGN (8);
|
|
_rodata_start = ABSOLUTE(.);
|
|
*(.rodata)
|
|
*(.rodata.*)
|
|
*(.gnu.linkonce.r.*)
|
|
*(.rodata1)
|
|
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
|
|
*(.xt_except_table)
|
|
*(.gcc_except_table)
|
|
*(.gnu.linkonce.e.*)
|
|
*(.gnu.version_r)
|
|
*(.eh_frame)
|
|
/* C++ constructor and destructor tables, properly ordered: */
|
|
KEEP (*crtbegin.o(.ctors))
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
|
KEEP (*(SORT(.ctors.*)))
|
|
KEEP (*(.ctors))
|
|
KEEP (*crtbegin.o(.dtors))
|
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
|
KEEP (*(SORT(.dtors.*)))
|
|
KEEP (*(.dtors))
|
|
/* C++ exception handlers table: */
|
|
__XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
|
|
*(.xt_except_desc)
|
|
*(.gnu.linkonce.h.*)
|
|
__XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
|
|
*(.xt_except_desc_end)
|
|
*(.dynamic)
|
|
*(.gnu.version_d)
|
|
. = ALIGN(4); /* this table MUST be 4-byte aligned */
|
|
_bss_table_start = ABSOLUTE(.);
|
|
LONG(_bss_start)
|
|
LONG(_bss_end)
|
|
_bss_table_end = ABSOLUTE(.);
|
|
_rodata_end = ABSOLUTE(.);
|
|
|
|
. = ALIGN (8);
|
|
_bss_start = ABSOLUTE(.);
|
|
*(.dynsbss)
|
|
*(.sbss)
|
|
*(.sbss.*)
|
|
*(.gnu.linkonce.sb.*)
|
|
*(.scommon)
|
|
*(.sbss2)
|
|
*(.sbss2.*)
|
|
*(.gnu.linkonce.sb2.*)
|
|
*(.dynbss)
|
|
*(.bss)
|
|
*(.bss.*)
|
|
*(.gnu.linkonce.b.*)
|
|
. = ALIGN (8);
|
|
_bss_end = ABSOLUTE(.);
|
|
/* CRC stored in last 8 bytes */
|
|
ASSERT((. < 4096 - 8), "Error: No space for CRC in bootloader sector.");
|
|
. = _stext + 4096 - 8;
|
|
_crc_size = .;
|
|
. = . + 4;
|
|
_crc_val = .;
|
|
} >iram1_0_seg :iram1_0_phdr
|
|
|
|
.lit4 : ALIGN(4)
|
|
{
|
|
_lit4_start = ABSOLUTE(.);
|
|
*(*.lit4)
|
|
*(.lit4.*)
|
|
*(.gnu.linkonce.lit4.*)
|
|
_lit4_end = ABSOLUTE(.);
|
|
} >iram1_0_seg :iram1_0_phdr
|
|
|
|
.irom0.text : ALIGN(4)
|
|
{
|
|
_irom0_text_start = ABSOLUTE(.);
|
|
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
|
|
_irom0_text_end = ABSOLUTE(.);
|
|
} >irom0_0_seg :irom0_0_phdr
|
|
}
|
|
|
|
/* get ROM code address */
|
|
INCLUDE "rom.ld"
|