[U-Boot] [PATCH v5 0/6] 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/82.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 Cc: Sandeep Paulraj Cc: Tom Rini 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
Hi Tom, On Tue, Dec 6, 2011 at 11:17 PM, Tom Rini wrote: > On Tue, Dec 6, 2011 at 10:34 AM, Tom Rini wrote: [...] >> 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(-) diff --git a/board/davinci/da8xxevm/u-boot-spl.lds b/board/davinci/da8xxevm/u-boot-spl.lds index 6f6e065..1ba0a59 100644 --- a/board/davinci/da8xxevm/u-boot-spl.lds +++ b/board/davinci/da8xxevm/u-boot-spl.lds @@ -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 -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
Hi again, On Wed, Dec 7, 2011 at 10:32 AM, Christian Riesch wrote: > Hi Tom, > > On Tue, Dec 6, 2011 at 11:17 PM, Tom Rini wrote: >> On Tue, Dec 6, 2011 at 10:34 AM, Tom Rini wrote: > [...] >>> 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. 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) / 100UL; 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 at 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(-) diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c index c7bf7a5..31f8633 100644 --- a/arch/arm/cpu/arm926ejs/davinci/timer.c +++ b/arch/arm/cpu/arm926ejs/davinci/timer.c @@ -40,6 +40,7 @@ #include #include #include +#include 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) / 100UL; + endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz, + 100UL); endtime += get_ticks(); while (get_ticks() < endtime) diff --git a/post/post.c b/post/post.c index 0e67ad7..745767a 100644 --- a/post/post.c +++ b/post/post.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #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" -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch wrote: > > 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! -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: > On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch > wrote: >> >> 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. -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
Hi Tom, On Tue, Dec 6, 2011 at 5:46 PM, Tom Rini wrote: > On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: >> On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch >> wrote: >>> >>> 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: 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 > 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@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On 12/06/2011 10:08 AM, Christian Riesch wrote: > Hi Tom, > > On Tue, Dec 6, 2011 at 5:46 PM, Tom Rini wrote: >> On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: >>> On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch >>> wrote: 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: > > 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) ? -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On Tue, Dec 6, 2011 at 6:14 PM, Tom Rini wrote: > On 12/06/2011 10:08 AM, Christian Riesch wrote: >> Hi Tom, >> >> On Tue, Dec 6, 2011 at 5:46 PM, Tom Rini wrote: >>> On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch wrote: > > 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: >> >> 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 : 0x8000 size 0x44ec $ Ok. This is the current ti master (commit f50dda60868a9deeb70d220867704dec06f5b7b4) plus my patchset. Regards, Christian ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On Tue, Dec 6, 2011 at 10:32 AM, Christian Riesch wrote: > On Tue, Dec 6, 2011 at 6:14 PM, Tom Rini wrote: >> On 12/06/2011 10:08 AM, Christian Riesch wrote: >>> Hi Tom, >>> >>> On Tue, Dec 6, 2011 at 5:46 PM, Tom Rini wrote: On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: > On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch > wrote: >> >> 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: >>> >>> 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 : 0x8000 size 0x44ec > $ > > Ok. > > This is the current ti master (commit > f50dda60868a9deeb70d220867704dec06f5b7b4) plus my patchset. OK, thanks, I'll chalk it up to my toolchain then. -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v5 0/6] Add an SPL to boot the da850evm from SPI
On Tue, Dec 6, 2011 at 10:34 AM, Tom Rini wrote: > On Tue, Dec 6, 2011 at 10:32 AM, Christian Riesch > wrote: >> On Tue, Dec 6, 2011 at 6:14 PM, Tom Rini wrote: >>> On 12/06/2011 10:08 AM, Christian Riesch wrote: Hi Tom, On Tue, Dec 6, 2011 at 5:46 PM, Tom Rini wrote: > On Mon, Dec 5, 2011 at 1:05 PM, Tom Rini wrote: >> On Mon, Dec 5, 2011 at 3:58 AM, Christian Riesch >> wrote: >>> >>> 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: 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 : 0x8000 size 0x44ec >> $ >> >> 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! -- Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot