EmcraftSystems / u-boot

U-Boot for Cortex-M3 and Cortex-M4
http://www.emcraft.com
Other
182 stars 149 forks source link

u-boot.lds syntax error for the cortex-m3 #1

Closed thuoeg closed 12 years ago

thuoeg commented 12 years ago

Hi,I'm building u-boot for the actel a2f500 dev brd, and I get the following error: arm-none-eabi-gcc -E -g -Os -g2 -mthumb -mcpu=cortex-m3 -fsigned-char -O2 -fno-builtin-puts -fno-common -ffixed-r8 -DKERNEL -I/home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include -fno-builtin -ffreestanding -isystem /home/mzee/kernel/actel/toolchains/arm-2011.09/bin/../lib/gcc/arm-none-eabi/4.6.1/include -pipe -DCONFIG_ARM -DARM -DCONFIG_MEM_NVM_BASE= -DCONFIG_MEM_NVM_LEN= -DCONFIG_MEM_RAM_BASE= -DCONFIG_MEM_RAM_LEN= -DCONFIG_MEM_RAM_BUF_LEN= -DCONFIG_MEM_MALLOC_LEN= -DCONFIG_MEM_STACK_LEN= -I/home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/cpu/arm_cortexm3 -include /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/u-boot/u-boot.lds.h -ansi -DASSEMBLY -P - </home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/cpu/arm_cortexm3/u-boot.lds >u-boot.lds UNDEF_SYM=arm-none-eabi-objdump -x board/actel/a2f-actel-dev-brd/liba2f-actel-dev-brd.a lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/arm_cortexm3/libarm_cortexm3.a cpu/arm_cortexm3/a2f/liba2f.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a | sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq; cd /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1 && arm-none-eabi-ld -Bstatic -T u-boot.lds $UNDEF_SYM cpu/arm_cortexm3/start.o --start-group lib_generic/libgeneric.a lib_generic/lzma/liblzma.a lib_generic/lzo/liblzo.a cpu/arm_cortexm3/libarm_cortexm3.a cpu/arm_cortexm3/a2f/liba2f.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a fs/ubifs/libubifs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/fpga/libfpga.a drivers/gpio/libgpio.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/onenand/libonenand.a drivers/mtd/ubi/libubi.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/phy/libphy.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/power/libpower.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/twserial/libtws.a drivers/usb/gadget/libusb_gadget.a drivers/usb/host/libusb_host.a drivers/usb/musb/libusb_musb.a drivers/usb/phy/libusb_phy.a drivers/video/libvideo.a drivers/watchdog/libwatchdog.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a board/actel/a2f-actel-dev-brd/liba2f-actel-dev-brd.a --end-group -L /home/mzee/kernel/actel/toolchains/arm-2011.09/bin/../lib/gcc/arm-none-eabi/4.6.1/thumb2 -lgcc -Map u-boot.map -o u-boot arm-none-eabi-ld:u-boot.lds:7: syntax error make: *\ [u-boot] Error 1

What could be the source Please help Thanks

sposelenov-emcraft commented 12 years ago

Hi, What toolchain your are using? I've just tried CodeSourcery arm2010q1 arm-none-eabi and it builds fine.

BTW - "official" way to build U-Boot is with arm-uclinuxeabi toolchain. For U-Boot it doesn't matter, though.

Regards, Sergei

thuoeg commented 12 years ago

Hi, I've try with "(Sourcery G++ Lite 2011.03-46) arm-uclinuxeabi" and with arm-2011-09. The problem is at line 7 of the generated u-boot.lds at the MEMORY section as shown:

OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) MEMORY { NVM (r): ORIGIN = , LENGTH = <-------- this is line 7 RAM (rw): ORIGIN = , LENGTH = RAM_BUF (r): ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = MALLOC (r): ORIGIN = ORIGIN(RAM_BUF) + LENGTH(RAM_BUF), LENGTH = STACK (r): ORIGIN = ORIGIN(MALLOC) + LENGTH(MALLOC), LENGTH = }

I think this is the line generating the u-boot.lds file:

arm-uclinuxeabi-gcc -E -g -Os -g2 -mthumb -mcpu=cortex-m3 -fsigned-char -O2 -fno-builtin-puts -fno-common -ffixed-r8 -DKERNEL -I/home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include -fno-builtin -ffreestanding -isystem /home/mzee/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-uclinuxeabi/4.5.2/include -pipe -DCONFIG_ARM -DARM -DCONFIG_MEM_NVM_BASE= -DCONFIG_MEM_NVM_LEN= -DCONFIG_MEM_RAM_BASE= -DCONFIG_MEM_RAM_LEN= -DCONFIG_MEM_RAM_BUF_LEN= -DCONFIG_MEM_MALLOC_LEN= -DCONFIG_MEM_STACK_LEN= -I/home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/cpu/arm_cortexm3 -include /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/u-boot/u-boot.lds.h -ansi -DASSEMBLY -P - </home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/cpu/arm_cortexm3/u-boot.lds >u-boot.lds

Thanks

sposelenov-emcraft commented 12 years ago

Hi,

The reason of the failure is that the respective #define-s are not defined in the board's config file, see in your snippet above: ... DCONFIGMEM_NVM_BASE= -DCONFIG_MEM_NVM_LEN= -DCONFIG_MEM_RAM_BASE= -DCONFIG_MEM_RAM_LEN= -DCONFIG_MEM_RAM_BUF_LEN= -DCONFIG_MEM_MALLOC_LEN= .. What u-boot configuration are you using for the Actel A2F500 board? You should use "make a2f-actel-dev-brd_config" before running "make".

Regards, Sergei

thuoeg commented 12 years ago

Hi, I did manage to have a successful build after I switch to a different OS which was Debian Squeeze. The OS I was using that was causing the above error was Linux Mint 10,I was getting the following command line warning that i think resulted to the error:

/home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:95:0: warning: "CONFIG_MEM_NVM_BASE" redefined [enabled by default]

:0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:96:0: warning: "CONFIG_MEM_NVM_LEN" redefined [enabled by default] :0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:98:0: warning: "CONFIG_MEM_RAM_BASE" redefined [enabled by default] :0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:99:0: warning: "CONFIG_MEM_RAM_LEN" redefined [enabled by default] :0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:100:0: warning: "CONFIG_MEM_RAM_BUF_LEN" redefined [enabled by default] :0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:101:0: warning: "CONFIG_MEM_MALLOC_LEN" redefined [enabled by default] :0:0: note: this is the location of the previous definition /home/mzee/kernel/uboot/EmcraftSystems-u-boot-3f592e1/include/configs/a2f-actel-dev-brd.h:102:0: warning: "CONFIG_MEM_STACK_LEN" redefined [enabled by default] :0:0: note: this is the location of the previous definition But in Debian these warning were not there.I do not know the reason,But I'll Continue using Debian. Thanks
tijsmaas commented 11 years ago

I suffer from this bug too.

I am using the (up-to-date) Open Embedded toolchain on debian wheezy to compile u-boot. I also configured before making.

u-boot.lds:9: nonconstant expression for origin This is how the top of my u-boot.lds looks:

OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) MEMORY { NVM (r): ORIGIN = (0x00000000 + 0x0), LENGTH = ((96 * 1024) - 0x0) RAM (rw): ORIGIN = 0x20000000, LENGTH = (32 * 1024) RAM_BUF (r): ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = (1 * 1024) MALLOC (r): ORIGIN = ORIGIN(RAM_BUF) + LENGTH(RAM_BUF), LENGTH = (27 * 1024) STACK (r): ORIGIN = ORIGIN(MALLOC) + LENGTH(MALLOC), LENGTH = (4 * 1024) }

I tried compilation of several boards, also with a different toolchains, but I get the same result. I wonder if this bug is related to the older u-boot version you are using.

sposelenov-emcraft commented 11 years ago

Hello,

We are aware of this issue. Since we are using the older CodeSourcery toolchain, the current linker script works for us.

Unless we switch to the newer toolchain we have no plans to fix this issue.

Consider to compare the linker script with the one from the current U-Boot from denx.de, for the similar target board. Much probably is a minor syntax change required to get it working.

Regards, Sergei Poselenov, Emcraft Systems

On Wed, 02 Oct 2013 02:20:16 -0700 tijs14tijs notifications@github.com wrote:

I suffer from this bug too.

I am using the (up-to-date) Open Embedded toolchain on debian wheezy to compile u-boot. I also configured before making.

u-boot.lds:9: nonconstant expression for origin This is how the top of my u-boot.lds looks:

OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) MEMORY { NVM (r): ORIGIN = (0x00000000 + 0x0), LENGTH = ((96 * 1024) - 0x0) RAM (rw): ORIGIN = 0x20000000, LENGTH = (32 * 1024) RAM_BUF (r): ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = (1 * 1024) MALLOC (r): ORIGIN = ORIGIN(RAM_BUF) + LENGTH(RAM_BUF), LENGTH = (27

  • 1024) STACK (r): ORIGIN = ORIGIN(MALLOC) + LENGTH(MALLOC), LENGTH = (4 * 1024) }

I tried compilation of several boards, also with a different toolchains, but I get the same result. I wonder if this bug is related to the older u-boot version you are using.


Reply to this email directly or view it on GitHub: https://github.com/EmcraftSystems/u-boot/issues/1#issuecomment-25524857

blueskycoco commented 9 years ago

MEMORY { NVM (r): ORIGIN = NVM_BASE, \ LENGTH = NVM_LEN RAM (rw): ORIGIN = CONFIG_MEM_RAM_BASE, \ LENGTH = CONFIG_MEM_RAM_LEN RAM_BUF (r): ORIGIN = CONFIG_MEM_RAM_BASE + CONFIG_MEM_RAM_LEN, \ LENGTH = CONFIG_MEM_RAM_BUF_LEN MALLOC (r): ORIGIN = CONFIG_MEM_RAM_BASE + CONFIG_MEM_RAM_LEN + CONFIG_MEM_RAM_BUF_LEN, \ LENGTH = CONFIG_MEM_MALLOC_LEN STACK (r): ORIGIN = CONFIG_MEM_RAM_BASE + CONFIG_MEM_RAM_LEN + CONFIG_MEM_RAM_BUF_LEN + CONFIG_MEM_MALLOC_LEN, \ LENGTH = CONFIG_MEM_STACK_LEN

if defined(CONFIG_MEM_RAMCODE_BASE) && defined(CONFIG_MEM_RAMCODE_LEN)

    RAMCODE (rw):   ORIGIN = CONFIG_MEM_RAMCODE_BASE, \
                    LENGTH = CONFIG_MEM_RAMCODE_LEN

endif

}

this is ok for link

tijsmaas commented 9 years ago

Yes of course, in the origin I add up 0x00000000 + 0x0, but I should have added up constants with these values instead. Thanks for posting the solution blueskycoco.