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
Hi MFM,
> seemingly my flash base adress is 0x800000, don't ask how I get it, I just tried it and it's fine, > where to get that information remains then a mystery to me. If you're using Nios 5.1 and the 1s40 standard configuration, your flash base address should be 0000_0000. The best bet is to follow mountain8848's suggestions and review your ptf file. > Bank# 1: Size: 0 KB in 0 Sectors Check your flash_init() routine in board/altera/common/AMDLV065D.c -- you probably still have the routine contents commented out -- I believe that's what I suggested you do to get started on the other board you were using (since you were using a different flash device). Normally, u-boot will report an error if flash_init() reports zero memory. Regards, --Scott - Altera_Forum
Honored Contributor
Hi scut_ak,
> My flash is AM29LV160DB and it locates in 0x800000 ,how can I choose a flash drive for it. The best bet is to copy an existing driver and make whatever modifications you like. The one I would suggest is board/mvblue/flash.c -- you'll have to grab it from the u-boot project since it's not included in the sources from psyent (because it's not a nios board). The mvblue flash driver includes support for the 160D (and a few others). I will be updating the psyent sources soon and hope to have the CFI driver fixed to work with the avalon bus (and Nios II configurations with dcache). There has been alot of churn in the u-boot CFI implementation over the past several months, but things finally seem stable. Hopefully, the CFI driver will eliminate the need for any custom flash drivers -- so it will be easier to port u-boot to a custom board. I'll make a post once I have things ready. Regards, --Scott - Altera_Forum
Honored Contributor
Hi mountain8848,
<div class='quotetop'>QUOTE </div> --- Quote Start --- Do you just develop SW in NiosII system? Who develops NiosII in Quartus/SOPC builder?[/b] --- Quote End --- ?????????????????????????? <div class='quotetop'>QUOTE </div> --- Quote Start --- All informatioins about modules of NiosII, including flash, SDRAM..., can be found in SOPC builder.[/b] --- Quote End --- I told that when I open the standard reference design in SoPC builder, I found the flas adress at 0x00000000 which is not correct! <div class='quotetop'>QUOTE </div> --- Quote Start --- The file-- <NiosII Name>.ptf records all information about "HW" of NiosII system. Yes, of course the BASE ADDRESS. [/b] --- Quote End --- I checked that out and you're right, I found the following
0x00800000 is the right base adress. <div class='quotetop'>QUOTE </div> --- Quote Start --- <u-boot-src>/include/configs/"board".h should deal with the information manually.[/b] --- Quote End --- That's what I found:REFDES U5 { base = "0x00800000"; }
And again the base adress is wrong!!!!!!!!!!!!!!!!!!!!!!!! I concluded that I got to look only in the .ptf file./*------------------------------------------------------------------------ * MEMORY BASE ADDRESSES *----------------------------------------------------------------------*/# define CFG_FLASH_BASE 0x00000000 /* FLASH base addr */# define CFG_FLASH_SIZE 0x00800000 /* 8 MByte */# define CFG_SDRAM_BASE 0x01000000 /* SDRAM base addr */# define CFG_SDRAM_SIZE 0x01000000 /* 16 MByte */# define CFG_SRAM_BASE 0x02000000 /* SRAM base addr */# define CFG_SRAM_SIZE 0x00100000 /* 1 MB */ - Altera_Forum
Honored Contributor
Hi Scott,
<div class='quotetop'>QUOTE </div> --- Quote Start --- If you're using Nios 5.1 and the 1s40 standard configuration, your flash base address should be 0000_0000.[/b] --- Quote End --- I'm using Nios II 5.0 and 1s40 standard configuration. <div class='quotetop'>QUOTE </div> --- Quote Start --- The best bet is to follow mountain8848's suggestions and review your ptf file[/b] --- Quote End --- That's right I found the correct information there. <div class='quotetop'>QUOTE </div> --- Quote Start --- > Bank# 1: Size: 0 KB in 0 Sectors Check your flash_init() routine in board/altera/common/AMDLV065D.c -- you probably still have the routine contents commented out -- I believe that's what I suggested you do to get started on the other board you were using (since you were using a different flash device). Normally, u-boot will report an error if flash_init() reports zero memory.[/b] --- Quote End --- That's already done without my intervention, this is the content of the AMDLV065D.c file:/* * (C) Copyright 2000-2004 * Wolfgang Denk, DENX Software Engineering, [email protected]. * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ # include <common.h># if defined(CONFIG_NIOS)# include <nios.h># else# include <asm/io.h># endif # define SECTSZ (64 * 1024) flash_info_t flash_info; /*----------------------------------------------------------------------*/ unsigned long flash_init (void) { return (CFG_FLASH_SIZE); } /*--------------------------------------------------------------------*/ void flash_print_info (flash_info_t * info) { int i, k; int erased; unsigned long *addr; printf (" Size: %ld KB in %d Sectors\n", info->size >> 10, info->sector_count); printf (" Sector Start Addresses:"); for (i = 0; i < info->sector_count; ++i) { /* Check if whole sector is erased */ erased = 1; addr = (unsigned long *) info->start; for (k = 0; k < SECTSZ/sizeof(unsigned long); k++) { if ( readl(addr++) != (unsigned long)-1) { erased = 0; break; } } /* Print the info */ if ((i % 5) == 0) printf ("\n "); printf (" %08lX%s%s", info->start, erased ? " E" : " ", info->protect ? "RO " : " "); } printf ("\n"); } /*-------------------------------------------------------------------*/ int flash_erase (flash_info_t * info, int s_first, int s_last) { unsigned char *addr = (unsigned char *) info->start; unsigned char *addr2; int prot, sect; ulong start; /* Some sanity checking */ if ((s_first < 0) || (s_first > s_last)) { printf ("- no sectors to erase\n"); return 1; } prot = 0; for (sect = s_first; sect <= s_last; ++sect) { if (info->protect) { prot++; } } if (prot) { printf ("- Warning: %d protected sectors will not be erased!\n", prot); } else { printf ("\n"); } /* It's ok to erase multiple sectors provided we don't delay more * than 50 usec between cmds ... at which point the erase time-out * occurs. So don't go and put printf() calls in the loop ... it * won't be very helpful;-) */ for (sect = s_first; sect <= s_last; sect++) { if (info->protect == 0) { /* not protected */ addr2 = (unsigned char *) info->start; writeb (addr, 0xaa); writeb (addr, 0x55); writeb (addr, 0x80); writeb (addr, 0xaa); writeb (addr, 0x55); writeb (addr2, 0x30); /* Now just wait for 0xff & provide some user * feedback while we wait. */ start = get_timer (0); while ( readb (addr2) != 0xff) { udelay (1000 * 1000); putc ('.'); if (get_timer (start) > CFG_FLASH_ERASE_TOUT) { printf ("timeout\n"); return 1; } } } } printf ("\n"); return 0; } /*----------------------------------------------------------------------- * Copy memory to flash, returns: * 0 - OK * 1 - write timeout * 2 - Flash not erased */ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) { vu_char *cmd = (vu_char *) info->start; vu_char *dst = (vu_char *) addr; unsigned char b; ulong start; while (cnt) { /* Check for sufficient erase */ b = *src; if ((readb (dst) & b) != b) { printf ("%02x : %02x\n", readb (dst), b); return (2); } writeb (cmd, 0xaa); writeb (cmd, 0x55); writeb (cmd, 0xa0); writeb (dst, b); /* Verify write */ start = get_timer (0); while (readb (dst) != b) { if (get_timer (start) > CFG_FLASH_WRITE_TOUT) { return 1; } } dst++; src++; cnt--; } return (0); } - Altera_Forum
Honored Contributor
Hi MFM,
Your problem is:
Which is undoubtedly due to my suggestion in an other thread to stub out that routine. See: http://forum.niosforum.com/forum/index.php...700&#entry13700 (http://forum.niosforum.com/forum/index.php?showtopic=3571&st=0&p=13700&#entry13700) You need to restore the routine to its original state now that you're using a board with an LV065D flash device:unsigned long flash_init (void) { return (CFG_FLASH_SIZE); }
This will always succeed at startup -- even if you don't provide the correct base address. If the base address is incorrect, the utilities just won't work. Regards, --Scottunsigned long flash_init (void) { int i; unsigned long addr; flash_info_t *fli = &flash_info; fli->size = CFG_FLASH_SIZE; fli->sector_count = CFG_MAX_FLASH_SECT; fli->flash_id = FLASH_MAN_AMD + FLASH_AMDLV065D; addr = CFG_FLASH_BASE; for (i = 0; i < fli->sector_count; ++i) { fli->start = addr; addr += SECTSZ; fli->protect = 1; } return (CFG_FLASH_SIZE); } - Altera_Forum
Honored Contributor
Hi Scott,
that fix it, thanks a lot http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif - Altera_Forum
Honored Contributor
Hi,
this is my u-boot configuration:
Question: why is my board info printed twice with one bdinfo ? I used mkimage to convert the /home/MFM/linux-2.6.x/arch/nios2nommu/boot/compressed/vmlinux.bin generated using hippo's buildroot: * with a gzip compression: gzip --best vmlinux.bin and: ./mkimage -d vmlinux.bin.gz -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01100000 -e 01100000 -C gzip vmlinux.imgU-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 ==> 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 ==> 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 ==> pri baudrate=115200 ethaddr=08:00:3e:26:0a:5b bootdelay=-1 serverip=192.168.0.183 netmask=255.255.252.0 ipaddr=192.168.0.62 gatewayip=192.168.3.1 autostart=yes loadaddr=1100000 hostname=FC5 bootfile=vmlinux.img stdin=serial stdout=serial stderr=serial Environment size: 248/65532 bytes ==>
*with a bz2 compression: bzip2 --best vmlinux.bin and : ./mkimage -d vmlinux.bin.bz2 -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01100000 -e 01100000 -C bzip2 vmlinux.img==> tftpboot 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: 0x1100000 Loading:# ################################################################ # ################################################################ # ################################################################ # ############# done Bytes transferred = 1069702 (105286 hex) Automatic boot of image at addr 0x01100000 ... # # Booting image at 01100000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1069638 Bytes = 1 MB Load Address: 01100000 Entry Point: 01100000 Verifying Checksum ... OK Uncompressing Kernel Image ... Error: inflate() returned -3 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 ==>
* with no compression:==> tftpboot 1100000 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: 0x1100000 Loading:# ################################################################ # ################################################################ # ################################################################ done Bytes transferred = 994728 (f2da8 hex) Automatic boot of image at addr 0x01100000 ... # # Booting image at 01100000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (bzip2 compressed) Data Size: 994664 Bytes = 971.4 kB Load Address: 01100000 Entry Point: 01100000 Verifying Checksum ... OK Unimplemented compression type 2 ==>$ ./mkimage -d vmlinux.bin -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01100000 -e 01100000 vmlinux.img Image Name: Welcome to uClinux with MFM Created: Wed May 10 00:01:59 2006 Image Type: NIOS II Linux Kernel Image (gzip compressed) Data Size: 2005944 Bytes = 1958.93 kB = 1.91 MB Load Address: 0x01100000 Entry Point: 0x01100000
* with the zImage file:==> tftpboot 1100000 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: 0x1100000 Loading: T# ################################################################ # ################################################################ # ################################################################ # ################################################################ # ################################################################ # ################################################################ # # done Bytes transferred = 2006008 (1e9bf8 hex) Automatic boot of image at addr 0x01100000 ... # # Booting image at 01100000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 2005944 Bytes = 1.9 MB Load Address: 01100000 Entry Point: 01100000 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 ==>$ ./mkimage -d zImage -A nios2 -O linux -T kernel -n "Welcome to uClinux with MFM" -a 01100000 -e 01100000 vmlinux.img Image Name: Welcome to uClinux with MFM Created: Wed May 10 00:07:30 2006 Image Type: NIOS II Linux Kernel Image (gzip compressed) Data Size: 1096043 Bytes = 1070.35 kB = 1.05 MB Load Address: 0x01100000 Entry Point: 0x01100000
Another question: I've set the bootfile and loadaddr variables and saved the environment, I type first time only tftpboot to load the kernel, but the second time I get this==> tftpboot 1100000 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: 0x1100000 Loading: T# ################################################################ # ################################################################ # ################################################################ # ################### done Bytes transferred = 1096107 (10b9ab hex) Automatic boot of image at addr 0x01100000 ... # # Booting image at 01100000 ... Image Name: Welcome to uClinux with MFM Image Type: Nios-II Linux Kernel Image (gzip compressed) Data Size: 1096043 Bytes = 1 MB Load Address: 01100000 Entry Point: 01100000 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 ==>
and I got to type the full command tftpboot 1100000 vmlinux.img to make it work. Is there any explanation ? PS: I'm working with the GtkTerm terminal==> tftpboot Using MAC Address 08:00:3E:26:0A:5B *** Warning: no boot file name; using 'C0A8003E.img' TFTP from server 192.168.0.183; our IP address is 192.168.0.62 Filename 'C0A8003E.img'. Load address: 0x1100000 Loading: *T TFTP error: 'File not found' (1) Starting again - Altera_Forum
Honored Contributor
Hi,
well, I've figured out the following: I was overwriting the compressed image with the uncompressed one, so I changed the loadaddr to 0x0150 0000. To be carefull, I changed also the load adress and entry point to 0x0120 0000. That's fixed up the gzip compressed kernel image issue, now it's uncompressing successfully but then it hangs up:
The other problems remain with no change although I corrected the adresses for too. PS: I'm using UART for both u-boot and the kernel.==> 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 = 1067691 (104aab 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: 1067627 Bytes = 1 MB Load Address: 01200000 Entry Point: 01200000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK - Altera_Forum
Honored Contributor
Hi MFM,
> 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. > well, I've figured out the following: I was overwriting the compressed image with > the uncompressed one That's a common scenario ... especially when bringing up a new board 8-P > 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. Regards, --Scott - Altera_Forum
Honored Contributor
Hi Scott
<div class='quotetop'>QUOTE </div> --- 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.[/b] --- 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).