亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

TQ2440裸板更新程序_update

系統(tǒng) 1680 0

以前的裸板程序都是通過u-boot下載到內(nèi)存運行,今天實現(xiàn)更新程序update,程序運行時會輸出一個菜單供選擇。

系統(tǒng):ubuntu 10.04.4
單板:tq2440
編譯器:arm-linux-gcc-4.3.2
搭建開發(fā)環(huán)境詳見ubuntu 10.04.4開發(fā)環(huán)境配置。

目標:實現(xiàn)自我更新程序,串口輸出菜單,有以下·功能供選擇

*********************************
update program with serial port
The board:TQ2440
The NAND:K9F1216U0A 256MB
The NOR:EN29LV160AB 2MB
The SRAM:HY57V561620 x2 64MB
The NET:DM9000AEP
? ? ? ? ? ? ? ? ?date: 2013.4.26
***********************************
the menu of the update programe:
[w] write the nand flash
[r] read the nand flash
[e] erase the nand flash
[g] get file, and write to nand flash 0 block
[x] get file to ddr(0x32000000), run it
[s] reset the programe
Please enter the chose:

一、編寫源代碼

根據(jù)s3c2440手冊編寫代碼,包括文件:start.S init.c main.c boot.lds Makefile

文件start.S:

?

    #define S3C2440_MPLL_200MHZ     ((0x5c<<12)|(0x01<<4)|(0x02))

#define MEM_CTL_BASE    	0x48000000



.text

.global	_start

_start:	

	/*1.關(guān)看門狗*/

	ldr r0, =0x53000000

	mov r1, #0

	str r1, [r0]

	

	/*2.設(shè)置時鐘*/

	ldr r0, =0x4c000014

	mov r1, #0x03

	str r1, [r0]



	/* 如果HDIVN非0,CPU的總線模式應(yīng)該從“fast bus mode”變?yōu)椤癮synchronous bus mode” */

	mrc	p15, 0, r1, c1, c0, 0		/* 讀出控制寄存器 */ 

	orr	r1, r1, #0xc0000000		/* 設(shè)置為“asynchronous bus mode” */

	mcr	p15, 0, r1, c1, c0, 0		/* 寫入控制寄存器 */



	/* MPLLCON = S3C2440_MPLL_200MHZ */

	ldr r0, =0x4c000004

	ldr r1, =S3C2440_MPLL_200MHZ

	str r1, [r0]



	/*3.初始化SDRAM*/

	ldr r0, =MEM_CTL_BASE

	adr r1, sdram_config			/*當前地址*/

	add r3, r0, #(13*4)

1:	

	ldr r2, [r1], #4

	str r2, [r0], #4

	cmp r0 ,r3

	bne 1b



	/*4.重定位:把bootloader本身代碼從flash復(fù)制到他的鏈接地址*/

	ldr sp, =0x34000000



	bl nand_init

	

	mov r0, #0

	ldr r1, =_start

	ldr r2, =__bss_start

	sub r2 ,r2, r1

	

	bl copy_code_to_sdram

	bl clear_bss

	/*5.執(zhí)行main*/

	//bl main

	ldr lr, =halt

	ldr pc, =main



halt:

	b halt

	

sdram_config:



	.long 0x22011110	 //BWSCON

	.long 0x00000700	 //BANKCON0

	.long 0x00000700	 //BANKCON1

	.long 0x00000700	 //BANKCON2

	.long 0x00000700	 //BANKCON3

	.long 0x00000700	 //BANKCON4

	.long 0x00000700	 //BANKCON5

	.long 0x00018005	 //BANKCON6

	.long 0x00018005	 //BANKCON7

	.long 0x008C04F4	 // REFRESH

	.long 0x000000B1	 //BANKSIZE

	.long 0x00000030	 //MRSRB6

	.long 0x00000030	 //MRSRB7
  

文件init.c:

?

?

    /* NAND FLASH控制器 */

#define NFCONF (*((volatile unsigned long *)0x4E000000))

#define NFCONT (*((volatile unsigned long *)0x4E000004))

#define NFCMMD (*((volatile unsigned char *)0x4E000008))

