Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

NiosII booting from on-chip memory

I am trying to boot a NiosII (HAL only, no other bigger OS) on a Cyclone IV directly from the on-chip memory. I have initialized the memory .hex file and included it in my project. I then recompiled the project again. I downloaded the *.sof file to the FPGA. However, the NiosII is not booting.

I want to be able that when I download the *.sof file to the FPGA, the processor should boot by itself (without me having to manually download the software from Eclipse)

Would anyone have any suggestions for me?

18 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    A timing unconstrained design can lead to inconsistent results from one compile to the next. I have personnaly benefitted from the time quest users guide posted by user rysc on the altera wiki.

    --- Quote End ---

    Could you provide an explicit link :D please ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    If you have the nios JTAG debugger enabled I think it 'steals' the reset vector.

    Try removing it.

    ISTR problems with the JTAG debugger when downloading over PCIe (which is what we do).

    I think there is a separate JTAG to avalon master that can be used to access memory - useful for debug.

    With the nios soft-reset exposed that could be used for software download.

    --- Quote End ---

    I did your suggestion. The same behaviour. The NiosII does not start when the *.sof is downloaded via JTAG. It just hangs.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello Terrazas,

    Did you manage to solve your problem ? I am having the same problem.

    How did you convert your elf-file to a hex-file which could be included in Quartus.

    I use the following:

    elf2hex --little-endian-mem --input="C_bootloader.elf" --output="C_bootloader.hex" --base=0 --width=32 --end=0x3fff --record=4 --lower

    When I use SignalTap to look at the processor-signals I don't see any processor activity. It looks like it is still in reset.

    Regards,

    Wamor
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Actually, you don't need to explicitly perform the elf2hex. You can just run "make mem_init_generate" at the app directory and the hex files will be generated for you under a mem_init folder. You should be able to find a QIP file inside the folder. In your Quartus GUI, you can just add the qip file as part of the Quartus project, re-compile in Quartus and the sof generated from the compilation should be able to run after FPGA is configured.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Actually, you don't need to explicitly perform the elf2hex. You can just run "make mem_init_generate" at the app directory and the hex files will be generated for you under a mem_init folder. You should be able to find a QIP file inside the folder. In your Quartus GUI, you can just add the qip file as part of the Quartus project, re-compile in Quartus and the sof generated from the compilation should be able to run after FPGA is configured.

    --- Quote End ---

    Did that. It still does not work. Any other ideas?

    I also tried creating a .hex from the .elf, and setting that as the initialization file in qSys.

    In either case the hardware is correct in the SOF, but the code is not there.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Did that. It still does not work. Any other ideas?

    I also tried creating a .hex from the .elf, and setting that as the initialization file in qSys.

    In either case the hardware is correct in the SOF, but the code is not there.

    --- Quote End ---

    Review the fitter report and the Quartus messages from your compile.

    Does it say it is using your initialization file for that M9K memory?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Probably you can attached your Quartus Project/ Qsys system and I can take a quick look.