Hardware platform: FL2440 (S3C2440) with linux kernel 2.6.35
Original work, please indicate the source when reprinting http://blog.csdn.net/yming0221/article/details/7211396
1. First download DNW for linux http://download.csdn.net/source/1011140
2. Unzip the file
、
3. Compile the host's USB driver
- make -C /lib/modules/`uname -r`/build M=`pwd` modules
Then install the driver with insmod and check with dmesg as follows
4. Modify the dnw.c file and compile
Since the FL2440 needs to set the initial address to 0x30800000 when burning the kernel, the modified file is as follows
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- const char* dev = "/dev/secbulk0";
- int main(int argc, char* argv[])
- {
- unsigned char* file_buffer = NULL;
- if( 2 != argc )
- {
- printf("Usage: dwn
\n"); - return 1;
- }
- int fd = open(argv[1], O_RDONLY);
- if(-1 == fd)
- {
- printf("Can not open file - %s\n", argv[1]);
- return 1;
- }
- struct stat file_stat;
- if( -1 == fstat(fd, &file_stat) )
- {
- printf("Get file size filed!\n");
- return 1;
- }
- file_buffer = (char*)malloc(file_stat.st_size+10);
- if(NULL == file_buffer)
- {
- printf("malloc failed!\n");
- goto error;
- }
- if( file_stat.st_size != read(fd, file_buffer+8, file_stat.st_size))
- {
- printf("Read file failed!\n");
- goto error;
- }
- printf("file name : %s\n", argv[1]);
- printf("file size : %d bytes\n", file_stat.st_size);
- int fd_dev = open(dev, O_WRONLY);
- if( -1 == fd_dev)
- {
- printf("Can not open %s\n", dev);
- goto error;
- }
- *((unsigned long*)file_buffer) = 0x30800000; //load address
- *((unsigned long*)file_buffer+1) = file_stat.st_size+10; //file size
- unsigned short sum = 0;
- int i;
- for(i=8; i
- {
- sum += file_buffer[i];
- }
- printf("Writing data...\n");
- size_t remain_size = file_stat.st_size+10;
- // size_t block_size = remain_size / 100;
- size_t block_size = 512;
- size_t writed = 0;
- while(remain_size>0)
- {
- size_t to_write = remain_size > block_size ? block_size:remain_size;
- if( to_write != write(fd_dev, file_buffer+writed, to_write))
- {
- printf("failed!\n");
- return 1;
- }
- remain_size -= to_write;
- writed += to_write;
- printf("\r%d%\t %d bytes ", writed*100/(file_stat.st_size+10), writed);
- fflush(stdout);
- }
- printf("OK\n");
- return 0;
- error:
- if(-1!=fd_dev) close(fd_dev);
- if(fd != -1) close(fd);
- if( NULL!=file_buffer )
- free(file_buffer);
- return -1;
- }
Finally burn the kernel
Previous article:ARM-Linux driver--ADC driver (interrupt mode)
Next article:ARM-Linux driver--MTD driver analysis (Part 3)
- 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
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- MSP430 G2553 Timer/Counter Timer_A
- DSP28027 SPI learning
- AWR1843BOOST mmw demo operation guide (Part 2)
- DHT11 temperature and humidity sensor, error File "dht.py", line 23, in measure
- Wafer Foundry
- RVB2601 drives MPU6050 gyroscope module
- Compile Linux firmware for Xunwei 3399 development board
- Compatibility Design Considerations for Mesh Topology in Wireless Mesh Networks
- It’s worth the wait, the STM32 video account and Bilibili account are now opened!
- Coaxial cable related information PDF