Skip to contentSkip to conversation

Add an SPL to boot the da850evm from SPI

PATCH Superseded Christian Riesch 5 participants 21 messages Dec 5, 2011 – Dec 9, 2011

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Hi,
this is v5 of the last part of my recent patchset

[PATCH v3 00/15] Add an SPL to boot the da850evm from SPI
http://lists.denx.de/pipermail/u-boot/2011-November/111182.html

Most of the other parts are already merged, together with this patchset they introduce an SPL for the da850evm to run u-boot directly without the need of a UBL (see doc/README.davinci).

The first patches fix dependencies and introduce a function to load the u-boot image from SPI flash. Patch #4 adds an SPL to the da850evm configuration. Finally, a simple
AIS (Application Image Script) is required to start the SPL. This AIS is generated by mkimage. Patch #5 fixes mkimage for building AIS. Finally the last patch introduces a u-boot.ais target in the Makefile.

This patchset applies on top of git://git.denx.de/u-boot-ti.git

Changes for v5:
- changed formatting (indentation) of the $(obj)u-boot.ais target in the Makefile
- removed useless '0 | ... ' from include/configs/da850evm.h
- added Acked-bys

Changes for v4:
- added documentation for the SPL to doc/README.davinci
- split patchset because it got too big
- use COBJS-$(CONFIG_SPL_SPI_LOAD) instead of ifdefs in drivers/mtd/spi/Makefile
- use __noreturn instead of __attribute__((noreturn))
- added Acked-by

Changes for v3:
- removed noise and hardcoded values from drivers/mtd/spi/spi_spl_load.c
- replaced $(PAD_TO) in Makefile by $(CONFIG_SPL_MAX_SIZE)

Major changes for v2:
- Added code that actually loads u-boot from SPI flash and starts it.

To build run
make da850evm_config
make u-boot.ais
Then program u-boot.ais to the SPI flash on the da850evm.

Best regards,
Christian

Cc Heiko Schocher <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rini <[email protected]>

Christian Riesch (6):
spl: display_options.o is required for SPI flash support in SPL
sf: Add spi_boot() to allow booting from SPI flash in an SPL arm, davinci: Add SPL support for DA850 SoCs
arm, da850evm: Add an SPL for SPI boot
mkimage: Fix variable length header support
arm, davinci: Add support for generating AIS images to the Makefile

 .gitignore                              |    1 +
 Makefile                                |   13 ++++
 arch/arm/cpu/arm926ejs/davinci/Makefile |    3 +-
 arch/arm/cpu/arm926ejs/davinci/spl.c    |   34 +++++++++++-
 board/davinci/da8xxevm/da850evm.c       |    4 +-
 board/davinci/da8xxevm/u-boot-spl.lds   |   73 +++++++++++++++++++++++
 doc/README.SPL                          |    1 +
 doc/README.davinci                      |    9 +++
 drivers/mtd/spi/Makefile                |    4 +
 drivers/mtd/spi/spi_spl_load.c          |   58 ++++++++++++++++++
 include/configs/da850evm.h              |   87 +++++++++++++++++++++++++++
 include/spi_flash.h                     |    3 +
 lib/Makefile                            |    2 +
 tools/mkimage.c                         |   97 ++++++++++++++++---------------
 14 files changed, 338 insertions(+), 51 deletions(-)
 create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
 create mode 100644 drivers/mtd/spi/spi_spl_load.c
#1 lore raw

PATCH v5 1/6 spl: display_options.o is required for SPI flash support in SPL

Cc Heiko Schocher <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 lib/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
lib/Makefile +2 -0
index 54708c2..35ba7ff 100644
@@ -50,6 +50,8 @@ COBJS-$(CONFIG_SHA1) += sha1.o
 COBJS-$(CONFIG_SHA256) += sha256.o
 COBJS-y	+= strmhz.o
 COBJS-$(CONFIG_RBTREE)	+= rbtree.o
+else
+COBJS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += display_options.o
 endif
 
 COBJS-y += ctype.o
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v5 2/6 sf: Add spi_boot() to allow booting from SPI flash in an SPL

In reply to Christian Riesch
---
 doc/README.SPL                 |    1 +
 drivers/mtd/spi/Makefile       |    4 +++
 drivers/mtd/spi/spi_spl_load.c |   58 ++++++++++++++++++++++++++++++++++++++++
 include/spi_flash.h            |    3 ++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_spl_load.c
