How to compile rosflight/firmware

We are getting errors trying to compile rosflight/firmware:
We've tried compiling from within the rosflight_ws git clone as well as cloning rosflight/firmware standalone and then compiling.

We've followed the instructions exactly as in the docs and have installed all prereqs
We are getting a make error when we try compiling from the standalone clone:
No rule to make target 'build/rosflight/lib/breezystm32/drv_gpio.o' , needed by 'build/rosflight.elf"

From the rosflight_ws clone with the submodules we get an error that ::printf is not defined.

Any ideas?

Best Answer

  • 6 Comments sorted by Votes Date Added
  • Oh, darn it.

    So, I think what is going on is that sometimes the gcc-arm-embedded package from the ppa breaks things.

    You need to download and install an older version of the compiler. (I don't know why their updates break things).

    I've modified the documentation to reference a known working version of the compiler, but until then, try this script:

    sudo apt remove gcc-arm-embedded
    sudo apt install -y lib32ncurses5
    wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
    tar -xvf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
    sudo mv gcc-arm-none-eabi-5_4-2016q3 /opt/.
    echo "export PATH=\$PATH:/opt/gcc-arm-none-eabi-5_4-2016q3/bin" >> ~/.bashrc
    rm -rf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
    

Answers

  • Looks like we forgot to add the submodule clone step in the documentation; I'll get that fixed. The command is

    git submodule update --init --recursive
    

    You should be able to make after running that.

  • It looks like you haven't cloned the submodules in the firmware package. (drv_gpio.c is in breezystm32, a submodule to the firmware)

  • I'm not sure what the ::printf error is. Could you please post the full error message?

  • The ::printf error looks like this:

    cd boards/naze && make -j4 DEBUG= SERIAL_DEVICE=/dev/ttyUSB0
    make[1]: Entering directory '/home/tim/rosflight_ws/src/rosflight/rosflight_firmware/firmware/boards/naze'
    %% core_cm3.c
    %% system_stm32f10x.c
    %% stm32f10x_dma.c
    %% stm32f10x_dbgmcu.c
    %% stm32f10x_iwdg.c
    %% stm32f10x_dac.c
    %% stm32f10x_can.c
    %% stm32f10x_rtc.c
    %% stm32f10x_pwr.c
    %% stm32f10x_i2c.c
    %% stm32f10x_sdio.c
    %% stm32f10x_rcc.c
    %% stm32f10x_flash.c
    %% stm32f10x_crc.c
    %% stm32f10x_usart.c
    %% stm32f10x_wwdg.c
    %% stm32f10x_cec.c
    %% misc.c
    %% stm32f10x_tim.c
    %% stm32f10x_adc.c
    %% stm32f10x_spi.c
    %% stm32f10x_bkp.c
    %% stm32f10x_exti.c
    %% stm32f10x_fsmc.c
    %% stm32f10x_gpio.c
    %% drv_gpio.c
    %% drv_i2c.c
    %% drv_adc.c
    %% drv_spi.c
    %% drv_pwm.c
    %% drv_system.c
    %% drv_serial.c
    %% drv_uart.c
    %% drv_timer.c
    %% drv_mpu6050.c
    %% drv_ms4525.c
    %% drv_mb1242.c
    %% drv_ms5611.c
    %% drv_hmc5883l.c
    arm-none-eabi-gcc -E lib/breezystm32/startup_stm32f10x_md_gcc.S > lib/breezystm32/startup_stm32f10x_md_gcc.s
    %% flash.c
    %% nanoprintf.cpp
    %% rosflight.cpp
    %% param.cpp
    %% sensors.cpp
    %% state_manager.cpp
    %% estimator.cpp
    %% mavlink.cpp
    %% controller.cpp
    %% command_manager.cpp
    %% rc.cpp
    %% mixer.cpp
    %% naze32.cpp
    %% main.cpp
    In file included from /usr/arm-none-eabi/include/stdlib.h:11:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/cstdlib:75,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdlib.h:36,
    from lib/breezystm32/breezystm32.h:25,
    from naze32.cpp:34:
    lib/breezystm32/breezyprintf.h:118:16: error: conflicting declaration of C function 'int tfp_printf(const char*, ...)'
    #define printf tfp_printf
    ^
    In file included from lib/breezystm32/breezystm32.h:46:0,
    from naze32.cpp:34:
    lib/breezystm32/breezyprintf.h:113:6: note: previous declaration 'void tfp_printf(const char*, ...)'
    void tfp_printf(const char fmt, ...);
    ^~~~~~
    In file included from /usr/arm-none-eabi/include/stdlib.h:11:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/cstdlib:75,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdlib.h:36,
    from lib/breezystm32/breezystm32.h:25,
    from naze32.cpp:34:
    lib/breezystm32/breezyprintf.h:119:17: error: conflicting declaration of C function 'int tfp_sprintf(char
    , const char*, ...)'
    #define sprintf tfp_sprintf
    ^
    In file included from lib/breezystm32/breezystm32.h:46:0,
    from naze32.cpp:34:
    lib/breezystm32/breezyprintf.h:114:6: note: previous declaration 'void tfp_sprintf(char*, const char*, ...)'
    void tfp_sprintf(char* s, const char fmt, ...);
    ^~~
    In file included from /usr/arm-none-eabi/include/c++/6.3.1/ext/string_conversions.h:43:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/bits/basic_string.h:5417,
    from /usr/arm-none-eabi/include/c++/6.3.1/string:52,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdexcept:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/array:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/tuple:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/functional:55,
    from ../../include/board.h:35,
    from naze32.h:41,
    from naze32.cpp:44:
    /usr/arm-none-eabi/include/c++/6.3.1/cstdio:127:11: error: '::printf' has not been declared
    using ::printf;
    ^~
    /usr/arm-none-eabi/include/c++/6.3.1/cstdio:137:11: error: '::sprintf' has not been declared
    using ::sprintf;
    ^~~
    In file included from /usr/arm-none-eabi/include/stdlib.h:11:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/cstdlib:75,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdlib.h:36,
    from lib/breezystm32/breezystm32.h:25,
    from naze32.h:38,
    from main.cpp:32:
    lib/breezystm32/breezyprintf.h:118:16: error: conflicting declaration of C function 'int tfp_printf(const char
    , ...)'
    #define printf tfp_printf
    ^
    In file included from lib/breezystm32/breezystm32.h:46:0,
    from naze32.h:38,
    from main.cpp:32:
    lib/breezystm32/breezyprintf.h:113:6: note: previous declaration 'void tfp_printf(const char*, ...)'
    void tfp_printf(const char fmt, ...);
    ^~~~~~
    In file included from /usr/arm-none-eabi/include/stdlib.h:11:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/cstdlib:75,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdlib.h:36,
    from lib/breezystm32/breezystm32.h:25,
    from naze32.h:38,
    from main.cpp:32:
    lib/breezystm32/breezyprintf.h:119:17: error: conflicting declaration of C function 'int tfp_sprintf(char
    , const char*, ...)'
    #define sprintf tfp_sprintf
    ^
    In file included from lib/breezystm32/breezystm32.h:46:0,
    from naze32.h:38,
    from main.cpp:32:
    lib/breezystm32/breezyprintf.h:114:6: note: previous declaration 'void tfp_sprintf(char*, const char*, ...)'
    void tfp_sprintf(char* s, const char *fmt, ...);
    ^~~
    In file included from /usr/arm-none-eabi/include/c++/6.3.1/ext/string_conversions.h:43:0,
    from /usr/arm-none-eabi/include/c++/6.3.1/bits/basic_string.h:5417,
    from /usr/arm-none-eabi/include/c++/6.3.1/string:52,
    from /usr/arm-none-eabi/include/c++/6.3.1/stdexcept:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/array:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/tuple:39,
    from /usr/arm-none-eabi/include/c++/6.3.1/functional:55,
    from ../../include/board.h:35,
    from naze32.h:41,
    from main.cpp:32:
    /usr/arm-none-eabi/include/c++/6.3.1/cstdio:127:11: error: '::printf' has not been declared
    using ::printf;
    ^~
    /usr/arm-none-eabi/include/c++/6.3.1/cstdio:137:11: error: '::sprintf' has not been declared
    using ::sprintf;
    ^~~
    Makefile:207: recipe for target 'build/rosflight/./naze32.o' failed
    make[1]: *** [build/rosflight/./naze32.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    Makefile:207: recipe for target 'build/rosflight/./main.o' failed
    make[1]: *** [build/rosflight/./main.o] Error 1
    rm lib/breezystm32/startup_stm32f10x_md_gcc.s
    make[1]: Leaving directory '/home/tim/rosflight_ws/src/rosflight/rosflight_firmware/firmware/boards/naze'
    Makefile:54: recipe for target 'all' failed
    make: *** [all] Error 2

  • That did it, thanks!
    You also might want to add
    source ~/.bashrc

Sign In or Register to comment.