Skip to contentSkip to conversation

Add support for stm32f429-discovery board

PATCH New Kamil Lulko 4 participants 19 messages Mar 1, 2015 – Apr 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add support for stm32f429-discovery board

The following patches implement basic support for the ARMv7-M microcontroller architecture.
Additionally, stm32f429-discovery board support is added with tested ability to boot uClinux from the embedded Flash memory.

Kamil Lulko (4):
ARM: Add ARMv7-M support
ARMv7M: Add STM32F4 support
stm32f4: Add serial driver
stm32f4: Add support for stm32f429-discovery board

 arch/arm/Kconfig                                   |   9 +
 arch/arm/cpu/armv7m/Makefile                       |  11 +
 arch/arm/cpu/armv7m/config.mk                      |   8 +
 arch/arm/cpu/armv7m/cpu.c                          |  35 +++
 arch/arm/cpu/armv7m/start.S                        |  15 ++
 arch/arm/cpu/armv7m/stm32f4/Makefile               |  11 +
 arch/arm/cpu/armv7m/stm32f4/clock.c                | 209 +++++++++++++++
 arch/arm/cpu/armv7m/stm32f4/flash.c                | 143 ++++++++++
 arch/arm/cpu/armv7m/stm32f4/soc.c                  |  37 +++
 arch/arm/cpu/armv7m/stm32f4/timer.c                | 118 +++++++++
 arch/arm/include/asm/arch-stm32f4/fmc.h            |  75 ++++++
 arch/arm/include/asm/arch-stm32f4/gpio.h           | 116 +++++++++
 arch/arm/include/asm/arch-stm32f4/stm32.h          | 108 ++++++++
 arch/arm/include/asm/armv7m.h                      |  60 +++++
 arch/arm/lib/Makefile                              |   8 +-
 arch/arm/lib/crt0.S                                |  30 +++
 arch/arm/lib/interrupts_m.c                        |  95 +++++++
 arch/arm/lib/relocate.S                            |  13 +
 arch/arm/lib/vectors_m.S                           |  57 ++++
 board/st/stm32f429-discovery/Kconfig               |  19 ++
 board/st/stm32f429-discovery/MAINTAINERS           |   6 +
 board/st/stm32f429-discovery/Makefile              |  12 +
 board/st/stm32f429-discovery/led.c                 |  35 +++
 board/st/stm32f429-discovery/stm32f429-discovery.c | 288 +++++++++++++++++++++
 configs/stm32f429-discovery_defconfig              |   2 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/stm32_gpio.c                          | 199 ++++++++++++++
 drivers/serial/Makefile                            |   1 +
 drivers/serial/serial.c                            |   2 +
 drivers/serial/serial_stm32.c                      | 117 +++++++++
 include/configs/stm32f429-discovery.h              | 106 ++++++++
 include/flash.h                                    |   2 +
 32 files changed, 1946 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7m/Makefile
 create mode 100644 arch/arm/cpu/armv7m/config.mk
 create mode 100644 arch/arm/cpu/armv7m/cpu.c
 create mode 100644 arch/arm/cpu/armv7m/start.S
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/Makefile
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/clock.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/flash.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/soc.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/timer.c
 create mode 100644 arch/arm/include/asm/arch-stm32f4/fmc.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/gpio.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32.h
 create mode 100644 arch/arm/include/asm/armv7m.h
 create mode 100644 arch/arm/lib/interrupts_m.c
 create mode 100644 arch/arm/lib/vectors_m.S
 create mode 100644 board/st/stm32f429-discovery/Kconfig
 create mode 100644 board/st/stm32f429-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f429-discovery/Makefile
 create mode 100644 board/st/stm32f429-discovery/led.c
 create mode 100644 board/st/stm32f429-discovery/stm32f429-discovery.c
 create mode 100644 configs/stm32f429-discovery_defconfig
 create mode 100644 drivers/gpio/stm32_gpio.c
 create mode 100644 drivers/serial/serial_stm32.c
 create mode 100644 include/configs/stm32f429-discovery.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/4 ARM: Add ARMv7-M support

---
 arch/arm/Kconfig              |  4 ++
 arch/arm/cpu/armv7m/Makefile  | 10 +++++
 arch/arm/cpu/armv7m/config.mk |  8 ++++
 arch/arm/cpu/armv7m/cpu.c     | 35 ++++++++++++++++
 arch/arm/cpu/armv7m/start.S   | 15 +++++++
 arch/arm/include/asm/armv7m.h | 60 +++++++++++++++++++++++++++
 arch/arm/lib/Makefile         |  8 +++-
 arch/arm/lib/crt0.S           | 30 ++++++++++++++
 arch/arm/lib/interrupts_m.c   | 95 +++++++++++++++++++++++++++++++++++++++++++
 arch/arm/lib/relocate.S       | 13 ++++++
 arch/arm/lib/vectors_m.S      | 57 ++++++++++++++++++++++++++
 11 files changed, 333 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7m/Makefile
 create mode 100644 arch/arm/cpu/armv7m/config.mk
 create mode 100644 arch/arm/cpu/armv7m/cpu.c
 create mode 100644 arch/arm/cpu/armv7m/start.S
 create mode 100644 arch/arm/include/asm/armv7m.h
 create mode 100644 arch/arm/lib/interrupts_m.c
 create mode 100644 arch/arm/lib/vectors_m.S
arch/arm/Kconfig +4 -0
index 41f3220..29ea8b4 100644
@@ -33,6 +33,9 @@ config CPU_V7
         bool
         select HAS_VBAR
 
+config CPU_V7M
+	bool
+
 config CPU_PXA
         bool
 
@@ -47,6 +50,7 @@ config SYS_CPU
         default "arm1136" if CPU_ARM1136
         default "arm1176" if CPU_ARM1176
         default "armv7" if CPU_V7
+        default "armv7m" if CPU_V7M
         default "pxa" if CPU_PXA
         default "sa1100" if CPU_SA1100
 	default "armv8" if ARM64
arch/arm/cpu/armv7m/Makefile new file +10 -0
new file mode 100644
index 0000000..a187f6e
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+extra-y := start.o
+obj-y += cpu.o
+
arch/arm/cpu/armv7m/config.mk new file +8 -0
new file mode 100644
index 0000000..0b31e44
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2015
+# Kamil Lulko, <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+PLATFORM_CPPFLAGS += -march=armv7-m -mthumb
arch/arm/cpu/armv7m/cpu.c new file +35 -0
new file mode 100644
index 0000000..d3ab862
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2010,2011
+ * Vladimir Khusainov, Emcraft Systems, vlad at emcraft.com
+ *
+ * (C) Copyright 2015
+ * Kamil Lulko, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/armv7m.h>
+
+/*
+ * This is called right before passing control to
+ * the Linux kernel point.
+ */
+int cleanup_before_linux(void)
+{
+	return 0;
+}
+
+/*
+ * Perform the low-level reset.
+ */
+void reset_cpu(ulong addr)
+{
+	/*
+	 * Perform reset but keep priority group unchanged.
+	 */
+	writel((V7M_AIRCR_VECTKEY << V7M_AIRCR_VECTKEY_SHIFT)
+		| (V7M_SCB->aircr & V7M_AIRCR_PRIGROUP_MSK)
+		| V7M_AIRCR_SYSRESET, &V7M_SCB->aircr);
+}
arch/arm/cpu/armv7m/start.S new file +15 -0
new file mode 100644
index 0000000..e05e984
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2015
+ * Kamil Lulko, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+.globl	reset
+.type reset, %function
+reset:
+	b	_main
+
+.globl	c_runtime_cpu_setup
+c_runtime_cpu_setup:
+	mov	pc, lr
arch/arm/include/asm/armv7m.h new file +60 -0

60 lines not on this page · raw message

arch/arm/lib/Makefile +6 -2
index d74e4b8..3cfeb14 100644
@@ -8,7 +8,9 @@
 lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _divsi3.o \
 			_lshrdi3.o _modsi3.o _udivsi3.o _umodsi3.o div0.o
 
-ifdef CONFIG_ARM64
+ifdef CONFIG_CPU_V7M
+obj-y	+= vectors_m.o crt0.o
+else ifdef CONFIG_ARM64
 obj-y	+= crt0_64.o
 else
 obj-y	+= vectors.o crt0.o
@@ -35,7 +37,9 @@ endif
 obj-$(CONFIG_SEMIHOSTING) += semihosting.o
 
 obj-y	+= sections.o
-ifdef CONFIG_ARM64
+ifdef CONFIG_CPU_V7M
+obj-y	+= interrupts_m.o
+else ifdef CONFIG_ARM64
 obj-y	+= gic_64.o
 obj-y	+= interrupts_64.o
 else
arch/arm/lib/crt0.S +30 -0
index 22df3e5..51e6bb8 100644
@@ -9,6 +9,9 @@
 #include <config.h>
 #include <asm-offsets.h>
 #include <linux/linkage.h>
+#ifdef CONFIG_CPU_V7M
+#include <asm/armv7m.h>
+#endif
 
 /*
  * This file handles the target-independent stages of the U-Boot
@@ -66,15 +69,30 @@ ENTRY(_main)
 #else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
 #endif
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif
 	mov	r2, sp
 	sub	sp, sp, #GD_SIZE	/* allocate one GD above SP */
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif
 	mov	r9, sp		/* GD is above SP */
 	mov	r1, sp
 	mov	r0, #0
 clr_gd:
 	cmp	r1, r2			/* while not at end of GD */
+#if defined(CONFIG_CPU_V7M)
+	itt	lo
+#endif
 	strlo	r0, [r1]		/* clear 32-bit GD word */
 	addlo	r1, r1, #4		/* move to next */
 	blo	clr_gd
