Skip to contentSkip to conversation

spl: add xip booting support

PATCH Superseded Vikas Manocha 5 participants 27 messages May 28, 2017 – Aug 19, 2017

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

v2 cover spl: add xip booting support

This patchset adds support for XIP (execute in place) of U-Boot or kernel image and enables it for stm32f7.

Changed in v2:
- added patch to move v7m thumb mode just before next image boot
- removed extra blank line.

Vikas Manocha (7):
spl: armv7m: to keep ARM v7M in thumb mode before booting next image
stm32f7: remove duplicate configs
stm32: stm32f7: add spl build support
SPL: Add XIP booting support
serial: stm32f7: disable overrun
spl: stm32f7: add kernel boot support
spl: stm32f7: configure for xip booting

 arch/arm/include/asm/spl.h                 |  1 +
 arch/arm/mach-stm32/Kconfig                |  1 +
 arch/arm/mach-stm32/stm32f7/Kconfig        | 24 ++++++++++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 36 +++++++++++++++++++++++++++++-
 common/spl/Kconfig                         |  9 ++++++++
 common/spl/Makefile                        |  1 +
 common/spl/spl.c                           |  6 ++---
 common/spl/spl_xip.c                       | 28 +++++++++++++++++++++++
 configs/stm32f746-disco_defconfig          |  5 -----
 drivers/serial/serial_stm32x7.c            |  3 +++
 drivers/serial/serial_stm32x7.h            |  2 ++
 include/configs/stm32f746-disco.h          | 31 ++++++++++++++++++++++---
 12 files changed, 135 insertions(+), 12 deletions(-)
 create mode 100644 common/spl/spl_xip.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/7 spl: armv7m: to keep ARM v7M in thumb mode before booting next image

On ARM v7M, the processor will return to ARM mode when executing blx instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb mode.

At present, it is applied only for raw U-Boot. This patch moves it to just before booting next image. This way armv7m will be in thumb mode for any image like raw or image with header like zImage or standard U-Boot.

---

Changed in v2: Added this patch in v2

 common/spl/spl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
common/spl/spl.c +3 -3
index df984b8..1bdae3e 100644
@@ -121,9 +121,6 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 {
 	spl_image->size = CONFIG_SYS_MONITOR_LEN;
 	spl_image->entry_point = CONFIG_SYS_UBOOT_START;
-#ifdef CONFIG_CPU_V7M
-	spl_image->entry_point |= 0x1;
-#endif
 	spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
 	spl_image->os = IH_OS_U_BOOT;
 	spl_image->name = "U-Boot";
@@ -396,6 +393,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		hang();
 	}
 
+#ifdef CONFIG_CPU_V7M
+	spl_image.entry_point |= 0x1;
+#endif
 	switch (spl_image.os) {
 	case IH_OS_U_BOOT:
 		debug("Jumping to U-Boot\n");
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/7 spl: armv7m: to keep ARM v7M in thumb mode before booting next image

Quoted 9 lines · Vikas Manocha

On ARM v7M, the processor will return to ARM mode when executing blx instruction with bit 0 of the address == 0. Always set it to 1 to stay in thumb mode.

At present, it is applied only for raw U-Boot. This patch moves it to just before booting next image. This way armv7m will be in thumb mode for any image like raw or image with header like zImage or standard U-Boot.

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

PATCH v2 2/7 stm32f7: remove duplicate configs

In reply to Vikas Manocha

---

Changed in v2: None

 configs/stm32f746-disco_defconfig | 4 ----
 1 file changed, 4 deletions(-)
configs/stm32f746-disco_defconfig +0 -4
index 4322aad..a334d50 100644
@@ -44,10 +44,6 @@ CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
-CONFIG_CLK=y
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_FULL is not set
-CONFIG_PINCTRL_STM32=y
 CONFIG_RAM=y
 CONFIG_STM32_SDRAM=y
 CONFIG_DM_GPIO=y
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 2/7 stm32f7: remove duplicate configs

Quoted 1 line · Vikas Manocha
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/7526a03b/attachment.sig>
#5 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

In reply to Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

To compile u-boot without spl: Remove SUPPORT_SPL configuration (arch/arm/mach-stm32/Kconfig)

---

Changed in v2: None

 arch/arm/mach-stm32/Kconfig                |  1 +
 arch/arm/mach-stm32/stm32f7/Kconfig        | 22 ++++++++++++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 27 ++++++++++++++++++++++++++-
 configs/stm32f746-disco_defconfig          |  1 -
 include/configs/stm32f746-disco.h          | 22 +++++++++++++++++++++-
 5 files changed, 70 insertions(+), 3 deletions(-)
arch/arm/mach-stm32/Kconfig +1 -0
index ec6b3ff..879383f 100644
@@ -8,6 +8,7 @@ config STM32F1
 
 config STM32F7
 	bool "stm32f7 family"
+	select SUPPORT_SPL
 
 source "arch/arm/mach-stm32/stm32f4/Kconfig"
 source "arch/arm/mach-stm32/stm32f1/Kconfig"
arch/arm/mach-stm32/stm32f7/Kconfig +22 -0
index 287e5ad..c13fafa 100644
@@ -3,6 +3,28 @@ if STM32F7
 config TARGET_STM32F746_DISCO
 	bool "STM32F746 Discovery board"
 
+config SUPPORT_SPL
+	select SPL
+	select SPL_FRAMEWORK
+	select SPL_SERIAL_SUPPORT
+	select SPL_CLK
+	select SPL_OF_CONTROL
+	select SPL_OF_LIBFDT
+	select SPL_GPIO_SUPPORT
+	select SPL_LIBCOMMON_SUPPORT
+	select SPL_LIBGENERIC_SUPPORT
+	select SPL_DRIVERS_MISC_SUPPORT
+	select SPL_SYS_MALLOC_SIMPLE
+	select SPL_MTD_SUPPORT
+	select SPL_DM
+	select SPL_PINCTRL
+	select SPL_RAM
+	select SPL_DM_SEQ_ALIAS
+	select SPL_OF_TRANSLATE
+
+config SPL_PINCTRL_FULL
+	default n if TARGET_STM32F746_DISCO
+
 source "board/st/stm32f746-disco/Kconfig"
 
 endif
board/st/stm32f746-disco/stm32f746-disco.c +26 -1
index dc3a9dc..4f2b677 100644
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <ram.h>
+#include <spl.h>
 #include <asm/io.h>
 #include <asm/armv7m.h>
 #include <asm/arch/stm32.h>
@@ -36,16 +37,18 @@ int get_memory_base_size(fdt_addr_t *mr_base, fdt_addr_t *mr_size)
 }
 int dram_init(void)
 {
-	struct udevice *dev;
 	int rv;
 	fdt_addr_t mr_base, mr_size;
 
+#ifndef CONFIG_SUPPORT_SPL
+	struct udevice *dev;
 	rv = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (rv) {
 		debug("DRAM init failed: %d\n", rv);
 		return rv;
 	}
 
+#endif
 	rv = get_memory_base_size(&mr_base, &mr_size);
 	if (rv)
 		return rv;
@@ -87,6 +90,28 @@ int board_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_SPL_BUILD
+int spl_dram_init(void)
+{
+	struct udevice *dev;
+	int rv;
+	rv = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (rv)
+		debug("DRAM init failed: %d\n", rv);
+	return rv;
+}
+void spl_board_init(void)
+{
+	spl_dram_init();
+	preloader_console_init();
+	arch_cpu_init(); /* to configure mpu for sdram rw permissions */
+}
+u32 spl_boot_device(void)
+{
+	return BOOT_DEVICE_NOR;
+}
+
+#endif
 u32 get_board_rev(void)
 {
 	return 0;
configs/stm32f746-disco_defconfig +0 -1
index a334d50..766b111 100644
@@ -39,7 +39,6 @@ CONFIG_ETH_DESIGNWARE=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_PINCTRL_STM32=y
-# CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
include/configs/stm32f746-disco.h +21 -1
index 1ee5815..055fdf8 100644
@@ -10,7 +10,12 @@
 
 #define CONFIG_SYS_FLASH_BASE		0x08000000
 #define CONFIG_SYS_INIT_SP_ADDR		0x20050000
-#define CONFIG_SYS_TEXT_BASE		0x08000000
+
+#ifdef CONFIG_SUPPORT_SPL
+#define CONFIG_SYS_TEXT_BASE		0xC0000000
+#else
+#define CONFIG_SYS_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#endif
 
 /*
  * Configuration of the external SDRAM memory
@@ -69,4 +74,19 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_BOARD_LATE_INIT
 #define CONFIG_DISPLAY_BOARDINFO
+
+/* For SPL */
+#ifdef CONFIG_SUPPORT_SPL
+#define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		(512 * 1024)
+#define CONFIG_SYS_SPL_LEN		0x00008000
+#define CONFIG_SYS_UBOOT_START		0XC00003FD
+#define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
+					 CONFIG_SYS_SPL_LEN)
+#endif
+/* For SPL ends */
+
 #endif /* __CONFIG_H */
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Quoted 4 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Quoted 8 lines

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

To compile u-boot without spl: Remove SUPPORT_SPL configuration (arch/arm/mach-stm32/Kconfig)

I had to rework the Kconfig locations here slightly (and in follow-up patches) to have the main select's be under STM32F7 in arch/arm/mach-stm32/Kconfig as it's not right to introduce a second 'config SUPPORT_SPL\nselect ...' stanza inside of arch/arm/mach-stm32/stm32f7/Kconfig.

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

PATCH v2 3/7 stm32: stm32f7: add spl build support

Hi Tom,

Quoted 18 lines

-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Saturday, June 10, 2017 6:46 AM
To: Vikas MANOCHA <[email protected]>
Cc: u-boot at lists.denx.de; Christophe KERELLO <[email protected]>; Alexandre TORGUE <[email protected]>; Christophe PRIOUZEAU <[email protected]>
Subject: Re: [U-Boot,v2,3/7] stm32: stm32f7: add spl build support

Quoted 8 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Quoted 8 lines
Quoted 4 lines

To compile u-boot without spl: Remove SUPPORT_SPL configuration (arch/arm/mach-stm32/Kconfig)

I had to rework the Kconfig locations here slightly (and in follow-up
patches) to have the main select's be under STM32F7 in arch/arm/mach-stm32/Kconfig as it's not right to introduce a second 'config SUPPORT_SPL\nselect ...' stanza inside of arch/arm/mach-stm32/stm32f7/Kconfig.

Thanks for the kconfig rework, appreciate it.

Cheers,
Vikas

Quoted 5 lines

--
Tom

#8 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

In reply to Vikas Manocha

Hi Vikas,

Quoted 7 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP
Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

openocd -f board/stm32f7discovery.cfg \
-c "init" \
-c "reset init" \
-c "flash probe 0" \
-c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
-c "flash write_image erase ./u-boot.img 0x08008000" \
-c "reset run" \
-c "shutdown"

Regards,

Signature · 2 lines
Robert Nelson
https://rcn-ee.com/
#9 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Hi Robert,

Quoted 7 lines · Robert Nelson

Hi Vikas,

Quoted 4 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Quoted 5 lines
Quoted 3 lines

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

No, you just need to flash spl & next image at above mentioned addresses. By default spl expects kernel image.

To boot u-boot, press keyboard character 'c'.
you might need to keep on pressing 'c' it for some time as the keyboard entry acceptance & detection window is very small.

Cheers,
Vikas

Quoted 26 lines

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP
Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

openocd -f board/stm32f7discovery.cfg \
-c "init" \
-c "reset init" \
-c "flash probe 0" \
-c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
-c "flash write_image erase ./u-boot.img 0x08008000" \
-c "reset run" \
-c "shutdown"

Regards,

#10 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

One other point,

Quoted 16 lines · Vikas Manocha

Hi Robert,

Quoted 7 lines · Robert Nelson

Hi Vikas,

Quoted 4 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Quoted 5 lines
Quoted 3 lines

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

Quoted 29 lines

No, you just need to flash spl & next image at above mentioned addresses. By default spl expects kernel image.

To boot u-boot, press keyboard character 'c'.
you might need to keep on pressing 'c' it for some time as the keyboard entry acceptance & detection window is very small.

Cheers,
Vikas

Quoted 21 lines

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP
Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

openocd -f board/stm32f7discovery.cfg \
-c "init" \
-c "reset init" \
-c "flash probe 0" \
-c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
-c "flash write_image erase ./u-boot.img 0x08008000" \

it should be u-boot-dtb.bin.

Cheers,
Vikas

Quoted 5 lines
Quoted 5 lines
  -c "reset run" \
  -c "shutdown"

Regards,

#11 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Quoted 42 lines · Vikas Manocha

One other point,

Quoted 39 lines · Vikas Manocha

Hi Robert,

Quoted 7 lines · Robert Nelson

Hi Vikas,

Quoted 4 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Quoted 5 lines
Quoted 3 lines

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

No, you just need to flash spl & next image at above mentioned addresses. By default spl expects kernel image.

To boot u-boot, press keyboard character 'c'.
you might need to keep on pressing 'c' it for some time as the keyboard entry acceptance & detection window is very small.

Cheers,
Vikas

Quoted 15 lines

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP
Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

openocd -f board/stm32f7discovery.cfg \
-c "init" \
-c "reset init" \
-c "flash probe 0" \
-c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
-c "flash write_image erase ./u-boot.img 0x08008000" \

it should be u-boot-dtb.bin.

Bingo!

Thanks Vikas!!

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP

U-Boot 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35 -0500)

Model: STMicroelectronics STM32F746-DISCO board
DRAM:  8 MiB
Flash: 1 MiB

Using default environment

In:    serial at 40011000
Out:   serial at 40011000
Err:   serial at 40011000

usr button is at LOW LEVEL
Net:
Warning: ethernet at 40028000 (eth0) using random MAC address - 02:4a:de:c3:c8:80
eth0: ethernet at 40028000
Hit SPACE in 3 seconds to stop autoboot.
U-Boot >

Regards,

Signature · 2 lines
Robert Nelson
https://rcn-ee.com/
#12 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Hi Vikas,
Try to remove this magic (press 'c' on the keyboard when at the boot
time), I'd suggest to add a follow-up patch to move all the selected SPL related configuration from "arch/arm/mach-stm32/Kconfig" under STM32F7 to default configuration file (stm32f746-disco_defconfig). Then if the people want just boot up u-boot itself, what they need to do is just run "make menuconfig" and then de-select "Activate Falcon Mode" (SPL_OS_BOOT). Then everything will be fine.

Thanks.

Best Regards,
Bo Shen

Quoted 74 lines · Robert Nelson
Quoted 39 lines · Vikas Manocha

One other point,

Quoted 36 lines · Vikas Manocha

Hi Robert,

Quoted 11 lines · Robert Nelson

Hi Vikas,

Quoted 7 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

No, you just need to flash spl & next image at above mentioned addresses. By default spl expects kernel image.

To boot u-boot, press keyboard character 'c'.
you might need to keep on pressing 'c' it for some time as the keyboard entry acceptance & detection window is very small.

Cheers,
Vikas

Quoted 14 lines

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP
Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
openocd -f board/stm32f7discovery.cfg \
   -c "init" \
   -c "reset init" \
   -c "flash probe 0" \
   -c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
   -c "flash write_image erase ./u-boot.img 0x08008000" \

it should be u-boot-dtb.bin.

Bingo!

Thanks Vikas!!

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP

U-Boot 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35 -0500)

Model: STMicroelectronics STM32F746-DISCO board
DRAM:  8 MiB
Flash: 1 MiB

Using default environment

In:    serial at 40011000
Out:   serial at 40011000
Err:   serial at 40011000

usr button is at LOW LEVEL
Net:
Warning: ethernet at 40028000 (eth0) using random MAC address - 02:4a:de:c3:c8:80
eth0: ethernet at 40028000
Hit SPACE in 3 seconds to stop autoboot.
U-Boot >

Regards,

#13 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Hi Bo,

Quoted 11 lines

-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: Thursday, August 17, 2017 10:07 PM
To: Robert Nelson <[email protected]>; Vikas MANOCHA <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Christophe PRIOUZEAU <[email protected]>; Alexandre TORGUE <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 3/7] stm32: stm32f7: add spl build support

Hi Vikas,
Try to remove this magic (press 'c' on the keyboard when at the boot time),

It helps to select between U-Boot or OS booting.

Quoted 5 lines

I'd suggest to add a follow-up patch to move all the
selected SPL related configuration from "arch/arm/mach-stm32/Kconfig" under STM32F7 to default configuration file (stm32f746- disco_defconfig). Then if the people want just boot up u-boot itself, what they need to do is just run "make menuconfig" and then de- select "Activate Falcon Mode"
(SPL_OS_BOOT). Then everything will be fine.

Yes, Agree. How about using "imply" instead of "select" for SPL_OS_BOOT to make it configurable.

Cheers,
Vikas

Quoted 81 lines

Thanks.

Best Regards,
Bo Shen

Quoted 74 lines · Robert Nelson
Quoted 38 lines · Vikas Manocha

One other point,

Quoted 35 lines · Vikas Manocha

Hi Robert,

Quoted 11 lines · Robert Nelson

Hi Vikas,

Quoted 7 lines · Vikas Manocha

This commit supports booting from stm32 internal nor flash. spl U-Boot initializes the sdram memory, copies next image (e.g. standard U-Boot) to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
- spl U-Boot : 0x0800_0000
- standard U-Boot : 0x0800_8000

Is there another patchset missing on mainline for booting via spl?

No, you just need to flash spl & next image at above mentioned addresses. By default spl expects kernel image.

To boot u-boot, press keyboard character 'c'.
you might need to keep on pressing 'c' it for some time as the keyboard entry acceptance & detection window is very small.

Cheers,
Vikas

Quoted 13 lines

on mainline with the stm32f746-disco board:

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP Hard fault

pc : 08008008    lr : 08000adb    xPSR : 21000000

r12 : 2004f338 r3 : 00000005 r2 : 081c0000
r1 : ffffff9a r0 : 00000000
Resetting CPU ...

resetting ...

I'm using openocd to program

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
openocd -f board/stm32f7discovery.cfg \
   -c "init" \
   -c "reset init" \
   -c "flash probe 0" \
   -c "flash write_image erase ./spl/u-boot-spl.bin 0x08000000" \
   -c "flash write_image erase ./u-boot.img 0x08008000" \

it should be u-boot-dtb.bin.

Bingo!

Thanks Vikas!!

U-Boot SPL 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35) Trying to boot from XIP

U-Boot 2017.09-rc1-00177-gd529124fdc (Aug 10 2017 - 12:33:35 -0500)

Model: STMicroelectronics STM32F746-DISCO board
DRAM:  8 MiB
Flash: 1 MiB

Using default environment

In:    serial at 40011000
Out:   serial at 40011000
Err:   serial at 40011000

usr button is at LOW LEVEL
Net:
Warning: ethernet at 40028000 (eth0) using random MAC address - 02:4a:de:c3:c8:80
eth0: ethernet at 40028000
Hit SPACE in 3 seconds to stop autoboot.
U-Boot >

Regards,

#14 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Quoted 16 lines · Vikas MANOCHA

Hi Bo,

Quoted 11 lines

-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: Thursday, August 17, 2017 10:07 PM
To: Robert Nelson <[email protected]>; Vikas MANOCHA <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Christophe PRIOUZEAU <[email protected]>; Alexandre TORGUE <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 3/7] stm32: stm32f7: add spl build support

Hi Vikas,
Try to remove this magic (press 'c' on the keyboard when at the boot time),

It helps to select between U-Boot or OS booting.

Quoted 7 lines
Quoted 5 lines

I'd suggest to add a follow-up patch to move all the
selected SPL related configuration from "arch/arm/mach-stm32/Kconfig" under STM32F7 to default configuration file (stm32f746- disco_defconfig). Then if the people want just boot up u-boot itself, what they need to do is just run "make menuconfig" and then de- select "Activate Falcon Mode"
(SPL_OS_BOOT). Then everything will be fine.

Yes, Agree. How about using "imply" instead of "select" for SPL_OS_BOOT to make it configurable.

Well, we really need a /doc/README.stm32 that explains this "different" default.. It's definitely different then omap/imx/tegra/atmel in this tree. But the processor is also more handicapped, so not wasting time in normal u-boot just booting the kernel via spl/falcon more makes sense.

Regards,

Signature · 2 lines
Robert Nelson
https://rcn-ee.com/
#15 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

Hi,

Quoted 25 lines · Robert Nelson
Quoted 24 lines · Vikas MANOCHA

Hi Bo,

Quoted 11 lines

-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: Thursday, August 17, 2017 10:07 PM
To: Robert Nelson <[email protected]>; Vikas MANOCHA <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Christophe PRIOUZEAU <[email protected]>; Alexandre TORGUE <[email protected]>
Subject: Re: [U-Boot] [PATCH v2 3/7] stm32: stm32f7: add spl build support

Hi Vikas,
Try to remove this magic (press 'c' on the keyboard when at the boot time),

It helps to select between U-Boot or OS booting.

Quoted 5 lines

I'd suggest to add a follow-up patch to move all the
selected SPL related configuration from "arch/arm/mach-stm32/Kconfig" under STM32F7 to default configuration file (stm32f746- disco_defconfig). Then if the people want just boot up u-boot itself, what they need to do is just run "make menuconfig" and then de- select "Activate Falcon Mode"
(SPL_OS_BOOT). Then everything will be fine.

Quoted 7 lines
Quoted 1 line

Yes, Agree. How about using "imply" instead of "select" for SPL_OS_BOOT to make it configurable.

Well, we really need a /doc/README.stm32 that explains this "different" default.. It's definitely different then omap/imx/tegra/atmel in this tree. But the processor is also more handicapped, so not wasting time in normal u-boot just booting the kernel via spl/falcon more makes sense.

That's the current configuration with one additional key entry check which is insignificant in terms of any overhead.

Making SPL_OS_BOOT configurable is also adding option to compile spl to boot UBoot directly without any overhead.

Cheers,
Vikas

Quoted 6 lines

Regards,

Signature · 2 lines
Robert Nelson
https://rcn-ee.com/
#16 lore raw

PATCH v2 3/7 stm32: stm32f7: add spl build support

In reply to Vikas MANOCHA

Hi Vikas,

Quoted 6 lines · Vikas MANOCHA
Quoted 5 lines

I'd suggest to add a follow-up patch to move all the
selected SPL related configuration from "arch/arm/mach-stm32/Kconfig" under STM32F7 to default configuration file (stm32f746- disco_defconfig). Then if the people want just boot up u-boot itself, what they need to do is just run "make menuconfig" and then de- select "Activate Falcon Mode"
(SPL_OS_BOOT). Then everything will be fine.

Yes, Agree. How about using "imply" instead of "select" for SPL_OS_BOOT to make it configurable.

I don't realize this option before. For sure, it's a great option. I'd like it. :)

Thanks.

Best Regards,
Bo Shen

#17 lore raw

PATCH v2 4/7 SPL: Add XIP booting support

In reply to Vikas Manocha

Enable support for XIP (execute in place) of U-Boot or kernel image. There is no need to copy image from flash to ram if flash supports execute in place.

---

Changed in v2:
- removed v7m thumb mode for entry point, added separate patch.
- removed extra blank line.

 arch/arm/include/asm/spl.h |  1 +
 common/spl/Kconfig         |  9 +++++++++
 common/spl/Makefile        |  1 +
 common/spl/spl_xip.c       | 28 ++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 common/spl/spl_xip.c
arch/arm/include/asm/spl.h +1 -0
index a0bda28..0a3536b 100644
@@ -29,6 +29,7 @@ enum {
 	BOOT_DEVICE_I2C,
 	BOOT_DEVICE_BOARD,
 	BOOT_DEVICE_DFU,
+	BOOT_DEVICE_XIP,
 	BOOT_DEVICE_NONE
 };
 #endif
common/spl/Kconfig +9 -0
index f51ae2c..52a5271 100644
@@ -459,6 +459,15 @@ config SPL_NOR_SUPPORT
 	  a memory-mapped device makes it very easy to access. Loading from
 	  NOR is typically achieved with just a memcpy().
 
+config SPL_XIP_SUPPORT
+	bool "Support XIP"
+	depends on SPL
+	help
+	  Enable support for execute in place of U-Boot or kernel image. There
+	  is no need to copy image from flash to ram if flash supports execute
+	  in place. Its very useful in systems having enough flash but not
+	  enough ram to load the image.
+
 config SPL_ONENAND_SUPPORT
 	bool "Support OneNAND flash"
 	depends on SPL
common/spl/Makefile +1 -0
index 1933cbd..88deeaf 100644
@@ -12,6 +12,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_LOAD_FIT) += spl_fit.o
 obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
+obj-$(CONFIG_SPL_XIP_SUPPORT) += spl_xip.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
 ifndef CONFIG_SPL_UBI
 obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
common/spl/spl_xip.c new file +28 -0
new file mode 100644
index 0000000..18c7d11
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 Vikas Manocha <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+
+static int spl_xip(struct spl_image_info *spl_image,
+		   struct spl_boot_device *bootdev)
+{
+#ifdef CONFIG_SPL_OS_BOOT
+	if (!spl_start_uboot()) {
+		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
+		spl_image->name = "Linux";
+		spl_image->os = IH_OS_LINUX;
+		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
+		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
+		debug("spl: payload xipImage, load addr: 0x%lx\n",
+		      spl_image->load_addr);
+		return 0;
+	}
+#endif
+	return(spl_parse_image_header(spl_image, (const struct image_header *)
+	       CONFIG_SYS_UBOOT_BASE));
+}
+SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
Signature · 1 line
1.9.1
#18 lore raw

PATCH v2 4/7 SPL: Add XIP booting support

Quoted 85 lines · Vikas Manocha

Enable support for XIP (execute in place) of U-Boot or kernel image. There is no need to copy image from flash to ram if flash supports execute in place.

---

Changed in v2:
- removed v7m thumb mode for entry point, added separate patch.
- removed extra blank line.

 arch/arm/include/asm/spl.h |  1 +
 common/spl/Kconfig         |  9 +++++++++
 common/spl/Makefile        |  1 +
 common/spl/spl_xip.c       | 28 ++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 common/spl/spl_xip.c
arch/arm/include/asm/spl.h +1 -0
index a0bda28..0a3536b 100644
@@ -29,6 +29,7 @@ enum {
 	BOOT_DEVICE_I2C,
 	BOOT_DEVICE_BOARD,
 	BOOT_DEVICE_DFU,
+	BOOT_DEVICE_XIP,
 	BOOT_DEVICE_NONE
 };
 #endif
common/spl/Kconfig +9 -0
index f51ae2c..52a5271 100644
@@ -459,6 +459,15 @@ config SPL_NOR_SUPPORT
 	  a memory-mapped device makes it very easy to access. Loading from
 	  NOR is typically achieved with just a memcpy().
 
+config SPL_XIP_SUPPORT
+	bool "Support XIP"
+	depends on SPL
+	help
+	  Enable support for execute in place of U-Boot or kernel image. There
+	  is no need to copy image from flash to ram if flash supports execute
+	  in place. Its very useful in systems having enough flash but not
+	  enough ram to load the image.
+
 config SPL_ONENAND_SUPPORT
 	bool "Support OneNAND flash"
 	depends on SPL
common/spl/Makefile +1 -0
index 1933cbd..88deeaf 100644
@@ -12,6 +12,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_LOAD_FIT) += spl_fit.o
 obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
+obj-$(CONFIG_SPL_XIP_SUPPORT) += spl_xip.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
 ifndef CONFIG_SPL_UBI
 obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
common/spl/spl_xip.c new file +18 -0
new file mode 100644
index 0000000..18c7d11
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 Vikas Manocha <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+
+static int spl_xip(struct spl_image_info *spl_image,
+		   struct spl_boot_device *bootdev)
+{
+#ifdef CONFIG_SPL_OS_BOOT
+	if (!spl_start_uboot()) {
+		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
+		spl_image->name = "Linux";
+		spl_image->os = IH_OS_LINUX;
+		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;

common/spl/spl_xip.c line 28

Quoted 10 lines
common/spl/spl_xip.c new file +10 -0
+		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
+		debug("spl: payload xipImage, load addr: 0x%lx\n",
+		      spl_image->load_addr);
+		return 0;
+	}
+#endif
+	return(spl_parse_image_header(spl_image, (const struct image_header *)
+	       CONFIG_SYS_UBOOT_BASE));
+}
+SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
#19 lore raw

PATCH v2 4/7 SPL: Add XIP booting support

In reply to Vikas Manocha
Quoted 5 lines · Vikas Manocha

Enable support for XIP (execute in place) of U-Boot or kernel image. There is no need to copy image from flash to ram if flash supports execute in place.

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: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/cf3097a6/attachment.sig>
#20 lore raw

PATCH v2 5/7 serial: stm32f7: disable overrun

In reply to Vikas Manocha

With overrun enabled, serial port console freezes & stops receiving data with overun error if we keep sending data.

---

Changed in v2: None

 drivers/serial/serial_stm32x7.c | 3 +++
 drivers/serial/serial_stm32x7.h | 2 ++
 2 files changed, 5 insertions(+)
drivers/serial/serial_stm32x7.c +3 -0
index 1907cef..2b305cd 100644
@@ -93,6 +93,9 @@ static int stm32_serial_probe(struct udevice *dev)
 	}
 #endif
 
+	/* Disable usart-> disable overrun-> enable usart */
+	clrbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
+	setbits_le32(&usart->cr3, USART_CR3_OVRDIS);
 	setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
 
 	return 0;
drivers/serial/serial_stm32x7.h +2 -0
index 6190d67..8c02548 100644
@@ -27,6 +27,8 @@ struct stm32_usart {
 #define USART_CR1_TE			(1 << 3)
 #define USART_CR1_UE			(1 << 0)
 
+#define USART_CR3_OVRDIS		(1 << 12)
+
 #define USART_SR_FLAG_RXNE		(1 << 5)
 #define USART_SR_FLAG_TXE		(1 << 7)
 
Signature · 1 line
1.9.1
#21 lore raw

PATCH v2 5/7 serial: stm32f7: disable overrun

Quoted 4 lines · Vikas Manocha

With overrun enabled, serial port console freezes & stops receiving data with overun error if we keep sending data.

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: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/6583d419/attachment.sig>
#22 lore raw

PATCH v2 6/7 spl: stm32f7: add kernel boot support

In reply to Vikas Manocha

---

Changed in v2: None

 arch/arm/mach-stm32/stm32f7/Kconfig        | 1 +
 board/st/stm32f746-disco/stm32f746-disco.c | 9 +++++++++
 include/configs/stm32f746-disco.h          | 7 +++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-stm32/stm32f7/Kconfig +1 -0
index c13fafa..3f6455e 100644
@@ -21,6 +21,7 @@ config SUPPORT_SPL
 	select SPL_RAM
 	select SPL_DM_SEQ_ALIAS
 	select SPL_OF_TRANSLATE
+	select SPL_OS_BOOT
 
 config SPL_PINCTRL_FULL
 	default n if TARGET_STM32F746_DISCO
board/st/stm32f746-disco/stm32f746-disco.c +9 -0
index 4f2b677..335dcb9 100644
@@ -91,6 +91,15 @@ int board_early_init_f(void)
 #endif
 
 #ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_start_uboot(void)
+{
+	debug("SPL: booting kernel\n");
+	/* break into full u-boot on 'c' */
+	return serial_tstc() && serial_getc() == 'c';
+}
+#endif
+
 int spl_dram_init(void)
 {
 	struct udevice *dev;
include/configs/stm32f746-disco.h +7 -0
index 055fdf8..9052025 100644
@@ -86,6 +86,13 @@
 #define CONFIG_SYS_UBOOT_START		0XC00003FD
 #define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					 CONFIG_SYS_SPL_LEN)
+
+#define CONFIG_SYS_OS_BASE		0x08040000
+/* DT blob (fdt) address */
+#define CONFIG_SYS_SPL_ARGS_ADDR        0xC0000100
+#define CONFIG_SYS_FDT_BASE		(CONFIG_SYS_FLASH_BASE + \
+					0x1C0000)
+#define CONFIG_SYS_FDT_SIZE		(20*1024)
 #endif
 /* For SPL ends */
 
Signature · 1 line
1.9.1
#23 lore raw

PATCH v2 6/7 spl: stm32f7: add kernel boot support

Quoted 1 line · Vikas Manocha

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: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/0360eb38/attachment.sig>
#24 lore raw

PATCH v2 7/7 spl: stm32f7: configure for xip booting

In reply to Vikas Manocha

With xip booting configuration, we don't need to copy the next image (U-Boot or linux xipimage) from flash to sdram area.

Flash memory organization is like this:

	spl-U-Boot:	u-boot-spl.bin 	: 0x0800_0000
	U-Boot :	u-boot-dtb.bin	: 0x0800_8000
	linux :		xipImage	: 0x0800_8000

It is also possible to have U-Boot binary & linux binaries configured at different addresses of flash memory like U-Boot at 0x0800_8000 & linux xipImage at 0x0800_4000. But in any case, spl-U-Boot needs to be compiled for U-Boot as next binary with SPL_OS_BOOT option disabled.
By default, spl is configured to boot linux xipImage.

---

Changed in v2: None

 arch/arm/mach-stm32/stm32f7/Kconfig        |  1 +
 board/st/stm32f746-disco/stm32f746-disco.c |  2 +-
 include/configs/stm32f746-disco.h          | 12 +++++-------
 3 files changed, 7 insertions(+), 8 deletions(-)
arch/arm/mach-stm32/stm32f7/Kconfig +1 -0
index 3f6455e..6acf9cf 100644
@@ -22,6 +22,7 @@ config SUPPORT_SPL
 	select SPL_DM_SEQ_ALIAS
 	select SPL_OF_TRANSLATE
 	select SPL_OS_BOOT
+	select SPL_XIP_SUPPORT
 
 config SPL_PINCTRL_FULL
 	default n if TARGET_STM32F746_DISCO
board/st/stm32f746-disco/stm32f746-disco.c +1 -1
index 335dcb9..11957e0 100644
@@ -117,7 +117,7 @@ void spl_board_init(void)
 }
 u32 spl_boot_device(void)
 {
-	return BOOT_DEVICE_NOR;
+	return BOOT_DEVICE_XIP;
 }
 
 #endif
