mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Added dependencies for eboot.ld and Makefile to Makefile.
Updated eboot.ld to not fill with zeros through the CS field on its way to the CRC. Added size test to elf2bin.py
This commit is contained in:
parent
9e9515b49f
commit
fe7faf701e
@ -29,11 +29,11 @@ CFLAGS += $(INC)
|
||||
|
||||
CFLAGS += $(UZLIB_FLAGS)
|
||||
|
||||
LDFLAGS += -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -umain
|
||||
LDFLAGS += -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -umain -Wl,-Map,$(@:.elf=.map)
|
||||
|
||||
LD_SCRIPT := -Teboot.ld
|
||||
|
||||
APP_OUT:= eboot.elf
|
||||
APP_OUT := eboot.elf
|
||||
APP_AR := eboot.a
|
||||
APP_FW := eboot.bin
|
||||
|
||||
@ -49,13 +49,14 @@ tinfgzip.o: $(UZLIB_PATH)/tinfgzip.c $(UZLIB_PATH)/uzlib.h $(UZLIB_PATH)/uzlib_c
|
||||
$(APP_AR): $(TARGET_OBJ_PATHS) tinflate.o tinfgzip.o
|
||||
$(AR) cru $@ $^
|
||||
|
||||
$(APP_OUT): $(APP_AR)
|
||||
$(APP_OUT): $(APP_AR) eboot.ld | Makefile
|
||||
$(LD) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group -Wl,--whole-archive $(APP_AR) -Wl,--end-group -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(APP_AR)
|
||||
rm -f $(APP_OUT)
|
||||
rm -f *.map
|
||||
|
||||
|
||||
.PHONY: all clean default
|
||||
|
Binary file not shown.
@ -154,12 +154,24 @@ SECTIONS
|
||||
*(.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 = .;
|
||||
_free_space = 4096 - 17 - (. - _stext);
|
||||
/*
|
||||
The boot loader checksum must be before the CRC, which is written by elf2bin.py.
|
||||
This leaves 16 bytes after the checksum for the CRC placed at the end of the
|
||||
4096-byte sector. */
|
||||
_cs_here = (ALIGN((. + 1), 16) == ALIGN(16)) ? (ALIGN(16) - 1) : (. + 0x0F);
|
||||
|
||||
/*
|
||||
The filling (padding) and values for _crc_size and _crc_val are handled by
|
||||
elf2bin.py. With this, we give values to the symbols without explicitly
|
||||
assigning space. This avoids the linkers back *fill* operation that causes
|
||||
trouble.
|
||||
|
||||
The CRC info is stored in last 8 bytes. */
|
||||
_crc_size = _stext + 4096 - 8;
|
||||
_crc_val = _stext + 4096 - 4;
|
||||
ASSERT((4096 > (17 + (. - _stext))), "Error: No space for CS and CRC in bootloader sector.");
|
||||
ASSERT((_crc_size > _cs_here), "Error: CRC must be located after CS.");
|
||||
} >iram1_0_seg :iram1_0_phdr
|
||||
|
||||
.lit4 : ALIGN(4)
|
||||
|
@ -93,6 +93,8 @@ def write_bin(out, elf, segments, to_addr, flash_mode, flash_size, flash_freq, p
|
||||
out.write(bytearray([0]))
|
||||
out.write(bytearray([checksum]))
|
||||
if to_addr != 0:
|
||||
if total_size + 8 > to_addr:
|
||||
raise Exception('Bin image of ' + elf + ' is too big, actual size ' + str(total_size + 8) + ', target size ' + str(to_addr) + '.')
|
||||
while total_size < to_addr:
|
||||
out.write(bytearray([0xaa]))
|
||||
total_size += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user