Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Comunicados
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussões

NIOSII - Write output to Dev kit LCD

Altera_Forum
Colaborador honorário II
2.468 Visualizações

I am trying to switch over to eCos from MicroC/OS-II. I have succesfully installed eCos for NIOS 5.0. I have built and run the eCos hello example. 

 

I am now trying to modify the hello example to write to the LCD of my dev kit. Altera Cyclone II standard 2C35. 

 

The code will build with my reference to the /dev/lcd_display put I get no output to the LCD. 

 

I have tried running in debug but this seems to misbehave when I get to my lCD code. 

 

 

Anyone run across this ? 

 

 

Thanks.
0 Kudos
11 Respostas
Altera_Forum
Colaborador honorário II
736 Visualizações

Hi jkealty, 

 

Make sure the Compact Flash card is not plugged into it's socket. Due to a hardware constraint on the Nios evaluation boards, you cannot have the LCD and Compact Flash plugged in simultaneously.
Altera_Forum
Colaborador honorário II
736 Visualizações

Hi, 

 

Thanks for the suggestion, but I do not have the compact flash inserted. I did some debuging of this and I am finding that the /dev/lcd_display 

is not being recognised by the system. I am checking the return value from cyg_io_lookup and it indicates that the lcd_display does not exist. I am wondering if any devices are being defined since I get the same results for the LED's.  

 

The stange thing is, in the <cyg/hal> directory I found a devices.h file that was created from the std_2C35.ptf file when I generated the eCos library. 

 

I also know that my dev kit is fully functional because I can use all devices when I run code under MicroC/OS-II. 

 

I am missing something, but do not know what it is. 

 

Thanks,
Altera_Forum
Colaborador honorário II
736 Visualizações

To use the LCD you need to have the "hardware serial device drivers" option enabled. This is located under the "Serial device drivers" folder in configtool. 

 

This is a little unintuitive - but unfortuanely it&#39;s the eCos way of dealing with these devices...
Altera_Forum
Colaborador honorário II
736 Visualizações

Hi, 

 

Thanks for your prompt response. 

 

I enabled the Hardware Serial Devices in ConfigTool.  

 

I have also added the extra compiler CFLAGS options to my makefile: 

 

-I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_lcd_16207/inc -I$(PREFIX)/include/cyg/hal 

 

I rebuilt the library and the LCD is now working for me. 

 

Thanks! 

 

P.S. 

 

I added -I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_pio/inc -I$(PREFIX)/include/cyg/hal 

so I could use any of the PIO devices in my hardware. However, I get an undefined reference to IOWR_ALTERA_AVALON_PIO_DATA 

when I tried to use it like shown below: 

 

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 1); // turn on LED# 1 

 

I am curious if the PIO devices have an enable/disable feature in the configtool too?
Altera_Forum
Colaborador honorário II
736 Visualizações

There&#39;s no eCos component for the PIO. You need to make direct register accesses (as you described).

Altera_Forum
Colaborador honorário II
736 Visualizações

monkeyboy, 

 

Thanks for your assistance. I can now access all of my PIO interfaced devices. 

 

FYI for anyone coming from MicroC/OS: 

 

You need to include the following header file. 

# include <cyg/hal/io.h> /* Additional HAL device IO support.*/ 

 

You will also need to replace all ALTERA AVALON PIO reads and writes 

Such as: 

IOWR_ALTERA_AVALON_PIO_DATA and IORD_ALTERA_AVALON_PIO_DATA 

 

With: 

IOWR_16DIRECT(BASE, OFFSET, DATA) and IORD_16DIRECT(BASE, OFFSET) 

 

You will need to use the appropriate size function i.e. 8,16,32 bits too. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif
Altera_Forum
Colaborador honorário II
736 Visualizações

An easier way to do this is to just include altera_avalon_pio.h, and add the compiler flags:  

 

-I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_pio/inc -I$(PREFIX)/include/cyg/hal.  

 

That way you can continue to use the same macros you would have used in the Altera HAL or MicroC/OS-II. I thought that&#39;s what you had previously said you were doing. 

 

Also, I just noticed that you were adding:  

 

-I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_lcd_16207/inc -I$(PREFIX)/include/cyg/hal 

 

to get the LCD working. This should not be necessary.
Altera_Forum
Colaborador honorário II
736 Visualizações

Dear monkeyboy. 

 

I&#39;m tring to include "altera_avalon_pio.h", as you wrote. 

 

(1) Adding this line to my c-file.# include "altera_avalon_pio.h" 

(2) Modifying CFLAG in makefile. 

CFLAGS = -I$(INSTALL_DIR)/include -I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_pio/inc -I$(PREFIX)/include/cyg/hal 

 

But when I built the project, this error message appeared. 

 

make INSTALL_DIR=/cygdrive/c/temp/ecos_install all nios2-elf-gcc -c -o hello.o -I/cygdrive/c/temp/ecos_install/include -I&#39;c:/altera/kits/nios2&#39;/components/altera_avalon_pio/inc -I/include/cyg/hal -g -O3 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -DSYSTEM_BUS_WIDTH=32 -mhw-mul -mhw-mulx -mno-hw-div hello.c cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C cc1: warning: command line option "-fvtable-gc" is valid for C++/ObjC++ but not for C hello.c:3:31: altera_avalon_pio.h: No such file or directory make: *** Error 1 

 

What is wrong? 

Please tell me why. 

 

Thank you. 

Best regards.
Altera_Forum
Colaborador honorário II
736 Visualizações

My mistake. The file you wanted was altera_avalon_pio_regs.h, not altera_avalon_pio.h.

Altera_Forum
Colaborador honorário II
736 Visualizações

Thank you, monkeyboy. 

 

But I got this error message. 

c:/altera/kits/nios2/components/altera_avalon_pio/inc/altera_avalon_pio_regs.h:34:16: io.h: No such file or directory 

 

How can I solve it? 

There are so many "io.h". 

Which "io.h" must I include? 

 

Thank you.
Altera_Forum
Colaborador honorário II
736 Visualizações

Dear monkeyboy. 

 

It&#39; OK now. 

 

CFLAGS = -I$(INSTALL_DIR)/include -I&#39;$(SOPC_KIT_NIOS2)&#39;/components/altera_avalon_pio/inc -I$(PREFIX)/include/cyg/hal 

 

In my PC, $(PREFIX) was not defined. 

So, I changed "PREFIX" to "INSTALL_DIR", 

then, it works OK. 

 

Thank you.
Responder