Skip to content

Commit

Permalink
feat: (ISP) jump to bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
but0n committed Jun 5, 2017
1 parent 2ad843e commit ba766ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LDLIBS+=-lstm32

STARTUP=startup.c

all: clean libs src
all: libs src
$(CC) -o $(PROGRAM).elf $(LDFLAGS) \
-Wl,--whole-archive \
src/app.a \
Expand Down Expand Up @@ -40,7 +40,13 @@ tshow:
@echo "=🍺====>> optimize settings: $(InfoTextLib), $(InfoTextSrc)"
@echo "=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_"

flash:
isp: /dev/cu.SLAB_USBtoUART main.bin
cat -u /dev/cu.SLAB_USBtoUART & stty -f /dev/cu.SLAB_USBtoUART 115200
echo '>' > /dev/cu.SLAB_USBtoUART
pkill cat -u /dev/cu.SLAB_USBtoUART
make flash || make flash

flash: /dev/cu.SLAB_USBtoUART main.bin
stm32flash -w $(TOP)/main.bin -v -g 0 /dev/tty.SLAB_USBtoUART
dump:
$(OBJDUMP) -D main.elf > DUMP.s
Expand Down
7 changes: 7 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
#include "pid.h"
#include "tty.h"

#define ISP_ADDR 0x1FFFF000

void jump2ISP() {
__set_MSP(*(unsigned int *)ISP_ADDR);
((void (*)(void))*((unsigned int *)(ISP_ADDR + 4)))();
}


double _asin(double i) {return asin(i);}
double _atan2(double i,double k) {return atan2(i,k);}
Expand Down

0 comments on commit ba766ae

Please sign in to comment.