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++

using char-lcd in linux

Altera_Forum
Honored Contributor II
3,149 Views

hi, 

when i compile the kernel ,error occurs: 

na_lcd_16207_0 undeclared  

 

How can i fix it  

thank you  

wangweike
0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
695 Views

Do you have an LCD? If not, don't include the LCD driver in the menuconfig.

0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

Do you have an LCD? If not, don't include the LCD driver in the menuconfig. 

--- Quote End ---  

 

 

yes ,i have ,i use DE2-70. I donnot know how to fix it
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

What is the name of the LCD peripheral? it needs to match what it's called in the driver.

0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

What is the name of the LCD peripheral? it needs to match what it's called in the driver. 

--- Quote End ---  

 

 

Copy the kernel header file lcd_16207.h to uClinux-dist/linux-2.6.x/source/drivers/char/ 

 

Goto: 

http://www.nioswiki.com/operatingsystems/uclinux/lcd_16207 

for source file. 

 

I had to make the following modification to bypass the cache in the driver code in lcd_16207.h: 

 

# define ADR_LCD_COMMAND na_lcd_16207_0 + 0x80000000# define ADR_LCD_READY (na_lcd_16207_0 + 0x80000000 + 4)# define ADR_LCD_DATA (na_lcd_16207_0 + 0x80000000 + 8)# define ADR_LCD_READ (na_lcd_16207_0 + 0x80000000 + 12)  

 

In lcd_16207.c change# include "linux/lcd_16207.h" to# include "lcd_16207.h" 

 

The device name in de SOPC builder "lcd_16207_0"!! 

 

If the character driver for the display is loaded in your kernel, 

and you use the MSH shell which allows redirection from the echo command, you should be able to do something as simple as: 

 

switch to the MSH shell: 

/> msh 

# echo "Hello World!" > /dev/lcd16207 

 

You will need to have the MSH shell enabled in the kernel and the 'echo' command from busybox.
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

Copy the kernel header file lcd_16207.h to uClinux-dist/linux-2.6.x/source/drivers/char/ 

 

Goto: 

http://www.nioswiki.com/operatingsystems/uclinux/lcd_16207 

for source file. 

 

I had to make the following modification to bypass the cache in the driver code in lcd_16207.h: 

 

# define ADR_LCD_COMMAND na_lcd_16207_0 + 0x80000000 # define ADR_LCD_READY (na_lcd_16207_0 + 0x80000000 + 4) # define ADR_LCD_DATA (na_lcd_16207_0 + 0x80000000 + 8) # define ADR_LCD_READ (na_lcd_16207_0 + 0x80000000 + 12)  

 

In lcd_16207.c change# include "linux/lcd_16207.h" to# include "lcd_16207.h" 

 

The device name in de SOPC builder "na_lcd_16207_0"!! 

 

If the character driver for the display is loaded in your kernel, 

and you use the MSH shell which allows redirection from the echo command, you should be able to do something as simple as: 

 

switch to the MSH shell: 

/> msh 

 

# echo "Hello World!" > /dev/lcd16207 

 

You will need to have the MSH shell enabled in the kernel and the 'echo' command from busybox. 

--- Quote End ---  

 

 

Thank you very much, though it doesnot work. 

I think na_lcd_16207_0 is something about address. 

i am using linux-mmu .do you have any other suggestions?
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

Thank you very much, though it doesnot work. 

I think na_lcd_16207_0 is something about address. 

i am using linux-mmu .do you have any other suggestions? 

--- Quote End ---  

 

 

Me tip is usefull for a system without a mmu. I think the + 0x8000000 is not needed with a mmu based system.  

 

Is jou system running and you can compile linux?
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

Me tip is usefull for a system without a mmu. I think the + 0x8000000 is not needed with a mmu based system.  

 

Is jou system running and you can compile linux? 

--- Quote End ---  

 

 

yes,everything goes fine,except adding lcd
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

yes,everything goes fine,except adding lcd 

--- Quote End ---  

 

 

What do you mean with "except adding lcd"? Compile errors?
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

What do you mean with "except adding lcd"? Compile errors? 

--- Quote End ---  

 

 

yes,when compiling after add lcd : 

error:"na_lcd_16207_0" undeclared
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

yes,when compiling after add lcd : 

error:"na_lcd_16207_0" undeclared 

--- Quote End ---  

 

 

Oeps little typo on my side!! 

 

The device name in de SOPC builder "na_lcd_16207_0"!! this is wrong!! 

 