#define NFADDR (*((volatile unsigned char *)0x4E00000C))

#define NFDATA (*((volatile unsigned char *)0x4E000010))

#define NFSTAT (*((volatile unsigned char *)0x4E000020))



/* GPIO */

#define GPHCON              (*(volatile unsigned long *)0x56000070)

#define GPHUP               (*(volatile unsigned long *)0x56000078)



/* UART registers*/

#define ULCON0              (*(volatile unsigned long *)0x50000000)

#define UCON0               (*(volatile unsigned long *)0x50000004)

#define UFCON0              (*(volatile unsigned long *)0x50000008)

#define UMCON0              (*(volatile unsigned long *)0x5000000c)

#define UTRSTAT0            (*(volatile unsigned long *)0x50000010)

#define UFSTAT0             (*(volatile unsigned long *)0x50000018)

#define UTXH0               (*(volatile unsigned char *)0x50000020)

#define URXH0               (*(volatile unsigned char *)0x50000024)

#define UBRDIV0             (*(volatile unsigned long *)0x50000028)



#define TXD0READY   (1<<2)





void nand_read(unsigned int nand_start, unsigned int ddr_start, unsigned int len);

int isBootFromNorFlash(void)

{

  volatile int *p = (volatile int *)0;

  int val;

  

  val = *p;

  *p = 0x12345678;

  if (*p == 0x12345678)

    {

      /*寫成功,是nand啟動*/

      *p = val;

      return 0;

    }

  else

    {

      /*Nor不能像內(nèi)存一樣寫*/

      return 1;

}

}

void copy_code_to_sdram(unsigned int src, unsigned int dest, unsigned int len)

{

  int i = 0;

  unsigned char *src_start = (unsigned char *)src;

  unsigned char *dest_start = (unsigned char *)dest;

  /*如果是Nor啟動*/

  if(isBootFromNorFlash())

    {

      while (i < len)

	{

	  //dest[i] = src[i];

	  dest_start[i] = src_start[i];

	  i++;

	}  

    }

  else

    {

      //nand_init();

      //nand_resd(src, dest, len)

      nand_read(src, dest, len);

    }

}



void clear_bss(void)

{

       extern int __bss_start, __bss_end;

	int *p = &__bss_start;

	

	for (; p < &__bss_end; p++)

		*p = 0;

}



void nand_select(void)

{

  NFCONT &= ~(1<<1);	

}



void nand_deselect(void)

{

  NFCONT |= (1<<1);	

}



void nand_cmd(unsigned char cmd)

{

  volatile int i;

  NFCMMD = cmd;

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

}



void nand_addr(unsigned int addr)

{

	unsigned int col  = addr % 2048;

	unsigned int page = addr / 2048;

	volatile int i;



	NFADDR = col & 0xff;

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

	NFADDR = (col >> 8) & 0xff;

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

	

	NFADDR  = page & 0xff;

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

	NFADDR  = (page >> 8) & 0xff;

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

	NFADDR  = (page >> 16) & 0xff;

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

}



void wait_ready(void)

{

	while (!(NFSTAT & 1));

}



unsigned char nand_get_data(void)

{

	return NFDATA;

}



void nand_send_data(unsigned char data)

{

  	NFDATA = data;

}



void nand_reset(void)

{

  /* 選中 */

  nand_select();



  /* 發(fā)出0xff命令 */

  nand_cmd(0xff);



  /* 等待就緒 */

  wait_ready();



  /* 取消選中 */

  nand_deselect();

}



void nand_read(unsigned int nand_start, unsigned int ddr_start, unsigned int len)

{

	unsigned int addr = nand_start;

	int col = addr % 2048;

	int i = 0;

	unsigned char *dest = (unsigned char *)ddr_start;

	

	/* 1. 選中 */

	nand_select();

	while (i < len)

	{

		/* 2. 發(fā)出讀命令00h */

		nand_cmd(0x00);



		/* 3. 發(fā)出地址(分5步發(fā)出) */

		nand_addr(addr);



		/* 4. 發(fā)出讀命令30h */

		nand_cmd(0x30);



		/* 5. 判斷狀態(tài) */

		wait_ready();



		/* 6. 讀數(shù)據(jù) */

		for (; (col < 2048) && (i < len); col++)

		{

			dest[i] = nand_get_data();

			i++;

			addr++;

		}

		

		col = 0;

	}



	/* 7. 取消選中 */		

	nand_deselect();

}



void nand_erase_block(unsigned long addr)

{

  int page = addr / 2048;

  

  nand_select();

  nand_cmd(0x60);

  

  nand_addr(page & 0xff);

  nand_addr((page >> 8) & 0xff);

  nand_addr((page >> 16) & 0xff);



  nand_cmd(0xd0);

  wait_ready();



  nand_deselect();

}





void nand_write(unsigned int nand_start, unsigned char * buf, unsigned int len)

{

  unsigned long count = 0;

  unsigned long addr  = nand_start;

  int i = nand_start % 2048;

  //int left = i;

  

  nand_select();

  while (count < len)

    {

      nand_cmd(0x80);

      nand_addr(addr);

      //for (; i < (2048-left) && count < len; i++)

      for (; i < 2048 && count < len; i++)

	{

	  /*if(addr<16384)//寫前2K

	    {

	      if(i<(2048-left))//前2頁每頁只能寫2K

		{

		  nand_send_data(buf[count++]);

		}

	    }

	  else

	    {

	      nand_send_data(buf[count++]);

	      }*/

	  nand_send_data(buf[count++]);

	  addr++;

	}



      nand_cmd(0x10);

      wait_ready();

      i = 0;

      //left = i;

    }



  nand_deselect();

  

}

void nand_init(void)

{

#define TACLS   0

#define TWRPH0  1

#define TWRPH1  0

  /* 設(shè)置時序 */

  NFCONF = (TACLS<<12)|(TWRPH0<<8)|(TWRPH1<<4);

  /* 使能NAND Flash控制器, 初始化ECC, 禁止片選 */

  NFCONT = (1<<4)|(1<<1)|(1<<0);



  nand_reset();	

}



#define PCLK            50000000    // init.c中的clock_init函數(shù)設(shè)置PCLK為50MHz

#define UART_CLK        PCLK        //  UART0的時鐘源設(shè)為PCLK

#define UART_BAUD_RATE  115200      // 波特率

#define UART_BRD        ((UART_CLK  / (UART_BAUD_RATE * 16)) - 1)



#define ENABLE_FIFO 



static void delay(void)

{

  volatile int i = 10;

  while (i--);

}

/*

 * 初始化UART0

 * 115200,8N1,無流控

 */

void uart0_init(void)

{

    GPHCON  |= 0xa0;    // GPH2,GPH3用作TXD0,RXD0

    GPHUP   = 0x0c;     // GPH2,GPH3內(nèi)部上拉



    ULCON0  = 0x03;     // 8N1(8個數(shù)據(jù)位,無較驗,1個停止位)

    UCON0   = 0x05;     // 查詢方式,UART時鐘源為PCLK

    #ifdef ENABLE_FIFO

	UFCON0 = 0x07; /* FIFO enable */

    #else

	UFCON0 = 0x00; /* FIFO disable */

    #endif

    UMCON0  = 0x00;     // 不使用流控

    UBRDIV0 = UART_BRD; // 波特率為115200

}



/*

 * 發(fā)送一個字符

 */

void putc(unsigned char c)

{

    /* 等待,直到發(fā)送緩沖區(qū)中的數(shù)據(jù)已經(jīng)全部發(fā)送出去 */

    //while (!(UTRSTAT0 & TXD0READY));

    #ifdef ENABLE_FIFO

    	while (UFSTAT0 & (1<<14))delay();

    #else

    	while ((UTRSTAT0 & (1<<2)) == 0);

#endif   

    /* 向UTXH0寄存器中寫入數(shù)據(jù),UART即自動將它發(fā)送出去 */

    UTXH0 = c;

}

/*

 * 接收字符

 */

unsigned char getc(void)

