Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16556 Discussions

Nios II Console only displays the first printf statement

Altera_Forum
Honored Contributor II
2,104 Views

As the title says, I am trying to print some values, and the Nios II Console only prints the first printf statement. 

 

Here's my code so far: 

 

#include <stdio.h># include <alt_types.h># include <io.h># include <system.h># include <string.h> int main() { unsigned long *THE_ADDRESS; THE_ADDRESS = (unsigned long *)ADDRESS_SPAN_EXTENDER_0_WINDOWED_SLAVE_BASE; printf("Debugging"); printf("Reading from Address: %p", THE_ADDRESS); IOWR_32DIRECT(THE_ADDRESS,0, 0); int i = 0; printf("value: %x", IORD_32DIRECT(THE_ADDRESS, i)); while(i<20) { printf("value: %x", IORD_32DIRECT(THE_ADDRESS, i)); i++; } return 0; }  

 

The above code only prints: Debugging 

Has anyone else gotten this issue before? 

 

Thank you so much, 

 

Vinny
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
1,064 Views

Try adding a newline to the end of each printf format string? 

Whats probably happening is that your second printf, the string is being placed into the buffer, but then your "IOWR_32DIRECT(THE_ADDRESS,0,0)" is hanging the software, so the second printf text never gets sent up to the console. 

Adding a newline to each line, you should get each line shown before the software continues execution with the next statement.
0 Kudos
Altera_Forum
Honored Contributor II
1,064 Views

Dear Ted, 

 

Thank you so much for your quick response. 

I actually had newlines in there before, and it would still only print the first printf statement. 

The code can print a simple printf, but if I try to print the result of an IORD_32DIRECT, it "hangs up" there and doesn't print that printf statement. 

I was trying to look up documentation for IORD to see what return type it is, do you have any idea what it is? 

 

Thanks again, 

 

Vinny
0 Kudos
MartinD1
Beginner
897 Views

I have same problem. Did You found sollution?

0 Kudos
Reply