Forum Discussion

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

Overriding Default LCD 16207 Driver

Hi all,

I try to override the default lcd driver so I read the tutorial in the Nios II Software Developer's Handbook. I created the directory "altera_avalon_lcd_16207" in the system library project with the sub-dirs HAL/inc HAL/src and inc. But when I try to compile the syslib, the compiler includes the wrong header files (the original ones). I read the tutorial over and over again, but can't find what I do wrong. I've created the component.ml file in the HAL/src folder and it looks like this:

C_LIB_SRCS += altera_avalon_lcd_16207.c

ASM_LIB_SRCS +=

INCLUDE_PATH +=

are the paths of the INCLUDE_PATH relative or absolute? And when they're relative, from which point then?

When I use# include "../inc/altera_avalon_lcd_16207.h" and# include "../../inc/altera_avalon_lcd_16207_regs.h", the code will compile, but the program still uses the wrong .c file.

Does anyone have some suggestions?

Thnx

1 Reply

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

    Here I am again.

    I still can't get it to work and have even more questions now.

    All makefiles are generated by the IDE, first the makefile in the Debug directory is created; this file says this:

    -------------------------------------------------------------------------------------------------# Every subdirectory with source files must be described here

    SUBDIRS :=

    altera_avalon_lcd_ks0713/HAL/src

    # Include the makefiles for each source subdirectory

    -include ${patsubst %, %/subdir.mk, $(SUBDIRS)}

    MAKEFILE_LIST += $(patsubst %, %/subdir.mk, $(SUBDIRS))

    -------------------------------------------------------------------------------------------------

    So this is (what I think) what's happening: The auto generated subdir.mk file is included here. This file is located in a subdir of the Debug directory: "altera_avalon_lcd_ks0713/HAL/src". The content of this file is this:

    -------------------------------------------------------------------------------------------------

    C_SRCS +=

    ${addprefix altera_avalon_lcd_ks0713/HAL/src/,

    altera_avalon_lcd_ks0713.c

    }

    CXX_SRCS +=

    ${addprefix altera_avalon_lcd_ks0713/HAL/src/,

    }

    ASM_SRCS +=

    ${addprefix altera_avalon_lcd_ks0713/HAL/src/,

    }

    -------------------------------------------------------------------------------------------------

    So now the compiler will compile this file. But when the file is being compiled, it can't locate the associated header files: "altera_avalon_lcd_16207.h" and "altera_avalon_lcd_ks0713_regs.h". It doesn't use the header file I created, but the one provided by altera, and I just can't get it work.

    When I take al look at the generated_all.mk file (Located in the system_description directory) a variable called "COMPONENTS_DEVICE_DRIVERS" is made, but with the driver provided by altera located at "/cygdrive/c/eda/altera/quartus60/sopc_builder/components/altera_avalon_lcd_16207" and not with the driver I created.

    I've read the instructions from altera in the software developer's handbook several times, and I don't know what I do wrong. I've created a directory called "altera_avalon_lcd_ks0713" in the system library directory, and created the subdirs "HAL/inc", "HAL/src" and "inc". I've created a header file called "altera_avalon_lcd_ks0713_regs.h" in the "inc" subdir. I've created a header file called "altera_avalon_lcd_16207.h" in the "HAL/inc" subdir. And I've created a source file called "altera_acalon_lcd_ks0713.c" in the subdir "HAL/src". I've also changed the names to 16207, but this doesn't matter.

    The instructions from altera says that the system library directory is seached first to locate a header file with the corresponding name from the SOPC builders component. And when the IDE found one, it skips the original driver. But this is not what's happening.

    I also created the component.mk file in the HAL/src directory with the following contents:

    -------------------------------------------------------------------------------------------------

    C_LIB_SRCS += altera_avalon_lcd_ks0713.c

    INCLUDE_PATH += altera_avalon_lcd_ks0713/inc

    -------------------------------------------------------------------------------------------------

    I tried various things but I can't get it compiled with the right driver. So I hope someone could give me the right tip.

    Please help me, I realy need this to work.

    Best regards,

    Ronald