Migration environment
1. Host environment: CentOS 5.5 under VMare, 1G memory.
2. Integrated development environment: Eclipse IDE
3. Compilation environment: arm-linux-gcc v4.4.3, arm-none-eabi-gcc v4.5.1.
4. Development board: mini2440, 2M nor flash, 128M nand flash.
5. u-boot version: u-boot-2009.08
u-boot-2009.08 has relatively complete code support for CS8900, RTL8019 and DM9000X network cards (the code is in the drivers/net/ directory), and the CS8900 network card is configured by default in the S3C24XX series. The mini2440 development board uses the DM9000 network card chip, so you only need to add support for DM9000 on the development board. Another point is that the previous U-boot had problems with the network delay part, and many places needed to be modified. But now the U-boot network
part basically does not need to be modified, only the DM9000 driver and NFS TIMEOUT parameters need to be slightly modified.
4.1, DM9000 driver code modification
【1】Modify part of the code in the static int dm9000_init function. If you do not modify this part, the error "could not establish link" will be reported when using the network card.
Open /drivers/net/dm9000x.c, locate line 377, and modify it as follows:
/* Activate DM9000 */
/* RX enable */
DM9000_iow(DM9000_RCR, RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN);
/* Enable TX/RX interrupt mask */
DM9000_iow(DM9000_IMR, IMR_PAR);
#if 0 //default to link MII interface
i = 0;
while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */
udelay(1000);
i++;
if (i == 1650) {
//printf("could not establish linkn");
//return 0;
break;
}
}
#endif
【2】For NFS, the delay is increased, otherwise the error "*** ERROR: Cannot mount" will appear.
Open /net/nfs.c, locate line 36, and modify it as follows:
#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
#define NFS_RETRY_COUNT 30
#define NFS_TIMEOUT (CONFIG_SYS_HZ/1000*2000UL) //2000UL
【3】Add the initialization function of the network card chip (DM9000)
Open board/samsung/mini2440/mini2440.c, locate around line 194, at the end of the file, and modify it as follows:
int dram_init (void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
return 0;
}
extern int dm9000_initialize(bd_t *bis);//implicit declaration of function 'dm9000_initialize'
#ifdef CONFIG_DRIVER_DM9000
int board_eth_init(bd_t *bis)
{
return dm9000_initialize(bis);
}
#endif
【4】Add serial port Xmodem transmission protocol (optional)
For operations that use the serial port to transfer data to memory, the Xmodem protocol may be used. However, the original kermit protocol transmission is quite easy to use and has a relatively fast speed, so this function can be added.
Open /common/cmd_load.c, locate line 37, and modify it as follows:
#if defined(CONFIG_CMD_LOADB)
#if defined(ENABLE_CMD_LOADB_X)
static ulong load_serial_xmodem (ulong offset);
#endif
static ulong load_serial_ymodem (ulong offset);
#endif
Then locate around line 480 and modify it as follows:
if (load_baudrate != current_baudrate) {
printf ("## Switch baudrate to %d bps and press ENTER ...n",
load_baudrate);
udelay(50000);
gd->baudrate = load_baudrate;
serial_setbrg ();
udelay(50000);
for (;;) {
if (getc() == 'r')
break;
}
}
#if defined(ENABLE_CMD_LOADB_X)
if (strcmp(argv[0],"loadx")==0) {
printf ("## Ready for binary (xmodem) download "
"to 0x%08lX at %d bps...n",
offset,
load_baudrate);
addr = load_serial_xmodem (offset);
} else if (strcmp(argv[0],"loady")==0) {
#else
if (strcmp(argv[0],"loady")==0) {
#endif
printf ("## Ready for binary (ymodem) download "
"to 0x%08lX at %d bps...n",
offset,
load_baudrate);
addr = load_serial_ymodem (offset);
Then locate around line 998 and modify it as follows:
static int getcxmodem(void) {
if (tstc())
return (getc());
return -1;
}
#if defined(ENABLE_CMD_LOADB_X)
static ulong load_serial_xmodem (ulong offset)
{
int size;
char buf[32];
int err;
int res;
connection_info_t info;
char xmodemBuf[1024];
ulong store_addr = ~0;
ulong addr = 0;
size = 0;
info.mode = xyzModem_xmodem;
res = xyzModem_stream_open (&info, &err);
if (!res) {
while ((res =
xyzModem_stream_read (xmodemBuf, 1024, &err)) > 0) {
store_addr = addr + offset;
size += res;
addr += res;
#ifndef CFG_NO_FLASH
if (addr2info (store_addr)) {
int rc;
rc = flash_write ((char *) xmodemBuf,
store_addr, res);
if (rc != 0) {
flash_perror (rc);
return (~0);
}
} else
#endif
{
memcpy ((char *) (store_addr), xmodemBuf,
res);
}
}
} else {
printf ("%sn", xyzModem_error (err));
}
xyzModem_stream_close (&err);
xyzModem_stream_terminate (false, &getcxmodem);
flush_cache (offset, size);
printf ("## Total Size = 0x%08x = %d Bytesn", size, size);
sprintf (buf, "%X", size);
setenv ("filesize", buf);
return offset;
}
#endif
static ulong load_serial_ymodem (ulong offset)
Then locate line 1169 and modify it as follows:
#if defined(CONFIG_CMD_LOADB)
U_BOOT_CMD(
loadb, 3, 0, do_load_serial_bin,
"load binary file over serial line (kermit mode)",
"[ off ] [ baud ]n"
" - load binary file over serial line"
" with offset 'off' and baudrate 'baud'"
);
#if defined(ENABLE_CMD_LOADB_X)
U_BOOT_CMD(
loadx, 3, 0, do_load_serial_bin,
"load binary file over serial line (xmodem mode)",
"[ off ] [ baud ]n"
" - load binary file over serial line"
" with offset 'off' and baudrate 'baud'"
);
#endif
U_BOOT_CMD(
loady, 3, 0, do_load_serial_bin,
"load binary file over serial line (ymodem mode)",
"[ off ] [ baud ]n"
" - load binary file over serial line"
" with offset 'off' and baudrate 'baud'"
);
【5】Modify the configuration file and add relevant definitions in mini2440.h
Open /include/configs/mini2440.h, locate around line 60, and modify it as follows:
/*
* Hardware drivers
*/
#if 0
#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
#define CS8900_BASE 0x19000300
#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
#endif
#define CONFIG_NET_MULTI 1
#define CONFIG_DRIVER_DM9000 1
#define CONFIG_DM9000_BASE 0x20000300 //网卡片选地址
#define DM9000_IO CONFIG_DM9000_BASE
#define DM9000_DATA (CONFIG_DM9000_BASE+4) //网卡数据地址
#define CONFIG_DM9000_NO_SROM 1
//#define CONFIG_DM9000_USE_16BIT
#undef CONFIG_DM9000_DEBUG
Note:
u-boot-2009.08 can automatically detect the number of bits of the DM9000 network card. According to the development board schematic, the data bit of the network card is 16 bits, and the network card is located
on BANK4 of the CPU, so you only need to set #define B4_BWSCON (DW16) in board/samsung/mini2440/lowlevel_init.S.
No need to set #define CONFIG_DM9000_USE_16BIT 1 here
Add ping command to u-boot to test whether the network is accessible
/*
* Command line configuration.
*/
#include
#define CONFIG_CMD_CACHE
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF
#define CONFIG_CMD_NAND
#define CONFIG_CMD_JFFS2 /* JFFS2 Support*/
#define CONFIG_CMD_PING /*ping command support*/
Restore the commented-out network card MAC address and modify your appropriate development board IP address and kernel startup parameters:
#define CONFIG_BOOTDELAY 3
#define CONFIG_ETHADDR 08:00:3e:26:0a:5b
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 10.1.0.129
#define CONFIG_SERVERIP 10.1.0.128
#define CONFIG_GATEWAYIP 10.1.0.1
#define CONFIG_OVERWRITE_ETHADDR_ONCE
/*#define CONFIG_BOOTFILE "elinos-lart" */
Locate around line 139 and add the operation to enable the serial port to transfer data to the memory:
#define ENABLE_CMD_LOADB_X 1 //Enable the operation of transferring data from the serial port to the memory
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 115200 /* speed to run kgdb serial port */
/* what's this ? it's not used anywhere */
#define CONFIG_KGDB_SER_INDEX 1 /* which serial port to use */
#endif
4.2, recompile u-boot, download it to Nand and boot from Nand, check the startup information and environment variables and use the ping command to test the network card, the operation is as follows:
Enter your selection: a
USB host is connected. Waiting a download.
Now, Downloading [ADDRESS:30000000h,TOTAL:154934]
RECEIVED FILE SIZE: 154934 (151KB/S, 1S)
Downloaded file at 0x30000000, size = 154924 bytes
Write to flash ok: skipped size = 0x0, size = 0x25d2c
... ...
After power-on and restart in nand mode:
U-Boot 2009.08 ( 5鏈?09 2011 - 15:01:04)
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
In: serial
Out: serial
Err: serial
Net: dm9000
[u-boot@MINI2440]#
Display the following environment variables:
[u-boot@MINI2440]# printenv
bootdelay=3
baudrate=115200
netmask=255.255.255.0
stdin=serial
stdout=serial
stderr=serial
ipaddr=10.1.129
serverip=10.1.0.128
ethact=dm9000
Environment size: 141/131068 bytes
ping测试:
[u-boot@MINI2440]# ping 10.1.0.128
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:00:00:00:00:00
operating at 100M full duplex mode
*** ERROR: `ethaddr' not set
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:00:00:00:00:00
operating at 100M full duplex mode
ping failed; host 10.1.0.128 is not alive
You need to set the IP address and MAC address
[u-boot@MINI2440]# setenv ipaddr 10.1.0.129
[u-boot@MINI2440]# setenv serverip 10.1.0.128
[u-boot@MINI2440]# setenv setenv ethaddr 12:34:56:78:9A:BC
[u-boot@MINI2440]# saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x4000000000002 -- 0% complete.
Writing to Nand... done
[u-boot@MINI2440]#
Previous article:u-boot-2009.08 transplanted on mini2440 to add nand flash function
Next article:u-boot-2009.08 transplanted on mini2440 to add LCD display function
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- MSP432 learning experience: system tick timer
- Introduce the factors to be considered in selecting DSP chips with examples
- Tektronix Industrial Application Standard and High-Speed Interface Test Solutions
- Ora Good Cat “chip replacement incident”: How big is the gap between the two chips?
- 【NUCLEO-L552ZE Review】+ Bluetooth communication experiment (1)
- Sigma-Delta ADC Digital Filter Types
- Explanation of the stack pointer register SP of msp430
- Qorvo at CES 2020: Innovative Solutions for 5G, IoT, Wi-Fi 6 and V2X
- dsp28335 Ecap Summary
- Motor drive control essence summary post