Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

eCos from epcs

Altera_Forum
Honored Contributor II
1,700 Views

Hi all 

 

Does anybody know if eCos supports botting up from epcs instead of the on board flash device on ALtera's developement board (the 1c20 board) ? Looking at the templates tab under the nios2configtool there does not seem to be support for this device, only for the AMD flash.  

 

Attempting to change the elf2flash command in the program_flash script created with one that uses the epcs, yields unclear error messages. 

 

If it is supported, please advise how it should be done, and if not, does anybody know if it's going to be supported in the version that's supposed to work with NiosII v1.1 ?
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
898 Views

To boot eCos from an EPCS you simply need to select a "ROMRAM" configuration for the "Statup type" in configtool. Assuming that you have configured the hardware reset vector in SOPC builder to point at the EPCS device, then this will build an elf file suitable for booting from EPCS. 

 

The generated program_flash should also be able to happily program it into the EPCS for you. However it sounds like this isn't the case. 

 

If not, an easy way to determine what options the script should have been using is to program a HAL "hello world" example into the EPCS using the IDE. YOu can get the command the IDE uses by going to the Windows->Preferences->Nios II tab and ticking the "Show command lines when running make" option. You can then compare this to the commands issued by the program_flash script. 

 

If you find there is a discrepancy, please post the results back.
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Hi monkeyboy 

 

I have set the reset address to point to the epcs in the SOPC builder. However, the program_flash script that the nios2configtool generates insists on programming into the flash (uses the --flash=U5 flag in the elf2flash command). When I try to manually change this command to use the --epcs flag instead of the --flash flag, it complains that the --epcs flag should not come with a --reset flag (which is right), but after removing the --reset flag, it complains that the --reset flag is missing. 

 

I've made sure that the design is written to the flash by programming something else into epcs and then going through the scripts created by eCos, but the design from the epcs keeps coming up. 

 

As I've mentioned in my first post, when I use build->templeate in the nios2configtool I see that the system called default for a niosII developement board has support for the AMD flash but no support for serial flash memory is listed.  

 

Any ideas ? 

 

Regards 

Nir
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Hi All 

 

I've decided to add some snippets of code and output of commands to make things a littl emore clear. 

The system I'm trying to run eCos on is based on the standard example that comes with Nios. The only change I've done is to remove the ext_flash and leave only the epcs. In addition I've made sure that the reset address is the epcs. Next I've run the nios2configtool on the generated cpu and specified ROMRAM where I was supposed to. After building the project, a program_flash script was generated in the _install directory. This script contains the following command: 

 

elf2flash --silent --input=$1 --epcs --flash=U59 --boot=`$QUARTUS_ROOTDIR/sopc_builder/bin/find_sopc_component_dir altera_nios2`/boot_loader_epcs.srec --outfile=$TMP/ecos.flash --sim_optimize=0 --base=0x0 --end=0x7FFFFFFF  

 

This command is wrong because you should only have a --epcs flag OR a --flash flag in this command, not both. 

 

Trying to execute this script yields the following output: 

 

[SOPC Builder]$ ./program_flash ../software/hello 

Generating flash file for device epcs_controller... 

28/01/2005 11:46:07 - (SEVERE) elf2flash: no reset address provided on the comma 

nd line, and none found in the elf file 

Programming device epcs_controller... 

28/01/2005 11:46:10 - (SEVERE) nios2-flash-programmer: com.altera.memory.RWMemor 

yException: File not found: c:/DOCUME~1/xxxxxxxx/LOCALS~1/Temp/ecos.flash 

28/01/2005 11:46:10 - (SEVERE) nios2-flash-programmer: Unable to read input-data 

from: c:/DOCUME~1/xxxxxxx/LOCALS~1/Temp/ecos.flash, exiting 

...done 

 

As I've mentioned, trying to change the command in the program_flash script to contain a reset address and executing the script again, yields the following output: 

 

[SOPC Builder]$ ./program_flash ../software/hello 

Generating flash file for device epcs_controller... 

28/01/2005 11:47:41 - (SEVERE) elf2flash: in epcs mode, the reset address must not be specified 

 

DAH!! 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

If anybody has worked around this, please let me know.  

It looks as though is a problem with the nios tools, but as most of you may know you can program designs into the epcs when eCos is not involved. 

 

Nir
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Hi Nir, 

 

it looks like there is a problem with generating this script in the case of EPCS devices. To work around this, you can extract the correct command to use from the Nios II IDE using the method I described in my previous post. You can then run that command directly from an SDK shell (or create your own script). 

 

As you said earlier, there is currently no driver for the EPCS device in eCos. This means that you will not have read/write access to it from your application. However a driver of this kind is not required for you to use the EPCS as a boot device.
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Hello monkeyboy 

 

I&#39;ve tried what you suggested, but although I got the IDE to print out all the commands it did not print out the elf2flash command. All it printed was: post-processing to create epcs_controller_boot_rom.flash

 

So I&#39;m back where I started. In the mean time I have downloaded the latest release of eCos, just to find out the problem persists on it as well. 

 

Any ideas ? 

 

Nir
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

I&#39;m suprised that the command line didn&#39;t show up. Are you sure that you ticked the right option? 

 

In any case, you will find the rule being run in the file generated_app.mk which is in the "system_description" directory of your system library project. That may solve this puzzle for you.
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Me again, monkeyboy 

 

I&#39;ve looked in the generated_app.mk file and saw that the elf2flash command there has the same syntax as the one in the ecos program_flash script, i.e: 

elf2flash --input=$(ELF) --flash=U59 --boot=`$(QUARTUS_ROOTDIR)/sopc_builder/bin/find_sopc_component_dir $(CPU_CLASS)`/$(BOOT_COPIER_EPCS) --outfile=$(EPCS_CONTROLLER_BOOT_ROM_FLASHTARGET_ALT_SIM_PREFIX)epcs_controller_boot_r 

om.flash --sim_optimize=$(ALT_SIM_OPTIMIZE) --epcs --base=0x0 --end=0x7FFFFFFF ; fi 

 

Meaning it uses both the epcs and the flash flags. When I run this command from the program_flash script I get an error saying that no reset address was specified in the command line or in the elf file. Since the command line looks the same as the one that does work, I am forced to cnoclude that for some reason, the elf file generated by the compiler when making the ecos software examples does not have a reset address written in it.  

 

Do you aggree ? 

 

Nir
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

I&#39;ve had a quick look at this, and I&#39;ve found that a simple work around is to just add the __reset symbol to your elf file yourself. You can do this by adding the following to the linker options: 

 

-Wl,--defsym,__reset=0x2100000 

 

where 0x2100000 is the base address of your epcs device. 

 

Linker flags are set under "Global build options" in configtool. 

 

Having done that, the program_flash script will work as expected.
0 Kudos
Altera_Forum
Honored Contributor II
898 Views

Hi monkeyboy 

 

Thank you very much. This looks like it did the trick. 

 

Nir
0 Kudos
Reply