NEEK 烧录flash 方法
--yw—2010.03.14
本篇所述的方法可进行对界面的修改,烧录flash,达到移植的目的。
一、 进行界面调试
1. 运行一系列命令
1).Create a BSP
a. 切换到 application_selector/
software_examples/
bsp/
ucosii_application_selector
b. Run the command ./create_this_bsp.
生成的一大堆文件:如下图所示
2)Build the project
a.切换到 application_selector/
software_examples/
app/
application_selector
b. Run the command make all.
3)Build the boot code
a.切换到 application_selector/
application_utilities/
app_selector_boot_code
b. Run the command make.
2. 新建NIOS新建工程 并import app 文件夹
1)新建工程 application_selector
2)Import 工程app 文件夹
3. 修改调试的文件
4. 重新执行1.运行一系列命令
5. 将硬件.sof 下载到硬件上
6. 将import 的内容下载到硬件中调试
实际上是对其中的.elf 文件进行操作
7. 界面已发生变化,成功!
二、调试结果的烧录(FOR SD CARD)
1. 将 .sof 和 .elf 文件拷贝到flash_file_conversion_script文件夹下中(含有 .eek.sh、eek_rc.sh文件)
2. 执行命令 ./eek.sh <elf_file>.elf <sof_file>.sof
(eek_rc.sh文件,与以太网相关)
3. 生成两个flash 文件,一个xx_sw.flash 一个xx_hw.flash
4. 新建文件夹,将xx_sw.flash和xx_hw.flash 文件 拷入文件夹中,存入SD 存入卡中
二、调试结果的烧录(FOR FLASH )
Rebuilding the Application Selector from Source Files
从源文件中重建应用程序选择器
CFI flash 内存地址分配:
1. Boot Code
The first portion of the factory recovery image is the application bootcode, located at flash offset 0x0. 编译之后产生的文件(包含启动的相关信息)。
Building the boot code produces a file named app_selector_boot_code.srec.
2. Hardware Image Catalog
The hardware image catalog section of flash is located at offset 0x8000.
To erase this section of flash, enter the command:
nios2-flash-programmer --base=0x4000000 –-erase 0x8000+0x8000
After erasing this section, you may wish to read back the erased contents into a file, so that you can combine this file into the final factory recover image. The command to read back this section into a file named
catalog.srec is:
nios2-flash-programmer --base=0x4000000 –read catalog.flash
--read-bytes 0x8000+0x8000
3. Application Selector Hardware Image
This section is located at flash offset 0x20000
sof2flash --activeparallel --offset=0x20000 --input= cycloneIII_embedded_evaluation_kit _application_selector.sof --output=
appsel_hw.flash
4. Application Selector Software Image
in the application selector software project directory
This section is located at flash offset 0x100000.
make flash
5. Combining factory recovery image files
Once you’ve created flash (or srec) files for all the sections of the factory recovery image, you can combine them all into one file using the cat
command:
cat app_selector_boot_code.srec catalog.flash appsel_hw.flash
ext_flash.flash > temp_restore.flash
However, you are still not done. Some of the individual files we combined contained non-data records in them. Some non-data records, such as “S0” records cannot appear anywhere in an SREC file except for the beginning,
so you want to remove all the non-data records from the final factory recovery image. Data record types, are S1, S2, and S3, so you want to remove all the other types of records (S0, S5, S7, S8, and S9).You can use the command “sed” to perform this task. Use the following command to remove all non-data records from the new factory recovery image file:
sed '/^S[05789]/ d' temp_restore.flash >restore_cycloneIII_3c25.flash
You can now restore the Embedded Evaluation Kit board to its factory
state by running the command
nios2-flash-programmer --base=0x4000000 restore_cycloneIII_3c25.flash
Nios II Command Shell:
Nios IDE 终端窗口
存在问题:
1. 重新上电之后,无显示,只有烧入之后,按cpu reset 键才有显示
2. Load 不好用
分析原因:可能是flash地址写入的问题,写的有错。