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++

problems with iCACHE!

Altera_Forum
Honored Contributor II
1,531 Views

Hi! 

 

I've been working with the nios/e , and I have a program now working and tested. It uses threads (eCos) and interrupts (three). 

 

the fact is that if ONLY change the Nios2/e to Nios/s, thus having instruction cache, it hangs. I've initialized the instruction cache, as it indicates in the SW development guide, and I think I don't have to do anything else, because my program is static, doesn't change. 

 

The only thing that I don't control is the fact that the program is kept in flash until it executes, and then it copies itself to RAM. It is done automatically by a self-copier, so I don't know if it's flushing the instruction cache (if it's needed) or what. 

 

any idea about what can be happening? I thought the iCACHE shouldn't give so many problems, isn't it? 

 

aLeX
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
572 Views

I have now realized... the program that inits the iCACHE is the eCos initialization code, which executes AFTER the program has been copied to RAM. So the iCACHE initialization are not the 8 first instruction (as the software guide says). 

 

Also I have remembered that the program that copies the code from ROM to RAM is the one added to my original code that generates automatically the altera_nios2 development kit: "boot_loader_cfi.srec". I use it with "elf2flash" in order to generate my flash file to write to flash. 

 

Any other way to do it and ensure that the iCACHE initalization is correct? In the niosI kit, I had the original code of the boot_loader, so I was able to modify it, but now I only have the srec, and can't do it.... 

 

Any help would be appreciated. 

 

aLeX
0 Kudos
Altera_Forum
Honored Contributor II
572 Views

When using a "ROMRAM" configuration, eCos uses the standard Altera bootloader to load code from flash to RAM. The source for this is in the Nios II kit in the directory: 

 

components\altera_nios2\sdk\src\boot_loader_sources
0 Kudos
Altera_Forum
Honored Contributor II
572 Views

As I've seen, it seems that the boot_loader initalizes the iCACHE, and does all the necessary steps to copy in a correct way the code from flash to RAM, so now I don't know what can be wrong with the iCACHE. 

 

Is there any other SOFTWARE consideration when changing from a nios/e to a nios/s???? My program is now working, but the execution is 210% of the nios/s (in nios/s it works for a few time. Enough to see the speed difference) 

 

Any ideas? 

 

aLeX
0 Kudos
Reply