RavenLRS / raven

Raven Long Range System
GNU General Public License v3.0
165 stars 45 forks source link

Trouble building with libopencm3 #39

Closed jaxxzer closed 5 years ago

jaxxzer commented 5 years ago

When trying to build with this simple patch, I am having a strange error:

In file included from lib/libopencm3/include/libopencm3/stm32/f1/gpio.h:39,
                 from main/target/platforms/stm32/main.c:2:
lib/libopencm3/include/libopencm3/stm32/common/gpio_common_all.h:72:12: error: expected ';' before 'void'
 BEGIN_DECLS
            ^
            ;

Simply removing the DECLS macros resolves the issue.

I do not have any problem building libopencm3-examples, and the error remains in raven after pulling in libopencm3 master. This leads me to believe this is some problem with raven.

This script demonstrate the issue and the results can be seen here.

arm-none-eabi-gcc -v && \
git clone https://github.com/RavenLRS/raven && \
cd raven && \
git submodule update --init --recursive && \
TARGET=stm32f1_blackpill_rx make && \
curl https://github.com/jaxxzer/raven/commit/e92aa5b8741c96064abdf3f8e1c467bf06b603df.patch | git apply && \
git diff && \
TARGET=stm32f1_blackpill_rx make
fiam commented 5 years ago

You need to include <libopencm3/stm32/gpio.h> instead of <libopencm3/stm32/f1/gpio.h>. Generally, in libopencm3 you include the family header and the subfamily is provided via CFLAGS.