Do not use IRQs and remove vector table
Do not use ISRs and poll for interrupt flags in the main loop. No need for moving vector table into bootloader and back. Remove vector table by adding LDFLAGS = -nostartfiles. Manually add some code which is now removed, but still needed by C runtime: - make sure that r1 is 0x00 (zero register). - on some MCUs the stack pointer is not initialized correctly after reset. - main() need to be placed in special section .init9 to be called at all. Not sure why the BSS and DATA segment are still initialized. This change is heavily based on the optiboot bootloader.
This commit is contained in:
1
Makefile
1
Makefile
@@ -63,6 +63,7 @@ endif
|
||||
CFLAGS = -pipe -g -Os -mmcu=$(MCU) -Wall -fdata-sections -ffunction-sections
|
||||
CFLAGS += -Wa,-adhlns=$(*F).lst -DBOOTLOADER_START=$(BOOTLOADER_START)
|
||||
LDFLAGS = -Wl,-Map,$(@:.elf=.map),--cref,--relax,--gc-sections,--section-start=.text=$(BOOTLOADER_START)
|
||||
LDFLAGS += -nostartfiles
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user