AW: [En-Nut-Discussion] Nut/OS Device Control Block amke errors.

Ernst Stippl ernst at stippl.org
Tue May 31 21:29:18 CEST 2005


Hi Grahame!

I experienced (more or less) this sequence of error messages when the number
of opening and closing curly brackets did not match thru all the source
files included in the compilation.

I had about 15 source files inluded into the main file and somewhere (!!) I
had introduced a typo. The error surfaced in a different source file and it
was difficult to trace it back to the initial typing error. 

Look at recent changes in your source, maybe use an editor/IDE which
highlights matching curly brackets, that help me finding the missing "}" (or
"{".

regards
ernst

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Grahame M. Kelly
Gesendet: Dienstag, 31. Mai 2005 05:39
An: EtherNUT Discussions
Betreff: [En-Nut-Discussion] Nut/OS Device Control Block amke errors.

Hi Everyone.

I have a syntax or header problem(s) in trying to build a very simple LCD
controller structured around the NutOS foundation device driver.

Given the LCD Information Block and its generic Device Control Block are as
follows:

/*!
 * \brief LCD device information structure.
 */
NUTDEVICE devLcd20 = {
    0,              /*!< Pointer to next device. */
    {'l', 'c', 'd', '2', '0', 0, 0, 0, 0},      /*!< Unique device name. */
    IFTYP_STREAM,   /*!< Type of device. */
    0,              /*!< Base address. */
    0,              /*!< First interrupt number. */
    0,              /*!< Interface control block. */
    &dcb_term,      /*!< Driver control block. */
    TermInit,       /*!< Driver initialization routine. */
    TermIOCtl,      /*!< Driver specific control function. */
    0,
    TermWrite,
    TermWrite_P,
    TermOpen,
    TermClose,
    0
};


/*!
 * \brief Terminal device control block structure.
 */
TERMDCB dcb_term = {

    LcdInit,            /*!< \brief Initialize display subsystem, dss_init.
*/
    LcdWriteData,       /*!< \brief Write display character, dss_write. */
    LcdWriteCmd,        /*!< \brief Write display command, dss_command. */
    LcdClear,           /*!< \brief Clear display, dss_clear. */
    LcdSetCursor,       /*!< \brief Set display cursor, dss_set_cursor. */
    LcdCursorHome,      /*!< \brief Set display cursor home,
dss_cursor_home. 
*/
    LcdCursorLeft,      /*!< \brief Move display cursor left,
dss_cursor_left. 
*/
    LcdCursorRight,     /*!< \brief Move display cursor right, 
dss_cursor_right. */
    LcdCursorMode,      /*!< \brief Switch cursor on/off, dss_cursor_mode.
*/
    0,                  /*!< \brief Mode flags. */
    0,                  /*!< \brief Status flags. */
    2,                  /*!< \brief Number of rows. */
    16,                 /*!< \brief Number of columns per row. */
    16,                 /*!< \brief Number of visible columns. */
    0,                  /*!< \brief Cursor row. */
    0,                  /*!< \brief Cursor column. */
    0                   /*!< \brief Display shadow memory. */
};

Why do I get the following make errors almost throughout this structure.

gmkelly at glider:~/ethernut/nut/app/NutLCD> make avr-gcc -c -mmcu=atmega128
-Os -Wall -Wstrict-prototypes -Wa,-ahlms=nutlcd.lst -D__HARVARD_ARCH__
-I../../include  nutlcd.c -o nutlcd.o

nutlcd.c:50: error: `dcb_term' undeclared here (not in a function)
nutlcd.c:50: error: initializer element is not constant
nutlcd.c:50: error: (near initialization for `devLcd20.dev_dcb')
nutlcd.c:66: error: `LcdInit' undeclared here (not in a function)
nutlcd.c:66: error: initializer element is not constant
nutlcd.c:66: error: (near initialization for `dcb_term.dss_init')
nutlcd.c:67: error: `LcdWriteData' undeclared here (not in a function)
nutlcd.c:67: error: initializer element is not constant
nutlcd.c:67: error: (near initialization for `dcb_term.dss_write')
nutlcd.c:68: error: `LcdWriteCmd' undeclared here (not in a function)
nutlcd.c:68: error: initializer element is not constant
nutlcd.c:68: error: (near initialization for `dcb_term.dss_command')
nutlcd.c:69: error: `LcdClear' undeclared here (not in a function)
nutlcd.c:69: error: initializer element is not constant

Can anyone kindly put me out of my initial misary and offer the solution to
this C structure puzzle on why make sees 

A> terms undeclared (not in a fuction)?

B> Why the initializer element is not constant?  
I thought the preambled Static would have fixed this.

C> The  near initialization form...?  

i.e.: Simply what do I have to do to remove these make errors.

I second the idea currently floating around that there should be a
"standard"
device driver format structure for each and every device, in line with the
way Linux does it IMHO and one vote!

----------------------------------------
Much Thanks. Grahame
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion





More information about the En-Nut-Discussion mailing list