change it to "lcd_16207_0"!! 

 

Regenerate the custom_fpga.h with the new .sopcinfo file (use sopc-create-header-files tool) and recompile linux.
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

 

--- Quote Start ---  

Oeps little typo on my side!! 

 

The device name in de SOPC builder "na_lcd_16207_0"!! this is wrong!! 

 

change it to lcd_16207_0!! 

 

Regenerate the custom_fpga.h with the new .sopcinfo file (use sopc-create-header-files tool) and recompile linux. 

--- Quote End ---  

 

 

yes ,i know .i have changed it yestoday .still not work
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

thank you for your patient

0 Kudos
Altera_Forum
Honored Contributor II
695 Views

You have changed the custom_fpga.h file?

0 Kudos
Altera_Forum
Honored Contributor II
695 Views

This evening I build a design with MMU and tried it on my de2 board. 

 

When I compile uclinux for my hardware platform i encounter different problems. First I make a board definition for my de2. 

 

In folder: nios2-linux\linux-2.6\arch\nios2\boards\my_de2 

 

See http://www.nioswiki.com/linux/creating_a_nios_ii_design_with_an_mmu for more information. 

 

I had to change /nios2-linux/linux-2.6/arch/nios2/boards/my_nios2/include/asm/nios.h 

 

I added: 

# elif defined(CONFIG_MY_DE2_FPGA)# include <asm/my_nios2_fpga.h> # define CONFIG_ALTERA_DE2# define DDR2_TOP_BASE SDRAM_BASE# define DDR2_TOP_SPAN SDRAM_SPAN# define TIMER_1MS_FREQ SYS_CLK_TIMER_FREQ# define TIMER_1MS_BASE SYS_CLK_TIMER_BASE# define TIMER_1MS_SPAN SYS_CLK_TIMER_SPAN# define TIMER_1MS_IRQ SYS_CLK_TIMER_IRQ# define EXT_FLASH_BASE CFI_FLASH_BASE# define EXT_FLASH_SPAN CFI_FLASH_SPAN For example SDRAM_BASE is found in <asm/my_nios2_fpga.h>. The my_nios2_fpga.h is generated with "sopc-create-header-files --single my_nios2_fpga.h" 

 

This basic design with the basic kernel is compiling but when I want to add the lcd_16207 support I get probably the same error. 

 

/data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c: In function 'lcd16207_module_init': /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c:319: error: 'na_lcd_16207_0' undeclared (first use in this function) /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c:319: error: (Each undeclared identifier is reported only once /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c:319: error: for each function it appears in.) /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c: In function 'LcdWriteLines': /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c:395: error: 'na_lcd_16207_0' undeclared (first use in this function) /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c: In function 'LcdReadLines': /data/share/uclinux/nios2-linux/linux-2.6/drivers/char/lcd_16207.c:417: error: 'na_lcd_16207_0' undeclared (first use in this function) make: *** Error 1 make: *** Error 2 make: *** Waiting for unfinished jobs....  

 

 

And then I had the idea of adding "#define na_lcd_16207_0 LCD_16207_0_BASE" to "/nios2-linux/linux-2.6/arch/nios2/boards/my_nios2/include/asm/nios.h" 

 

# elif defined(CONFIG_MY_DE2_FPGA)# include <asm/my_nios2_fpga.h> # define CONFIG_ALTERA_DE2# define DDR2_TOP_BASE SDRAM_BASE# define DDR2_TOP_SPAN SDRAM_SPAN# define TIMER_1MS_FREQ SYS_CLK_TIMER_FREQ# define TIMER_1MS_BASE SYS_CLK_TIMER_BASE# define TIMER_1MS_SPAN SYS_CLK_TIMER_SPAN# define TIMER_1MS_IRQ SYS_CLK_TIMER_IRQ# define EXT_FLASH_BASE CFI_FLASH_BASE# define EXT_FLASH_SPAN CFI_FLASH_SPAN #define na_lcd_16207_0 LCD_16207_0_BASE  

 

And the kernel compiled.  

 

But when I download the zImage and start the nios2-terminal no response of the nios.  

 

Hopefully you have better luck! I'm curious if you get it up and running! :)
0 Kudos
Altera_Forum
Honored Contributor II
695 Views

i finally compiled with neek_ocm_spi_mmu with uclinux+mmu, however, i can only access the uclinux for few minutes before it went hang. anyone know why?

0 Kudos
Reply