Mailbox generated .c files don't compile

Mailbox generated .c files don't compile

par Tanguy Sagi Husseini,
Number of replies: 0

Hello,

I added the Mailbox component in my qsys, specifically
"Processors and Peripherals"
x- "Inter-Process Communication"
    x- "Avalon Mailbox (simple) Intel FPGA IP"

But when i try to compile the BSP, the autogenerated file "alt_sys_init.c" has many compilation errors, particularly around the Mailbox component.

Have I added the wrong component or did I miss something?

Thank you.

Error log:

19:00:18 **** Build of configuration Nios II for project mulpro_bsp ****
make all
Compiling alt_sys_init.c...
nios2-elf-gcc -xc -MP -MMD -c  -I./HAL/inc -I. -I./drivers/inc -pipe -D__hal__ -DALT_NO_INSTRUCTION_EMULATION -DALT_SINGLE_THREADED    -O0 -g -Wall  -mno-hw-div -mhw-mul -mno-hw-mulx -mgpopt=global   -o obj/alt_sys_init.o alt_sys_init.c
In file included from alt_sys_init.c:62:0:
alt_sys_init.c:73:41: error: 'MAILBOX_SIMPLE_0_NAME' undeclared here (not in a function)
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
                                         ^
./drivers/inc/altera_avalon_mailbox_simple.h:90:7: note: in definition of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
       name##_NAME,                                              \
       ^
./drivers/inc/altera_avalon_mailbox_simple.h:91:7: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
       altera_avalon_mailbox_open,                               \
       ^
alt_sys_init.c:73:1: note: in expansion of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
 ^
./drivers/inc/altera_avalon_mailbox_simple.h:91:7: note: (near initialization for 'mailbox_simple_0.dev.open')
       altera_avalon_mailbox_open,                               \
       ^
alt_sys_init.c:73:1: note: in expansion of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
 ^
./drivers/inc/altera_avalon_mailbox_simple.h:92:7: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
       altera_avalon_mailbox_close,                              \
       ^
alt_sys_init.c:73:1: note: in expansion of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
 ^
./drivers/inc/altera_avalon_mailbox_simple.h:92:7: note: (near initialization for 'mailbox_simple_0.dev.close')
       altera_avalon_mailbox_close,                              \
       ^
alt_sys_init.c:73:1: note: in expansion of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
 ^
alt_sys_init.c:73:1: warning: braces around scalar initializer
alt_sys_init.c:73:1: note: (near initialization for 'mailbox_simple_0.base')
In file included from alt_sys_init.c:62:0:
alt_sys_init.c:73:41: error: 'MAILBOX_SIMPLE_0_BASE' undeclared here (not in a function)
 ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE ( MAILBOX_SIMPLE_0, mailbox_simple_0);
                                         ^
./drivers/inc/altera_avalon_mailbox_simple.h:100:5: note: in definition of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INSTANCE'
     name##_BASE,                                                \
     ^
alt_sys_init.c: In function 'alt_sys_init':
alt_sys_init.c:102:41: error: 'MAILBOX_SIMPLE_0_IRQ' undeclared (first use in this function)
     ALTERA_AVALON_MAILBOX_SIMPLE_INIT ( MAILBOX_SIMPLE_0, mailbox_simple_0);
                                         ^
./drivers/inc/altera_avalon_mailbox_simple.h:113:9: note: in definition of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INIT'
     if (name##_IRQ == ALT_IRQ_NOT_CONNECTED)                                 \
         ^
alt_sys_init.c:102:41: note: each undeclared identifier is reported only once for each function it appears in
     ALTERA_AVALON_MAILBOX_SIMPLE_INIT ( MAILBOX_SIMPLE_0, mailbox_simple_0);
                                         ^
./drivers/inc/altera_avalon_mailbox_simple.h:113:9: note: in definition of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INIT'
     if (name##_IRQ == ALT_IRQ_NOT_CONNECTED)                                 \
         ^
alt_sys_init.c:102:41: error: 'MAILBOX_SIMPLE_0_IRQ_INTERRUPT_CONTROLLER_ID' undeclared (first use in this function)
     ALTERA_AVALON_MAILBOX_SIMPLE_INIT ( MAILBOX_SIMPLE_0, mailbox_simple_0);
                                         ^
./drivers/inc/altera_avalon_mailbox_simple.h:119:41: note: in definition of macro 'ALTERA_AVALON_MAILBOX_SIMPLE_INIT'
                                         name##_IRQ_INTERRUPT_CONTROLLER_ID,  \
                                         ^
make: *** [Makefile:595: obj/alt_sys_init.o] Error 1

19:00:18 Build Finished (took 160ms)