Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,178 Views

Nios II Console only displays the first printf statement

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
2 Replies
Altera_Forum
Honored Contributor I
138 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.
Altera_Forum
Honored Contributor I
138 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
Reply