Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20693 Discussions

MAX10 with NIOS does not start program code

Altera_Forum
Honored Contributor II
1,514 Views

Hi All, 

 

I have a very peculiar issue. I have a MAX10 10M08SCE144 with a NIOS core that I am trying to get to run at reset. So I got hold of AN730 which describes how to make sure the device is loaded with the program Hex file at reset. 

 

I have followed this guide to the letter for what they call option 2b, which is where the UFM data (hex file) and SOF are combined into a single POF. 

 

in Qsys I have ensured that the Flash is present and connected correctly, with initialisatrion unchecked in both the flash and onchip ram settings, and that the reset vector is set to the flash. 

 

I then go to edit my BSP and makes sure that none of the HAL linker settings are checked as per AN730. I then clean and build the projects. I generate the hex file and go through the convert programming files to turn it into a pof again, as per AN730. 

 

But the NIOS will not startup at reset after power cycling. The code is quite obviously in the UFM, this I know because if I try to load a SOF file into the device the JTAG debugger doing a reset starts the code running, and this cannot be from the SOF itself as the SOF does not contain the NIOS code. 

 

Any ideas why the code would be in there but not starting up at reset? 

 

many thanks 

deBoogle
0 Kudos
10 Replies
Altera_Forum
Honored Contributor II
508 Views

Hi deBoogle, 

 

I believe there is a documentation error on AN730 for Advanced.hal.linker Settings for Boot Option 2. 

Please try again by enabling allow_code_at_reset and leave other settings unchecked. 

 

Regards, 

CH
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

I'll have a try now... thanks

0 Kudos
Altera_Forum
Honored Contributor II
508 Views

That did not seem to make a difference. But thank you.

0 Kudos
Altera_Forum
Honored Contributor II
508 Views

I had a similar problem, have you got the nios and the flash in the same clock domain? I had a load of trouble getting my nios to boot from ufm but moving my nios, flash, dual boot and surrounding ip to the same clock domain fixed it.

0 Kudos
Altera_Forum
Honored Contributor II
508 Views

I play with this a few months ago. One of my notes says: ...set up the BSP with "Reduced device drivers", "Small C library" 

 

Hope that helps.
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

Hi Guys, 

Some very sage advice, thank you. I have actually already done some of these things. I have reduced drivers set in my BSP and as far as I am aware the flash is in the same clock domain as it is connected to the only clock in the system Qsys system along with the NIOS II/f core. 

 

One peculiarity is that it seems to be application (and therefore possibly size) related, the reason I say that is that if I put in a different application code (smaller in size) the bootloader works, however when I put the code I want to run into the application, it does not boot after power cycling. 

 

A further oddity is that after powering up (and nothing booting), if I press the reset or toggle nConfig, the system runs the code! 

 

Very odd. I am quite confused. 

 

Thank you for all your help so far. 

 

deBoogle
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

A few guesses: 

1. When you mentioned a different application code, did you already check if their BSP settings are identical? and the only difference is the code size? 

2. Is you desired application code implements printf() and require JTAG UART print out while the smaller application code does not include any JTAG print out? I am wondering if there is possibility that cause boot copier to stall if no host is reading output from JTAG UART.
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

Ok, I have just come back to this. 

 

I decided to do a complete fresh build, new project folders, workspaces the whole sherbang. And it just worked as per the app note. Not sure what I may have set incorrectly along the way but it now works. My initial suspicion is that I had done so many incremental changes to Qsys, the quartus project and the BSP that maybe the tools were getting a bit confused, but maybe that is just finding an excuse for my lazy mistakes.
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

Hi, 

 

Just a quick check, for Advanced.hal.linker Settings, are you enabling "allow_code_at_reset" and leave other settings unchecked? 

Or you are leaving all settings unchecked? 

Which setting actually works?
0 Kudos
Altera_Forum
Honored Contributor II
508 Views

AH Sorry, the "allow_code_at_reset" is unchecked. The app note does say this but then points to a graphic where it shows it checked! 

 

I had tried this prior to doing a complete rebuild and it didnt seem to make a difference. But who knows! 

 

deBoogle
0 Kudos
Reply