[U-Boot-Users] [patch 0/3] KB9202 CodeSourcery ARM EABI toolchain build fixes

Hi,
I'm pretty new to u-boot and ARM stuff, so please review carefully.
I wanted to build u-boot-1.3.0-rc3 for the KwikByte KB9202 board with the current ARM toolchain from CodeSourcery. I needed the following three patches to get it to build.
The first one is probably a bugfix needed for other toolchains, too.
The other two patches are specific to the CodeSourcery toolchain (or probably to any EABI toolchain with gcc-4.2.x). I haven't checked if they break the build for other ARM toolchains, so it's probably better to not apply them unless someone else confirms they're OK.
Regards, Johannes

KB9202 compile fix
Problem observed with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
make -C cpu/arm920t start.o ... start.S: Assembler messages: start.S:205: Error: invalid constant (20200) after fixup start.S:378: Error: invalid constant (28200) after fixup start.S:379: Error: invalid constant (28200) after fixup start.S:384: Error: invalid constant (28200) after fixup start.S:385: Error: invalid constant (28200) after fixup start.S:390: Error: invalid constant (28200) after fixup start.S:391: Error: invalid constant (28200) after fixup start.S:396: Error: invalid constant (28200) after fixup start.S:397: Error: invalid constant (28200) after fixup start.S:402: Error: invalid constant (28200) after fixup start.S:403: Error: invalid constant (28200) after fixup start.S:427: Error: invalid constant (28200) after fixup start.S:428: Error: invalid constant (28200) after fixup start.S:433: Error: invalid constant (28200) after fixup start.S:434: Error: invalid constant (28200) after fixup
Signed-off-by: Johannes Stezenbach js@sig21.net
diff -r e53ef89e46dd -r 1f24112792e7 include/configs/kb9202.h --- a/include/configs/kb9202.h Fri Oct 19 18:22:38 2007 +0200 +++ b/include/configs/kb9202.h Fri Oct 19 18:34:12 2007 +0200 @@ -57,7 +57,7 @@ /* * Size of malloc() pool */ -#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_MALLOC_LEN (128*1024) #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
#define CONFIG_BAUDRATE 115200

In message 20071025161107.169028618@sig21.net you wrote:
KB9202 compile fix
Problem observed with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
...
--- a/include/configs/kb9202.h Fri Oct 19 18:22:38 2007 +0200 +++ b/include/configs/kb9202.h Fri Oct 19 18:34:12 2007 +0200 @@ -57,7 +57,7 @@ /*
- Size of malloc() pool
*/ -#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_MALLOC_LEN (128*1024) #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
This seems to be broken for me, especially for bigger environments.
NAK.
Best regards,
Wolfgang Denk

On Sat, Nov 03, 2007 at 10:27:07PM +0100, Wolfgang Denk wrote:
In message 20071025161107.169028618@sig21.net you wrote:
KB9202 compile fix
Problem observed with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
...
--- a/include/configs/kb9202.h Fri Oct 19 18:22:38 2007 +0200 +++ b/include/configs/kb9202.h Fri Oct 19 18:34:12 2007 +0200 @@ -57,7 +57,7 @@ /*
- Size of malloc() pool
*/ -#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) +#define CFG_MALLOC_LEN (128*1024) #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
This seems to be broken for me, especially for bigger environments.
NAK.
I would've hoped for a better suggestion. Currently I don't know if the problem is caused by a binutils issue with the CodeSourcery toolchain, or if kb9202 is broken with any toolchain.
Anyway, what I did was to grep for CFG_MALLOC_LEN and the majority of the other configs don't add CFG_ENV_SIZE here.
Thanks, Johannes

KB9202 EABI build with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
Signed-off-by: Johannes Stezenbach js@sig21.net
diff -r 1f24112792e7 -r aeff4cd3d1be cpu/arm920t/config.mk --- a/cpu/arm920t/config.mk Fri Oct 19 18:34:12 2007 +0200 +++ b/cpu/arm920t/config.mk Fri Oct 19 18:35:39 2007 +0200 @@ -24,11 +24,10 @@ PLATFORM_RELFLAGS += -fno-strict-aliasin PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ -msoft-float
-PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= # # Supply options according to compiler version # # ========================================================================= -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))

In message 20071025161107.465063527@sig21.net you wrote:
KB9202 EABI build with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
Signed-off-by: Johannes Stezenbach js@sig21.net
diff -r 1f24112792e7 -r aeff4cd3d1be cpu/arm920t/config.mk --- a/cpu/arm920t/config.mk Fri Oct 19 18:34:12 2007 +0200 +++ b/cpu/arm920t/config.mk Fri Oct 19 18:35:39 2007 +0200 @@ -24,11 +24,10 @@ PLATFORM_RELFLAGS += -fno-strict-aliasin PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ -msoft-float
-PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= # # Supply options according to compiler version # # ========================================================================= -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
Did you test this modification with other tool chains? Which ones? Which compiler / binutils versions?
Best regards,
Wolfgang Denk

On Sat, Nov 03, 2007, Wolfgang Denk wrote:
In message 20071025161107.465063527@sig21.net you wrote:
KB9202 EABI build with CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
Signed-off-by: Johannes Stezenbach js@sig21.net
diff -r 1f24112792e7 -r aeff4cd3d1be cpu/arm920t/config.mk --- a/cpu/arm920t/config.mk Fri Oct 19 18:34:12 2007 +0200 +++ b/cpu/arm920t/config.mk Fri Oct 19 18:35:39 2007 +0200 @@ -24,11 +24,10 @@ PLATFORM_RELFLAGS += -fno-strict-aliasin PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \ -msoft-float
-PLATFORM_CPPFLAGS += -march=armv4 +PLATFORM_CPPFLAGS += -march=armv4t # ========================================================================= # # Supply options according to compiler version # # ========================================================================= -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
Did you test this modification with other tool chains? Which ones? Which compiler / binutils versions?
No, I only tested with the toolchain ARM Ltd. recommends, and the patch was originally created against the U-Boot version with ARM offers for download (but tested against 1.3.0-rc3). http://www.arm.com/products/os/linux.html http://www.arm.com/linux/U-Boot-src.tar.gz
The arm-2007q3-51 toolchain has: * binutils-2.18.50.20070820 * gcc-4.2.1 * glibc-2.5 * gdb-6.6.50.20070821-cvs
Maybe the ARM custodian can comment.
Thanks, Johannes

-----Original Message----- From: u-boot-users-bounces@lists.sourceforge.net [mailto:u-boot-users-bounces@lists.sourceforge.net] On Behalf Of Johannes Stezenbach Sent: 03 November 2007 22:21 To: Wolfgang Denk Cc: u-boot-users@lists.sourceforge.net Subject: Re: [U-Boot-Users] [patch 2/3] KB9202 EABI build withCodeSourcery EABI toolchain
Maybe the ARM custodian can comment.
Given that U-Boot is a standalone binary, I am content that the U-Boot main tree should build with current version of the ELDK - individual users may then port locally to their preferred toolchains as required/desired.
This avoids the combinatorial explosion of testing with multiple toolchains.
Not that this should stop users submitting their local toolchain patches to the list and/or discussing the use of other toolchains.
Thanks, Johannes

On Mon, Nov 05, 2007, Peter Pearse wrote:
-----Original Message-----
Maybe the ARM custodian can comment.
Given that U-Boot is a standalone binary, I am content that the U-Boot main tree should build with current version of the ELDK
- individual users may then port locally to their preferred toolchains
as required/desired.
Fair enough.
This avoids the combinatorial explosion of testing with multiple toolchains.
Not that this should stop users submitting their local toolchain patches to the list and/or discussing the use of other toolchains.
Maintaining a second toolchain installation is more work than to create a few build fix patches. And I'm happy to share them even if they can't be merged.
Thanks, Johannes

