Skip to contentSkip to conversation

omap3: Reduce logic/overo SPL max image size

PATCH New Tom Rini 3 participants 10 messages Apr 27, 2016 – May 3, 2016 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

While the OMAP3 has 64KiB of SRAM, per the TRM the download area is only from 0x40200000 to 0x4020F000 and exceeding that will cause failure to boot. Further, we need to make sure that we don't run into SRAM_SCRATCH_SPACE_ADDR as once SPL is running we will write values there and would corrupt our running image.

Cc Adam Ford <[email protected]>
Cc Steve Sakoman <[email protected]>
---
 include/configs/omap3_logic.h | 2 +-
 include/configs/omap3_overo.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/configs/omap3_logic.h +1 -1
index 055dcb7..6c79643 100644
@@ -34,7 +34,7 @@
 #undef CONFIG_SPL_TEXT_BASE
 #undef CONFIG_SPL_MAX_SIZE
 #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (64 * 1024)
+#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
 
 /* Display CPU and Board information */
 
include/configs/omap3_overo.h +1 -1
index c066eae5..fbd0c2a 100644
@@ -12,9 +12,9 @@
 
 #include <configs/ti_omap3_common.h>
 #undef CONFIG_SPL_MAX_SIZE
-#define CONFIG_SPL_MAX_SIZE	(64*1024)
 #undef CONFIG_SPL_TEXT_BASE
 #define CONFIG_SPL_TEXT_BASE	0x40200000
+#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
 
 #define CONFIG_BCH
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 9 lines · Tom Rini

While the OMAP3 has 64KiB of SRAM, per the TRM the download area is only from 0x40200000 to 0x4020F000 and exceeding that will cause failure to boot. Further, we need to make sure that we don't run into SRAM_SCRATCH_SPACE_ADDR as once SPL is running we will write values there and would corrupt our running image.

Cc Adam Ford <[email protected]>
Cc Steve Sakoman <[email protected]>

First, this will break linking SPL on some toolchains. However, I am confident that in those cases the binary would not work or not be reliable. I will be fixing this properly in the next release for all toolchains. 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/20160428/edab506f/attachment.sig>
#2 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

I am hoping to look at this tomorrow at work. Any suggested toolchain you recommend?

Quoted 20 lines · Tom Rini
Quoted 9 lines · Tom Rini

While the OMAP3 has 64KiB of SRAM, per the TRM the download area is only from 0x40200000 to 0x4020F000 and exceeding that will cause failure to boot. Further, we need to make sure that we don't run into SRAM_SCRATCH_SPACE_ADDR as once SPL is running we will write values there and would corrupt our running image.

Cc Adam Ford <[email protected]>
Cc Steve Sakoman <[email protected]>

First, this will break linking SPL on some toolchains. However, I am confident that in those cases the binary would not work or not be reliable. I will be fixing this properly in the next release for all toolchains. Applied to u-boot/master, thanks!

--
Tom

author
#3 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 2 lines · Adam Ford

I am hoping to look at this tomorrow at work. Any suggested toolchain you recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

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/20160428/10daf022/attachment.sig>
#9 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

In reply to Tom Rini
Quoted 9 lines · Tom Rini

While the OMAP3 has 64KiB of SRAM, per the TRM the download area is only from 0x40200000 to 0x4020F000 and exceeding that will cause failure to boot. Further, we need to make sure that we don't run into SRAM_SCRATCH_SPACE_ADDR as once SPL is running we will write values there and would corrupt our running image.

Cc Adam Ford <[email protected]>
Cc Steve Sakoman <[email protected]>
Quoted 36 lines
---
 include/configs/omap3_logic.h | 2 +-
 include/configs/omap3_overo.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/configs/omap3_logic.h +1 -1
index 055dcb7..6c79643 100644
@@ -34,7 +34,7 @@
 #undef CONFIG_SPL_TEXT_BASE
 #undef CONFIG_SPL_MAX_SIZE
 #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (64 * 1024)
+#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
 
 /* Display CPU and Board information */
 
include/configs/omap3_overo.h +1 -2
index c066eae5..fbd0c2a 100644
@@ -12,9 +12,9 @@
 
 #include <configs/ti_omap3_common.h>
 #undef CONFIG_SPL_MAX_SIZE
-#define CONFIG_SPL_MAX_SIZE    (64*1024)
 #undef CONFIG_SPL_TEXT_BASE
 #define CONFIG_SPL_TEXT_BASE   0x40200000
+#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
 
 #define CONFIG_BCH
 
--

1.9.1

#4 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

In reply to Tom Rini
Quoted 6 lines · Tom Rini
Quoted 2 lines · Adam Ford

I am hoping to look at this tomorrow at work. Any suggested toolchain you recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

Hi Tom,

Using gcc-5.3.0, for 'omap3_logic', I get the following:

---8<------------------------------------------ arm-cortexa8-linux-gnueabihf-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
arm-cortexa8-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 948 bytes ---8<------------------------------------------

I built the compiler today with crosstool-ng.

gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)

What things could/should be removed, from the configuration, to avoid these kinds of things in the future?

I would expect that the default board configuration to be less sensitive, in general. I guess I want to know what is the right size for an OMAP3 with SPL enabled.

Changing compilers, just for this, can cause quite a ripple on projects and the products that are supported by them.

Derald Woods

Quoted 6 lines

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

author
#5 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 10 lines · Derald D. Woods
Quoted 6 lines · Tom Rini
Quoted 2 lines · Adam Ford

I am hoping to look at this tomorrow at work. Any suggested toolchain you recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

Hi Tom,

Quoted 7 lines

Using gcc-5.3.0, for 'omap3_logic', I get the following:

---8<------------------------------------------ arm-cortexa8-linux-gnueabihf-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
arm-cortexa8-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 948 bytes ---8<------------------------------------------

That's odd, 5.3.1 from debian/unstable works.

Quoted 7 lines

I built the compiler today with crosstool-ng.

gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)

What things could/should be removed, from the configuration, to avoid these kinds of things in the future?

Quoted 6 lines

I would expect that the default board configuration to be less sensitive, in general. I guess I want to know what is the right size for an OMAP3 with SPL enabled.

Changing compilers, just for this, can cause quite a ripple on projects and the products that are supported by them.

So, the first thing to do would be to please try the following patch:

arch/arm/include/asm/arch-omap3/omap.h +1 -1
index bc0e02a..6cef323 100644
@@ -145,7 +145,7 @@ struct gpio {
 
 #define NON_SECURE_SRAM_START		0x40208000 /* Works for GP & EMU */
 #define NON_SECURE_SRAM_END		0x40210000
-#define SRAM_SCRATCH_SPACE_ADDR		0x4020E000
+#define SRAM_SCRATCH_SPACE_ADDR		0x4020F000
 
 #define LOW_LEVEL_SRAM_STACK		0x4020FFFC
 
doc/SPL/README.omap3 +4 -2
index c77ca43..cc54afe 100644
@@ -33,8 +33,9 @@ SRAM: 0x40200000 - 0x4020FFFF
 DDR1: 0x80000000 - 0xBFFFFFFF
 
 Option 1 (SPL only):
-0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x40200800 - 0x4020EFFF: Area for SPL text, data and rodata
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
+0x4020FCB0 - 0x4020FFFF: Area for the SPL stack
 0x80000000 - 0x8007FFFF: Area for the SPL BSS.
 0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot
 0x80208000 - 0x80307FFF: malloc() pool available to SPL.
@@ -42,6 +43,7 @@ Option 1 (SPL only):
 Option 2 (SPL or X-Loader):
 0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
 0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
 0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot
 0x87000000 - 0x8707FFFF: Area for the SPL BSS.
 0x87080000 - 0x870FFFFF: malloc() pool available to SPL.
include/configs/omap3_logic.h +2 -4
index 6c79643..ed03e07 100644
@@ -28,13 +28,11 @@
 #define CONFIG_SYS_SPL_MALLOC_START	0x80208000
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
 
-#include <configs/ti_omap3_common.h>
 
 /* Override default SPL info to minimize empty space and allow BCH8 in SPL */
-#undef CONFIG_SPL_TEXT_BASE
-#undef CONFIG_SPL_MAX_SIZE
 #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
+
+#include <configs/ti_omap3_common.h>
 
 /* Display CPU and Board information */
 
include/configs/omap3_overo.h +1 -4
index fbd0c2a..289c8e9 100644
@@ -10,11 +10,8 @@
 #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
 #define CONFIG_NAND
 
-#include <configs/ti_omap3_common.h>
-#undef CONFIG_SPL_MAX_SIZE
-#undef CONFIG_SPL_TEXT_BASE
 #define CONFIG_SPL_TEXT_BASE	0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
+#include <configs/ti_omap3_common.h>
 
 #define CONFIG_BCH
 
include/configs/ti_omap3_common.h +10 -2
index 32877d1..ffd695f 100644
@@ -68,9 +68,17 @@
 /* TWL4030 */
 #define CONFIG_TWL4030_POWER
 
-/* SPL */
+/*
+ * For SPL we say that our text base is at 0x40200800 for compatibility
+ * with HS and GP devices.  We say that the maximum image size is the end
+ * of the downloaded image area minus the text base.  If desired the text
+ * base can be lowered by individual platforms but the upper bound is a
+ * hard limit.
+ */
+#ifndef CONFIG_SPL_TEXT_BASE
 #define CONFIG_SPL_TEXT_BASE		0x40200800
-#define CONFIG_SPL_MAX_SIZE		(54 * 1024)
+#endif
+#define CONFIG_SPL_MAX_SIZE		(0x4020F000 - CONFIG_SPL_TEXT_BASE)
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
 #define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SYS_SPL_ARGS_ADDR	(CONFIG_SYS_SDRAM_BASE + \
include/configs/ti_omap4_common.h +6 -4
index 586d848..66592f0 100644
@@ -143,12 +143,14 @@
 	BOOTENV
 
 /*
- * Defines for SPL
- * It is known that this will break HS devices. Since the current size of
- * SPL is overlapped with public stack and breaking non HS devices to boot.
- * So moving TEXT_BASE down to non-HS limit.
+ * For SPL we set our text base to the start of the download image area for GP
+ * devices.  HS devices will have to define this value instead.  We say that
+ * the maximum image size is the end of the downloaded image area minus the
+ * text base.
  */
+#ifndef
 #define CONFIG_SPL_TEXT_BASE		0x40300000
+#endif
 #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)
 #define CONFIG_SPL_DISPLAY_PRINT
 #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"

As this will allow for boards to bring themselves to the maximum binary size for GP parts on OMAP3. It's too late in the release cycle and needs broad testing, but giving it a whirl on omap3_logic would be a good start. Next, are you also using falcon mode? FAT and EXT2/3/4 fs support?

Part of the problem is that the defaults bring in a lot of wide ranging support right now and we need to move things to Kconfig to make it easy to turn those things off. The various partition table types shouldn't be too hard to migrate and for moving all Kconfigs, I'm just going to do that since there can be a bit of churn that makes those patches hard to apply.

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/20160501/0cacd975/attachment.sig>
#6 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 145 lines · Tom Rini
Quoted 9 lines · Derald D. Woods
Quoted 6 lines · Tom Rini
Quoted 2 lines · Adam Ford

I am hoping to look at this tomorrow at work. Any suggested toolchain you recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

Hi Tom,

Quoted 7 lines

Using gcc-5.3.0, for 'omap3_logic', I get the following:

---8<------------------------------------------ arm-cortexa8-linux-gnueabihf-ld.bfd: u-boot-spl section .data' will not fit in region .sram'
arm-cortexa8-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 948 bytes ---8<------------------------------------------

That's odd, 5.3.1 from debian/unstable works.

Quoted 7 lines

I built the compiler today with crosstool-ng.

gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)

What things could/should be removed, from the configuration, to avoid these kinds of things in the future?

Quoted 6 lines

I would expect that the default board configuration to be less sensitive, in general. I guess I want to know what is the right size for an OMAP3 with SPL enabled.

Changing compilers, just for this, can cause quite a ripple on projects and the products that are supported by them.

So, the first thing to do would be to please try the following patch:

arch/arm/include/asm/arch-omap3/omap.h +1 -1
index bc0e02a..6cef323 100644
@@ -145,7 +145,7 @@ struct gpio {
 
  #define NON_SECURE_SRAM_START		0x40208000 /* Works for GP & EMU */
  #define NON_SECURE_SRAM_END		0x40210000
-#define SRAM_SCRATCH_SPACE_ADDR		0x4020E000
+#define SRAM_SCRATCH_SPACE_ADDR		0x4020F000
 
  #define LOW_LEVEL_SRAM_STACK		0x4020FFFC
 
doc/SPL/README.omap3 +4 -2
index c77ca43..cc54afe 100644
@@ -33,8 +33,9 @@ SRAM: 0x40200000 - 0x4020FFFF
  DDR1: 0x80000000 - 0xBFFFFFFF
 
  Option 1 (SPL only):
-0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x40200800 - 0x4020EFFF: Area for SPL text, data and rodata
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
+0x4020FCB0 - 0x4020FFFF: Area for the SPL stack
  0x80000000 - 0x8007FFFF: Area for the SPL BSS.
  0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x80208000 - 0x80307FFF: malloc() pool available to SPL.
@@ -42,6 +43,7 @@ Option 1 (SPL only):
  Option 2 (SPL or X-Loader):
  0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
  0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
  0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x87000000 - 0x8707FFFF: Area for the SPL BSS.
  0x87080000 - 0x870FFFFF: malloc() pool available to SPL.
include/configs/omap3_logic.h +2 -4
index 6c79643..ed03e07 100644
@@ -28,13 +28,11 @@
  #define CONFIG_SYS_SPL_MALLOC_START	0x80208000
  #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
 
-#include <configs/ti_omap3_common.h>
 
  /* Override default SPL info to minimize empty space and allow BCH8 in SPL */
-#undef CONFIG_SPL_TEXT_BASE
-#undef CONFIG_SPL_MAX_SIZE
  #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
+
+#include <configs/ti_omap3_common.h>
 
  /* Display CPU and Board information */
 
include/configs/omap3_overo.h +1 -4
index fbd0c2a..289c8e9 100644
@@ -10,11 +10,8 @@
  #define CONFIG_NR_DRAM_BANKS	2	/* CS1 may or may not be populated */
  #define CONFIG_NAND
 
-#include <configs/ti_omap3_common.h>
-#undef CONFIG_SPL_MAX_SIZE
-#undef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE	0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR - CONFIG_SPL_TEXT_BASE)
+#include <configs/ti_omap3_common.h>
 
  #define CONFIG_BCH
 
include/configs/ti_omap3_common.h +10 -2
index 32877d1..ffd695f 100644
@@ -68,9 +68,17 @@
  /* TWL4030 */
  #define CONFIG_TWL4030_POWER
 
-/* SPL */
+/*
+ * For SPL we say that our text base is at 0x40200800 for compatibility
+ * with HS and GP devices.  We say that the maximum image size is the end
+ * of the downloaded image area minus the text base.  If desired the text
+ * base can be lowered by individual platforms but the upper bound is a
+ * hard limit.
+ */
+#ifndef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE		0x40200800
-#define CONFIG_SPL_MAX_SIZE		(54 * 1024)
+#endif
+#define CONFIG_SPL_MAX_SIZE		(0x4020F000 - CONFIG_SPL_TEXT_BASE)
  #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
  #define CONFIG_SPL_POWER_SUPPORT
  #define CONFIG_SYS_SPL_ARGS_ADDR	(CONFIG_SYS_SDRAM_BASE + \
include/configs/ti_omap4_common.h +1 -4
index 586d848..66592f0 100644
@@ -143,12 +143,14 @@
  	BOOTENV
 
  /*
- * Defines for SPL
- * It is known that this will break HS devices. Since the current size of
- * SPL is overlapped with public stack and breaking non HS devices to boot.
- * So moving TEXT_BASE down to non-HS limit.
+ * For SPL we set our text base to the start of the download image area for GP

include/configs/ti_omap4_common.h line 156

Quoted 10 lines
include/configs/ti_omap4_common.h +5 -0
+ * devices.  HS devices will have to define this value instead.  We say that
+ * the maximum image size is the end of the downloaded image area minus the
+ * text base.
   */
+#ifndef
  #define CONFIG_SPL_TEXT_BASE		0x40300000
+#endif
  #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)
  #define CONFIG_SPL_DISPLAY_PRINT
  #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"

Okay. That patch allows compilation to complete successfully. But ...

---8<-----------------------------------------------------

U-Boot SPL 2016.05-rc3-00012-gfccdb28-dirty (May 01 2016 - 11:50:16) Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

---8<-----------------------------------------------------

This is likely related to the "[U-Boot] spl_mmc: allow to load raw image" thread that is being discussed now.

My SD/MMC card is FAT on the first partition. The 'omap3_logic' board does not use RAW MMC access. So MLO and u-boot.img are simply files on the FAT filesystem.

Derald

Quoted 15 lines

As this will allow for boards to bring themselves to the maximum binary size for GP parts on OMAP3. It's too late in the release cycle and needs broad testing, but giving it a whirl on omap3_logic would be a good start. Next, are you also using falcon mode? FAT and EXT2/3/4 fs support?

Part of the problem is that the defaults bring in a lot of wide ranging support right now and we need to move things to Kconfig to make it easy to turn those things off. The various partition table types shouldn't be too hard to migrate and for moving all Kconfigs, I'm just going to do that since there can be a bit of churn that makes those patches hard to apply.

Thanks!

#7 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 180 lines · Derald D. Woods
Quoted 163 lines · Tom Rini
Quoted 13 lines · Derald D. Woods
Quoted 9 lines · Tom Rini

On Thu, Apr 28, 2016 at 05:55:17PM -0500, Adam Ford wrote:

I am hoping to look at this tomorrow at work. Any suggested toolchain

Quoted 3 lines

you
recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

Hi Tom,

Quoted 9 lines

Using gcc-5.3.0, for 'omap3_logic', I get the following:

---8<------------------------------------------ arm-cortexa8-linux-gnueabihf-ld.bfd: u-boot-spl section .data' will not fit in region .sram' arm-cortexa8-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 948 bytes
---8<------------------------------------------

That's odd, 5.3.1 from debian/unstable works.

I built the compiler today with crosstool-ng.

Quoted 6 lines

gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)

