Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/buildcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ def generate_code(self, options):
# The ResetHandler was not defined - don't build VectorTable
return ""
max_irq = max(self.irqs.keys())
table = [" DefaultHandler,\n"] * (max_irq + armcm_offset + 1)
table = [" DefaultHandler,\n"] * (max_irq + armcm_offset + 2)
defs = []
for num, func in self.irqs.items():
if num < 1 - armcm_offset:
error("Invalid IRQ %d (%s)" % (num, func))
defs.append("extern void %s(void);\n" % (func,))
table[num + armcm_offset] = " %s,\n" % (func,)
table[0] = " &_stack_end,\n"
table[-1] = " (void*)0x55AA11EE,\n"
fmt = """
extern void DefaultHandler(void);
extern uint32_t _stack_end;
Expand Down
14 changes: 14 additions & 0 deletions src/stm32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,25 @@ src-$(CONFIG_HAVE_GPIO_SDIO) += stm32/sdio.c

# Binary output file rules
target-y += $(OUT)klipper.bin
target-y += $(OUT)klipper.srec

$(OUT)klipper.bin: $(OUT)klipper.elf
@echo " Creating bin file $@"
$(Q)$(OBJCOPY) -O binary $< $@

$(OUT)klipper.srec: $(OUT)klipper.bin
@echo " Creating srec file $@"
$(Q)$(OBJCOPY) -I binary -O srec --change-addresses "$(CONFIG_FLASH_APPLICATION_ADDRESS)" $< $@

# Print OpenBLT BOOT_FLASH_VECTOR_TABLE_CS_OFFSET
print-openblt-vector-table-cs-offset:
@addr=`$(OBJDUMP) -s -j .text $(OUT)klipper.elf | grep ee11aa55 | awk '{print $$1}'`; \
if [ -z "$$addr" ]; then \
echo "Pattern not found"; \
exit 1; \
fi; \
printf "BOOT_FLASH_VECTOR_TABLE_CS_OFFSET: 0x%X\n" $$((0x$$addr - $(CONFIG_FLASH_APPLICATION_ADDRESS)))

# Flash rules
lib/hidflash/hid-flash:
@echo " Building hid-flash"
Expand Down
Loading