39
sof2flash --epcs --input=”your example.sof” --output= “your example
_HW
.flash”(3*)
Convert .flash file into .binary file
nios2-elf-objcopy –I srec –O binary “your example
_HW
.flash” “your example
_HW
.bin”
From the command shell navigate to where your ELF file is located and create your software
binary file using the following command
nios2-elf-objcopy –O binary “your example.elf” “your example
_SW
.bin ”(4,5*)
Create a new subdirectory and name it what you would like the title of your application to be
shown as in the application selector
Using an SD Card reader, copy the directory onto an SD Card into a directory named
“Application_Selector”. The directory structure on the SD Card should look like this:
Application_Selector\<Name of Application>\{<elf_name>_SW.bin;<sof_name>_HW.bin}
Place the SD Card in the tPad board, and switch on the power. The Application Selector will
start up, and you will now see your application appear as one of the selections
Note:
(1).You may not need a CFI Flash controller when your design does not contain a Nios II
processor or you store your software code within the on-chip memory and use the .hex
initialization file.
(2).If you would like to use other memories such as SRAM or SDRAM as the program memory,
you may need to perform two steps to convert your .elf file into .bin file to make the software
properly run on tPad. The commands seem to look like this:
elf2flash
--base=flash_base_address
--end=flash_end_address
--reset=flash_base_address
--input="<your
software
name>.elf"
--output="<your
software
name>.flash"
--boot="$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_cfi.srec"
nios2-elf-objcopy –I srec –O binary <your software name>.flash <your software name>_SW.bin
(3).You may pad a --compress option for saving binary image space because the Cyclone IV E
series support the decompress feature while loading hardware image from EPCS device.
(4).The command will use the default HAL boot loader and link it to the .text section.
(5).You can also use the tool „bin_demo_batch‟ to convert your sof and elf to bin. Copy ”your
example.sof” and “your example.elf” to the bin_demo_batch folder, rename them to test.sof,
test.elf, execute the test.bat, then the final test_HW.bin and test_SW.bin are your target files.