In message 20071105103712.GB30679@sig21.net you wrote:
Given that U-Boot is a standalone binary, I am content that the U-Boot main tree should build with current version of the ELDK
- individual users may then port locally to their preferred toolchains
as required/desired.
Fair enough.
Actually I'd like to keep incompatibilities between ELDK and other toolchains as small as possible; ideally, U-Boot should build with any tool chain the end user decides to use. So the important thing is to isolate such incompatibilities, understand why they happen and then implement measures to deal with them - if they cannot be avoided one way or another.
Maintaining a second toolchain installation is more work than to create a few build fix patches. And I'm happy to share them even if they can't be merged.
It is essential that such changes are (1) verified to build with all board at least in this architecture, and (2) we receive confirmations from test users fromn this and from other tool chains.
If a change helps one specific toolchain without braking any already working ones it will go in easily.
Best regards,
Wolfgang Denk

KB9202 build fix for CodeSourcery EABI toolchain (arm-2007q3-51-arm-none-linux-gnueabi)
libgcc on arm-linux calls raise() in division-by-zero handler, to be provided by system library http://gcc.gnu.org/viewcvs?view=rev&revision=107018
Signed-off-by: Johannes Stezenbach js@sig21.net
diff -r aeff4cd3d1be -r 27c7db5e53df Makefile --- a/Makefile Fri Oct 19 18:35:39 2007 +0200 +++ b/Makefile Fri Oct 19 18:43:49 2007 +0200 @@ -286,7 +286,7 @@ all: $(ALL) $(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT) UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*(__u_boot_cmd_.*)/-u\1/p'|sort|uniq`;\ cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \ - --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ + --start-group $(__LIBS) $(PLATFORM_LIBS) --end-group \ -Map u-boot.map -o u-boot
$(OBJS): diff -r aeff4cd3d1be -r 27c7db5e53df common/Makefile --- a/common/Makefile Fri Oct 19 18:35:39 2007 +0200 +++ b/common/Makefile Fri Oct 19 18:43:49 2007 +0200 @@ -51,7 +51,7 @@ COBJS = main.o ACEX1K.o altera.o bedbug. memsize.o miiphybb.o miiphyutil.o \ s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \ usb.o usb_kbd.o usb_storage.o \ - virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o cmd_mfsl.o + virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o cmd_mfsl.o raise.o
SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) diff -r aeff4cd3d1be -r 27c7db5e53df common/raise.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/raise.c Fri Oct 19 18:43:49 2007 +0200 @@ -0,0 +1,6 @@ +#include "common.h" + +void raise(void) +{ + panic("raise() called"); +}

-----Original Message----- From: u-boot-users-bounces@lists.sourceforge.net [mailto:u-boot-users-bounces@lists.sourceforge.net] On Behalf Of Johannes Stezenbach Sent: 25 October 2007 17:11 To: u-boot-users@lists.sourceforge.net Subject: [U-Boot-Users] [patch 0/3] KB9202 CodeSourcery ARM EABI toolchainbuild fixes
Hi,
I'm pretty new to u-boot and ARM stuff, so please review carefully.
I'll use my careful review as the reason this reply is so late ;-)
I wanted to build u-boot-1.3.0-rc3 for the KwikByte KB9202 board with the current ARM toolchain from CodeSourcery. I needed the following three patches to get it to build.
The first one is probably a bugfix needed for other toolchains, too.
Thanks for this - it has alerted me to the use of sub rx, rx, #CONSTANT in several of the ARM .S assembler files. Whilst sub rx, rx, #CONSTANT saves code size it does demand that users understand their constants, what they are for and where they are used. For ARM #CONSTANT in this context must be capable of being formed by rotating an 8 bit constant in a 32 bit register e.g. 0x22000 is allowed whereas 0x20200 is not.
I am going to reject your patch though. It is the code that should be changed. I have added an action to my list of required patches http://www.denx.de/wiki/UBoot/PatchStatus to examine the use of constants in the ARM assembler code.
The other two patches are specific to the CodeSourcery toolchain (or probably to any EABI toolchain with gcc-4.2.x). I haven't checked if they break the build for other ARM toolchains, so it's probably better to not apply them unless someone else confirms they're OK.
Thanks for submitting these - they will be of use/interest to users building EABI code.
However I do not propose to submit them to the main tree since they are toolchain specific. The standard toolchain for building U-Boot is that supplied in the ELDK http://www.denx.de/wiki/DULG/ELDK. Of course many users have reasons for using others, however to support all possible toolchains would result in a support nightmare.....
Sorry for the delayed response
Regards
Peter

On Wed, Jan 23, 2008, Peter Pearse wrote:
-----Original Message----- From: u-boot-users-bounces@lists.sourceforge.net [mailto:u-boot-users-bounces@lists.sourceforge.net] On Behalf Of Johannes Stezenbach Sent: 25 October 2007 17:11
I wanted to build u-boot-1.3.0-rc3 for the KwikByte KB9202 board with the current ARM toolchain from CodeSourcery. I needed the following three patches to get it to build.
The first one is probably a bugfix needed for other toolchains, too.
Thanks for this - it has alerted me to the use of sub rx, rx, #CONSTANT in several of the ARM .S assembler files. Whilst sub rx, rx, #CONSTANT saves code size it does demand that users understand their constants, what they are for and where they are used. For ARM #CONSTANT in this context must be capable of being formed by rotating an 8 bit constant in a 32 bit register e.g. 0x22000 is allowed whereas 0x20200 is not.
I am going to reject your patch though. It is the code that should be changed. I have added an action to my list of required patches http://www.denx.de/wiki/UBoot/PatchStatus to examine the use of constants in the ARM assembler code.
The simple patch below at least circumvents the problem and allows u-boot to build for the kb9202. Please consider applying this one. It is not toolchain specific.
The other two patches are specific to the CodeSourcery toolchain (or probably to any EABI toolchain with gcc-4.2.x). I haven't checked if they break the build for other ARM toolchains, so it's probably better to not apply them unless someone else confirms they're OK.
Thanks for submitting these - they will be of use/interest to users building EABI code.
However I do not propose to submit them to the main tree since they are toolchain specific. The standard toolchain for building U-Boot is that supplied in the ELDK http://www.denx.de/wiki/DULG/ELDK. Of course many users have reasons for using others, however to support all possible toolchains would result in a support nightmare.....
The patch propsed in
[U-Boot-Users] [patch u-boot git 2/3] better ARM9 compiler options From: David Brownell <david-b@pa...> - 2008-01-18 20:55 http://sourceforge.net/mailarchive/forum.php?thread_name=200801181250.50303....
would take care of the CodeSourcery build issues, too. It should work with any toolchain.
--- KB9202 compile fix
make -C cpu/arm920t start.o ... start.S: Assembler messages: start.S:205: Error: invalid constant (20200) after fixup etc.
The environment size is the same as in the kb9202 patch available from www.kwikbyte.com.
Signed-off-by: Johannes Stezenbach js@sig21.net
diff --git a/include/configs/kb9202.h b/include/configs/kb9202.h index 75d9c3b..88e8737 100644 --- a/include/configs/kb9202.h +++ b/include/configs/kb9202.h @@ -128,8 +128,8 @@ #define CFG_ENV_IS_IN_EEPROM
#ifdef CONFIG_KB9202 -#define CFG_ENV_OFFSET 0x3E00 -#define CFG_ENV_SIZE 0x0200 +#define CFG_ENV_OFFSET 0x2000 +#define CFG_ENV_SIZE 0x2000 #else #define CFG_ENV_OFFSET 0x1000 #define CFG_ENV_SIZE 0x1000
Thanks, Johannes
participants (3)
-
Johannes Stezenbach
-
Peter Pearse
-
Wolfgang Denk