mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[usb-flasher] Create a standalone DFU .bin.
Change-Id: I34e87b66cc51f4e6f4578c8efc7a510ee08cd138
This commit is contained in:
@@ -43,3 +43,6 @@ products += $(patsubst %.$(EXE),%.map,$(filter %.$(EXE),$(products)))
|
||||
.PHONY: openocd
|
||||
openocd:
|
||||
openocd -f build/device/openocd.cfg
|
||||
|
||||
flasher.$(EXE): LDFLAGS = --gc-sections -T ion/src/device/usb/flasher.ld
|
||||
flasher.$(EXE): $(objs) $(usb_objs) ion/src/device/usb/flasher.o
|
||||
|
||||
@@ -34,19 +34,19 @@ objs += $(usb_objs)
|
||||
|
||||
else
|
||||
|
||||
usb_objs += liba/src/assert.o
|
||||
usb_objs += liba/src/strlen.o
|
||||
usb_objs += liba/src/strlcpy.o
|
||||
usb_objs += liba/src/memset.o
|
||||
usb_objs += liba/src/memcpy.o
|
||||
usb_objs += libaxx/src/cxxabi/pure_virtual.o
|
||||
usb_objs += ion/src/device/usb/boot.o
|
||||
usb_objs += ion/src/device/keyboard.o
|
||||
usb_objs += ion/src/device/device.o
|
||||
usb_objs += ion/src/device/usb.o
|
||||
dfu_objs += liba/src/assert.o
|
||||
dfu_objs += liba/src/strlen.o
|
||||
dfu_objs += liba/src/strlcpy.o
|
||||
dfu_objs += liba/src/memset.o
|
||||
dfu_objs += liba/src/memcpy.o
|
||||
dfu_objs += libaxx/src/cxxabi/pure_virtual.o
|
||||
dfu_objs += ion/src/device/usb/boot.o
|
||||
dfu_objs += ion/src/device/keyboard.o
|
||||
dfu_objs += ion/src/device/device.o
|
||||
dfu_objs += ion/src/device/usb.o
|
||||
|
||||
ion/src/device/usb/dfu.elf: LDFLAGS = --gc-sections -T ion/src/device/boot/dfu.ld
|
||||
ion/src/device/usb/dfu.elf: $(usb_objs)
|
||||
ion/src/device/usb/dfu.elf: LDFLAGS = --gc-sections -T ion/src/device/usb/dfu.ld
|
||||
ion/src/device/usb/dfu.elf: $(usb_objs) $(dfu_objs)
|
||||
|
||||
ion/src/device/usb/dfu.o: ion/src/device/usb/dfu.bin
|
||||
@echo "OBJCOPY $@"
|
||||
|
||||
8
ion/src/device/usb/flasher.cpp
Normal file
8
ion/src/device/usb/flasher.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "../regs/regs.h"
|
||||
#include "../usb/calculator.h"
|
||||
|
||||
void ion_main(int argc, char * argv[]) {
|
||||
while (!OTG.GINTSTS()->getENUMDNE()) {
|
||||
}
|
||||
Ion::USB::Device::Calculator::Poll();
|
||||
}
|
||||
68
ion/src/device/usb/flasher.ld
Normal file
68
ion/src/device/usb/flasher.ld
Normal file
@@ -0,0 +1,68 @@
|
||||
/* Create a flash bridge.
|
||||
* Load it at address 0x20004000 and execute it from there
|
||||
* TODO: Explain the 16K offset (ST's DFU ROMed bootloader)
|
||||
*/
|
||||
|
||||
MEMORY {
|
||||
RAM_BUFFER (rw) : ORIGIN = 0x20000000 + 16K, LENGTH = 256K - 16K
|
||||
}
|
||||
|
||||
STACK_SIZE = 4K;
|
||||
|
||||
SECTIONS {
|
||||
.isr_vector_table ORIGIN(RAM_BUFFER) : {
|
||||
KEEP(*(.isr_vector_table))
|
||||
} >RAM_BUFFER
|
||||
|
||||
.text : {
|
||||
. = ALIGN(4);
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
} >RAM_BUFFER
|
||||
|
||||
.init_array : {
|
||||
. = ALIGN(4);
|
||||
_init_array_start = .;
|
||||
KEEP (*(.init_array*))
|
||||
_init_array_end = .;
|
||||
} >RAM_BUFFER
|
||||
|
||||
.rodata : {
|
||||
. = ALIGN(4);
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
} >RAM_BUFFER
|
||||
|
||||
.data : {
|
||||
. = ALIGN(4);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
} >RAM_BUFFER
|
||||
|
||||
.bss : {
|
||||
. = ALIGN(4);
|
||||
_bss_section_start_ram = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(COMMON)
|
||||
_bss_section_end_ram = .;
|
||||
} >RAM_BUFFER
|
||||
|
||||
.stack : {
|
||||
. = ALIGN(8);
|
||||
_stack_end = .;
|
||||
. += (STACK_SIZE - 8);
|
||||
. = ALIGN(8);
|
||||
_stack_start = .;
|
||||
} >RAM_BUFFER
|
||||
|
||||
.phony : {
|
||||
/* We won't do dynamic memory allocation */
|
||||
_heap_start = .;
|
||||
_heap_end = .;
|
||||
/* Effectively bypass copying .data to RAM */
|
||||
_data_section_start_flash = .;
|
||||
_data_section_start_ram = .;
|
||||
_data_section_end_ram = .;
|
||||
} >RAM_BUFFER
|
||||
}
|
||||
Reference in New Issue
Block a user