<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                如果沒有Nor FLASH的同學可以跳過這一章節,直接進行下一張節。如果遇到什么問題,一般都是你沒有定義那個宏之類的,這個問題可以很好的額解決。 修改norflash(nor fhash型號:JS28F320)的配置,把include/configs/fl2440.h中關于“Physical?Memory?Map”和“FLASH?and?environment?organization”的配置都刪掉,換成下面的配置: ~~~ - /*----------------------------------------------------------------------- ?* Physical Memory Map ?*/ #define CONFIG_NR_DRAM_BANKS1?? /* we have 1 bank of DRAM */ #define PHYS_SDRAM_10x30000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE0x04000000 /* 64 MB */ #define PHYS_FLASH_10x00000000 /* Flash Bank #1 */ #define CONFIG_SYS_FLASH_BASEPHYS_FLASH_1 #define CONFIG_SYS_MONITOR_BASE ? TEXT_BASE #define FLASH_BASE0_PRELIM ? ? ? ?PHYS_FLASH_1 /*----------------------------------------------------------------------- ?* FLASH and environment organization ?*/ #if 0 #define CONFIG_AMD_LV4001/* uncomment this if you have a LV400 flash */ #define CONFIG_AMD_LV8001/* uncomment this if you have a LV800 flash */ #endif #define CONFIG_SYS_MAX_FLASH_BANKS1/* max number of memory banks */ #define CONFIG_JS2_8F320?1 #define CONFIG_SYS_FLASH_PROTECTION ? 1 #define CONFIG_SYS_FLASH_SIZE ? ?0x00400000 ? ?/*4 MB*/ #define CONFIG_SYS_MAX_FLASH_SECT ? ?32 ? ? ? ? /*max number of sectors on one chip*/ /* timeout values are in ticks */ #define CONFIG_SYS_FLASH_ERASE_TOUT(2*CONFIG_SYS_HZ) /* Timeout for Flash Erase */ #define CONFIG_SYS_FLASH_WRITE_TOUT(2*CONFIG_SYS_HZ) /* Timeout for Flash Write */ #defineCONFIG_ENV_IS_IN_FLASH1 #define CONFIG_ENV_SIZE0x40000/* Total Size of Environment Sector,這是256K的環境變量儲存空間?*/ #define CONFIG_ENV_OFFSET ?0x100000 ?//在以后的內核分區中環境變量分區的OFFSET值要與此一致 #endif/* __CONFIG_H */ ~~~ 修改board/samsung/fl2440/lowlevel_init.S文件中SDARM刷新參數 ~~~ #define?REFCNT???1258 ~~~ 修改flash型號相關文件,用board/cmi/flash.c文件替換board/samsung/ofl2440/flash.c文件,使uboot支持Intel的JS28F320型號nor fhash. 打開board/samsung/fl2440/flash.c文件,修改: 1.把: ~~~ #define FLASH_BLOCK_SIZE??? ??? 0x00010000 ~~~ 改為: ~~~ #define FLASH_BLOCK_SIZE??? ????0x00020000 ~~~ 2.把聲明: ~~~ static ?int? ?write_short? ?(flash_info_t *info, ulong dest, ushort data);//并刪除這個函數體 改為: static ? ?int ? ? ?write_word ? ? (flash_info_t *info, ulong dest, ushort data);?? 1. 刪除write_buff和write_short兩個函數,用下面兩個函數代替: int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) { ? ?ulong cp, wp; ? ?ushort data; ? ?int l; ? ?int i, rc; ? ?wp = (addr & ~1); ? ? ? ?/* get lower word aligned address */ ? ?/* ? ? * handle unaligned start bytes ? ? */ ? ?if ((l = addr - wp) != 0) ? ?{ ? ? ? data = 0; ? ? ? for (i=0, cp=wp; i<l; ++i, ++cp) { ? ? ? ?data = (data >> 8) | (*(uchar *)cp << 8); ? ? ? } ? ? ? for (; i<2 && cnt>0; ++i) { ? ? ?data = (data >> 8) | (*src++ << 8); ? ? ?--cnt; ? ? ?++cp; ? ? ? } ? ? ? for (; cnt==0 && i<2; ++i, ++cp) { ? ? ?data = (data >> 8) | (*(uchar *)cp << 8); ? ? ? } ? ? ? if ((rc = write_word(info, wp, data)) != 0) { ? ? ?return (rc); ? ? ? } ? ? ? wp += 2; ? ?} ? ?/* ? ? * handle word aligned part ? ? */ ? ?while (cnt >= 2) { ? ? ? data = *((vu_short*)src); ? ? ? if ((rc = write_word(info, wp, data)) != 0) { ? ? ? return (rc); ? ? ? } ? ? ? src += 2; ? ? ? wp ?+= 2; ? ? ? cnt -= 2; ? ?} ? ?if (cnt == 0) { ? ? ? return ERR_OK; ? ?} ? ?/* ? ? * handle unaligned tail bytes ? ? */ ? ?data = 0; ? ?for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) { ? ? ? data = (data >> 8) | (*src++ << 8); ? ? ? --cnt; ? ?} ? ?for (; i<2; ++i, ++cp) { ? ? ? data = (data >> 8) | (*(uchar *)cp << 8); ? ?} ? ?return write_word(info, wp, data); } /* ?* Write 16 bit (short) to flash ?*/ static int write_word (flash_info_t *info, ulong dest, ushort data) { ? ?vu_short *addr = (vu_short *)dest, val; ? ?int rc = ERR_OK; ? ?int flag; ? ?/* Check if Flash is (sufficiently) erased , fix by kavin*/ ? ?if ((*addr & data) != data) ? ? ? return ERR_NOT_ERASED; ? ?/* ? ? * Disable interrupts which might cause a timeout ? ? * here. Remember that our exception vectors are ? ? * at address 0 in the flash, and we don't want a ? ? * (ticker) exception to happen while the flash ? ? * chip is in programming mode. ? ? */ ? ?flag = disable_interrupts(); ? ?/* clear status register command */ ? ?*addr = 0x50; ? ?/* program set-up command */ ? ?*addr = 0x40; ? ?/* latch address/data */ ? ?*addr = data; ? ?/* arm simple, non interrupt dependent timer */ ? ?reset_timer_masked(); ? ?/* wait while polling the status register */ ? ?while(((val = *addr) & 0x80) != 0x80) ? ?{ ? ? ? if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) { ? ? ? rc = ERR_TIMOUT; ? ? ? /* suspend program command */ ? ? ? *addr = 0xB0; ? ? ? goto outahere; ? ? ? } ? ?} ? ?if(val & 0x1A) { ? ? ? ?/* check for error */ ? ? ? printf("\nFlash write error %02x at address %08lx\n", ? ? ? ? ? ?(int)val, (unsigned long)dest); ? ? ? if(val & (1<<3)) { ? ? ?printf("Voltage range error.\n"); ? ? ?rc = ERR_PROG_ERROR; ? ? ?goto outahere; ? ? ? } ? ? ? if(val & (1<<1)) { ? ? ?printf("Device protect error.\n"); ? ? ?rc = ERR_PROTECTED; ? ? ?goto outahere; ? ? ? } ? ? ? if(val & (1<<4)) { ? ? ?printf("Programming error.\n"); ? ? ?rc = ERR_PROG_ERROR; ? ? ?goto outahere; ? ? ? } ? ? ? rc = ERR_PROG_ERROR; ? ? ? goto outahere; ? ?} outahere: ? ?/* read array command */ ? ?*addr = 0xFF; ? ?if (flag) ? ? ? enable_interrupts(); ? ?return rc; } ~~~ 到目前為止我們還不能用tftp來下載文件,因為我們還沒有移植DM9000網卡。 至此,uboot就能完會支持從nor flash啟動,編譯生成新的u-boot.bin并通過DNW的USB線下載到SDRAM中運行,便可看到u-boot檢測到了我們的flash。用flinfo命令可以看 到具體的塊信息,還可以用flash的各種命令對flash進行操作,從而實現這塊nor flash驅動的完全支持。燒寫當然也是沒問題的了,把需要燒寫的文件下載到SDRAM中后,用cp.b命令就可以了。 下面大該分析一下這個驅動文件的函數調用,此flash.c文件中有如下幾個函數: ~~~ static ulong? flash_get_size ??? ??? (vu_short *addr, flash_info_t *info); static void ??? flash_get_offsets ??? (ulong base, flash_info_t *info); static int??????? write_word (flash_info_t *info, ulong dest, ushort data) unsigned long flash_init (void) void flash_print_info? (flash_info_t *info) int flash_erase (flash_info_t *info, int s_first, int s_last) int flash_real_protect(flash_info_t *info, long sector, int prot) int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt) ~~~ 1.u-boot啟動只會用到flash.c文件中的flash_init函數,正如上面所述; 2.以static修飾的3個函數只在flash.c文件中被調用; 3.最后面的4個函數會被/common/cmd_flash.c文件中的函數調用,以實現u-boot下的各種命令操作。 ?附:若用JLINK下載u-boot.bin到nor flash 中,需要把/include/configs/fl2440.h 中定義的以下這個宏注釋掉: ~~~ /*?#define CONFIG_SKIP_RELOCATE_UBOOT??? 1 ?*/ 注釋掉u-boo才能初始化CPU ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看