{

    /* 等待,直到接收緩沖區(qū)中的有數(shù)據(jù) */

    //while (!(UTRSTAT0 & RXD0READY));

    #ifdef ENABLE_FIFO

    	while ((UFSTAT0 & (1<<6)) == 0 && (UFSTAT0 & 0x3f) == 0)delay();

    #else

    	while ((UTRSTAT0 & (1<<0)) == 0);

#endif   

    /* 直接讀取URXH0寄存器,即可獲得接收到的數(shù)據(jù) */

    return URXH0;

}



int getc_nowait(unsigned char *pChar)

{

#ifdef ENABLE_FIFO

  if ((UFSTAT0 & (1<<6)) == 0 && (UFSTAT0 & 0x3f) == 0)

#else

    if ((UTRSTAT0 & (1<<0)) == 0)

#endif

      {

	return -1;

      }

    else

      {

	*pChar = URXH0;

	return 0;

      }

}



void puts(char *str)

{

	int i = 0;

	while (str[i])

	{

		putc(str[i]);

		i++;

	}

}



void puthex(unsigned int val)

{

  /* 0x1234abcd */

  int i;

  int j;



  puts("0x");



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

    {

      j = (val >> ((7-i)*4)) & 0xf;

      if ((j >= 0) && (j <= 9))

	putc('0' + j);

      else

	putc('A' + j - 0xa);



    }



}

void putbyte(unsigned char val)

{

  /* 0x1234abcd */

  int i;

  int j;



  puts("0x");



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

    {

      j = (val >> ((1-i)*4)) & 0xf;

      if ((j >= 0) && (j <= 9))

	putc('0' + j);

      else

	putc('A' + j - 0xa);



    }



}


  

文件main.c:

?

?

    extern void uart0_init(void);

extern void nand_read(unsigned int nand_start, unsigned int ddr_start, unsigned int len);

extern void putc(char c);

extern void puts(char *str);

extern void puthex(unsigned int val);

extern unsigned char getc(void);

extern int getc_nowait(unsigned char *pChar);

extern void putbyte(unsigned char val);

extern void nand_erase_block(unsigned long addr);

extern void nand_write(unsigned int nand_start, unsigned char * buf, unsigned int len);



int strlen(char *str)

{

	int i = 0;

	while (str[i])

	{

		i++;

	}

	return i;

}

void nand_write_test(void)

{

  char buf[20] = {"abcd1234ABCD"};

  unsigned long addr;

  unsigned long size;

  

  puts("enter the start address:0x80000 ");

  //scanf("%s", buf);

  //addr = strtoul(buf, NULL, 0);

  addr = 0x80000;

  puts("enter the string:abcd1234ABCD ");

  //scanf("%s", buf);

  size = strlen(buf) + 1;

  puts(" size= ");

  puthex(size);

  puts("\n\r");

  nand_write(addr, buf, size);

  

}



void nand_read_test(void)



{

  int i;

  char buf[100];

  unsigned long addr;

  unsigned long size;

 

  puts("enter the start address: 0x80000");



  //scanf("%s", buf);



  //addr = strtoul(buf, NULL, 0);

  addr = 0x80000;

  //puts("read addr = 0x%x\n\r", addr);



  puts("enter the size: 0x60");



  //scanf("%s", buf);

  //size = strtoul(buf, NULL, 0);

  size = 0x60;



  if (size > 100)

    {

      puts("the max size is 100\n\r");

      size = 100;

    }

  nand_read(addr, buf, size);



  puts("datas: \n\r");

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

    {

      // printf("%02x ", buf[i]);

      putbyte(buf[i]);

      puts("\t");

      if ((i+1) % 8 == 0)

	{

	  puts("\n\r");

	}

    }

  puts("\n\r");

}



void nand_erase_test(void)

{

  //char buf[100];

  unsigned long addr;

  

  puts("enter the start address: ");

  //scanf("%s", buf);

  //addr = strtoul(buf, NULL, 0);

  addr = 0x80000;

  puts("erase addr = ");

  puthex(addr);

  puts("\n\r");

  nand_erase_block(addr);

  

}



void update_program(void)