What things could/should be removed, from the configuration, to avoid these kinds of things in the future?

Quoted 7 lines

I would expect that the default board configuration to be less sensitive, in general. I guess I want to know what is the right size for an OMAP3 with SPL enabled.

Changing compilers, just for this, can cause quite a ripple on projects and the products that are supported by them.

So, the first thing to do would be to please try the following patch:

arch/arm/include/asm/arch-omap3/omap.h +0 -0
index bc0e02a..6cef323 100644
@@ -145,7 +145,7 @@ struct gpio {
    #define NON_SECURE_SRAM_START               0x40208000 /* Works for

GP & EMU */
#define NON_SECURE_SRAM_END 0x40210000

arch/arm/include/asm/arch-omap3/omap.h +1 -1
-#define SRAM_SCRATCH_SPACE_ADDR                0x4020E000
+#define SRAM_SCRATCH_SPACE_ADDR                0x4020F000
    #define LOW_LEVEL_SRAM_STACK                0x4020FFFC
  diff --git a/doc/SPL/README.omap3 b/doc/SPL/README.omap3

index c77ca43..cc54afe 100644

doc/SPL/README.omap3 +4 -2
@@ -33,8 +33,9 @@ SRAM: 0x40200000 - 0x4020FFFF
  DDR1: 0x80000000 - 0xBFFFFFFF
    Option 1 (SPL only):
-0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x40200800 - 0x4020EFFF: Area for SPL text, data and rodata
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
+0x4020FCB0 - 0x4020FFFF: Area for the SPL stack
  0x80000000 - 0x8007FFFF: Area for the SPL BSS.
  0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x80208000 - 0x80307FFF: malloc() pool available to SPL.
@@ -42,6 +43,7 @@ Option 1 (SPL only):
  Option 2 (SPL or X-Loader):
  0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
  0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
  0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x87000000 - 0x8707FFFF: Area for the SPL BSS.
  0x87080000 - 0x870FFFFF: malloc() pool available to SPL.
include/configs/omap3_logic.h +0 -0
index 6c79643..ed03e07 100644
@@ -28,13 +28,11 @@
  #define CONFIG_SYS_SPL_MALLOC_START   0x80208000
  #define CONFIG_SYS_SPL_MALLOC_SIZE    0x100000
  -#include <configs/ti_omap3_common.h>
    /* Override default SPL info to minimize empty space and allow BCH8

in SPL */

include/configs/omap3_logic.h +0 -3
-#undef CONFIG_SPL_TEXT_BASE
-#undef CONFIG_SPL_MAX_SIZE
  #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR -

CONFIG_SPL_TEXT_BASE)

include/configs/omap3_logic.h +2 -0
+
+#include <configs/ti_omap3_common.h>
    /* Display CPU and Board information */
  diff --git a/include/configs/omap3_overo.h

b/include/configs/omap3_overo.h
index fbd0c2a..289c8e9 100644

include/configs/omap3_overo.h +0 -0
@@ -10,11 +10,8 @@
  #define CONFIG_NR_DRAM_BANKS  2       /* CS1 may or may not be

populated */
#define CONFIG_NAND
-#include <configs/ti_omap3_common.h>

include/configs/omap3_overo.h +0 -3
-#undef CONFIG_SPL_MAX_SIZE
-#undef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE  0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR -

CONFIG_SPL_TEXT_BASE)
+#include <configs/ti_omap3_common.h>

    #define CONFIG_BCH

diff --git a/include/configs/ti_omap3_common.h
b/include/configs/ti_omap3_common.h
index 32877d1..ffd695f 100644

include/configs/ti_omap3_common.h +10 -1
@@ -68,9 +68,17 @@
  /* TWL4030 */
  #define CONFIG_TWL4030_POWER
  -/* SPL */
+/*
+ * For SPL we say that our text base is at 0x40200800 for compatibility
+ * with HS and GP devices.  We say that the maximum image size is the end
+ * of the downloaded image area minus the text base.  If desired the text
+ * base can be lowered by individual platforms but the upper bound is a
+ * hard limit.
+ */
+#ifndef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE          0x40200800
-#define CONFIG_SPL_MAX_SIZE            (54 * 1024)
+#endif
+#define CONFIG_SPL_MAX_SIZE            (0x4020F000 -
 CONFIG_SPL_TEXT_BASE)
  #define CONFIG_SPL_LDSCRIPT
 "$(CPUDIR)/omap-common/u-boot-spl.lds"
  #define CONFIG_SPL_POWER_SUPPORT
  #define CONFIG_SYS_SPL_ARGS_ADDR      (CONFIG_SYS_SDRAM_BASE + \
include/configs/ti_omap4_common.h +0 -3
index 586d848..66592f0 100644
@@ -143,12 +143,14 @@
        BOOTENV
    /*
- * Defines for SPL
- * It is known that this will break HS devices. Since the current size of
- * SPL is overlapped with public stack and breaking non HS devices to

boot.
- * So moving TEXT_BASE down to non-HS limit.
+ * For SPL we set our text base to the start of the download image area for GP
+ * devices. HS devices will have to define this value instead. We say that
+ * the maximum image size is the end of the downloaded image area minus the
+ * text base.
*/

include/configs/ti_omap4_common.h +2 -0
+#ifndef
  #define CONFIG_SPL_TEXT_BASE          0x40300000
+#endif
  #define CONFIG_SPL_MAX_SIZE           (0x4030C000 -
Quoted 4 lines

CONFIG_SPL_TEXT_BASE)
#define CONFIG_SPL_DISPLAY_PRINT
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"

Okay. That patch allows compilation to complete successfully. But ...

---8<-----------------------------------------------------

U-Boot SPL 2016.05-rc3-00012-gfccdb28-dirty (May 01 2016 - 11:50:16) Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

---8<-----------------------------------------------------

Quoted 10 lines

This is likely related to the "[U-Boot] spl_mmc: allow to load raw image" thread that is being discussed now.

My SD/MMC card is FAT on the first partition. The 'omap3_logic' board does not use RAW MMC access. So MLO and u-boot.img are simply files on the FAT filesystem.

Derald

Tom,

Is this patch landing in this release? I saw another patch, for the same purpose, on another board applied. Just wondering...

Derald

Quoted 18 lines

As this will allow for boards to bring themselves to the maximum binary

Quoted 15 lines

size for GP parts on OMAP3. It's too late in the release cycle and needs broad testing, but giving it a whirl on omap3_logic would be a good start. Next, are you also using falcon mode? FAT and EXT2/3/4 fs support?

Part of the problem is that the defaults bring in a lot of wide ranging support right now and we need to move things to Kconfig to make it easy to turn those things off. The various partition table types shouldn't be too hard to migrate and for moving all Kconfigs, I'm just going to do that since there can be a bit of churn that makes those patches hard to apply.

