Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini boot #11

Open
wants to merge 19 commits into
base: mini-boot
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ TAGS
tags
cscope.out
build
*~
12 changes: 12 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This is at least a partial credits-file of people that have
contributed to the Maple bootloader. It is formatted the same way the
Linux kernel CREDITS file is structured: sorted by name and formatted
for easy processing.

The fields are: name (N), email (E), web-address (W), description (D).

----------

N: Tormod Volden
E: debian.tormod@gmail.com
D: Fixes for DFU compliance
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ ST_LIB = stm32_lib
ST_USB = usb_lib

# Optimization level [0,1,2,3,s]
OPT = 0
DEBUG = -g
OPT ?= 0
DEBUG =
#DEBUG = dwarf-2

INCDIRS = ./$(ST_LIB) ./$(ST_USB)
Expand Down Expand Up @@ -81,7 +81,7 @@ ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
# file management
ASRC = $(ST_LIB)/c_only_startup.s $(ST_LIB)/cortexm3_macro.s

STM32SRCS =
STM32SRCS =

_STM32USBSRCS = usb_regs.c \
usb_int.c \
Expand Down Expand Up @@ -117,7 +117,7 @@ build: elf bin lss sym

bin: $(TARGET).bin
elf: $(TARGET).elf
lss: $(TARGET).lss
lss: $(TARGET).lss
sym: $(TARGET).sym
dfu: $(TARGET).bin
sudo dfu-util -d 0110:1001 -a 0 -D $(TARGET).bin
Expand All @@ -139,15 +139,15 @@ end:
@echo
sizeafter:
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
gccversion:
gccversion:
@$(CC) --version

program:
program:
@echo "Flash-programming with OpenOCD"
cp $(TARGET).bin flash/tmpflash.bin
cd flash && openocd -f flash.cfg

program_serial:
program_serial:
@echo "Flash-programming with stm32loader.py"
./flash/stm32loader.py -p /dev/ttyUSB0 -evw build/maple_boot.bin

Expand Down Expand Up @@ -192,7 +192,7 @@ run: $(TARGET).bin


# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(COBJ) $(AOBJ)

%.elf: $(COBJ) $(AOBJ)
Expand All @@ -204,7 +204,7 @@ run: $(TARGET).bin
$(COBJ) : $(BUILDDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(THUMB) $(ALL_CFLAGS) $< -o $@
$(CC) -c $(THUMB) $(ALL_CFLAGS) $< -o $@

# Assemble: create object files from assembler source files. ARM/Thumb
$(AOBJ) : $(BUILDDIR)/%.o : %.s
Expand Down
9 changes: 3 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ usb.c

usb_callbacks.c
- aka endpoints: handling data transfer when "Configured". calls out to
application specific callbacks (eg DFU or serial shit)
application specific callbacks (i.e. DFU).

usb_descriptor.c
- aka application descriptor; big static struct and callbacks for sending
Expand All @@ -29,10 +29,7 @@ hardware.c
dfu.c
- mostly the giant FSM case switch, also some USB endpoint callbacks


TODO --------------------------------------------------------------------------

* tap reset then quickly tap The Button leaves the board in dfu wait loop
forever instead of just 2 seconds

* use sizeof() for usb application descriptor
* pack the structs
* use sizeof() for usb application descriptor once structs are packed
2 changes: 2 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
#define BOOTLOADER_WAIT 6

#define USER_CODE_RAM ((u32)0x20000C00)
#define RAM_END ((u32)0x20005000)
#define USER_CODE_FLASH ((u32)0x08005000)
#define FLASH_END ((u32)0x08020000)

#define VEND_ID0 0xAF
#define VEND_ID1 0x1E
Expand Down
Loading