Include CPP Library Issue
Posted: Tue Feb 27, 2018 3:01 am
Hello,
I'm trying to refactor an existing Arduino CPP library for ChibiOS. The library is for the MCP2515. I've created a new folder under the project called mcp_can, and the main .cpp file is called ./mcp_can/mcp_can.cpp. I've added it the makefile with CPPSRC. I've also added in CHCPPSRC and CHCPPINC, following suit with the 'RT-STM32F407-DISCOVERY-G++' sample project (which compiles fine, I've even tried adding the library to this and it still produces this result). I'm getting many errors like the following:
./mcp_can/mcp_can.cpp:210:19: note: in expansion of macro 'spi_read'
values[i] = spi_read();
^~~~~~~~
In file included from C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:129:0,
from C:\ChibiStudio\chibios176/os/hal/include/hal.h:124,
from ./mcp_can/mcp_can_dfs.h:53,
from ./mcp_can/mcp_can.h:50,
from ./mcp_can/mcp_can.cpp:48:
C:\ChibiStudio\chibios176/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h:289:44: error: base operand of '->' is not a pointer
#define pal_lld_setport(port, bits) ((port)->BSRR = (bits))
^
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:286:32: note: in expansion of macro 'pal_lld_setport'
#define palSetPort(port, bits) pal_lld_setport(port, bits)
^~~~~~~~~~~~~~~
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:454:30: note: in expansion of macro 'palSetPort'
#define palSetPad(port, pad) palSetPort(port, PAL_PORT_BIT(pad))
^~~~~~~~~~
./mcp_can/mcp_can_dfs.h:396:28: note: in expansion of macro 'palSetPad'
#define MCP2515_UNSELECT() palSetPad(SPIGPIO, SPICS)
^~~~~~~~~
Hopefully this is enough information. I'm used to working with high level languages, and also with Arduino, so this is new to me. Sorry!
Thanks a ton in advance!
I'm trying to refactor an existing Arduino CPP library for ChibiOS. The library is for the MCP2515. I've created a new folder under the project called mcp_can, and the main .cpp file is called ./mcp_can/mcp_can.cpp. I've added it the makefile with CPPSRC. I've also added in CHCPPSRC and CHCPPINC, following suit with the 'RT-STM32F407-DISCOVERY-G++' sample project (which compiles fine, I've even tried adding the library to this and it still produces this result). I'm getting many errors like the following:
./mcp_can/mcp_can.cpp:210:19: note: in expansion of macro 'spi_read'
values[i] = spi_read();
^~~~~~~~
In file included from C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:129:0,
from C:\ChibiStudio\chibios176/os/hal/include/hal.h:124,
from ./mcp_can/mcp_can_dfs.h:53,
from ./mcp_can/mcp_can.h:50,
from ./mcp_can/mcp_can.cpp:48:
C:\ChibiStudio\chibios176/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h:289:44: error: base operand of '->' is not a pointer
#define pal_lld_setport(port, bits) ((port)->BSRR = (bits))
^
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:286:32: note: in expansion of macro 'pal_lld_setport'
#define palSetPort(port, bits) pal_lld_setport(port, bits)
^~~~~~~~~~~~~~~
C:\ChibiStudio\chibios176/os/hal/include/hal_pal.h:454:30: note: in expansion of macro 'palSetPort'
#define palSetPad(port, pad) palSetPort(port, PAL_PORT_BIT(pad))
^~~~~~~~~~
./mcp_can/mcp_can_dfs.h:396:28: note: in expansion of macro 'palSetPad'
#define MCP2515_UNSELECT() palSetPad(SPIGPIO, SPICS)
^~~~~~~~~
Hopefully this is enough information. I'm used to working with high level languages, and also with Arduino, so this is new to me. Sorry!
Thanks a ton in advance!