{

  unsigned char *buf = (unsigned char *)0x32000000;

  //unsigned char *buf = (unsigned char *)0xD0036000;

  unsigned long len = 0;

  int have_begin = 0;

  int nodata_time = 0;

  unsigned long erase_addr;

  char c;

  int i;



  /* 璇諱覆鍙h幏寰楁暟鎹?*/

  puts("\n\ruse V2.2.exe/gtkterm to send file\n\r");

  while (1)

    {

      if (getc_nowait(&buf[len]) == 0)

	{

	  have_begin = 1;

	  nodata_time = 0;

	  len++;

	}

      else

	{

	  if (have_begin)

	    {

	      nodata_time++;

	    }

	}



      if (nodata_time == 1000)

	{

	  break;

	}

    }

  puts("\n\rhave get data:");

  puthex(len);

  puts(" bytes\n\r");

  puts("the first 16 bytes data: \n\r");

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

    {

      // put("%02x ", buf[i]);

      putbyte(buf[i]);

      puts("\t");

    }

  puts("\n\r");



  puts("Press Y to program the flash: \n\r");



  c = getc();

  putc(c);

  puts("\n\r");

  if (c == 'y' || c == 'Y')

    {

      /* 鐑у啓鍒皀and flash block 0 */

      for (erase_addr = 0; erase_addr < ((len + 0x1FFFF) & ~0x1FFFF); erase_addr += 0x20000)

	{

	  nand_erase_block(erase_addr);

	}

      nand_write(0, buf, len);

      

      puts("update program successful\n\r");

    }

  else

    {

      puts("Cancel program!\n\r");

    }

}



void run_program(void)

{

  unsigned char *buf = (unsigned char *)0x32000000;

  //unsigned char *buf = (unsigned char *)0xD0036000;

  unsigned long len = 0;

  int have_begin = 0;

  int nodata_time = 0;

  void (*theProgram)(void);

  int i;

  /* 璇諱覆鍙h幏寰楁暟鎹?*/

  puts("\n\r use gtkterm to send file\n\r");

  while (1)

    {

      if (getc_nowait(&buf[len]) == 0)

	{

	  have_begin = 1;

	  nodata_time = 0;

	  len++;

	}

      else

	{

	  if (have_begin)

	    {

	      nodata_time++;

	    }

	}



      if (nodata_time == 10000)

	{

	  break;

	}

    }

  //printf("have get %d bytes data\n\r", len);

  puts("\n\r have get data:");

  puthex(len);

  puts(" bytes\n\r");

  puts("the first 16 bytes data: \n\r");

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

    {

      // put("%02x ", buf[i]);                                                                     

      putbyte(buf[i]);

      puts("\t");

      //putc('\0');

    }

  puts("\n\r");

  puts("jump to 0x32000000 to run it\n\r");

  

  theProgram = (void (*)(void))0x32000000;



  theProgram();

}



int main(void)

{

  char c;



  uart0_init();



  puts("\n\r*********************************\n\r");

  puts("update program with serial port\n\r");

  puts("The board:TQ2440\n\r");

  puts("The NAND:K9F1216U0A 256MB\n\r");

  puts("The NOR:EN29LV160AB 2MB\n\r");

  puts("The SRAM:HY57V561620 x2 64MB\n\r");

  puts("The NET:DM9000AEP\n\r");

  puts("                 date: 2013.4.26\n\r");

  puts("***********************************\n\r");



  while (1)

    {

      puts("the menu of the update programe:\n\r");

      puts("[w] write the nand flash\n\r");

      puts("[r] read the nand flash\n\r");

      puts("[e] erase the nand flash\n\r");

      puts("[g] get file, and write to nand flash 0 block\n\r");

      puts("[x] get file to ddr(0x32000000), run it\n\r");

      puts("[s] reset the programe\n\r");

      puts("Please enter the chose:\n\r");



      do {

	c = getc();

	if (c == '\n' || c == '\r')

	  {

	    puts("\n\r");

	  }

	else

	  {

	    putc(c);

	  }

      } while (c == '\n' || c == '\r');

      

      switch (c)

	{

	case 'w':

	case 'W':

	  {

	    nand_write_test();

	    break;

	  }



	case 'r':

	case 'R':

	  {

	    nand_read_test();

	    break;

	  }



	case 'e':

	case 'E':

	  {

	    nand_erase_test();

	    break;

	  }



	case 'g':

	case 'G':

	  {

	    update_program();

	    break;

	  }



	case 'x':

	case 'X':

	  {

	    run_program();

	    break;

	  }



	case 's':

	case 'S':

	  {

	    void (*theProgram)(void);

	    theProgram = (void (*)(void))0x33f80000;

	    theProgram();

	    break;

	  }

	

	}

    }



  return 0;

}


  

