Skip to content

Commit 129615a

Browse files
committed
text fixes
1 parent 426ddb3 commit 129615a

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

ports/stm32f4/boards/STM32F412ZGTx_FLASH.ld

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
GNU linker script for STM32F411 via Micropython
2+
GNU linker script for STM32F412
33
*/
44

55
/* Specify the memory areas */
@@ -51,8 +51,6 @@ SECTIONS
5151
. = ALIGN(4);
5252
*(.text*) /* .text* sections (code) */
5353
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
54-
/* *(.glue_7) */ /* glue arm to thumb code */
55-
/* *(.glue_7t) */ /* glue thumb to arm code */
5654

5755
. = ALIGN(4);
5856
_etext = .; /* define a global symbol at end of code */

ports/stm32f4/boards/stm32f412zg_discovery/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ USB_PID = 0x572B
33
USB_PRODUCT = "STM32F412ZG Discovery Board - CPy"
44
USB_MANUFACTURER = "STMicroelectronics"
55

6-
USB_CDC_AND_MSC_ONLY = 1
6+
USB_DEVICES = "CDC,MSC"
77
INTERNAL_FLASH_FILESYSTEM = 1
88
LONGINT_IMPL = NONE
99

ports/stm32f4/supervisor/usb.c

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,42 +33,46 @@
3333
#include "stm32f4xx_hal.h"
3434

3535
void init_usb_hardware(void) {
36-
GPIO_InitTypeDef GPIO_InitStruct = {0};
37-
/**USB_OTG_FS GPIO Configuration
38-
PA10 ------> USB_OTG_FS_ID
39-
PA11 ------> USB_OTG_FS_DM
40-
PA12 ------> USB_OTG_FS_DP
41-
*/
42-
__HAL_RCC_GPIOA_CLK_ENABLE();
36+
//TODO: if future chips overload this with options, move to peripherals management.
4337

44-
/* Configure DM DP Pins */
45-
GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12;
46-
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
47-
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
48-
GPIO_InitStruct.Pull = GPIO_NOPULL;
49-
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
50-
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
38+
GPIO_InitTypeDef GPIO_InitStruct = {0};
39+
/**USB_OTG_FS GPIO Configuration
40+
PA10 ------> USB_OTG_FS_ID
41+
PA11 ------> USB_OTG_FS_DM
42+
PA12 ------> USB_OTG_FS_DP
43+
*/
44+
__HAL_RCC_GPIOA_CLK_ENABLE();
5145

52-
/* Configure VBUS Pin */
53-
GPIO_InitStruct.Pin = GPIO_PIN_9;
54-
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
55-
GPIO_InitStruct.Pull = GPIO_NOPULL;
56-
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
46+
/* Configure DM DP Pins */
47+
GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12;
48+
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
49+
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
50+
GPIO_InitStruct.Pull = GPIO_NOPULL;
51+
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
52+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
5753

58-
/* This for ID line debug */
59-
GPIO_InitStruct.Pin = GPIO_PIN_10;
60-
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
61-
GPIO_InitStruct.Pull = GPIO_PULLUP;
62-
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
63-
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
64-
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
54+
/* Configure VBUS Pin */
55+
GPIO_InitStruct.Pin = GPIO_PIN_9;
56+
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
57+
GPIO_InitStruct.Pull = GPIO_NOPULL;
58+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
6559

66-
/* Configure POWER_SWITCH IO pin (F412 ONLY)*/
67-
GPIO_InitStruct.Pin = GPIO_PIN_8;
68-
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
69-
GPIO_InitStruct.Pull = GPIO_NOPULL;
70-
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
60+
/* This for ID line debug */
61+
GPIO_InitStruct.Pin = GPIO_PIN_10;
62+
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
63+
GPIO_InitStruct.Pull = GPIO_PULLUP;
64+
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
65+
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
66+
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
7167

72-
/* Peripheral clock enable */
73-
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
68+
#ifdef STM32F412Zx
69+
/* Configure POWER_SWITCH IO pin (F412 ONLY)*/
70+
GPIO_InitStruct.Pin = GPIO_PIN_8;
71+
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
72+
GPIO_InitStruct.Pull = GPIO_NOPULL;
73+
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
74+
#endif
75+
76+
/* Peripheral clock enable */
77+
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
7478
}

0 commit comments

Comments
 (0)