I can't quote the message, something doesn't work. I see several versions of ready-made bootloaders in the \components\altera_nios2 folder. I figured out that my bootloader is taken from this file boot_loader_epcs_sii_siii_ciii.srec. I see that these files do not directly mention Cyсlone 4. Probably, this does not mean anything, but does not work - the bootloader does not want to load the code. In the end, I began to write something of my own.
At this point I have written a code that successfully loads from EPCS into OnHip RAM.
EPCS FirmWare Begin At: 0x23c3e
Read address: 0x23c3e Length: 0x130c
Read address: 0x23c42 Destination address: 0x8008000
Record N: 0 At EPCS Address: 0x23c46 - 0x24f51 Length: 0x130c Will be copied to adress: 0x8008000 - 0x800930c
Read address: 0x24f52 Lenth: 0x5d4
Read address: 0x24f56 Destination address: 80098e0
Record N: 1 At EPCS Address: 0x24f5a - 0x2552d Length: 0x5d4 Will be copied to adress: 80098e0 - 8009eb4
Read address: 0x2552e Lenth: 0
Last EPCS Free Address: 0x25532
Copy Succses. Copy Records: 2
Reset Address: 0x80081b8
I see that the result of the Eclipse Programmer (programming test ELF file into OnHip RAM) and the result of load program of my bootloader (previously uploaded into EPCS by Flash Programmer) are the same. I compared the dumps made by my code.
It would seem that the code should start. But when jump to the starting address 0x80081b8(OnHip RAM), processor halt. I checked the linker file - the starting address is correct. The test program wogking well when I change reset to OnHip RAM in QSYS.
The bootloader program works in SD RAM at all. Including all sections. The Test program work in OnchipRam at all. Including all sections. Test program starting address is 0x1b8. If jump to this address using the jump function, the program starts again. It works.
jump function is
void JumpFromBootCopier(void target(void))
{
alt_irq_disable_all ();
alt_dcache_flush_all ();
alt_icache_flush_all ();
target();
}
Why jump to OnchipRam code doesn't work? Can executing code outside the .text section result exception interrupt?