Skip to content

Commit 79d5cfd

Browse files
Erwan Le Rayatorgue
authored andcommitted
ARM: debug: stm32: add UART early console configuration for STM32F4
Early console is hardcoded on USART1 in current implementation. With this patch, default UART instance is USART1, but other UART instances can be configured by setting physical and virtual base addresses in menuconfig. Signed-off-by: Erwan Le Ray <erwan.leray@st.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
1 parent bb6d3fb commit 79d5cfd

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎arch/arm/Kconfig.debug‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,12 +1201,13 @@ choice
12011201

12021202
config STM32F4_DEBUG_UART
12031203
bool "Use STM32F4 UART for low-level debug"
1204-
depends on ARCH_STM32
1204+
depends on MACH_STM32F429 || MACH_STM32F469
12051205
select DEBUG_STM32_UART
12061206
help
12071207
Say Y here if you want kernel low-level debugging support
12081208
on STM32F4 based platforms, which default UART is wired on
1209-
USART1.
1209+
USART1, but another UART instance can be selected by modifying
1210+
CONFIG_DEBUG_UART_PHYS.
12101211

12111212
If unsure, say N.
12121213

@@ -1619,6 +1620,7 @@ config DEBUG_UART_PHYS
16191620
default 0x3e000000 if DEBUG_BCM_KONA_UART
16201621
default 0x3f201000 if DEBUG_BCM2836
16211622
default 0x4000e400 if DEBUG_LL_UART_EFM32
1623+
default 0x40011000 if STM32F4_DEBUG_UART
16221624
default 0x40028000 if DEBUG_AT91_SAMV7_USART1
16231625
default 0x40081000 if DEBUG_LPC18XX_UART0
16241626
default 0x40090000 if DEBUG_LPC32XX
@@ -1713,7 +1715,7 @@ config DEBUG_UART_PHYS
17131715
DEBUG_S3C64XX_UART || \
17141716
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
17151717
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \
1716-
DEBUG_AT91_UART
1718+
DEBUG_AT91_UART || DEBUG_STM32_UART
17171719

17181720
config DEBUG_UART_VIRT
17191721
hex "Virtual base address of debug UART"
@@ -1823,7 +1825,7 @@ config DEBUG_UART_VIRT
18231825
DEBUG_S3C64XX_UART || \
18241826
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
18251827
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \
1826-
DEBUG_AT91_UART
1828+
DEBUG_AT91_UART || DEBUG_STM32_UART
18271829

18281830
config DEBUG_UART_8250_SHIFT
18291831
int "Register offset shift for the 8250 debug UART"

‎arch/arm/include/debug/stm32.S‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* Author: Gerald Baeza <gerald.baeza@st.com> for STMicroelectronics.
55
*/
66

7-
#define STM32_UART_BASE 0x40011000 /* USART1 */
8-
97
#ifdef CONFIG_STM32F4_DEBUG_UART
108
#define STM32_USART_SR_OFF 0x00
119
#define STM32_USART_TDR_OFF 0x04
@@ -20,8 +18,8 @@
2018
#define STM32_USART_TXE (1 << 7) /* Tx data reg empty */
2119

2220
.macro addruart, rp, rv, tmp
23-
ldr \rp, =STM32_UART_BASE @ physical base
24-
ldr \rv, =STM32_UART_BASE @ virt base /* NoMMU */
21+
ldr \rp, =CONFIG_DEBUG_UART_PHYS @ physical base
22+
ldr \rv, =CONFIG_DEBUG_UART_VIRT @ virt base
2523
.endm
2624

2725
.macro senduart,rd,rx

0 commit comments

Comments
 (0)