doc/README.SPL +1 -0
index 89d24a7..f01a8bd 100644
@@ -65,3 +65,4 @@ CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
 CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
 CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
 CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
+CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
drivers/mtd/spi/Makefile +4 -0
index 57112af..90f8392 100644
@@ -25,6 +25,10 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libspi_flash.o
 
+ifdef CONFIG_SPL_BUILD
+COBJS-$(CONFIG_SPL_SPI_LOAD)	+= spi_spl_load.o
+endif
+
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
 COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
 COBJS-$(CONFIG_SPI_FLASH_EON)	+= eon.o
drivers/mtd/spi/spi_spl_load.c new file +58 -0

58 lines not on this page · raw message

include/spi_flash.h +3 -0
index 2671ab5..9da9062 100644
@@ -25,6 +25,7 @@
 
 #include <spi.h>
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 struct spi_flash {
 	struct spi_slave *spi;
@@ -68,4 +69,6 @@ static inline int spi_flash_erase(struct spi_flash *flash, u32 offset,
 	return flash->erase(flash, offset, len);
 }
 
+void spi_boot(void) __noreturn;
+
 #endif /* _SPI_FLASH_H_ */
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v5 2/6 sf: Add spi_boot() to allow booting from SPI flash in an SPL

Quoted 5 lines · Christian Riesch
Quoted 7 lines
---
 doc/README.SPL                 |    1 +
 drivers/mtd/spi/Makefile       |    4 +++
 drivers/mtd/spi/spi_spl_load.c |   58 ++++++++++++++++++++++++++++++++++++++++
 include/spi_flash.h            |    3 ++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_spl_load.c

I'm not sure if you're the one assigning this to me in Patchwork (would be nice if it had a history log), but I'm not the maintainer of SPI, nor of SPL generically -- just NAND.

-Scott

#4 lore raw

PATCH v5 2/6 sf: Add spi_boot() to allow booting from SPI flash in an SPL

Quoted 16 lines · On Monday 05 December 2011 14:33:40 Scott Wood wrote:
Quoted 7 lines · Christian Riesch

---

Quoted 7 lines
 doc/README.SPL                 |    1 +
 drivers/mtd/spi/Makefile       |    4 +++
 drivers/mtd/spi/spi_spl_load.c |   58
 ++++++++++++++++++++++++++++++++++++++++ include/spi_flash.h           
 |    3 ++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_spl_load.c
Quoted 3 lines

I'm not sure if you're the one assigning this to me in Patchwork (would be nice if it had a history log), but I'm not the maintainer of SPI, nor of SPL generically -- just NAND.

i don't plan on running these through my SPI branch ... seems like it should go through the SPL with everything else here.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111205/bc37c65f/attachment.pgp>

#5 lore raw

PATCH v5 2/6 sf: Add spi_boot() to allow booting from SPI flash in an SPL

Quoted 17 lines · Mike Frysinger
Quoted 16 lines · On Monday 05 December 2011 14:33:40 Scott Wood wrote:
Quoted 14 lines · Christian Riesch

---

?doc/README.SPL ? ? ? ? ? ? ? ? | ? ?1 +
?drivers/mtd/spi/Makefile ? ? ? | ? ?4 +++
?drivers/mtd/spi/spi_spl_load.c | ? 58

?++++++++++++++++++++++++++++++++++++++++ include/spi_flash.h ?| ? ?3 ++
?4 files changed, 66 insertions(+), 0 deletions(-) ?create mode 100644 drivers/mtd/spi/spi_spl_load.c

Quoted 6 lines
Quoted 3 lines

I'm not sure if you're the one assigning this to me in Patchwork (would be nice if it had a history log), but I'm not the maintainer of SPI, nor of SPL generically -- just NAND.

i don't plan on running these through my SPI branch ... seems like it should go through the SPL with everything else here.

How about this? I don't see SPL nor SPI on the Custodians page, but there is TI and this is SPL for DaVinci (TI) stuff, so once everyone is happy with the whole series I'll take this for u-boot-ti/master and try for v2011.12 (since this series has been around for a while).

Signature · 1 line
Tom
#6 lore raw

PATCH v5 2/6 sf: Add spi_boot() to allow booting from SPI flash in an SPL

Quoted 22 lines · On Monday 05 December 2011 15:03:44 Tom Rini wrote:
Quoted 21 lines · Mike Frysinger
Quoted 19 lines · On Monday 05 December 2011 14:33:40 Scott Wood wrote:
Quoted 7 lines · Christian Riesch

---

Quoted 7 lines
 doc/README.SPL                 |    1 +
 drivers/mtd/spi/Makefile       |    4 +++
 drivers/mtd/spi/spi_spl_load.c |   58
 ++++++++++++++++++++++++++++++++++++++++ include/spi_flash.h
 |    3 ++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/spi_spl_load.c

I'm not sure if you're the one assigning this to me in Patchwork (would be nice if it had a history log), but I'm not the maintainer of SPI, nor of SPL generically -- just NAND.

Quoted 7 lines
Quoted 2 lines

i don't plan on running these through my SPI branch ... seems like it should go through the SPL with everything else here.

How about this? I don't see SPL nor SPI on the Custodians page, but there is TI and this is SPL for DaVinci (TI) stuff, so once everyone is happy with the whole series I'll take this for u-boot-ti/master and try for v2011.12 (since this series has been around for a while).

that's fine by me
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111205/0e60b807/attachment.pgp>

#7 lore raw

PATCH v5 3/6 arm, davinci: Add SPL support for DA850 SoCs

In reply to Christian Riesch

This code adds an SPL for booting from SPI flash on DA850 SoCs.

---
 arch/arm/cpu/arm926ejs/davinci/Makefile |    3 +-
 arch/arm/cpu/arm926ejs/davinci/spl.c    |   34 ++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/davinci/Makefile +2 -1
index 5ae89df..da7efac 100644
@@ -38,7 +38,8 @@ COBJS-$(CONFIG_DRIVER_TI_EMAC)	+= lxt972.o dp83848.o et1011c.o ksz8873.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS-y	+= spl.o
-COBJS-y	+= dm365_lowlevel.o
+COBJS-$(CONFIG_SOC_DM365)	+= dm365_lowlevel.o
+COBJS-$(CONFIG_SOC_DA8XX)	+= da850_lowlevel.o
 endif
 
 SOBJS	= reset.o
arch/arm/cpu/arm926ejs/davinci/spl.c +33 -1
index d9b9398..20f798e 100644
@@ -26,6 +26,16 @@
 #include <nand.h>
 #include <asm/arch/dm365_lowlevel.h>
 #include <ns16550.h>
+#include <malloc.h>
+#include <spi_flash.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Define global data structure pointer to it*/
+static gd_t gdata __attribute__ ((section(".data")));
+static bd_t bdata __attribute__ ((section(".data")));
+
+#ifndef CONFIG_SPL_LIBCOMMON_SUPPORT
 
 void puts(const char *str)
 {
@@ -41,6 +51,8 @@ void putc(char c)
 	NS16550_putc((NS16550_t)(CONFIG_SYS_NS16550_COM1), c);
 }
 
+#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
+
 inline void hang(void)
 {
 	puts("### ERROR ### Please RESET the board ###\n");
@@ -50,14 +62,34 @@ inline void hang(void)
 
 void board_init_f(ulong dummy)
 {
+#ifdef CONFIG_SOC_DM365
 	dm36x_lowlevel_init(0);
+#endif
+#ifdef CONFIG_SOC_DA8XX
+	arch_cpu_init();
+#endif
 	relocate_code(CONFIG_SPL_STACK, NULL, CONFIG_SPL_TEXT_BASE);
 }
 
 void board_init_r(gd_t *id, ulong dummy)
 {
-
+#ifdef CONFIG_SOC_DM365
 	nand_init();
 	puts("Nand boot...\n");
 	nand_boot();
+#endif
+#ifdef CONFIG_SOC_DA8XX
+	mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_MALLOC_LEN,
+			CONFIG_SYS_MALLOC_LEN);
+
+	gd = &gdata;
+	gd->bd = &bdata;
+	gd->flags |= GD_FLG_RELOC;
+	gd->baudrate = CONFIG_BAUDRATE;
+	serial_init();          /* serial communications setup */
+	gd->have_console = 1;
+
+	puts("SPI boot...\n");
+	spi_boot();
+#endif
 }
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH v5 4/6 arm, da850evm: Add an SPL for SPI boot

In reply to Christian Riesch
Cc Heiko Schocher <[email protected]>
Cc Sandeep Paulraj <[email protected]>
Cc Tom Rini <[email protected]>
Cc Sudhakar Rajashekhara <[email protected]>
---
 board/davinci/da8xxevm/da850evm.c     |    4 +-
 board/davinci/da8xxevm/u-boot-spl.lds |   73 +++++++++++++++++++++++++++
 doc/README.davinci                    |    9 +++
 include/configs/da850evm.h            |   87 +++++++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 1 deletions(-)
 create mode 100644 board/davinci/da8xxevm/u-boot-spl.lds
board/davinci/da8xxevm/da850evm.c +3 -1
index e827256..8e66c35 100644
@@ -108,7 +108,7 @@ static const struct pinmux_config gpio_pins[] = {
 #endif
 };
 
-static const struct pinmux_resource pinmuxes[] = {
+const struct pinmux_resource pinmuxes[] = {
 #ifdef CONFIG_DRIVER_TI_EMAC
 	PINMUX_ITEM(emac_pins_mdio),
 #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII
@@ -135,6 +135,8 @@ static const struct pinmux_resource pinmuxes[] = {
 	PINMUX_ITEM(gpio_pins),
 };
 
+const int pinmuxes_size = ARRAY_SIZE(pinmuxes);
+
 static const struct lpsc_resource lpsc[] = {
 	{ DAVINCI_LPSC_AEMIF },	/* NAND, NOR */
 	{ DAVINCI_LPSC_SPI1 },	/* Serial Flash */
board/davinci/da8xxevm/u-boot-spl.lds new file +73 -0

73 lines not on this page · raw message

doc/README.davinci +9 -0
index 5f1bdc8..aa7c850 100644
@@ -95,6 +95,15 @@ into the RAM.
 The programmers and UBL are always released as part of any standard TI
 software release associated with an SOC.
 
+Alternative boot method (DA850 EVM only):
+For the DA850 EVM an SPL (secondary program loader, see doc/README.SPL)
+is provided to load U-Boot directly from SPI flash. In this case, the
+SPL does the low level initialization that is otherwise done by the SPL.
+To build U-Boot with this SPL, do
+make da850evm_config
+make u-boot.ais
+and program the resulting u-boot.ais file to the SPI flash of the DA850 EVM.
+
 Environment Variables
 =====================
 
include/configs/da850evm.h +87 -0

105 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#9 lore raw

PATCH v5 4/6 arm, da850evm: Add an SPL for SPI boot

On 12/05/2011 03:58 AM, Christian Riesch wrote:

[snip]

Quoted 1 line
 include/configs/da850evm.h            |   87 +++++++++++++++++++++++++++++++++

[snip]

include/configs/da850evm.h line 132

Quoted 8 lines
include/configs/da850evm.h +8 -0
+#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (		\
+	(7 << DV_DDR_SDTMR2_RASMAX_SHIFT) |	\
+	(0 << DV_DDR_SDTMR2_XP_SHIFT) |		\
+	(0 << DV_DDR_SDTMR2_ODT_SHIFT) |	\
+	(17 << DV_DDR_SDTMR2_XSNR_SHIFT) |	\
+	(199 << DV_DDR_SDTMR2_XSRD_SHIFT) |	\
+	(0 << DV_DDR_SDTMR2_RTP_SHIFT) |	\
+	(0 << DV_DDR_SDTMR2_CKE_SHIFT))

Last time I guess I wasn't clear enough, sorry, there's 0 shifts other places I disagree with two. I really think in some cases we're best off just saying "Please look@the ... section of the TRM for this part for an explanation of all bit fields." and not calculate or'ing in 0 here or there.

Signature · 1 line
Tom
#10 lore raw

PATCH v5 5/6 mkimage: Fix variable length header support

In reply to Christian Riesch

Support for variable length images like AIS image was introduced in commit f0662105b674a3874227316abf8536bebc9b5995. A parameter "-s" was also introduced to prohibit copying of the image file automatically in the main program. However, this parameter was implemented incorrectly and the image file was copied nevertheless.

---
 tools/mkimage.c |   97 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 49 insertions(+), 48 deletions(-)
tools/mkimage.c +49 -48
index 36e28ec..eeb1b10 100644
@@ -383,65 +383,66 @@ NXTARG:		;
 		exit (EXIT_FAILURE);
 	}
 
-	if (!params.skipcpy &&
-		(params.type == IH_TYPE_MULTI ||
-			params.type == IH_TYPE_SCRIPT)) {
-		char *file = params.datafile;
-		uint32_t size;
-
-		for (;;) {
-			char *sep = NULL;
-
-			if (file) {
-				if ((sep = strchr(file, ':')) != NULL) {
-					*sep = '\0';
+	if (!params.skipcpy) {
+		if (params.type == IH_TYPE_MULTI ||
+		    params.type == IH_TYPE_SCRIPT) {
+			char *file = params.datafile;
+			uint32_t size;
+
+			for (;;) {
+				char *sep = NULL;
+
+				if (file) {
+					if ((sep = strchr(file, ':')) != NULL) {
+						*sep = '\0';
+					}
+
+					if (stat (file, &sbuf) < 0) {
+						fprintf (stderr, "%s: Can't stat %s: %s\n",
+							 params.cmdname, file, strerror(errno));
+						exit (EXIT_FAILURE);
+					}
+					size = cpu_to_uimage (sbuf.st_size);
+				} else {
+					size = 0;
 				}
 
-				if (stat (file, &sbuf) < 0) {
-					fprintf (stderr, "%s: Can't stat %s: %s\n",
-						params.cmdname, file, strerror(errno));
+				if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) {
+					fprintf (stderr, "%s: Write error on %s: %s\n",
+						 params.cmdname, params.imagefile,
+						 strerror(errno));
 					exit (EXIT_FAILURE);
 				}
-				size = cpu_to_uimage (sbuf.st_size);
-			} else {
-				size = 0;
-			}
 
-			if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) {
-				fprintf (stderr, "%s: Write error on %s: %s\n",
-					params.cmdname, params.imagefile,
-					strerror(errno));
-				exit (EXIT_FAILURE);
-			}
+				if (!file) {
+					break;
+				}
 
-			if (!file) {
-				break;
+				if (sep) {
+					*sep = ':';
+					file = sep + 1;
+				} else {
+					file = NULL;
+				}
 			}
 
-			if (sep) {
-				*sep = ':';
-				file = sep + 1;
-			} else {
-				file = NULL;
-			}
-		}
+			file = params.datafile;
 
-		file = params.datafile;
-
-		for (;;) {
-			char *sep = strchr(file, ':');
-			if (sep) {
-				*sep = '\0';
-				copy_file (ifd, file, 1);
-				*sep++ = ':';
-				file = sep;
-			} else {
-				copy_file (ifd, file, 0);
-				break;
+			for (;;) {
+				char *sep = strchr(file, ':');
+				if (sep) {
+					*sep = '\0';
+					copy_file (ifd, file, 1);
+					*sep++ = ':';
+					file = sep;
+				} else {
+					copy_file (ifd, file, 0);
+					break;
+				}
 			}
+		} else {
+			copy_file (ifd, params.datafile, 0);
 		}
-	} else {
-		copy_file (ifd, params.datafile, 0);
 	}
 
 	/* We're a bit of paranoid */
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH v5 6/6 arm, davinci: Add support for generating AIS images to the Makefile

In reply to Christian Riesch
Cc Stefano Babic <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 .gitignore |    1 +
 Makefile   |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
.gitignore +1 -0
index ff4bae0..e4e95e2 100644
@@ -35,6 +35,7 @@
 /u-boot.dis
 /u-boot.lds
 /u-boot.ubl
+/u-boot.ais
 /u-boot.dtb
 /u-boot.sb
 
Makefile +13 -0
index fb658f4..5fe54c6 100644
@@ -417,6 +417,18 @@ $(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		rm $(obj)u-boot-ubl.bin
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
+			-e $(CONFIG_SPL_TEXT_BASE) \
+			-d $(obj)spl/u-boot-spl.bin \
+			$(obj)spl/u-boot-spl.ais
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
+			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
+		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \
+			$(obj)u-boot.ais
+		rm $(obj)spl/u-boot-spl{,-pad}.ais
+
 $(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
 		elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \
 			-o $(obj)u-boot.sb
@@ -788,6 +800,7 @@ clobber:	clean
 	@rm -f $(obj)u-boot.kwb
 	@rm -f $(obj)u-boot.imx
 	@rm -f $(obj)u-boot.ubl
+	@rm -f $(obj)u-boot.ais
 	@rm -f $(obj)u-boot.dtb
 	@rm -f $(obj)u-boot.sb
 	@rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
Signature · 1 line
1.7.0.4
#12 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

In reply to Christian Riesch
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. Thanks!

Signature · 1 line
Tom
#13 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Quoted 11 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. ?Thanks!

OK, what toolchain are you using? For da850evm and gcc 4.5 I get:
arm-linux-gnueabi-ld: error: no memory region specified for loadable section `.ARM.exidx'
make[1]: *** [/home/trini/work/u-boot/u-boot-ti/da850evm/spl/u-boot-spl] Error 1
make: *** [/home/trini/work/u-boot/u-boot-ti/da850evm/spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs....

gcc-4.6 (Linaro, Ubuntu 'Lucid' packages) are fine. This isn't a vanilla 4.5 however so if this works for others, I'm OK.

Signature · 1 line
Tom
#14 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 6 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Quoted 7 lines
Quoted 5 lines

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. ?Thanks!

OK, what toolchain are you using? ?For da850evm and gcc 4.5 I get:

I'm using
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)

make da850evm_config && make -s -j3 u-boot.ais
builds without warnings.

Regards, Christian

Quoted 16 lines

arm-linux-gnueabi-ld: error: no memory region specified for loadable section `.ARM.exidx'
make[1]: *** [/home/trini/work/u-boot/u-boot-ti/da850evm/spl/u-boot-spl] Error 1
make: *** [/home/trini/work/u-boot/u-boot-ti/da850evm/spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs....

gcc-4.6 (Linaro, Ubuntu 'Lucid' packages) are fine. ?This isn't a vanilla 4.5 however so if this works for others, I'm OK.

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

#15 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Quoted 16 lines · Christian Riesch

Hi Tom,

Quoted 13 lines · Tom Rini
Quoted 11 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. Thanks!

Quoted 7 lines
Quoted 1 line

OK, what toolchain are you using? For da850evm and gcc 4.5 I get:

I'm using
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)

make da850evm_config && make -s -j3 u-boot.ais
builds without warnings.

How about 'all' (or da850evm) ?

Signature · 1 line
Tom
#16 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Quoted 19 lines · Tom Rini
Quoted 18 lines · Christian Riesch

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 11 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. ?Thanks!

OK, what toolchain are you using? ?For da850evm and gcc 4.5 I get:

Quoted 7 lines
Quoted 5 lines

I'm using
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)

make da850evm_config && make -s -j3 u-boot.ais
builds without warnings.

How about 'all' (or da850evm) ?

$ cd u-boot
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ make mrproper
$ make -s da850evm
Configuring for da850evm board...
Generating include/generated/asm-offsets.h
$

So this worked.

$ make mrproper
$ make da850evm_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }'
boards.cfg > .boards.depend
Configuring for da850evm board...
$ make -s all
Generating include/generated/asm-offsets.h
$

So this way it worked as well.

$ make -s u-boot.ais
Image Type:   TI Davinci AIS Boot Image
AIS magic :   41504954
Image at  :   0x80000000 size 0x000044ec
$

Ok.

This is the current ti master (commit f50dda60868a9deeb70d220867704dec06f5b7b4) plus my patchset.

Regards, Christian

#17 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Quoted 55 lines · Christian Riesch
Quoted 19 lines · Tom Rini
Quoted 18 lines · Christian Riesch

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 11 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. ?Thanks!

OK, what toolchain are you using? ?For da850evm and gcc 4.5 I get:

Quoted 7 lines
Quoted 5 lines

I'm using
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)

make da850evm_config && make -s -j3 u-boot.ais
builds without warnings.

How about 'all' (or da850evm) ?

$ cd u-boot
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ make mrproper
$ make -s da850evm
Configuring for da850evm board...
Generating include/generated/asm-offsets.h
$

So this worked.

$ make mrproper
$ make da850evm_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }'
boards.cfg > .boards.depend
Configuring for da850evm board...
$ make -s all
Generating include/generated/asm-offsets.h
$

So this way it worked as well.

$ make -s u-boot.ais
Image Type: ? TI Davinci AIS Boot Image
AIS magic : ? 41504954
Image at ?: ? 0x80000000 size 0x000044ec
$
Quoted 4 lines

Ok.

This is the current ti master (commit f50dda60868a9deeb70d220867704dec06f5b7b4) plus my patchset.

OK, thanks, I'll chalk it up to my toolchain then.

Signature · 1 line
Tom
#18 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Quoted 57 lines · Tom Rini
Quoted 55 lines · Christian Riesch
Quoted 19 lines · Tom Rini
Quoted 18 lines · Christian Riesch

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 11 lines · Tom Rini
Quoted 3 lines · Christian Riesch

Hi,
this is v5 of the last part of my recent patchset

Following on to my last email in 2/6 of the series, if there's no objections other than mine about commenting and not doing 0 bit shifts, and that's an agreeable change, if there's no other objections within 24h I'll put the series into u-boot-ti/master and send a pull request to Albert. ?Thanks!

OK, what toolchain are you using? ?For da850evm and gcc 4.5 I get:

Quoted 7 lines
Quoted 5 lines

I'm using
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41)

make da850evm_config && make -s -j3 u-boot.ais
builds without warnings.

How about 'all' (or da850evm) ?

$ cd u-boot
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ make mrproper
$ make -s da850evm
Configuring for da850evm board...
Generating include/generated/asm-offsets.h
$

So this worked.

$ make mrproper
$ make da850evm_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }'
boards.cfg > .boards.depend
Configuring for da850evm board...
$ make -s all
Generating include/generated/asm-offsets.h
$

So this way it worked as well.

$ make -s u-boot.ais
Image Type: ? TI Davinci AIS Boot Image
AIS magic : ? 41504954
Image at ?: ? 0x80000000 size 0x000044ec
$
Quoted 6 lines
Quoted 4 lines

Ok.

This is the current ti master (commit f50dda60868a9deeb70d220867704dec06f5b7b4) plus my patchset.

OK, thanks, I'll chalk it up to my toolchain then.

After talking with Wolfgang and Albert, we (OK, Wolfgang) found that ELDK 4.2 toolchain also shows this issue, so please grab that and figure out what's going on here. Thanks!

Signature · 1 line
Tom
#19 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Hi Tom,

Quoted 1 line · Tom Rini

On Tue, Dec 6, 2011 at 10:34 AM, Tom Rini <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 1 line

OK, thanks, I'll chalk it up to my toolchain then.

After talking with Wolfgang and Albert, we (OK, Wolfgang) found that ELDK 4.2 toolchain also shows this issue, so please grab that and figure out what's going on here. Thanks!

With ELDK 4.2 I got the same error message:

arm-linux-ld: error: no memory region specified for loadable section `.ARM.exidx'

In my linker script for the SPL (board/davinci/da8xxevm/u-boot-spl.lds) no such section is defined. But somehow the linker in the Codesourcery toolchain that I used before manages to place the .ARM.exidx section between rodata and data automatically (The section is listed in the corresponding .map file). However, with the ELDK 4.2 toolchain this section (and the .got section) must be specified explicitly. With the patch below (applied on top of the patchset) the SPL builds and links nicely with both ELDK 4.2 and the Codesourcery toolchain.

Tom, could you please try if that works for your toolchain?

I don't know much about linker scripts, so my question is: Is this the right way to solve this problem?

Thanks, Christian

---
 board/davinci/da8xxevm/u-boot-spl.lds |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/u-boot-spl.lds +2 -0
index 6f6e065..1ba0a59 100644
@@ -44,6 +44,8 @@ SECTIONS
 
 	. = ALIGN(4);
 	.rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
+	.ARM.exidx : { *(.ARM.exidx*) } > .sram
+	.got : { *(.got*) } > .sram
 
 	. = ALIGN(4);
 	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
Signature · 1 line
1.7.0.4
#20 lore raw

v5 cover Add an SPL to boot the da850evm from SPI

Hi again,

Quoted 16 lines · Christian Riesch

Hi Tom,

Quoted 1 line · Tom Rini

On Tue, Dec 6, 2011 at 10:34 AM, Tom Rini <[email protected]> wrote:

[...]

Quoted 5 lines
Quoted 1 line

OK, thanks, I'll chalk it up to my toolchain then.

After talking with Wolfgang and Albert, we (OK, Wolfgang) found that ELDK 4.2 toolchain also shows this issue, so please grab that and figure out what's going on here. Thanks!

With ELDK 4.2 I got the same error message:

arm-linux-ld: error: no memory region specified for loadable section `.ARM.exidx'

Quoted 8 lines

In my linker script for the SPL (board/davinci/da8xxevm/u-boot-spl.lds) no such section is defined. But somehow the linker in the Codesourcery toolchain that I used before manages to place the .ARM.exidx section between rodata and data automatically (The section is listed in the corresponding .map file). However, with the ELDK 4.2 toolchain this section (and the .got section) must be specified explicitly. With the patch below (applied on top of the patchset) the SPL builds and links nicely with both ELDK 4.2 and the Codesourcery toolchain.

That's probably not the right way to solve the problem.

A run of ./MAKEALL -c arm926ejs with a modified version of MAKEALL that copied the resulting u-boot.map file of each build into the log directory and subsequently doing
for i in ls *.map; do grep exidx $i > /dev/null && echo $i; done showed that all davinci boards have this .ARM.exidx section, so it must be something in the davinci arch tree. After reading a lot of code and running nm over the object files I found out that there is some connection between the 64 bit division that are done in arch/arm/cpu/arm926ejs/davinci/timer.c and these .exidx sections.

The relevant code in timer.c is

ulong get_timer(ulong base)

{
        unsigned long long timer_diff;

        timer_diff = get_ticks() - gd->timer_reset_value;

        return (timer_diff / (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base;
}

void __udelay(unsigned long usec)

{
        unsigned long long endtime;

        endtime = ((unsigned long long)usec * gd->timer_rate_hz) / 1000000UL;
        endtime += get_ticks();

        while (get_ticks() < endtime)
                ;
}

When I replace both divisions with the lldiv function from ldiv64.h (I have seen that a lot of patches did such replacements in the u-boot code) the exidx sections vanish (for all davinci based boards) and my patches compile fine even with the ELDK 4.2 toolchain.

The patch below does the required changes in timer.c and also one replacement in post/post.c.

Could you please comment on this solution?

@Heiko: The SPL of the cam_enc_4xx board suffered from the same linker problem (.ARM.exidx section) and also after applying the patch I could not build this board with ELDK 4.2 (although it works fine with gcc version 4.5.2 (Sourcery G++ Lite 2011.03-41). Could you please have a look@this? (arm-linux-ld: u-boot-spl: Not enough room for program headers, try linking with -N)

Regards, Christian

---
 arch/arm/cpu/arm926ejs/davinci/timer.c |    6 ++++--
 post/post.c                            |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/cpu/arm926ejs/davinci/timer.c +4 -2
index c7bf7a5..31f8633 100644
@@ -40,6 +40,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/timer_defs.h>
+#include <div64.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -86,14 +87,15 @@ ulong get_timer(ulong base)
 
 	timer_diff = get_ticks() - gd->timer_reset_value;
 
-	return (timer_diff / (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base;
+	return lldiv(timer_diff, (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base;
 }
 
 void __udelay(unsigned long usec)
 {
 	unsigned long long endtime;
 
-	endtime = ((unsigned long long)usec * gd->timer_rate_hz) / 1000000UL;
+	endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz, 
+			1000000UL);
 	endtime += get_ticks();
 
 	while (get_ticks() < endtime)
post/post.c +2 -1
index 0e67ad7..745767a 100644
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <stdio_dev.h>
 #include <watchdog.h>
+#include <div64.h>
 #include <post.h>
 
 #ifdef CONFIG_SYS_POST_HOTKEYS_GPIO
@@ -495,7 +496,7 @@ void post_reloc(void)
 unsigned long post_time_ms(unsigned long base)
 {
 #if defined(CONFIG_PPC) || defined(CONFIG_ARM)
-	return (unsigned long)(get_ticks() / (get_tbclk() / CONFIG_SYS_HZ))
+  return (unsigned long) lldiv(get_ticks(), (get_tbclk() / CONFIG_SYS_HZ))
 		- base;
 #else
 #warning "Not implemented yet"
Signature · 1 line
1.7.0.4