Thanks!

Signature · 1 line
Derald D. Woods
author
#8 lore raw

PATCH 1/1 omap3: Reduce logic/overo SPL max image size

Quoted 190 lines · Derald Woods
Quoted 187 lines · Derald D. Woods
Quoted 163 lines · Tom Rini
Quoted 13 lines · Derald D. Woods
Quoted 9 lines · Tom Rini

On Thu, Apr 28, 2016 at 05:55:17PM -0500, Adam Ford wrote:

I am hoping to look at this tomorrow at work. Any suggested toolchain

Quoted 3 lines

you
recommend?

gcc-4.9.x fails (too large), gcc-5.3.x succeeds, gcc-6.x is also likely fine but I haven't started using those SDKs I just made today.

Hi Tom,

Quoted 9 lines

Using gcc-5.3.0, for 'omap3_logic', I get the following:

---8<------------------------------------------ arm-cortexa8-linux-gnueabihf-ld.bfd: u-boot-spl section .data' will not fit in region .sram' arm-cortexa8-linux-gnueabihf-ld.bfd: region `.sram' overflowed by 948 bytes
---8<------------------------------------------

That's odd, 5.3.1 from debian/unstable works.

I built the compiler today with crosstool-ng.

Quoted 6 lines

gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)

What things could/should be removed, from the configuration, to avoid these kinds of things in the future?

Quoted 7 lines

I would expect that the default board configuration to be less sensitive, in general. I guess I want to know what is the right size for an OMAP3 with SPL enabled.

Changing compilers, just for this, can cause quite a ripple on projects and the products that are supported by them.

So, the first thing to do would be to please try the following patch:

arch/arm/include/asm/arch-omap3/omap.h +0 -0
index bc0e02a..6cef323 100644
@@ -145,7 +145,7 @@ struct gpio {
    #define NON_SECURE_SRAM_START               0x40208000 /* Works for

GP & EMU */
#define NON_SECURE_SRAM_END 0x40210000

arch/arm/include/asm/arch-omap3/omap.h +1 -1
-#define SRAM_SCRATCH_SPACE_ADDR                0x4020E000
+#define SRAM_SCRATCH_SPACE_ADDR                0x4020F000
    #define LOW_LEVEL_SRAM_STACK                0x4020FFFC
  diff --git a/doc/SPL/README.omap3 b/doc/SPL/README.omap3

index c77ca43..cc54afe 100644

doc/SPL/README.omap3 +4 -2
@@ -33,8 +33,9 @@ SRAM: 0x40200000 - 0x4020FFFF
  DDR1: 0x80000000 - 0xBFFFFFFF
    Option 1 (SPL only):
-0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
-0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x40200800 - 0x4020EFFF: Area for SPL text, data and rodata
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
+0x4020FCB0 - 0x4020FFFF: Area for the SPL stack
  0x80000000 - 0x8007FFFF: Area for the SPL BSS.
  0x80100000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x80208000 - 0x80307FFF: malloc() pool available to SPL.
@@ -42,6 +43,7 @@ Option 1 (SPL only):
  Option 2 (SPL or X-Loader):
  0x40200800 - 0x4020BBFF: Area for SPL text, data and rodata
  0x4020E000 - 0x4020FFFC: Area for the SPL stack.
+0x4020F000 - 0x4020FCAF: Area for scratch space (see OMAP_SRAM_SCRATCH*)
  0x80008000: CONFIG_SYS_TEXT_BASE of U-Boot
  0x87000000 - 0x8707FFFF: Area for the SPL BSS.
  0x87080000 - 0x870FFFFF: malloc() pool available to SPL.
include/configs/omap3_logic.h +0 -0
index 6c79643..ed03e07 100644
@@ -28,13 +28,11 @@
  #define CONFIG_SYS_SPL_MALLOC_START   0x80208000
  #define CONFIG_SYS_SPL_MALLOC_SIZE    0x100000
  -#include <configs/ti_omap3_common.h>
    /* Override default SPL info to minimize empty space and allow BCH8

in SPL */

include/configs/omap3_logic.h +0 -3
-#undef CONFIG_SPL_TEXT_BASE
-#undef CONFIG_SPL_MAX_SIZE
  #define CONFIG_SPL_TEXT_BASE   0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR -

CONFIG_SPL_TEXT_BASE)

include/configs/omap3_logic.h +2 -0
+
+#include <configs/ti_omap3_common.h>
    /* Display CPU and Board information */
  diff --git a/include/configs/omap3_overo.h

b/include/configs/omap3_overo.h
index fbd0c2a..289c8e9 100644

include/configs/omap3_overo.h +0 -0
@@ -10,11 +10,8 @@
  #define CONFIG_NR_DRAM_BANKS  2       /* CS1 may or may not be

populated */
#define CONFIG_NAND
-#include <configs/ti_omap3_common.h>

include/configs/omap3_overo.h +0 -3
-#undef CONFIG_SPL_MAX_SIZE
-#undef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE  0x40200000
-#define CONFIG_SPL_MAX_SIZE    (SRAM_SCRATCH_SPACE_ADDR -

CONFIG_SPL_TEXT_BASE)
+#include <configs/ti_omap3_common.h>

    #define CONFIG_BCH

diff --git a/include/configs/ti_omap3_common.h
b/include/configs/ti_omap3_common.h
index 32877d1..ffd695f 100644

include/configs/ti_omap3_common.h +10 -1
@@ -68,9 +68,17 @@
  /* TWL4030 */
  #define CONFIG_TWL4030_POWER
  -/* SPL */
+/*
+ * For SPL we say that our text base is at 0x40200800 for compatibility
+ * with HS and GP devices.  We say that the maximum image size is the end
+ * of the downloaded image area minus the text base.  If desired the text
+ * base can be lowered by individual platforms but the upper bound is a
+ * hard limit.
+ */
+#ifndef CONFIG_SPL_TEXT_BASE
  #define CONFIG_SPL_TEXT_BASE          0x40200800
-#define CONFIG_SPL_MAX_SIZE            (54 * 1024)
+#endif
+#define CONFIG_SPL_MAX_SIZE            (0x4020F000 -
 CONFIG_SPL_TEXT_BASE)
  #define CONFIG_SPL_LDSCRIPT
 "$(CPUDIR)/omap-common/u-boot-spl.lds"
  #define CONFIG_SPL_POWER_SUPPORT
  #define CONFIG_SYS_SPL_ARGS_ADDR      (CONFIG_SYS_SDRAM_BASE + \
include/configs/ti_omap4_common.h +0 -3
index 586d848..66592f0 100644
@@ -143,12 +143,14 @@
        BOOTENV
    /*
- * Defines for SPL
- * It is known that this will break HS devices. Since the current size of
- * SPL is overlapped with public stack and breaking non HS devices to

boot.
- * So moving TEXT_BASE down to non-HS limit.
+ * For SPL we set our text base to the start of the download image area for GP
+ * devices. HS devices will have to define this value instead. We say that
+ * the maximum image size is the end of the downloaded image area minus the
+ * text base.
*/

include/configs/ti_omap4_common.h +2 -0
+#ifndef
  #define CONFIG_SPL_TEXT_BASE          0x40300000
+#endif
  #define CONFIG_SPL_MAX_SIZE           (0x4030C000 -
Quoted 4 lines

CONFIG_SPL_TEXT_BASE)
#define CONFIG_SPL_DISPLAY_PRINT
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"

Okay. That patch allows compilation to complete successfully. But ...

---8<-----------------------------------------------------

U-Boot SPL 2016.05-rc3-00012-gfccdb28-dirty (May 01 2016 - 11:50:16) Trying to boot from MMC1
Expected Linux image is not found. Trying to start U-boot

---8<-----------------------------------------------------

This is likely related to the "[U-Boot] spl_mmc: allow to load raw image" thread that is being discussed now.

My SD/MMC card is FAT on the first partition. The 'omap3_logic' board does not use RAW MMC access. So MLO and u-boot.img are simply files on the FAT filesystem.

Quoted 8 lines
Quoted 3 lines

Derald

Tom,

Is this patch landing in this release? I saw another patch, for the same purpose, on another board applied. Just wondering...

No, this is too invasive as it changes the defaults for all OMAP3 platforms. The other platform is just making use of the changes you've already got on omap3_logic.

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/20160503/8721e0cd/attachment.sig>