@@ -94,13 +112,22 @@ clr_gd:
  */
 
 	ldr	sp, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif
 	ldr	r9, [r9, #GD_BD]		/* r9 = gd->bd */
 	sub	r9, r9, #GD_SIZE		/* new GD is below bd */
 
 	adr	lr, here
 	ldr	r0, [r9, #GD_RELOC_OFF]		/* r0 = gd->reloc_off */
 	add	lr, lr, r0
+#if defined(CONFIG_CPU_V7M)
+	orr	lr, #1				/* As required by Thumb-only */
+#endif
 	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
 	b	relocate_code
 here:
@@ -120,6 +147,9 @@ here:
 	mov	r2, #0x00000000		/* prepare zero to clear BSS */
 
 clbss_l:cmp	r0, r1			/* while not at end of BSS */
+#if defined(CONFIG_CPU_V7M)
+	itt	lo
+#endif
 	strlo	r2, [r0]		/* clear 32-bit BSS word */
 	addlo	r0, r0, #4		/* move to next */
 	blo	clbss_l
arch/arm/lib/interrupts_m.c new file +95 -0

95 lines not on this page · raw message

arch/arm/lib/relocate.S +13 -0
index 92f5314..475d503 100644
@@ -9,6 +9,9 @@
 #include <asm-offsets.h>
 #include <config.h>
 #include <linux/linkage.h>
+#ifdef CONFIG_CPU_V7M
+#include <asm/armv7m.h>
+#endif
 
 /*
  * Default/weak exception vectors relocation routine
@@ -23,6 +26,15 @@
 
 ENTRY(relocate_vectors)
 
+#ifdef CONFIG_CPU_V7M
+	/*
+	 * On ARMv7-M we only have to write the new vector address
+	 * to VTOR register.
+	 */
+	ldr	r0, [r9, #GD_RELOCADDR]	/* r0 = gd->relocaddr */
+	ldr	r1, =V7M_SCB_BASE
+	str	r0, [r1, V7M_SCB_VTOR]
+#else
 #ifdef CONFIG_HAS_VBAR
 	/*
 	 * If the ARM processor has the security extensions,
@@ -47,6 +59,7 @@ ENTRY(relocate_vectors)
 	ldmia	r0!, {r2-r8,r10}
 	stmia	r1!, {r2-r8,r10}
 #endif
+#endif
 	bx	lr
 
 ENDPROC(relocate_vectors)
arch/arm/lib/vectors_m.S new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/4 ARM: Add ARMv7-M support

Quoted 1 line · Kamil Lulko

[snip]

Quoted 1 line
arch/arm/lib/crt0.S +0 -0

[snip]

arch/arm/lib/crt0.S ENTRY(_main) · line 78

Quoted 11 lines
arch/arm/lib/crt0.S +6 -0
@@ -66,15 +69,30 @@ ENTRY(_main)
 #else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
 #endif
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif

There's 4 places where this change comes in. Albert, what do you think about always just doing this in 3 instructions with a comment in the first instance about v7-M support?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150305/bc1da967/attachment.sig>
#3 lore raw

PATCH 1/4 ARM: Add ARMv7-M support

Am 05.03.2015 um 16:32 schrieb Tom Rini:

Quoted 6 lines · Kamil Lulko
Quoted 2 lines

[snip]

Quoted 1 line
arch/arm/lib/crt0.S +0 -0

[snip]

Quoted 15 lines

arch/arm/lib/crt0.S ENTRY(_main) · line 78

Quoted 11 lines
arch/arm/lib/crt0.S +6 -0
@@ -66,15 +69,30 @@ ENTRY(_main)
 #else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
 #endif
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif

There's 4 places where this change comes in. Albert, what do you think about always just doing this in 3 instructions with a comment in the first instance about v7-M support?

I remember running into problems like these when working on STM32F429 support late last year and I adopted some helper macros from Linux, I believe. The same problem existed in U-Boot's private libgcc code.

Regards,
Andreas

Signature · 11 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG N?rnberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150331/4417dbf7/attachment.sig>
#4 lore raw

PATCH 1/4 ARM: Add ARMv7-M support

Quoted 23 lines · Andreas F?rber

Am 05.03.2015 um 16:32 schrieb Tom Rini:

Quoted 6 lines · Kamil Lulko
Quoted 2 lines

[snip]

Quoted 1 line
arch/arm/lib/crt0.S +0 -0

[snip]

Quoted 15 lines

arch/arm/lib/crt0.S ENTRY(_main) · line 78

Quoted 11 lines
arch/arm/lib/crt0.S +6 -0
@@ -66,15 +69,30 @@ ENTRY(_main)
 #else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
 #endif
+#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
+	mov	r3, sp
+	bic	r3, r3, #7
+	mov	sp, r3
+#else
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
+#endif

There's 4 places where this change comes in. Albert, what do you think about always just doing this in 3 instructions with a comment in the first instance about v7-M support?

Quoted 3 lines

I remember running into problems like these when working on STM32F429 support late last year and I adopted some helper macros from Linux, I believe. The same problem existed in U-Boot's private libgcc code.

What macros did you use from the kernel? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150331/3747ae8f/attachment.sig>
#5 lore raw

PATCH 1/4 ARM: Add ARMv7-M support

In reply to Kamil Lulko
Quoted 1 line · On Sun, Mar 01, 2015 at 12:44:39PM +0100, rev13 at wp.pl wrote:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150423/7cc2cd10/attachment.sig>
#6 lore raw

PATCH 2/4 ARMv7M: Add STM32F4 support

In reply to Kamil Lulko
---
 arch/arm/cpu/armv7m/Makefile              |   1 +
 arch/arm/cpu/armv7m/stm32f4/Makefile      |  11 ++
 arch/arm/cpu/armv7m/stm32f4/clock.c       | 209 ++++++++++++++++++++++++++++++
 arch/arm/cpu/armv7m/stm32f4/flash.c       | 143 ++++++++++++++++++++
 arch/arm/cpu/armv7m/stm32f4/soc.c         |  37 ++++++
 arch/arm/cpu/armv7m/stm32f4/timer.c       | 118 +++++++++++++++++
 arch/arm/include/asm/arch-stm32f4/fmc.h   |  75 +++++++++++
 arch/arm/include/asm/arch-stm32f4/gpio.h  | 116 +++++++++++++++++
 arch/arm/include/asm/arch-stm32f4/stm32.h | 108 +++++++++++++++
 drivers/gpio/Makefile                     |   1 +
 drivers/gpio/stm32_gpio.c                 | 199 ++++++++++++++++++++++++++++
 include/flash.h                           |   2 +
 12 files changed, 1020 insertions(+)
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/Makefile
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/clock.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/flash.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/soc.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/timer.c
 create mode 100644 arch/arm/include/asm/arch-stm32f4/fmc.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/gpio.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32.h
 create mode 100644 drivers/gpio/stm32_gpio.c
arch/arm/cpu/armv7m/Makefile +1 -0
index a187f6e..b662e03 100644
@@ -8,3 +8,4 @@
 extra-y := start.o
 obj-y += cpu.o
 
+obj-$(CONFIG_STM32F4) += stm32f4/
arch/arm/cpu/armv7m/stm32f4/Makefile new file +11 -0
new file mode 100644
index 0000000..e982830
@@ -0,0 +1,11 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2015
+# Kamil Lulko, <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += soc.o clock.o timer.o flash.o
arch/arm/cpu/armv7m/stm32f4/clock.c new file +209 -0

209 lines not on this page · raw message

arch/arm/cpu/armv7m/stm32f4/flash.c new file +143 -0

143 lines not on this page · raw message

arch/arm/cpu/armv7m/stm32f4/soc.c new file +37 -0
new file mode 100644
index 0000000..202a126
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2015
+ * Kamil Lulko, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/armv7m.h>
+#include <asm/arch/stm32.h>
+
+u32 get_cpu_rev(void)
+{
+	return 0;
+}
+
+int arch_cpu_init(void)
+{
+	configure_clocks();
+
+	/*
+	 * Configure the memory protection unit (MPU) to allow full access to
+	 * the whole 4GB address space.
+	 */
+	writel(0, &V7M_MPU->rnr);
+	writel(0, &V7M_MPU->rbar);
+	writel((V7M_MPU_RASR_AP_RW_RW | V7M_MPU_RASR_SIZE_4GB
+		| V7M_MPU_RASR_EN), &V7M_MPU->rasr);
+	writel(V7M_MPU_CTRL_ENABLE | V7M_MPU_CTRL_HFNMIENA, &V7M_MPU->ctrl);
+
+	return 0;
+}
+
+void s_init(void)
+{
+}
arch/arm/cpu/armv7m/stm32f4/timer.c new file +118 -0

118 lines not on this page · raw message

arch/arm/include/asm/arch-stm32f4/fmc.h new file +75 -0

75 lines not on this page · raw message

arch/arm/include/asm/arch-stm32f4/gpio.h new file +116 -0

116 lines not on this page · raw message

arch/arm/include/asm/arch-stm32f4/stm32.h new file +108 -0

108 lines not on this page · raw message

drivers/gpio/Makefile +1 -0
index aa11f15..93b0ef6 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_ADI_GPIO2)	+= adi_gpio2.o
 obj-$(CONFIG_TCA642X)		+= tca642x.o
 oby-$(CONFIG_SX151X)		+= sx151x.o
 obj-$(CONFIG_SUNXI_GPIO)	+= sunxi_gpio.o
+obj-$(CONFIG_STM32_GPIO)	+= stm32_gpio.o
drivers/gpio/stm32_gpio.c new file +199 -0

199 lines not on this page · raw message

include/flash.h +2 -0
index 30aa080..48aa3a5 100644
@@ -459,6 +459,8 @@ extern flash_info_t *flash_get_info(ulong base);
 #define FLASH_S29GL064M 0x00F0		/* Spansion S29GL064M-R6		*/
 #define FLASH_S29GL128N 0x00F1		/* Spansion S29GL128N			*/
 
+#define FLASH_STM32F4	0x00F2		/* STM32F4 Embedded Flash */
+
 #define FLASH_UNKNOWN	0xFFFF		/* unknown flash type			*/
 
 
Signature · 1 line
1.9.1
#7 lore raw

PATCH 2/4 ARMv7M: Add STM32F4 support

Quoted 1 line · Kamil Lulko
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150305/c5b2684d/attachment.sig>
#8 lore raw

PATCH 2/4 ARMv7M: Add STM32F4 support

In reply to Kamil Lulko
Quoted 2 lines · On Sun, Mar 01, 2015 at 12:44:40PM +0100, rev13 at wp.pl wrote:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150423/a0930ac7/attachment.sig>
#9 lore raw

PATCH 3/4 stm32f4: Add serial driver

In reply to Kamil Lulko
---
 drivers/serial/Makefile       |   1 +
 drivers/serial/serial.c       |   2 +
 drivers/serial/serial_stm32.c | 117 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 120 insertions(+)
 create mode 100644 drivers/serial/serial_stm32.c
drivers/serial/Makefile +1 -0
index 63b0cbf..eb935bf 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
 obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
 obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o
 obj-$(CONFIG_X86_SERIAL) += serial_x86.o
+obj-$(CONFIG_STM32_SERIAL) += serial_stm32.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_TTY) += usbtty.o
drivers/serial/serial.c +2 -0
index 95c992a..9249a77 100644
@@ -155,6 +155,7 @@ serial_initfunc(sa1100_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(sh_serial_initialize);
+serial_initfunc(stm32_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(zynq_serial_initialize);
 
@@ -248,6 +249,7 @@ void serial_initialize(void)
 	sandbox_serial_initialize();
 	sconsole_serial_initialize();
 	sh_serial_initialize();
+	stm32_serial_initialize();
 	uartlite_serial_initialize();
 	zynq_serial_initialize();
 
drivers/serial/serial_stm32.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
1.9.1
#10 lore raw

PATCH 3/4 stm32f4: Add serial driver

Quoted 1 line · Kamil Lulko
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150305/abf7493e/attachment.sig>
#11 lore raw

PATCH 3/4 stm32f4: Add serial driver

In reply to Kamil Lulko
Quoted 2 lines · On Sun, Mar 01, 2015 at 12:44:41PM +0100, rev13 at wp.pl wrote:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150423/107be991/attachment.sig>
#12 lore raw

PATCH 4/4 stm32f4: Add support for stm32f429-discovery board

In reply to Kamil Lulko
---
 arch/arm/Kconfig                                   |   5 +
 board/st/stm32f429-discovery/Kconfig               |  19 ++
 board/st/stm32f429-discovery/MAINTAINERS           |   6 +
 board/st/stm32f429-discovery/Makefile              |  12 +
 board/st/stm32f429-discovery/led.c                 |  35 +++
 board/st/stm32f429-discovery/stm32f429-discovery.c | 288 +++++++++++++++++++++
 configs/stm32f429-discovery_defconfig              |   2 +
 include/configs/stm32f429-discovery.h              | 106 ++++++++
 8 files changed, 473 insertions(+)
 create mode 100644 board/st/stm32f429-discovery/Kconfig
 create mode 100644 board/st/stm32f429-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f429-discovery/Makefile
 create mode 100644 board/st/stm32f429-discovery/led.c
 create mode 100644 board/st/stm32f429-discovery/stm32f429-discovery.c
 create mode 100644 configs/stm32f429-discovery_defconfig
 create mode 100644 include/configs/stm32f429-discovery.h
arch/arm/Kconfig +5 -0
index 29ea8b4..8835d17 100644
@@ -839,6 +839,10 @@ config ARCH_UNIPHIER
 	select SPL
 	select OF_CONTROL if !SPL_BUILD
 
+config TARGET_STM32F429_DISCOVERY
+	bool "Support STM32F429 Discovery"
+	select CPU_V7M
+
 endchoice
 
 source "arch/arm/cpu/arm926ejs/davinci/Kconfig"
@@ -1000,6 +1004,7 @@ source "board/spear/spear600/Kconfig"
 source "board/spear/x600/Kconfig"
 source "board/st-ericsson/snowball/Kconfig"
 source "board/st-ericsson/u8500/Kconfig"
+source "board/st/stm32f429-discovery/Kconfig"
 source "board/st/stv0991/Kconfig"
 source "board/sunxi/Kconfig"
 source "board/syteco/jadecpu/Kconfig"
board/st/stm32f429-discovery/Kconfig new file +19 -0
new file mode 100644
index 0000000..e73d11b
@@ -0,0 +1,19 @@
+if TARGET_STM32F429_DISCOVERY
+
+config SYS_BOARD
+	string
+	default "stm32f429-discovery"
+
+config SYS_VENDOR
+	string
+	default "st"
+
+config SYS_SOC
+	string
+	default "stm32f4"
+
+config SYS_CONFIG_NAME
+	string
+	default "stm32f429-discovery"
+
+endif
board/st/stm32f429-discovery/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..27e9545
@@ -0,0 +1,6 @@
+M:	Kamil Lulko <[email protected]>
+S:	Maintained
+F:	board/st/stm32f429-discovery/
+F:	include/configs/stm32f429-discovery.h
+F:	configs/stm32f429-discovery_defconfig
+
board/st/stm32f429-discovery/Makefile new file +12 -0
new file mode 100644
index 0000000..7e764e3
@@ -0,0 +1,12 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2015
+# Kamil Lulko, <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= stm32f429-discovery.o
+obj-y	+= led.o
board/st/stm32f429-discovery/led.c new file +35 -0
new file mode 100644
index 0000000..306e550
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2015
+ * Kamil Lulko, <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm-generic/gpio.h>
+
+void coloured_LED_init(void)
+{
+	gpio_direction_output(CONFIG_RED_LED, 0);
+	gpio_direction_output(CONFIG_GREEN_LED, 0);
+}
+
+void red_led_off(void)
+{
+	gpio_set_value(CONFIG_RED_LED, 0);
+}
+
+void green_led_off(void)
+{
+	gpio_set_value(CONFIG_GREEN_LED, 0);
+}
+
+void red_led_on(void)
+{
+	gpio_set_value(CONFIG_RED_LED, 1);
+}
+
+void green_led_on(void)
+{
+	gpio_set_value(CONFIG_GREEN_LED, 1);
+}
board/st/stm32f429-discovery/stm32f429-discovery.c new file +288 -0

288 lines not on this page · raw message

configs/stm32f429-discovery_defconfig new file +2 -0
new file mode 100644
index 0000000..6d74d73
@@ -0,0 +1,2 @@
+CONFIG_ARM=y
+CONFIG_TARGET_STM32F429_DISCOVERY=y
include/configs/stm32f429-discovery.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
1.9.1
#13 lore raw

PATCH 4/4 stm32f4: Add support for stm32f429-discovery board

Quoted 1 line · Kamil Lulko
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150305/8c541be3/attachment.sig>
#14 lore raw

PATCH 4/4 stm32f4: Add support for stm32f429-discovery board

In reply to Kamil Lulko
Quoted 2 lines · On Sun, Mar 01, 2015 at 12:44:42PM +0100, rev13 at wp.pl wrote:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150423/913a25fd/attachment.sig>
#15 lore raw

cover Add support for stm32f429-discovery board

In reply to Kamil Lulko

Hi Kamil,

I tested this patch-set in STM32 Discovery board. After applied this patch-set on latest u-boot, I could not see the normal u-boot log. I saw broken console log. I used the USART1 port (pa9, pa10 gpio pin).

Could you give me a tip to resolve this issue?

Best Regards,
Chanwoo Choi

2015? 3? 1? ???, Kamil Lulko<[email protected]>?? ??? ???:

Quoted 80 lines

The following patches implement basic support for the ARMv7-M microcontroller
architecture.
Additionally, stm32f429-discovery board support is added with tested ability
to boot uClinux from the embedded Flash memory.

Kamil Lulko (4):
ARM: Add ARMv7-M support
ARMv7M: Add STM32F4 support
stm32f4: Add serial driver
stm32f4: Add support for stm32f429-discovery board

 arch/arm/Kconfig                                   |   9 +
 arch/arm/cpu/armv7m/Makefile                       |  11 +
 arch/arm/cpu/armv7m/config.mk                      |   8 +
 arch/arm/cpu/armv7m/cpu.c                          |  35 +++
 arch/arm/cpu/armv7m/start.S                        |  15 ++
 arch/arm/cpu/armv7m/stm32f4/Makefile               |  11 +
 arch/arm/cpu/armv7m/stm32f4/clock.c                | 209 +++++++++++++++
 arch/arm/cpu/armv7m/stm32f4/flash.c                | 143 ++++++++++
 arch/arm/cpu/armv7m/stm32f4/soc.c                  |  37 +++
 arch/arm/cpu/armv7m/stm32f4/timer.c                | 118 +++++++++
 arch/arm/include/asm/arch-stm32f4/fmc.h            |  75 ++++++
 arch/arm/include/asm/arch-stm32f4/gpio.h           | 116 +++++++++
 arch/arm/include/asm/arch-stm32f4/stm32.h          | 108 ++++++++
 arch/arm/include/asm/armv7m.h                      |  60 +++++
 arch/arm/lib/Makefile                              |   8 +-
 arch/arm/lib/crt0.S                                |  30 +++
 arch/arm/lib/interrupts_m.c                        |  95 +++++++
 arch/arm/lib/relocate.S                            |  13 +
 arch/arm/lib/vectors_m.S                           |  57 ++++
 board/st/stm32f429-discovery/Kconfig               |  19 ++
 board/st/stm32f429-discovery/MAINTAINERS           |   6 +
 board/st/stm32f429-discovery/Makefile              |  12 +
 board/st/stm32f429-discovery/led.c                 |  35 +++
 board/st/stm32f429-discovery/stm32f429-discovery.c | 288
+++++++++++++++++++++
 configs/stm32f429-discovery_defconfig              |   2 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/stm32_gpio.c                          | 199 ++++++++++++++
 drivers/serial/Makefile                            |   1 +
 drivers/serial/serial.c                            |   2 +
 drivers/serial/serial_stm32.c                      | 117 +++++++++
 include/configs/stm32f429-discovery.h              | 106 ++++++++
 include/flash.h                                    |   2 +
 32 files changed, 1946 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7m/Makefile
 create mode 100644 arch/arm/cpu/armv7m/config.mk
 create mode 100644 arch/arm/cpu/armv7m/cpu.c
 create mode 100644 arch/arm/cpu/armv7m/start.S
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/Makefile
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/clock.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/flash.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/soc.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/timer.c
 create mode 100644 arch/arm/include/asm/arch-stm32f4/fmc.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/gpio.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32.h
 create mode 100644 arch/arm/include/asm/armv7m.h
 create mode 100644 arch/arm/lib/interrupts_m.c
 create mode 100644 arch/arm/lib/vectors_m.S
 create mode 100644 board/st/stm32f429-discovery/Kconfig
 create mode 100644 board/st/stm32f429-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f429-discovery/Makefile
 create mode 100644 board/st/stm32f429-discovery/led.c
 create mode 100644 board/st/stm32f429-discovery/stm32f429-discovery.c
 create mode 100644 configs/stm32f429-discovery_defconfig
 create mode 100644 drivers/gpio/stm32_gpio.c
 create mode 100644 drivers/serial/serial_stm32.c
 create mode 100644 include/configs/stm32f429-discovery.h

--
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <javascript:;>
http://lists.denx.de/mailman/listinfo/u-boot

#16 lore raw

cover Add support for stm32f429-discovery board

Quoted 7 lines · Chanwoo Choi

Hi Kamil,

I tested this patch-set in STM32 Discovery board. After applied this patch-set on latest u-boot, I could not see the normal u-boot log. I saw broken console log. I used the USART1 port (pa9, pa10 gpio pin).

Could you give me a tip to resolve this issue?

I bet this needs changes similar to b81bdf6 as that was a similar problem I believe. In short, DM needs to be enabled now.

Quoted 90 lines

Best Regards,
Chanwoo Choi

2015? 3? 1? ???, Kamil Lulko<[email protected]>?? ??? ???:

Quoted 72 lines

The following patches implement basic support for the ARMv7-M microcontroller
architecture.
Additionally, stm32f429-discovery board support is added with tested ability
to boot uClinux from the embedded Flash memory.

Kamil Lulko (4):
ARM: Add ARMv7-M support
ARMv7M: Add STM32F4 support
stm32f4: Add serial driver
stm32f4: Add support for stm32f429-discovery board

 arch/arm/Kconfig                                   |   9 +
 arch/arm/cpu/armv7m/Makefile                       |  11 +
 arch/arm/cpu/armv7m/config.mk                      |   8 +
 arch/arm/cpu/armv7m/cpu.c                          |  35 +++
 arch/arm/cpu/armv7m/start.S                        |  15 ++
 arch/arm/cpu/armv7m/stm32f4/Makefile               |  11 +
 arch/arm/cpu/armv7m/stm32f4/clock.c                | 209 +++++++++++++++
 arch/arm/cpu/armv7m/stm32f4/flash.c                | 143 ++++++++++
 arch/arm/cpu/armv7m/stm32f4/soc.c                  |  37 +++
 arch/arm/cpu/armv7m/stm32f4/timer.c                | 118 +++++++++
 arch/arm/include/asm/arch-stm32f4/fmc.h            |  75 ++++++
 arch/arm/include/asm/arch-stm32f4/gpio.h           | 116 +++++++++
 arch/arm/include/asm/arch-stm32f4/stm32.h          | 108 ++++++++
 arch/arm/include/asm/armv7m.h                      |  60 +++++
 arch/arm/lib/Makefile                              |   8 +-
 arch/arm/lib/crt0.S                                |  30 +++
 arch/arm/lib/interrupts_m.c                        |  95 +++++++
 arch/arm/lib/relocate.S                            |  13 +
 arch/arm/lib/vectors_m.S                           |  57 ++++
 board/st/stm32f429-discovery/Kconfig               |  19 ++
 board/st/stm32f429-discovery/MAINTAINERS           |   6 +
 board/st/stm32f429-discovery/Makefile              |  12 +
 board/st/stm32f429-discovery/led.c                 |  35 +++
 board/st/stm32f429-discovery/stm32f429-discovery.c | 288
+++++++++++++++++++++
 configs/stm32f429-discovery_defconfig              |   2 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/stm32_gpio.c                          | 199 ++++++++++++++
 drivers/serial/Makefile                            |   1 +
 drivers/serial/serial.c                            |   2 +
 drivers/serial/serial_stm32.c                      | 117 +++++++++
 include/configs/stm32f429-discovery.h              | 106 ++++++++
 include/flash.h                                    |   2 +
 32 files changed, 1946 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7m/Makefile
 create mode 100644 arch/arm/cpu/armv7m/config.mk
 create mode 100644 arch/arm/cpu/armv7m/cpu.c
 create mode 100644 arch/arm/cpu/armv7m/start.S
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/Makefile
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/clock.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/flash.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/soc.c
 create mode 100644 arch/arm/cpu/armv7m/stm32f4/timer.c
 create mode 100644 arch/arm/include/asm/arch-stm32f4/fmc.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/gpio.h
 create mode 100644 arch/arm/include/asm/arch-stm32f4/stm32.h
 create mode 100644 arch/arm/include/asm/armv7m.h
 create mode 100644 arch/arm/lib/interrupts_m.c
 create mode 100644 arch/arm/lib/vectors_m.S
 create mode 100644 board/st/stm32f429-discovery/Kconfig
 create mode 100644 board/st/stm32f429-discovery/MAINTAINERS
 create mode 100644 board/st/stm32f429-discovery/Makefile
 create mode 100644 board/st/stm32f429-discovery/led.c
 create mode 100644 board/st/stm32f429-discovery/stm32f429-discovery.c
 create mode 100644 configs/stm32f429-discovery_defconfig
 create mode 100644 drivers/gpio/stm32_gpio.c
 create mode 100644 drivers/serial/serial_stm32.c
 create mode 100644 include/configs/stm32f429-discovery.h
Quoted 8 lines

--
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <javascript:;>
http://lists.denx.de/mailman/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150325/4ad0d26c/attachment.sig>
#17 lore raw

cover Add support for stm32f429-discovery board

Quoted 15 lines · Tom Rini
Quoted 7 lines · Chanwoo Choi

Hi Kamil,

I tested this patch-set in STM32 Discovery board. After applied this patch-set on latest u-boot, I could not see the normal u-boot log. I saw broken console log. I used the USART1 port (pa9, pa10 gpio pin).

Could you give me a tip to resolve this issue?

I bet this needs changes similar to b81bdf6 as that was a similar problem I believe. In short, DM needs to be enabled now.

Quoted 4 lines

Best Regards,
Chanwoo Choi

2015? 3? 1? ???, Kamil Lulko<[email protected]>?? ??? ???:

I have tested this patch set again with 2015.04-rc4-gf643d92 and serial works without any problems.

Chanwoo, you mention STM32 Discovery board - this patch set supports only STM32F429 Discovery (it should work on SDRAM-less boards but not without modifications). Other than that the only thing I can think of is configuration of the UART<>USB converter.

Tom, does this mean changes are required for this patchset to be accepted? I have more things queued up (like moving some of SDRAM configuration bits out of the board code or LCD display support) but I would prefer to have some kind of assurance that this will not go into /dev/null eventually :)

/Kamil

#18 lore raw

cover Add support for stm32f429-discovery board

Quoted 25 lines · Kamil Lulko
Quoted 15 lines · Tom Rini
Quoted 7 lines · Chanwoo Choi

Hi Kamil,

I tested this patch-set in STM32 Discovery board. After applied this patch-set on latest u-boot, I could not see the normal u-boot log. I saw broken console log. I used the USART1 port (pa9, pa10 gpio pin).

Could you give me a tip to resolve this issue?

I bet this needs changes similar to b81bdf6 as that was a similar problem I believe. In short, DM needs to be enabled now.

Quoted 4 lines

Best Regards,
Chanwoo Choi

2015? 3? 1? ???, Kamil Lulko<[email protected]>?? ??? ???:

I have tested this patch set again with 2015.04-rc4-gf643d92 and serial works without any problems.

Chanwoo, you mention STM32 Discovery board - this patch set supports only STM32F429 Discovery (it should work on SDRAM-less boards but not without modifications). Other than that the only thing I can think of is configuration of the UART<>USB converter.

Quoted 5 lines

Tom, does this mean changes are required for this patchset to be accepted? I have more things queued up (like moving some of SDRAM configuration bits out of the board code or LCD display support) but I would prefer to have some kind of assurance that this will not go into /dev/null eventually :)

Right now the patches don't apply cleanly due to 68145d4c but it's an easy enough fixup by hand. I plan to apply the current series after the 2015.04 release. If you want to start posting stuff that depends on the initial series being applied that's fine. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150326/c7974c6a/attachment.sig>