Skip to content

Commit

Permalink
add F4 OTGHS/FS support
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrystu committed Aug 1, 2020
1 parent 64b1460 commit f46db9b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
40 changes: 38 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ FWTARGETS += stm32l073v8 stm32l073xb stm32l073xc
FWTARGETS += stm32l476xc stm32l476xe stm32l476xg
FWTARGETS += stm32f103x4 stm32f103x6 stm32f103x8 stm32f103xb
FWTARGETS += stm32f303xb stm32f303xc stm32f303xd stm32f303xe
FWTARGETS += stm32f429xe stm32f429xg stm32f429xi
FWTARGETS += stm32f429xe stm32f429xg stm32f429xi stm32f429xi_hs
FWTARGETS += stm32f105xb stm32f107xb
FWTARGETS += stm32l433xb stm32l433xc
FWTARGETS += stm32f070x6 stm32f070xb
FWTARGETS += stm32g431x6 stm32g431x8 stm32g431xb
FWTARGETS += stm32g474xb stm32g474xc stm32g474xe
FWTARGETS += stm32f446xc
FWTARGETS += stm32f446xc stm32f446xc_hs stm32f446xe stm32f446xe_hs
FWTARGETS += stm32f405xg stm32f405xg_hs

$(FWTARGETS) : fwclean

Expand Down Expand Up @@ -459,6 +460,12 @@ stm32f429xi :
FWDEFS='STM32F4 STM32F429xx' \
LDPARAMS='ROMLEN=2048K RAMLEN=192K APPALIGN=0x4000'

stm32f429xi_hs :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F429xx USBD_PRIMARY_OTGHS' \
LDPARAMS='ROMLEN=2048K RAMLEN=192K APPALIGN=0x4000'

stm32f105xb :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m3' \
FWSTARTUP='mcu/stm32f105.S' \
Expand Down Expand Up @@ -536,5 +543,34 @@ stm32f446xc :
FWDEFS='STM32F4 STM32F446xx' \
LDPARAMS='ROMLEN=256K RAMLEN=128K APPALIGN=0x4000'

stm32f446xc_hs :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F446xx USBD_PRIMARY_OTGHS' \
LDPARAMS='ROMLEN=256K RAMLEN=128K APPALIGN=0x4000'

stm32f446xe :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F446xx' \
LDPARAMS='ROMLEN=512K RAMLEN=128K APPALIGN=0x4000'

stm32f446xe_hs :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F446xx USBD_PRIMARY_OTGHS' \
LDPARAMS='ROMLEN=512K RAMLEN=128K APPALIGN=0x4000'

stm32f405xg :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F405xx' \
LDPARAMS='ROMLEN=1024K RAMLEN=128K APPALIGN=0x4000'

stm32f405xg_hs :
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
FWSTARTUP='mcu/stm32f4xx.S' \
FWDEFS='STM32F4 STM32F405xx USBD_PRIMARY_OTGHS' \
LDPARAMS='ROMLEN=1024K RAMLEN=128K APPALIGN=0x4000'

.PHONY: clean bootloader crypter all program program_stcube rebuild fwclean testsuite prerequisites $(FWTARGETS)
16 changes: 13 additions & 3 deletions mcu/stm32f4xx.S
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,18 @@ System_Reset:
adds r1, 0x04
cmp r1, r2
bcc .L_bss_loop

/* Enabling USB pins GPIOA11 GPIO12 AF10*/
mov r1, 0x01
#if defined(USBD_PRIMARY_OTGHS)
/* Enabling USB pins GPIOB14 GPIOB15 AF12*/
movs r1, 0x02
strb r1, [r5, RCC_AHB1ENR]
ldr r0, = GPIOB
movs r1, 0xA0
strb r1, [r0, GPIO_MODER + 0x03]
movs r1, 0xCC
strb r1, [r0, GPIO_AFRH + 0x03]
#else
/* Enabling USB pins GPIOA11 GPIOA12 AF10*/
movs r1, 0x01
strb r1, [r5, RCC_AHB1ENR]
ldr r0, = GPIOA
ldr r1, [r0, GPIO_MODER]
Expand All @@ -278,6 +287,7 @@ System_Reset:
str r1, [r0, GPIO_MODER]
lsls r2, #12
str r2, [r0, GPIO_AFRH]
#endif
#if (DFU_SEAL_LEVEL != 0)
ldr r3, = seal_flash
blx r3
Expand Down

0 comments on commit f46db9b

Please sign in to comment.