Forum Discussion
Altera_Forum
Honored Contributor
20 years agoU-BOOT !!!!!!!!!!!!
Hi http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wacko.gif ,
that u-boot is really driving me crazy. This is what I've done: 1- Compiled u-boot (got the .bin and the .srec) 2- Used flash programmer to program the .bin in flash (user zone) 3- Used quartus programmer to program standard.sof 4- Followed those instructions in the Using.txt But everytime I launch the nios2-console I get an error messageCommunication port must be specified.
Use openport <port> to configure the communication port. And I'm totally lost within that, It's by God bless that I succeded to write this topic Please rescue me52 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by mfm@May 11 2006, 08:46 AM hi scott<div class='quotetop'>quote
--- quote end ---
--- quote start ---
> question: why is my board info printed twice with one bdinfo ?
your terminal software is probably configured to send line feeds. just turn them off. --- Quote End --- You 're absolutely right http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif <div class='quotetop'>QUOTE </div> --- Quote Start --- > I used mkimage to convert the > /home/MFM/linux-2.6.x/arch/nios2nommu/boot/compressed/vmlinux.bin > generated using hippo's buildroot Just to be sure ... is that the _uncompressed_ binary image? I currently don't use buildroot ... and I haven't looked buildroot through the build scripts/makefiles yet.[/b] --- Quote End --- I think so (1.9 MB), the compressed image is the zImage file (1 MB). <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15267)</div> [/b] --- Quote End --- The uncompressed kernel is ~/linux-2.6.x/vmlinux .
- Altera_Forum
Honored Contributor
<div class='quotetop'>QUOTE </div>
--- Quote Start --- The uncompressed kernel is ~/linux-2.6.x/vmlinux .[/b] --- Quote End --- That's a 12.8 MB file, 5.7 MB when gziped http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by mfm@May 11 2006, 09:26 AM <div class='quotetop'>quote--- quote end ---
--- quote start ---
the uncompressed kernel is ~/linux-2.6.x/vmlinux . --- Quote End --- That's a 12.8 MB file, 5.7 MB when gziped http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15269)</div> [/b] --- Quote End --- vmlinux and zImage are elf. maybe you should convert them to binary with "nios2-linux-uclibc-objcopy -O binary" . then use the binary for mkimage for u-boot.
- Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by hippo+may 11 2006, 03:53 am--><div class='quotetop'>quote (hippo @ may 11 2006, 03:53 am)</div>--- quote start ---
<!--quotebegin-mfm@May 11 2006, 09:26 AM <div class='quotetop'>quote
--- quote end ---
--- quote start ---
the uncompressed kernel is ~/linux-2.6.x/vmlinux . --- Quote End --- That's a 12.8 MB file, 5.7 MB when gziped http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/huh.gif <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15269)</div> [/b] --- Quote End --- vmlinux and zImage are elf. maybe you should convert them to binary with "nios2-linux-uclibc-objcopy -O binary" . then use the binary for mkimage for u-boot. <div align='right'><{post_snapback}> (index.php?act=findpost&pid=15270)</div> [/b] --- Quote End --- What about the home/MFM/linux-2.6.x/arch/nios2nommu/boot/compressed/vmlinux.bin file, isn't a binary file made from that vmlinux elf.
- Altera_Forum
Honored Contributor
TO_BE_DONE
- Altera_Forum
Honored Contributor
> > What about the
> > home/MFM/linux-2.6.x/arch/nios2nommu/boot/compressed/vmlinux.bin file, > > isn't a binary file made from that vmlinux elf. > yes, it is. ??? This is why I always like to review the scripts/makefiles ;-) Time to go back to the basics ... 1. Please post an objdump of the elf headers. E.g.: $ nios2-elf-objdump -h vmlinux 2. Confirm that the elf image can be loaded and successfully run using nios2-download. 3. Use the elf image to create a binary (nios2-elf-objcopy -O binary). Load the binary (via nios2-console) to the load address, set the pc to the load address, then resume execution -- confirm operation. 4. Make the u-boot image with the binary (uncompressed) -- confirm operation. 5. Compress the binary, and make the u-boot image (compressed) -- confirm operation. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott,
First of all, thanks for your interest and help http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif And... here we go <div class='quotetop'>QUOTE </div> --- Quote Start --- 1. Please post an objdump of the elf headers. E.g.: $ nios2-elf-objdump -h vmlinux[/b] --- Quote End ---
BTW, could you please explain those lines. <div class='quotetop'>QUOTE </div> --- Quote Start --- 2. Confirm that the elf image can be loaded and successfully run using nios2-download.[/b] --- Quote End ---$ nios2-elf-objdump -h vmlinux vmlinux: file format elf32-littlenios2 Sections: Idx Name Size VMA LMA File off Algn 0 .text 000026c0 01800000 01800000 00000094 2**9 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .rodata 0000038a 018026c0 018026c0 00002754 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .data 00104a63 01802a4c 01802a4c 00002ade 2**0 CONTENTS, ALLOC, LOAD, DATA 3 .got 00000000 019074b0 019074b0 00107541 2**0 CONTENTS 4 .bss 00008434 019074b0 019074b0 00107541 2**2 ALLOC 5 .debug_abbrev 000002d4 0190f8e4 0190f8e4 00107541 2**0 CONTENTS, READONLY, DEBUGGING 6 .debug_info 0000122e 0190fbb8 0190fbb8 00107815 2**0 CONTENTS, READONLY, DEBUGGING 7 .debug_line 00001823 01910de6 01910de6 00108a43 2**0 CONTENTS, READONLY, DEBUGGING 8 .debug_frame 0000018c 0191260c 0191260c 0010a268 2**2 CONTENTS, READONLY, DEBUGGING 9 .debug_pubnames 0000003e 01912798 01912798 0010a3f4 2**0 CONTENTS, READONLY, DEBUGGING 10 .debug_aranges 00000020 019127d6 019127d6 0010a432 2**0 CONTENTS, READONLY, DEBUGGING 11 .debug_ranges 000005b0 019127f6 019127f6 0010a452 2**0 CONTENTS, READONLY, DEBUGGING 12 .debug_str 00000297 01912da6 01912da6 0010aa02 2**0 CONTENTS, READONLY, DEBUGGING 13 .comment 00000012 0191303d 0191303d 0010ac99 2**0 CONTENTS, READONLY /cygdrive/g/Linux $$ nios2-download -g vmlinux Using cable "ByteBlasterMV ", device 1, instance 0x00 Pausing target processor: OK Downloaded 1054KB in 27.2s (38.7KB/s) Verified OK Starting processor at address 0x01800000 /cygdrive/g/Linux $
That's the first time I see µClinux booting on Linux http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif Rq: the line eth0: SMC91C11xFD(rev:1) at 0x82110300 IRQ:6 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07:ed:ff:16:c9 That's not my MAC adress !!!!!!!==> Uncompressing Linux... Ok, booting the kernel. Linux version 2.6.11-uc0 (MFM@FC5) (gcc version 3.4.6)# 3 Sun May 7 01 T 2006 uClinux/Nios II Altera Nios II support (C) 2004 Microtronix Datacom Ltd. Built 1 zonelists Kernel command line: PID hash table entries: 128 (order: 7, 2048 bytes) Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory available: 14148k/16384k RAM, 0k/0k ROM (1470k kernel code, 573k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) NET: Registered protocol family 16 NTFS driver 2.1.22 . JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc. NIOS serial driver version 0.0 ttyS0 (irq = 4) is a builtin NIOS UART io scheduler noop registered io scheduler deadline registered smc_probe: 50000 Khz Nios SMSC LAN91C111 Driver (v2.1), (Linux Kernel 2.6) eth0: SMC91C11xFD(rev:1) at 0x82110300 IRQ:6 MEMSIZE:8192b NOWAIT:0 ADDR: 00:07:ed:ff:16:c9 smc_probe: 50000 Khz Nios Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx CF: ctl=0 Freeing unused kernel memory: 428k freed (0x117e000 - 0x11e8000) init started: BusyBox v1.2.0-pre0 (2006.05.06-17:19+0000) multi-call binary BusyBox v1.2.0-pre0 (2006.05.06-17:19+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands.#
<div class='quotetop'>QUOTE </div> --- Quote Start --- 3. Use the elf image to create a binary (nios2-elf-objcopy -O binary). Load the binary (via nios2-console) to the load address, set the pc to the load address, then resume execution -- confirm operation.[/b] --- Quote End ---==> bd mem start = 0x01000000 mem size = 0x01000000 flash start = 0x00000000 flash size = 0x00800000 flash offset= 0x00000000 sram start = 0x02000000 sram size = 0x00100000 ethaddr = 08:00:3E:26:0A:5B ip_addr = 192.168.0.62 baudrate = 115200 bps ==>
And nothing happened http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ohmy.gif <div class='quotetop'>QUOTE </div> --- Quote Start --- 4. Make the u-boot image with the binary (uncompressed) -- confirm operation.[/b] --- Quote End ---1> halt Processor is already stopped. 2> load bin 1500000 vmlinux.bin 1078447 3> pc 1500000 0x0016E360 4> go Emulation started. 5>$ ./mkimage -d vmlinux.bin -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01000000 -e 01000000 vmlinux.img Image Name: Welcome to uClinux with MFM Created: Fri May 12 02:17:25 2006 Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1078447 Bytes = 1053.17 kB = 1.03 MB Load Address: 0x01000000 Entry Point: 0x01000000 /cygdrive/d/u-boot-src/u-boot/mkimage $
<div class='quotetop'>QUOTE </div> --- Quote Start --- 5. Compress the binary, and make the u-boot image (compressed) -- confirm operation.[/b] --- Quote End ---U-Boot 1.1.3 (May 5 2006 - 00:38:14) CPU : Nios-II SYSID : f7b67000, Thu Apr 21 03:45:55 2005 BOARD : Altera EP-1S40 ==> tftpboot 1500000 vmlinux.img Using MAC Address 08:00:3E:26:0A:5B TFTP from server 192.168.0.183; our IP address is 192.168.0.62 Filename 'vmlinux.img'. Load address: 0x1500000 Loading:# ################################################################ # ################################################################ # ################################################################ # ############### done Bytes transferred = 1078511 (1074ef hex) Automatic boot of image at addr 0x01500000 ...# # Booting image at 01500000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1078447 Bytes = 1 MB Load Address: 01000000 Entry Point: 01000000 Verifying Checksum ... OK Uncompressing Kernel Image ... Error: Bad gzipped data GUNZIP ERROR - must RESET board to recover U-Boot 1.1.3 (May 5 2006 - 00:38:14) CPU : Nios-II SYSID : f7b67000, Thu Apr 21 03:45:55 2005 BOARD : Altera EP-1S40 ==>
Here I got something new, u-boot is rebooting after image beeing uncompressed$ ./mkimage -d vmlinux.bin.gz -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01200000 -e 01200000 -C gzip vmlinux.img Image Name: Welcome to uClinux with MFM Created: Fri May 12 02:35:39 2006 Image Type: NIOS II Linux Kernel Image (gzip compressed) Data Size: 1073467 Bytes = 1048.31 kB = 1.02 MB Load Address: 0x01200000 Entry Point: 0x01200000 $U-Boot 1.1.3 (May 5 2006 - 00:38:14) CPU : Nios-II SYSID : f7b67000, Thu Apr 21 03:45:55 2005 BOARD : Altera EP-1S40 ==> tftpboot 1500000 vmlinux.img Using MAC Address 08:00:3E:26:0A:5B TFTP from server 192.168.0.183; our IP address is 192.168.0.62 Filename 'vmlinux.img'. Load address: 0x1500000 Loading:# ################################################################ # ################################################################ # ################################################################ # ############## done Bytes transferred = 1073531 (10617b hex) Automatic boot of image at addr 0x01500000 ...# # Booting image at 01500000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1073467 Bytes = 1 MB Load Address: 01200000 Entry Point: 01200000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK U-Boot 1.1.3 (May 5 2006 - 00:38:14) CPU : Nios-II SYSID : f7b67000, Thu Apr 21 03:45:55 2005 BOARD : Altera EP-1S40 ==> - Altera_Forum
Honored Contributor
Hi MFM,
Could you explain your memory organization (what RAM/SDRAM you have and where it's located)... and what is the exception address (I'm assuming it's 0180_0020 ... otherwise the kernel would go belly up on the first interrupt after nios2-download). Also, the kernel image you're using is compressed ... so please post the objdump of the uncompressed kernel image -- that's the one I need to see. When you use this image you should use '-C none' with mkimage (since the kernel will decompress itself). Could you also please post the header objdump of u-boot (you can strip it first -- nios2-elf-strip). > That's not my MAC adress !!!!!!! The kernel does this -- it's hardcoded since the kernel doesn't accept parameters from the bootloader -- this is something that needs to be addressed eventually. Thanks, --Scott - Altera_Forum
Honored Contributor
Hi MFM,
Ok, so I finally had a chance to review the buildroot scripts, etc. Here's what I believe is going on: 1. First, there are two elf files created. This is not unusual -- one is the kernel elf vmlinux. The other is the compressed kernel elf (zImage). The zImage is in the boot/compressed tree. 2. **Important** -- the zImage head.S is _not_, repeat _not_ coded to relocate itself. So you __MUST__ use the exact load address for this -- or add the relocation code. 3. The .text VMA of the zImage defaults to 0080_0000 above the .text VMA for the vmlinux. You can change this with the BOOT_LINK_OFFSET configuration option. So, here's what you have to do: 1. Use the zImage (the elf from the boot/compressed tree) and create a binary. The binary should be passed to mkimage with compression 'none' and the load and entry point addresses 0080_0000 above your ram base. In your case this should be 0180_0000. mkimage would look like: $ mkimage -C none -e 0x01800000 -a 0x01800000 -d zImage.bin <<other parameters>> 2. Use the vmlinux (not from the boot/compressed tree) and create a binary. Compress the binary (e.g. vmlinux.bin.gz). Pass the compressed binary to mkimage with compression 'gzip'. Set the load and entry point addresses to some valid address in ram (the kernel can relocate itself). But since u-boot will be decompressing, you might as well set the load/entry addresses to the actual VMA: 0x0100_0000: $ mkimage -C gzip -e 0x01000000 -a 0x01000000 -d vmlinux.bin.gz <<other parameters>> ================================================================ Just to review, so everyone knows where the problem is: The zImage does _not_ relocate itself. Setting the load/entry address to anything other than the correct VMA will cause the zImage to jump into the weeds. And, there's no need to compress a zImage -- it's already compressed -- so don't tell u-boot that it is. You can satisfy yourself that this is the case: use nios2-console, but load the binary to address 0x018000000 and it should work. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott,
Sorry, I did exactly like you said but this is what I got: <div class='quotetop'>QUOTE </div> --- Quote Start --- 1. Use the zImage (the elf from the boot/compressed tree) and create a binary. The binary should be passed to mkimage with compression 'none' and the load and entry point addresses 0080_0000 above your ram base. In your case this should be 0180_0000. mkimage would look like: $ mkimage -C none -e 0x01800000 -a 0x01800000 -d zImage.bin <<other parameters>>[/b] --- Quote End ---$ ./mkimage -d zImage.bin -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 0x01800000 -e 0x01800000 -C none zImage.img Image Name: Welcome to uClinux with MFM Created: Sat May 13 16:37:43 2006 Image Type: NIOS II Linux Kernel Image (uncompressed) Data Size: 1078447 Bytes = 1053.17 kB = 1.03 MB Load Address: 0x01800000 Entry Point: 0x01800000
<div class='quotetop'>QUOTE </div> --- Quote Start --- 2. Use the vmlinux (not from the boot/compressed tree) and create a binary. Compress the binary (e.g. vmlinux.bin.gz). Pass the compressed binary to mkimage with compression 'gzip'. Set the load and entry point addresses to some valid address in ram (the kernel can relocate itself). But since u-boot will be decompressing, you might as well set the load/entry addresses to the actual VMA: 0x0100_0000: $ mkimage -C gzip -e 0x01000000 -a 0x01000000 -d vmlinux.bin.gz <<other parameters>>[/b] --- Quote End ---==> tftpboot 0x01a00000 zImage.img Using MAC Address 08:00:3E:26:0A:5B TFTP from server 192.168.0.183; our IP address is 192.168.0.62 Filename 'zImage.img'. Load address: 0x1a00000 Loading:# ################################################################ # ################################################################ # ################################################################ # ############### done Bytes transferred = 1078511 (1074ef hex) Automatic boot of image at addr 0x01A00000 ...# # Booting image at 01a00000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (uncompressed) Data Size: 1078447 Bytes = 1 MB Load Address: 01800000 Entry Point: 01800000 Verifying Checksum ... OK OK==> tftpboot 1a00000 vmlinux.img Using MAC Address 08:00:3E:26:0A:5B TFTP from server 192.168.0.183; our IP address is 192.168.0.62 Filename 'vmlinux.img'. Load address: 0x1a00000 Loading:# ################################################################ # ################################################################ # ################################################################ # ############# done Bytes transferred = 1067691 (104aab hex) Automatic boot of image at addr 0x01A00000 ...# # Booting image at 01a00000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1067627 Bytes = 1 MB Load Address: 01000000 Entry Point: 01000000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK