Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

How to build u-boot for cycloneII board?

Altera_Forum
Honored Contributor II
1,924 Views

Hi all, 

Can someone tell me the procedure to build u-boot for owner niosII board?  

I need u-boot to use it in Altera niosII development kit CycloeII edition and owner design CycloneII board. 

Thanks in advance.
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

 

> Can someone tell me the procedure to build u-boot for owner niosII board?  

 

I'm not familiar with the owner niosII board -- you will need to add support for this 

board in the u-boot source tree. 

 

> I need u-boot to use it in Altera niosII development kit CycloeII edition and 

> owner design CycloneII board. 

 

You will need to add support for these boards. Please read the top-level README -- especially 

the section "Building the Software." For the Altera Cyclone II board, you can use any of the 

existing Altera boards as a starting point (e.g.: board/altera/ep1c20). 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi smcnutt, 

 

According to the EP1C20 I have built the u-boot and succeed in download boot up the Altera cyclone II board but I got CRC error report in console. I have no ideal about this error could you explain this? 

U-Boot 1.1.3 (Sep 26 2005 - 14:10:12) 

 

CPU : Nios-II 

SYSID : 6163a3b2, Sat Sep 24 09:50:31 2005 

BOARD : Altera EP-2C35 

*** Warning - bad CRC, using default environment 

 

==> 

==> 

 

 

Another question, How to add Ethernet driver to support DM9000 MAC? 

 

Thanks.
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

 

> *** Warning - bad CRC, using default environment 

 

Your environment has a bad CRC. Until you save the environment to non-volatile memory u-boot will 

detect an invalid environment and use the default environment (which is defined at compile time). For 

the EP1C20, the environment is stored at 0x0004_0000 (flash: CFG_ENV_ADDR). 

 

Please read the top-level README ... it contains alot of useful information. You can simply search for 

" _ENV_" to review environment information. 

 

> How to add Ethernet driver to support DM9000 MAC 

 

Remove the SMC driver macros (e.g. CONFIG_SMC91111_BASE) and define CONFIG_DRIVER_DM9000 

... and other CONFIG_DM9000_xxx macros as needed. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi smcnutt, 

I have built u-boot with DM9000 support and succeed download to Microtronix ukit board and boot up but it seems don¡¦t recognize the DM9000 MAC. 

Below is my board configuration: 

/*------------------------------------------------------------------------ 

* ETHERNET -- The header file for the DM9000 

*----------------------------------------------------------------------*/ 

# define CONFIG_DRIVER_DM9000 1# define CONFIG_DM9000_BASE 0x00000000# define DM9000_IO CONFIG_DM9000_BASE# define DM9000_DATA (CONFIG_DM9000_BASE+4)# define CONFIG_DM9000_USE_16BIT 

# define CONFIG_ETHADDR 08:00:3e:26:0a:5b# define CONFIG_NETMASK 255.255.255.0# define CONFIG_IPADDR 192.168.14.123# define CONFIG_SERVERIP 192.168.14.32 

 

 

u-boot: Console report 

U-Boot 1.1.3 (Sep 27 2005 - 16:20:50) 

 

CPU : Nios-II 

SYSID : a4a90077, Thu Jan 01 00:00:00 1970 

BOARD : Microtronix_ukit 

*** Warning - bad CRC, using default environment 

 

==> printenv 

baudrate=115200 

ethaddr=08:00:3e:26:0a:5b 

ipaddr=192.168.14.123 

serverip=192.168.14.32 

netmask=255.255.255.0 

stdin=serial 

stdout=serial 

stderr=serial 

 

Environment size: 150/65532 bytes 

==> ping 192.168.14.32 

dm9000 not found at 0x00000000 id: 0x01010101 

MAC: 00:00:00:00:00:00 

could not establish link 

*** ERROR: `ethaddr' not set 

ping failed; host 192.168.14.32 is not alive 

==> md 0 

00000000: 00010005 00000000 00000000 00000000 ................ 

00000010: 00000000 000005f2 00000000 00000000 ................ 

00000020: 00000000 00000000 00000000 00000000 ................ 

00000030: 00000000 00000000 00000000 00000000 ................ 

00000040: 00000001 00000000 00000000 00000000 ................ 

00000050: 00000000 00000000 00000000 00000000 ................ 

00000060: 00000000 00000000 00000000 00000000 ................ 

00000070: 00000000 00000000 00000000 00000000 ................ 

00000080: 00000000 00000000 00000000 00000000 ................ 

00000090: 00000000 00000000 00000000 00000000 ................ 

000000a0: 00000000 00000000 00000000 00000000 ................ 

000000b0: 00000000 00000000 00000000 00000000 ................ 

000000c0: 00000000 00000000 00000000 00000000 ................ 

000000d0: 00000000 00000000 00000000 00000000 ................ 

000000e0: 00000004 00000200 00000000 00000000 ................ 

000000f0: 00000000 00000000 00000000 00000000 ................ 

==> 

 

Would you please check it for me and thanks for help. 

 

Thanks Again. 

Regards,
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

 

> I have built u-boot with DM9000 support and succeed download to Microtronix ukit board 

 

Did you add the DM9000 to the ukit board? As I recall, the ukit assumes a MAC implemented in the 

FPGA (it has an external PHY, but no external MAC). If you added your own DM9000 via an expansion 

header, you should check your hardware interface. 

 

> Would you please check it for me and thanks for help. 

 

I'm not sure what you would like me to check. If the code you are attempting to use does not work, 

it's generally a good idea to review it. Did you read through the probe routine? If not, I strongly 

recommend that you do so. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi smcnutt, 

Sorry, my mistake I take the wrong SOF file.  

 

The u-boot can find the DM9000 now but the NET seems work incorrect.  

 

U-Boot 1.1.3 (Sep 28 2005 - 11:12:54) 

 

CPU : Nios-II 

SYSID : a98ca823, Fri Sep 23 08:13:59 2005 

BOARD : Microtronix_ukit 

*** Warning - bad CRC, using default environment 

 

==> ping 192.168.14.32 

dm9000 i/o: 0x80000000, id: 0x90000a46  

MAC: ff:ff:ff:ff:ff:ff 

operating at 100M full duplex mode 

host 192.168.14.32 is alive 

==> ping 192.168.14.32 

dm9000 i/o: 0x80000000, id: 0x90000a46  

MAC: 00:00:00:00:00:00 

operating at 100M full duplex mode 

*** ERROR: `ethaddr' not set 

ping failed; host 192.168.14.32 is not alive 

==> 

 

I think it is DM9000 head file setting incorrect. If so how to correct? 

Please help. 

# define CONFIG_DRIVER_DM9000 1# define CONFIG_DM9000_BASE 0x80000000# define DM9000_IO CONFIG_DM9000_BASE# define DM9000_DATA (CONFIG_DM9000_BASE+4)# define CONFIG_DM9000_USE_16BIT 

# define CONFIG_ETHADDR 08:00:3e:26:0a:5b# define CONFIG_NETMASK 255.255.255.0# define CONFIG_IPADDR 192.168.14.123# define CONFIG_SERVERIP 192.168.14.32 

 

 

 

 

Regards,
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

==> ping 192.168.14.32 

dm9000 i/o: 0x80000000, id: 0x90000a46 

MAC: ff:ff:ff:ff:ff:ff 

operating at 100M full duplex mode 

host 192.168.14.32 is alive 

==> ping 192.168.14.32 

dm9000 i/o: 0x80000000, id: 0x90000a46 

MAC: 00:00:00:00:00:00 

operating at 100M full duplex mode 

*** ERROR: `ethaddr&#39; not set[/b] 

--- Quote End ---  

 

Your MAC address is getting trashed -- which probably means your board info structure is being corrupted, 

which means the global data structure is probably being corrupted -- which can lead to many other potential 

problems as well. You should probably check the following macros to make sure you have them set correctly: 

CFG_MALLOC_BASE 

CFG_GBL_DATA_OFFSET 

CFG_INIT_SP 

 

Check the board info structure after reset (with the bdi command), try ping, then check 

the board info structure again to see if the data is actually being corrupted. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi Scott, 

 

Yes, you right the board info structure is actually being corrupt after execute ping command: 

U-Boot 1.1.3 (Sep 29 2005 - 14:51:23) 

 

CPU : Nios-II 

SYSID : a98ca823, Fri Sep 23 08:13:59 2005 

BOARD : Microtronix_ukit 

*** Warning - bad CRC, using default environment 

 

==> bdi 

mem start = 0x01000000 

mem size = 0x01000000 

flash start = 0x00800000 

flash size = 0x00800000 

flash offset= 0x00000000 

ethaddr = 08:00:3E:26:0A:5B 

ip_addr = 192.168.14.123 

baudrate = 115200 bps 

==> ping 192.168.14.32 

dm9000 i/o: 0x80000000, id: 0x90000a46  

MAC: 00:00:00:00:00:00 

operating at 100M half duplex mode 

*** ERROR: `ethaddr&#39; not set 

ping failed; host 192.168.14.32 is not alive 

==> bdi 

mem start = 0x01000000 

mem size = 0x01000000 

flash start = 0x00800000 

flash size = 0x00800000 

flash offset= 0x00000000 

ethaddr = 00:00:00:00:00:00 

ip_addr = 192.168.14.123 

baudrate = 0 bps 

==> 

What can I do now? My board configuration is set as: 

TEXT_BASE = 0x018C0000 

/*------------------------------------------------------------------------ 

* MEMORY ORGANIZATION 

* -Monitor at top. 

* -The heap is placed below the monitor. 

* -Global data is placed below the heap. 

* -The stack is placed below global data (&grows down). 

*----------------------------------------------------------------------*/# define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256k */# define CFG_GBL_DATA_SIZE 128 /* Global data size rsvd*/# define CFG_MALLOC_LEN (CFG_ENV_SIZE + 256*1024) /* 256k heap */ 

# define CFG_MONITOR_BASE TEXT_BASE# define CFG_MALLOC_BASE (CFG_MONITOR_BASE - CFG_MALLOC_LEN)# define CFG_GBL_DATA_OFFSET (CFG_MALLOC_BASE - CFG_GBL_DATA_SIZE)# define CFG_INIT_SP CFG_GBL_DATA_OFFSET 

 

 

Thanks, 

Best regards,
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

 

Ok, I think I found the problem ... but I have no way of testing since I don&#39;t have a board with a DM9000 ... so 

I&#39;ll leave that up to you ;-). The problem is in dm9000.c, eth_init routine, starting at line 303:<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

for (i = 0; i < 6; i++) 

    ((u16 *) bd->bi_enetaddr) = read_srom_word(i); 

printf("mac: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0], 

    bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3], 

    bd->bi_enetaddr[4], bd->bi_enetaddr[5]); 

for (i = 0, oft = 0x10; i < 6; i++, oft++) 

    dm9000_iow(oft, bd->bi_enetaddr); 

for (i = 0, oft = 0x16; i < 8; i++, oft++) 

    DM9000_iow(oft, 0xff);[/b] 

--- Quote End ---  

This is pretty brain-damaged ... and also explains why the baudrate gets corrupted as well ... as the 

16-bit writes spill over into the baudrate field of the board info struct. 

 

You have a few choices here: 

1. If you&#39;re not using an eeprom with your DM9000, just remove the for statement -- the driver should 

not be copying the MAC address into the bd struct if there is no eeprom anyway. 

 

2. If you are using an eeprom, you will have to rewrite the code to unpack the 16-bit values into the 

bd struct. Maybe something like the following will do:<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

for (i = 0; i < 3; i++) { 

    u16 val = read_srom_word (i); 

    bd->bi_enetaddr)[(i<<1)] = val >>8 

    bd->bi_enetaddr)[(i<<1)+1] = val & 0x0ff; 

}[/b] 

--- Quote End ---  

You will, of course, have to decide if the eeprom MAC address, or the environment 

MAC address (if present) should be used. In general, if the user programs a MAC address (ethaddr) into the 

environment (which is copied into the bd struct at startup), it should be used. If the user wants to use the 

eeprom MAC address, the ethaddr env variable should not be defined. 

 

Based on the output you posted, you don&#39;t have an eeprom (or it is not programmed). Regardless, a patch 

should be submitted to the u-boot project. If you need help with this just contact me via email. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi Scott, 

As you mentioned I removed the line 303 from dm9000x.c the board info structure not corrupted again. 

But, 

The NET seems can ping out only that is when issue ping command the dm9000 LINKACT# pin light up and light off after executed command then the Ethernet is broken so I can not ping it form outside. 

 

Would you please help me to patch the dm9000x.c file? 

 

Thanks, 

Best regards, 

Email: ystsai55@yahoo.com.tw
0 Kudos
Altera_Forum
Honored Contributor II
490 Views

Hi posix6973, 

 

> The NET seems can ping out only 

 

Correct. u-boot does not respond to pings. 

 

> when issue ping command the dm9000 LINKACT# pin light up and light off after executed command 

 

Correct. Each time a network operation is performed, the MAC/PHY is initialized, the operation is performed, 

then the device is shut down. 

 

> then the Ethernet is broken so I can not ping it form outside. 

 

The Ethernet is not broken at all, u-boot does not respond to a ping. Remember, u-boot is a boot loader 

and monitor. It has many features that serve two main purposes: (1) hardware initialization/testing and 

(2) loading and executing a kernel. To perform basic testing on your ethernet device you can use ping, 

bootp, dhcp, tftpboot, nfs etc. from the u-boot command line. And all of the network commands 

support booting a kernel via the network -- anything beyond testing/loading is outside the scope of 

u-boot -- which is why u-boot supports "standalone" applications. 

 

> Would you please help me to patch the dm9000x.c file? 

 

Sure. But first review the main README on how to submit patches and the following: 

http://sourceforge.net/mailarchive/forum.p...&forum_id=12898 (http://sourceforge.net/mailarchive/forum.php?thread_id=7969201&forum_id=12898

Then I&#39;ll be glad to help if you have any problems. 

 

Best Regards, 

--Scott
0 Kudos
Reply