Skip to content

Commit f46db9b

Browse files
committed
add F4 OTGHS/FS support
1 parent 64b1460 commit f46db9b

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed

Makefile

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ FWTARGETS += stm32l073v8 stm32l073xb stm32l073xc
173173
FWTARGETS += stm32l476xc stm32l476xe stm32l476xg
174174
FWTARGETS += stm32f103x4 stm32f103x6 stm32f103x8 stm32f103xb
175175
FWTARGETS += stm32f303xb stm32f303xc stm32f303xd stm32f303xe
176-
FWTARGETS += stm32f429xe stm32f429xg stm32f429xi
176+
FWTARGETS += stm32f429xe stm32f429xg stm32f429xi stm32f429xi_hs
177177
FWTARGETS += stm32f105xb stm32f107xb
178178
FWTARGETS += stm32l433xb stm32l433xc
179179
FWTARGETS += stm32f070x6 stm32f070xb
180180
FWTARGETS += stm32g431x6 stm32g431x8 stm32g431xb
181181
FWTARGETS += stm32g474xb stm32g474xc stm32g474xe
182-
FWTARGETS += stm32f446xc
182+
FWTARGETS += stm32f446xc stm32f446xc_hs stm32f446xe stm32f446xe_hs
183+
FWTARGETS += stm32f405xg stm32f405xg_hs
183184

184185
$(FWTARGETS) : fwclean
185186

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

463+
stm32f429xi_hs :
464+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
465+
FWSTARTUP='mcu/stm32f4xx.S' \
466+
FWDEFS='STM32F4 STM32F429xx USBD_PRIMARY_OTGHS' \
467+
LDPARAMS='ROMLEN=2048K RAMLEN=192K APPALIGN=0x4000'
468+
462469
stm32f105xb :
463470
$(MAKE) bootloader FWCPU='-mcpu=cortex-m3' \
464471
FWSTARTUP='mcu/stm32f105.S' \
@@ -536,5 +543,34 @@ stm32f446xc :
536543
FWDEFS='STM32F4 STM32F446xx' \
537544
LDPARAMS='ROMLEN=256K RAMLEN=128K APPALIGN=0x4000'
538545

546+
stm32f446xc_hs :
547+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
548+
FWSTARTUP='mcu/stm32f4xx.S' \
549+
FWDEFS='STM32F4 STM32F446xx USBD_PRIMARY_OTGHS' \
550+
LDPARAMS='ROMLEN=256K RAMLEN=128K APPALIGN=0x4000'
551+
552+
stm32f446xe :
553+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
554+
FWSTARTUP='mcu/stm32f4xx.S' \
555+
FWDEFS='STM32F4 STM32F446xx' \
556+
LDPARAMS='ROMLEN=512K RAMLEN=128K APPALIGN=0x4000'
557+
558+
stm32f446xe_hs :
559+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
560+
FWSTARTUP='mcu/stm32f4xx.S' \
561+
FWDEFS='STM32F4 STM32F446xx USBD_PRIMARY_OTGHS' \
562+
LDPARAMS='ROMLEN=512K RAMLEN=128K APPALIGN=0x4000'
563+
564+
stm32f405xg :
565+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
566+
FWSTARTUP='mcu/stm32f4xx.S' \
567+
FWDEFS='STM32F4 STM32F405xx' \
568+
LDPARAMS='ROMLEN=1024K RAMLEN=128K APPALIGN=0x4000'
569+
570+
stm32f405xg_hs :
571+
$(MAKE) bootloader FWCPU='-mcpu=cortex-m4' \
572+
FWSTARTUP='mcu/stm32f4xx.S' \
573+
FWDEFS='STM32F4 STM32F405xx USBD_PRIMARY_OTGHS' \
574+
LDPARAMS='ROMLEN=1024K RAMLEN=128K APPALIGN=0x4000'
539575

540576
.PHONY: clean bootloader crypter all program program_stcube rebuild fwclean testsuite prerequisites $(FWTARGETS)

mcu/stm32f4xx.S

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,18 @@ System_Reset:
267267
adds r1, 0x04
268268
cmp r1, r2
269269
bcc .L_bss_loop
270-
271-
/* Enabling USB pins GPIOA11 GPIO12 AF10*/
272-
mov r1, 0x01
270+
#if defined(USBD_PRIMARY_OTGHS)
271+
/* Enabling USB pins GPIOB14 GPIOB15 AF12*/
272+
movs r1, 0x02
273+
strb r1, [r5, RCC_AHB1ENR]
274+
ldr r0, = GPIOB
275+
movs r1, 0xA0
276+
strb r1, [r0, GPIO_MODER + 0x03]
277+
movs r1, 0xCC
278+
strb r1, [r0, GPIO_AFRH + 0x03]
279+
#else
280+
/* Enabling USB pins GPIOA11 GPIOA12 AF10*/
281+
movs r1, 0x01
273282
strb r1, [r5, RCC_AHB1ENR]
274283
ldr r0, = GPIOA
275284
ldr r1, [r0, GPIO_MODER]
@@ -278,6 +287,7 @@ System_Reset:
278287
str r1, [r0, GPIO_MODER]
279288
lsls r2, #12
280289
str r2, [r0, GPIO_AFRH]
290+
#endif
281291
#if (DFU_SEAL_LEVEL != 0)
282292
ldr r3, = seal_flash
283293
blx r3

0 commit comments

Comments
 (0)