Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Help, hello_world_small can not display

hello experts,

I want to run hello-world-small program on my own board, There are 1 epld and 2 stratix GX fpgas and 2 stratix FPGAs on the chain. I use one stratix GX FPGA to do nios2 test and using on-chip memory for Instruction and data memory.

Instruction memory is 16KB and data memory is 4KB.

But when I run the program using NIOS2 IDE, no 'hello' messages displayd on terminal window, the window only has such message as following:

********************

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "ByteBlasterII [LPT1]", device 4, instance 0

nios2-terminal: Warning: The JTAG cable you are using is not supported for Nios

nios2-terminal: II systems. You may experience intermittent JTAG communication

nios2-terminal: failures with this cable. Please use a USB Blaster revision B

nios2-terminal: cable or another supported cable. Please refer to the file

nios2-terminal: errata.txt included in the Nios II development kit documents

nios2-terminal: directory for more information.

nios2-terminal: starting in terminal mode (Control-C exits)

*********************

In order to know whether nios is runing or not, I add some code to hello_world_small.c, which using pio to control led, the changed hello_world_small.c is as following:

*********************************************# include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"# include "stdio.h"

int main()

{

alt_u8 led = 0x2;

alt_u8 dir = 0;

volatile int i;

while (1)

{

if (led & 0x81)

{

dir = (dir ^ 0x1);

}

if (dir)

{

led = led >> 1;

}

else

{

led = led << 1;

}

IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, led);

i = 0;

while (i<200000)

i++;

printf("Hi!\n");

}

return 0;

}

****************************************

At this time, I can see that led is controled by software correctly, this means that nios cpu is runing, but there is also no any printed message(&#39;hi&#39;) in the window, terminal window and download window has following messages:

********************************************************

terminal window:

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "ByteBlasterII [LPT1]", device 4, instance 0

nios2-terminal: Warning: The JTAG cable you are using is not supported for Nios

nios2-terminal: II systems. You may experience intermittent JTAG communication

nios2-terminal: failures with this cable. Please use a USB Blaster revision B

nios2-terminal: cable or another supported cable. Please refer to the file

nios2-terminal: errata.txt included in the Nios II development kit documents

nios2-terminal: directory for more information.

nios2-terminal: starting in terminal mode (Control-C exits)

download output:

Using cable "ByteBlasterII [LPT1]", device 4, instance 0x00

Processor is already paused

Downloading 00010000 ( 0%)

Downloaded 3KB in 0.1s

Leaving target processor paused

************************************************

I am not sure why no "hello" or "hi" messages are printed in terminal, How can I do now?

Maybe Jtag-uart can not work well in multi-component Jtag chain?

Maybe data-memory is too small(4KB)?

Maybe I should using usb_bluster cable?

Thanks

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Printf is large by default so try these: small c library, turn off the clean exit, reduced drivers, and 4 file descriptors (this is all in the system library properties). Also there is a hello world small example design, I forget how big it is but you may be able to cut and paste from it. When you compile, you will be told down at the bottom of the screen how big your program is and how much room is left for the heap and stack. Keep an eye out for those numbers.