@ -564,15 +564,56 @@ CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
e n d i f
e n d i f
.PHONY : deploy
d e f i n e R U N _ D F U
$( ECHO) " Writing $( 1) to the board "
$( if $( filter $( USE_PYDFU) ,1) ,\
$( Q) $( PYTHON) $( PYDFU) --vid $( BOOTLOADER_DFU_USB_VID) --pid $( BOOTLOADER_DFU_USB_PID) -u $( 1) ,
$( Q) $( DFU_UTIL) -a 0 -d $( BOOTLOADER_DFU_USB_VID) :$( BOOTLOADER_DFU_USB_PID) -D $( 1) )
e n d e f
d e f i n e R U N _ S T L I N K
$( ECHO) " Writing $( 1) to the board via ST-LINK "
$( Q) $( STFLASH) write $( 1) $( 2)
e n d e f
d e f i n e R U N _ O P E N O C D
$( ECHO) " Writing $( 1) to the board via ST-LINK using OpenOCD "
$( Q) $( OPENOCD) -f $( OPENOCD_CONFIG) -c " stm_flash $( 1) $( 2) $( 3) $( 4) "
e n d e f
d e f i n e G E N E R A T E _ E L F
$( ECHO) " LINK $( 1) "
$( Q) $( LD) $( LDFLAGS) -o $( 1) $( 2) $( LDFLAGS_MOD) $( LIBS)
$( Q) $( SIZE) $( 1)
$( if $( filter-out $( TEXT0_ADDR) ,0x08000000) , \
$( ECHO) "INFO: this build requires mboot to be installed first" )
$( if $( filter $( TEXT1_ADDR) ,0x90000000) , \
$( ECHO) "INFO: this build places firmware in external QSPI flash" )
e n d e f
d e f i n e G E N E R A T E _ B I N
$( ECHO) " GEN $( 1) "
$( Q) $( OBJCOPY) -O binary $( addprefix -j ,$( 3) ) $( 2) $( 1)
e n d e f
d e f i n e G E N E R A T E _ D F U
$( ECHO) " GEN $( 1) "
$( Q) $( PYTHON) $( DFU) \
-D $( BOOTLOADER_DFU_USB_VID) :$( BOOTLOADER_DFU_USB_PID) \
$( if $( 2) ,$( addprefix -b ,$( 3) :$( 2) ) ) \
$( if $( 4) ,$( addprefix -b ,$( 5) :$( 4) ) ) \
$( 1)
e n d e f
d e f i n e G E N E R A T E _ H E X
$( ECHO) " GEN $( 1) "
$( Q) $( OBJCOPY) -O ihex $( 2) $( 1)
e n d e f
.PHONY : deploy deploy -stlink deploy -openocd
deploy : $( BUILD ) /firmware .dfu
deploy : $( BUILD ) /firmware .dfu
$( ECHO) " Writing $< to the board "
$( call RUN_DFU,$^)
i f e q ( $( USE_PYDFU ) , 1 )
$( Q) $( PYTHON) $( PYDFU) --vid $( BOOTLOADER_DFU_USB_VID) --pid $( BOOTLOADER_DFU_USB_PID) -u $<
e l s e
$( Q) $( DFU_UTIL) -a 0 -d $( BOOTLOADER_DFU_USB_VID) :$( BOOTLOADER_DFU_USB_PID) -D $<
e n d i f
# A board should specify TEXT0_ADDR if to use a different location than the
# A board should specify TEXT0_ADDR if to use a different location than the
# default for the firmware memory location. A board can also optionally define
# default for the firmware memory location. A board can also optionally define
@ -584,18 +625,17 @@ ifeq ($(TEXT1_ADDR),)
TEXT0_SECTIONS ?= .isr_vector .text .data
TEXT0_SECTIONS ?= .isr_vector .text .data
deploy-stlink : $( BUILD ) /firmware .dfu
deploy-stlink : $( BUILD ) /firmware .bin
$( ECHO) " Writing $( BUILD) /firmware.bin to the board via ST-LINK "
$( call RUN_STLINK,$^,$( TEXT0_ADDR) )
$( Q) $( STFLASH) write $( BUILD) /firmware.bin $( TEXT0_ADDR)
deploy-openocd : $( BUILD ) /firmware .dfu
deploy-openocd : $( BUILD ) /firmware .bin
$( ECHO) " Writing $( BUILD) /firmware.bin to the board via ST-LINK using OpenOCD "
$( call RUN_OPENOCD,$^,$( TEXT0_ADDR) )
$( Q) $( OPENOCD) -f $( OPENOCD_CONFIG) -c " stm_flash $( BUILD) /firmware.bin $( TEXT0_ADDR) "
$(BUILD)/firmware.dfu : $( BUILD ) /firmware .elf
$(BUILD)/firmware.bin : $( BUILD ) /firmware .elf
$( ECHO) " Create $@ "
$( call GENERATE_BIN,$@ ,$^,$( TEXT0_SECTIONS) )
$( Q) $( OBJCOPY) -O binary $( addprefix -j ,$( TEXT0_SECTIONS) ) $^ $( BUILD) /firmware.bin
$( Q) $( PYTHON) $( DFU) -D $( BOOTLOADER_DFU_USB_VID) :$( BOOTLOADER_DFU_USB_PID) -b $( TEXT0_ADDR) :$( BUILD) /firmware.bin $@
$(BUILD)/firmware.dfu : $( BUILD ) /firmware .bin
$( call GENERATE_DFU,$@ ,$^,$( TEXT0_ADDR) )
e l s e
e l s e
# TEXT0_ADDR and TEXT1_ADDR are specified so split firmware between these locations
# TEXT0_ADDR and TEXT1_ADDR are specified so split firmware between these locations
@ -603,38 +643,28 @@ else
TEXT0_SECTIONS ?= .isr_vector
TEXT0_SECTIONS ?= .isr_vector
TEXT1_SECTIONS ?= .text .data
TEXT1_SECTIONS ?= .text .data
deploy-stlink : $( BUILD ) /firmware .dfu
deploy-stlink : $( BUILD ) /firmware 0.bin $( BUILD ) /firmware 1.bin
$( ECHO) " Writing $( BUILD) /firmware0.bin to the board via ST-LINK "
$( call RUN_STLINK,$( word 1,$^) ,$( TEXT0_ADDR) )
$( Q) $( STFLASH) write $( BUILD) /firmware0.bin $( TEXT0_ADDR)
$( call RUN_STLINK,$( word 2,$^) ,$( TEXT1_ADDR) )
$( ECHO) " Writing $( BUILD) /firmware1.bin to the board via ST-LINK "
$( Q) $( STFLASH) --reset write $( BUILD) /firmware1.bin $( TEXT1_ADDR)
deploy-openocd : $( BUILD ) /firmware .dfu
deploy-openocd : $( BUILD ) /firmware 0.bin $( BUILD ) /firmware 1.bin
$( ECHO) " Writing $( BUILD) /firmware{0,1}.bin to the board via ST-LINK using OpenOCD "
$( call RUN_OPENOCD,$( word 1,$^) ,$( TEXT0_ADDR) ,$( word 2,$^) ,$( TEXT1_ADDR) )
$( Q) $( OPENOCD) -f $( OPENOCD_CONFIG) -c " stm_flash $( BUILD) /firmware0.bin $( TEXT0_ADDR) $( BUILD) /firmware1.bin $( TEXT1_ADDR) "
$(BUILD)/firmware.dfu : $( BUILD ) /firmware .elf
$(BUILD)/firmware0.bin : $( BUILD ) /firmware .elf
$( ECHO) " GEN $@ "
$( call GENERATE_BIN,$@ ,$^,$( TEXT0_SECTIONS) )
$( Q) $( OBJCOPY) -O binary $( addprefix -j ,$( TEXT0_SECTIONS) ) $^ $( BUILD) /firmware0.bin
$( Q) $( OBJCOPY) -O binary $( addprefix -j ,$( TEXT1_SECTIONS) ) $^ $( BUILD) /firmware1.bin
$( Q) $( PYTHON) $( DFU) -D $( BOOTLOADER_DFU_USB_VID) :$( BOOTLOADER_DFU_USB_PID) -b $( TEXT0_ADDR) :$( BUILD) /firmware0.bin -b $( TEXT1_ADDR) :$( BUILD) /firmware1.bin $@
$(BUILD)/firmware1.bin : $( BUILD ) /firmware .elf
$( call GENERATE_BIN,$@ ,$^,$( TEXT1_SECTIONS) )
$(BUILD)/firmware.dfu : $( BUILD ) /firmware 0.bin $( BUILD ) /firmware 1.bin
$( call GENERATE_DFU,$@ ,$( word 1,$^) ,$( TEXT0_ADDR) ,$( word 2,$^) ,$( TEXT1_ADDR) )
e n d i f
e n d i f
$(BUILD)/firmware.hex : $( BUILD ) /firmware .elf
$(BUILD)/firmware.hex : $( BUILD ) /firmware .elf
$( ECHO) " GEN $@ "
$( call GENERATE_HEX,$@ ,$^)
$( Q) $( OBJCOPY) -O ihex $< $@
$(BUILD)/firmware.elf : $( OBJ )
$(BUILD)/firmware.elf : $( OBJ )
$( ECHO) " LINK $@ "
$( call GENERATE_ELF,$@ ,$^)
$( Q) $( LD) $( LDFLAGS) -o $@ $^ $( LDFLAGS_MOD) $( LIBS)
$( Q) $( SIZE) $@
i f n e q ( $( TEXT 0_ADDR ) , 0 x 0 8 0 0 0 0 0 0 )
$( ECHO) "INFO: this build requires mboot to be installed first"
e n d i f
i f e q ( $( TEXT 1_ADDR ) , 0 x 9 0 0 0 0 0 0 0 )
$( ECHO) "INFO: this build places firmware in external QSPI flash"
e n d i f
PLLVALUES = boards/pllvalues.py
PLLVALUES = boards/pllvalues.py
MAKE_PINS = boards/make-pins.py
MAKE_PINS = boards/make-pins.py