include/configs/stm32f746-disco.h +5 -7
index 9052025..4e0edcb 100644
@@ -12,17 +12,18 @@
 #define CONFIG_SYS_INIT_SP_ADDR		0x20050000
 
 #ifdef CONFIG_SUPPORT_SPL
-#define CONFIG_SYS_TEXT_BASE		0xC0000000
+#define CONFIG_SYS_TEXT_BASE		0x08008000
+#define CONFIG_SYS_LOAD_ADDR		0x08008000
 #else
 #define CONFIG_SYS_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_LOAD_ADDR		0xC0400000
+#define CONFIG_LOADADDR			0xC0400000
 #endif
 
 /*
  * Configuration of the external SDRAM memory
  */
 #define CONFIG_NR_DRAM_BANKS		1
-#define CONFIG_SYS_LOAD_ADDR		0xC0400000
-#define CONFIG_LOADADDR			0xC0400000
 
 #define CONFIG_SYS_MAX_FLASH_SECT	8
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
@@ -83,16 +84,13 @@
 #define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_MONITOR_LEN		(512 * 1024)
 #define CONFIG_SYS_SPL_LEN		0x00008000
-#define CONFIG_SYS_UBOOT_START		0XC00003FD
+#define CONFIG_SYS_UBOOT_START		0x080083FD
 #define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					 CONFIG_SYS_SPL_LEN)
 
-#define CONFIG_SYS_OS_BASE		0x08040000
 /* DT blob (fdt) address */
-#define CONFIG_SYS_SPL_ARGS_ADDR        0xC0000100
 #define CONFIG_SYS_FDT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					0x1C0000)
-#define CONFIG_SYS_FDT_SIZE		(20*1024)
 #endif
 /* For SPL ends */
 
Signature · 1 line
1.9.1
#25 lore raw

PATCH v2 7/7 spl: stm32f7: configure for xip booting

Quoted 8 lines · Vikas Manocha

With xip booting configuration, we don't need to copy the next image (U-Boot or linux xipimage) from flash to sdram area.

Flash memory organization is like this:

	spl-U-Boot:	u-boot-spl.bin 	: 0x0800_0000
	U-Boot :	u-boot-dtb.bin	: 0x0800_8000
	linux :		xipImage	: 0x0800_8000
Quoted 7 lines

It is also possible to have U-Boot binary & linux binaries configured at different addresses of flash memory like U-Boot at 0x0800_8000 & linux xipImage at 0x0800_4000. But in any case, spl-U-Boot needs to be compiled for U-Boot as next binary with SPL_OS_BOOT option disabled.
By default, spl is configured to boot linux xipImage.

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: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170610/8cbf26dd/attachment.sig>
#26 lore raw

v2 cover spl: add xip booting support

In reply to Vikas Manocha

Hi Tom,

Quoted 10 lines

-----Original Message-----
From: Vikas MANOCHA
Sent: Sunday, May 28, 2017 12:55 PM
To: u-boot at lists.denx.de
Cc: Vikas MANOCHA <[email protected]>; Patrick DELAUNAY <[email protected]>; Patrice CHOTARD <[email protected]>; Christophe KERELLO <[email protected]>; Christophe PRIOUZEAU <[email protected]>; Alexandre TORGUE <[email protected]>
Subject: [PATCH v2 0/7] spl: add xip booting support

This patchset adds support for XIP (execute in place) of U-Boot or kernel image and enables it for stm32f7.

Pls apply this series whenever you get a chance.
Cheers,
Vikas

Quoted 30 lines

Changed in v2:
- added patch to move v7m thumb mode just before next image boot
- removed extra blank line.

Vikas Manocha (7):
spl: armv7m: to keep ARM v7M in thumb mode before booting next image
stm32f7: remove duplicate configs
stm32: stm32f7: add spl build support
SPL: Add XIP booting support
serial: stm32f7: disable overrun
spl: stm32f7: add kernel boot support
spl: stm32f7: configure for xip booting

 arch/arm/include/asm/spl.h                 |  1 +
 arch/arm/mach-stm32/Kconfig                |  1 +
 arch/arm/mach-stm32/stm32f7/Kconfig        | 24 ++++++++++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 36 +++++++++++++++++++++++++++++-
 common/spl/Kconfig                         |  9 ++++++++
 common/spl/Makefile                        |  1 +
 common/spl/spl.c                           |  6 ++---
 common/spl/spl_xip.c                       | 28 +++++++++++++++++++++++
 configs/stm32f746-disco_defconfig          |  5 -----
 drivers/serial/serial_stm32x7.c            |  3 +++
 drivers/serial/serial_stm32x7.h            |  2 ++
 include/configs/stm32f746-disco.h          | 31 ++++++++++++++++++++++---
 12 files changed, 135 insertions(+), 12 deletions(-)  create mode 100644 common/spl/spl_xip.c

--
1.9.1