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

Nios V Command Shell/juart-terminal input for std::cin

ReubenS
Beginner
121 Views

Cyclone 10 GX, programmed with a jic with a factory and two application images, using the GSFI bootloader method. Given that programming takes several minutes, for development I want to be able to input values through juart-terminal to choose configuration settings and behaviour after programming - e.g. choosing which application to switch to by inputting the start address, whether to use a watchdog, etc.

 

I have been using std::cout/cin, which worked at first. However at some point I made a change to an application image and when a particular std::cin line was reached, it no longer took input. The program is then stuck and I can only power cycle or wait for the watchdog to timeout to return to factory.

Importantly, the line where this happens is always the same for a given program, but if I make an unrelated change - even as small as changing an int i = 0; to int i = 1; - then the line might change. If I remove the new code and return to the working program I had originally, that still works. So the issue is inconsistent but not random.

 

Is there a fix for this, or if not what other options do I have to provide input after programming?

0 Kudos
2 Replies
BoonBengT_Intel
Moderator
61 Views

Hi @ReubenS,


Thank you for posting in Intel community forum and hope all is well.

Would perhaps recommend to check on the following item below:

- Ensure that the UART driver (especially any stdio redirection) is initialized before any use of cin/cout.

- Use fgets() and printf() temporarily to isolate the problem from cin (could avoid issues related to cin buffering or stream corruption)

- Ensure watchdogs is not trigger during blocked i/o (if cin blocks waiting for inputs and the watchdog is not serviced there could be weird behavior observed)


Hope that clarify.


Best Wishes

BB


0 Kudos
BoonBengT_Intel
Moderator
23 Views

Hi @ReubenS,


Greetings, just checking in to see if there is any further doubts in regards to this matter.

Hope your doubts have been clarified.


Best Wishes

BB


0 Kudos
Reply