Forum Discussion

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

using char-lcd in linux

hi,

when i compile the kernel ,error occurs:

na_lcd_16207_0 undeclared

How can i fix it

thank you

wangweike

15 Replies

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

    --- 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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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! :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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?