文件boot.lds:

?

?

    SECTIONS {

    . = 0x33f80000;

    .text : { *(.text) }

    

    . = ALIGN(4);

    .rodata : {*(.rodata*)} 

    

    . = ALIGN(4);

    .data : { *(.data) }

    

    . = ALIGN(4);

    __bss_start = .;

    .bss : { *(.bss)  *(COMMON) }

    __bss_end = .;

}




  

文件Makefile:

?

?

    CC      = arm-linux-gcc

LD      = arm-linux-ld

AR      = arm-linux-ar

OBJCOPY = arm-linux-objcopy

OBJDUMP = arm-linux-objdump



CFLAGS 		:= -Wall -O2

CPPFLAGS   	:= -nostdinc -nostdlib -fno-builtin



objs := start.o init.o main.o



update.bin: $(objs)

	${LD} -Tboot.lds -o boot.elf $^

	${OBJCOPY} -O binary -S boot.elf $@

	${OBJDUMP} -D -m arm boot.elf > update.dis



%.o:%.c

	${CC} $(CPPFLAGS) $(CFLAGS) -c -o $@ $<



%.o:%.S

	${CC} $(CPPFLAGS) $(CFLAGS) -c -o $@ $<



clean:

	rm -f *.o *.bin *.elf *.dis




  

二、編譯源代碼

?

change@change:~$ cd Si/TQ2440/update/
change@change:~/Si/TQ2440/update$ make clean
rm -f *.o *.bin *.elf *.dis
change@change:~/Si/TQ2440/update$ ls
boot.lds ?init.c ?main.c ?Makefile ?start.S
change@change:~/Si/TQ2440/update$ make
arm-linux-gcc -nostdinc -nostdlib -fno-builtin -Wall -O2 -c -o start.o start.S
arm-linux-gcc -nostdinc -nostdlib -fno-builtin -Wall -O2 -c -o init.o init.c
arm-linux-gcc -nostdinc -nostdlib -fno-builtin -Wall -O2 -c -o main.o main.c
main.c: In function 'nand_write_test':
main.c:38: warning: pointer targets in passing argument 2 of 'nand_write' differ in signedness
main.c: In function 'nand_read_test':
main.c:69: warning: passing argument 2 of 'nand_read' makes integer from pointer without a cast
arm-linux-ld -Tboot.lds -o boot.elf start.o init.o main.o
arm-linux-objcopy -O binary -S boot.elf update.bin
arm-linux-objdump -D -m arm boot.elf > update.dis
change@change:~/Si/TQ2440/update$ cp update.bin /home/change/work/tftpboot/
change@change:~/Si/TQ2440/update$

三、燒寫、測試

單板從NOR flash啟動,用u-boot下載上面編譯的程序update.bin到NAND Flash

U-Boot 1.1.6 (Mar 24 2012 - 03:44:51)


DRAM: ?64 MB
Flash: ?2 MB
NAND: ?256 MiB
In: ? ?serial
Out: ? serial
Err: ? serial
Hit any key to stop autoboot: ?0?
TQ2440 # set ipaddr 172.16.1.133
TQ2440 # set gatewayip 172.16.1.1
TQ2440 # set serverip 172.16.1.131
TQ2440 # tftp 0x32000000 update.bin
dm9000 i/o: 0x20000000, id: 0x90000a46?
MAC: 00:80:00:80:00:80
could not establish link
TFTP from server 172.16.1.131; our IP address is 172.16.1.133
Filename 'update.bin'.
Load address: 0x32000000
Loading: ##
done
Bytes transferred = 5136 (1410 hex)
TQ2440 # nand erase 0 0x40000


