mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2025-12-06 07:02:00 +01:00
Adding USB bootloader support
This commit is contained in:
parent
e394d90c0d
commit
776aae5450
37
Makefile
37
Makefile
|
|
@ -79,25 +79,32 @@ BINBIN=outp.bin
|
||||||
MCFLAGS=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
MCFLAGS=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
||||||
|
|
||||||
# COMPILE FLAGS
|
# COMPILE FLAGS
|
||||||
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC)
|
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0
|
||||||
|
DEFS_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000
|
||||||
|
|
||||||
CFLAGS=-c $(MCFLAGS) $(INCLUDES)
|
CFLAGS=-c $(MCFLAGS) $(INCLUDES)
|
||||||
CXXFLAGS=-c $(MCFLAGS) $(INCLUDES)
|
CXXFLAGS=-c $(MCFLAGS) $(INCLUDES)
|
||||||
|
|
||||||
# LINKER FLAGS
|
# LINKER FLAGS
|
||||||
LDSCRIPT=stm32f10x_link.ld
|
LDSCRIPT=normal.ld
|
||||||
LDFLAGS =-T $(LDSCRIPT) $(MCFLAGS) --specs=nosys.specs $(INCLUDES_LIBS) $(LINK_LIBS)
|
LDSCRIPT_BL=bootloader.ld
|
||||||
|
LDFLAGS=$(MCFLAGS) --specs=nosys.specs $(INCLUDES_LIBS) $(LINK_LIBS)
|
||||||
|
|
||||||
# Build Rules
|
# Build Rules
|
||||||
.PHONY: all release hs debug clean
|
.PHONY: all release hs bl debug clean
|
||||||
|
|
||||||
all: hs
|
all: hs
|
||||||
|
|
||||||
hs: CFLAGS+=$(DEFS_HS) -Os -MMD -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS
|
hs: CFLAGS+=$(DEFS_HS) -Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS
|
||||||
hs: CXXFLAGS+=$(DEFS_HS) -Os -MMD -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS
|
hs: CXXFLAGS+=$(DEFS_HS) -Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS
|
||||||
hs: LDFLAGS+=-Os --specs=nano.specs
|
hs: LDFLAGS+=-T $(LDSCRIPT_N) -Os --specs=nano.specs
|
||||||
hs: release
|
hs: release
|
||||||
|
|
||||||
|
bl: CFLAGS+=$(DEFS_HS_BL) -Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS
|
||||||
|
bl: CXXFLAGS+=$(DEFS_HS_BL) -Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS
|
||||||
|
bl: LDFLAGS+=-T $(LDSCRIPT_BL) -Os --specs=nano.specs
|
||||||
|
bl: release
|
||||||
|
|
||||||
debug: CFLAGS+=-g $(DEFS_HS)
|
debug: CFLAGS+=-g $(DEFS_HS)
|
||||||
debug: CXXFLAGS+=-g $(DEFS_HS)
|
debug: CXXFLAGS+=-g $(DEFS_HS)
|
||||||
debug: LDFLAGS+=-g
|
debug: LDFLAGS+=-g
|
||||||
|
|
@ -151,6 +158,22 @@ ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
stlink-bl:
|
||||||
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08002000"
|
||||||
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08002000"
|
||||||
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08002000"
|
||||||
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
serial:
|
serial:
|
||||||
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
/usr/local/bin/stm32flash -w bin/$(BINBIN) -g 0x0 $(devser)
|
/usr/local/bin/stm32flash -w bin/$(BINBIN) -g 0x0 $(devser)
|
||||||
|
|
|
||||||
26
bootloader.ld
Normal file
26
bootloader.ld
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ROM (rx) : ORIGIN = 0x08002000, LENGTH = 56K /* FLASH */
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
||||||
|
}
|
||||||
|
|
||||||
|
INCLUDE stm32f10x_link.ld
|
||||||
26
normal.ld
Normal file
26
normal.ld
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Memory areas */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64K /* FLASH */
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
||||||
|
}
|
||||||
|
|
||||||
|
INCLUDE stm32f10x_link.ld
|
||||||
|
|
@ -23,13 +23,6 @@ _min_stack_size = 0x0800;
|
||||||
/* The entry point in the interrupt vector table */
|
/* The entry point in the interrupt vector table */
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
/* Memory areas */
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64K /* FLASH */
|
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Stack start address (end of 20K RAM) */
|
/* Stack start address (end of 20K RAM) */
|
||||||
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue