Altera_Forum
Honored Contributor
19 years agoBooting Nios2 from custom NV-RAM
I tried this question on comp.arch.fpga newsgroup - no answer. Here is probably a better place to ask.
Preface: When the Nios2 CPU reset vector points into Altera-provided CFI flash the SOPC Builder automatically adds following lines to the system ptf file: WIZARD_SCRIPT_ARGUMENTS { MAKE { MACRO { FLASH_FLASHTARGET_ALT_SIM_PREFIX = "$(FLASH_FLASHTARGET_TMP1:0=)"; FLASH_FLASHTARGET_TMP1 = "$(ALT_SIM_OPTIMIZE:1=RUN_ON_HDL_SIMULATOR_ONLY_)"; } MASTER cpu { MACRO { BOOT_COPIER = "boot_loader_cfi.srec"; CPU_CLASS = "altera_nios2"; CPU_RESET_ADDRESS = "0x0"; } } TARGET delete_placeholder_warning { flash { Command1 = "rm -f $(SIMDIR)/contents_file_warning.txt"; Is_Phony = "1"; Target_File = "do_delete_placeholder_warning"; } } TARGET flashfiles { flash { Command1 = "@echo Post-processing to create $(notdir $@)"; Command2 = "elf2flash --input=$(ELF) --flash= --boot=$(shell $(QUARTUS_ROOTDIR)/sopc_builder/bin/find_sopc_component_dir $(CPU_CLASS) $(QUARTUS_PROJECT_DIR))/$(BOOT_COPIER) --outfile=$(FLASH_FLASHTARGET_ALT_SIM_PREFIX)flash.flash --sim_optimize=$(ALT_SIM_OPTIMIZE) --base=0x0 --end=0x1FFFFFF --reset=$(CPU_RESET_ADDRESS) "; Dependency = "$(ELF)"; Target_File = "$(FLASH_FLASHTARGET_ALT_SIM_PREFIX)flash.flash"; } } TARGET sim { flash { Command1 = "if [ ! -d $(SIMDIR) ]; then mkdir $(SIMDIR) ; fi"; Command2 = "@echo Hardware simulation is not enabled for the target SOPC Builder system. Skipping creation of hardware simulation model contents and simulation symbol files. \\(Note: This does not affect the instruction set simulator.\\)"; Command3 = "touch $(SIMDIR)/dummy_file"; Dependency = "$(ELF)"; Target_File = "$(SIMDIR)/dummy_file"; } } } } Later on when Nios2 IDE discovers that the .text section has to be copied/relocated it adds the required commands to the makefile. That's nice because this way we never forget to run elf2flash utility at the end of the make process and at the same time could take full advantage from other aspects of automatic makefile generation in Nios2 IDE. The Question: How do I get the same functionality for custom non-volatile memory component that has NOR-flash compatible read interface? The file class.ptf under "\kits\nios2_51\components\altera_avalon_cfi_flash" directory contains nothing resembling the required lines. Of course, it is possible to manually edit either the system .ptf file or the makefile generated by IDE, but I prefer more version-control friendly solution.