NAND erase: device 0 offset 0x0, size 0x40000
Erasing at 0x20000 -- 100% complete.
OK
TQ2440 # nand write 0x32000000 0 0x40000


NAND write: device 0 offset 0x0, size 0x40000
?262144 bytes written: OK
TQ2440 # save
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
TQ2440 #?

程序燒寫完畢,接著單板斷電從NAND啟動,設(shè)置串口115200 8 n 1輸出如下:

*********************************
update program with serial port
The board:TQ2440
The NAND:K9F1216U0A 256MB
The NOR:EN29LV160AB 2MB
The SRAM:HY57V561620 x2 64MB
The NET:DM9000AEP
? ? ? ? ? ? ? ? ?date: 2013.4.26
***********************************
the menu of the update programe:
[w] write the nand flash
[r] read the nand flash
[e] erase the nand flash
[g] get file, and write to nand flash 0 block
[x] get file to ddr(0x32000000), run it
[s] reset the programe
Please enter the chose:

下面開始用串口v2.2.exe測試更新程序:

*********************************
update program with serial port
The board:TQ2440
The NAND:K9F1216U0A 256MB
The NOR:EN29LV160AB 2MB
The SRAM:HY57V561620 x2 64MB
The NET:DM9000AEP
? ? ? ? ? ? ? ? ?date: 2013.4.26
***********************************
the menu of the update programe:
[w] write the nand flash
[r] read the nand flash
[e] erase the nand flash
[g] get file, and write to nand flash 0 block
[x] get file to ddr(0x32000000), run it
[s] reset the programe
Please enter the chose:

手動發(fā)送g
g
use V2.2.exe/gtkterm to send file

選擇要發(fā)送的程序文件eg:boot.bin,并發(fā)送文件
have get data:0x000008BC bytes
the first 16 bytes data:?
0x530x04 0xA00xE3 0x000x10 0xA00xE3 0x000x10 0x800xE5 0x980x00 0x9F0xE5

Press Y to program the flash:?
y

此時需謹慎,手動發(fā)送y,會擦除以前的程序,向NAND寫新的程序
update program successful

這表明程序更新完畢,斷電重啟就會啟動上面發(fā)送文件程序,這里串口輸出如下:

Copy kernel from nand
0x1234ABCD
0x7D98ACBA
Set boot params
Boot kernel

測試OK,程序跑起來了。

?

TQ2440裸板更新程序_update


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 色视频亚洲 | 久久国产精品亚洲 | 老司机午夜在线视频免费 | 久久婷五月综合 | 99免费看 | 亚洲精品中文字幕久久久久久 | 思思91精品国产综合在线 | 永久久久免费浮力影院 | 狠狠色丁香婷婷综合小时婷婷 | 奇米影视在线观看 | 久久www免费人成高清 | 精品在线99| 手机看片一区二区 | 一级毛片老太婆交性欧美 | 狠狠成人 | 高清在线一区二区三区亚洲综合 | 亚洲国产成人91精品 | 免费国产一区二区在免费观看 | 中文字幕日韩在线一区国内 | 午夜男人 | 日日摸夜夜添夜夜添毛片 | 欧美freesex10一|3 | 成人看的一级毛片 | 在线亚洲精品 | 中文字幕视频在线免费观看 | 亚洲精品www久久久久久久软件 | 亚洲射图 | 国产剧情一区二区 | 涩涩在线观看 | 看全色黄大色黄大片色责看的 | 久久美剧免费在线观看 | 国产资源精品一区二区免费 | 夜夜夜夜夜夜爽噜噜噜噜噜噜 | 国产第一福利影院 | 亚洲国产精品ⅴa在线观看 亚洲国产精品aa在线看 | 国产亚洲精品一区999 | 亚洲欧美日本一区 | 久草美女视频 | xxx毛片| 久久天天躁狠狠躁夜夜呲 | 91久久青草精品38国产 |