Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12455 Discussions

a question for printf() function

Altera_Forum
Honored Contributor II
1,101 Views

hi everyone: 

i made a nios project, use jtag-uart, the code is as follows:# include "alt_types.h"# include "altera_avalon_pio_regs.h"# include "sys/alt_irq.h"# include "system.h"# include <stdio.h># include <unistd.h> 

 

 

void delay(void); 

 

 

int main(void) 

alt_u8 timer = 0; 

 

 

while(1) 

printf("Hello NIOS II! %d\n",timer); 

IOWR_ALTERA_AVALON_PIO_DATA(PIO_BASE,timer); // connect to a led 

delay(); 

timer++; 

return 0; 

 

 

//&#24310;&#26102;&#20989; 

void delay(void) 

alt_u32 i=0; 

while(i < 4000000) 

i++; 

 

the function of the code is very simple: use jtag-uart output ""Hello NIOS II! timer" and make a led blink. 

the project works correct when i first download the *.sof file and then download *.elf file. i see the jtag-uart receive data and the led blinking. 

 

then i want to download the configure file to the EPCS Serial Configuration Device, so i add a EPCS Controller Core, and then download the configure file. 

 

then problem comes: 

i find the led only blink once. 

if i comment the printf() function, the led starts blinking. 

why? 

is it because the jtag-uart is not on receive mode so the code stuck in the printf() function? 

i think the jtag-uart printf() function is very useful during programming for debug, it can send out a lot information, such as whether a component works correct. 

does it mean that i should comment all the jtag-uart printf() when i want to download the configure file to the EPCS Device?? 

 

thanks
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
138 Views

 

--- Quote Start ---  

 

is it because the jtag-uart is not on receive mode so the code stuck in the printf() function? 

 

--- Quote End ---  

 

This could happen if you selected in the bsp configuration the Small implementation of the HAL drivers, for reduced code footprint.  

The default settings in the bsp is the Fast implementation, which checks the jtag connection status and it will avoid the interface to get stuck when nobody is receiving jtag output data.
Altera_Forum
Honored Contributor II
138 Views

Hi i have the same problem, no output in terminal when using JTAG and printf(). Did you solve the problem by just changing this reduced footprint size setting ? It doesn't do it for me..i changed the setting in NIOD bsp editor, cleaned project and then build, but still no output in the terminal...but debugger is running and code is running.

Altera_Forum
Honored Contributor II
138 Views

i do not think my problem is the same as yours. 

 

in my project, it works correct when i first download the *.sof file and then download *.elf file. i see the jtag-uart receive data and the led blinking 

 

my problem is that when i download the configure file to the EPCS, the project do not run.
Altera_Forum
Honored Contributor II
138 Views

ahh okay no its not the same problem. The project (custom_inst crc) runs with .sof file supplied,m but when i try to build it my self, the printf's dont show in the terminal.

Reply