cancel
Showing results for 
Search instead for 
Did you mean: 

MicroROS, FreeRTOS. The C compiler is not able to compile a simple test program.

DavidKim
Associate

Hello! I am following this tutorial to setup FreeRTOS on STM32F446ZE using MicroROS on Raspberry Pi 4

OS: Ubuntu 22.04.4 LTS

The workspace is set up for nucleo_f446ze which is what we have. Pi and STM32 board is connected using Serial.

 

ros2 run micro_ros_setup create_firmware_ws.sh freertos nucleo_f446ze

 

 

On step "Building the firmware" when I run this build command, I get a build fail error.

 

# Build step
ros2 run micro_ros_setup build_firmware.sh

 

 

This is the error message.

 

 

Crosscompiled environment: cleaning path
Building firmware for freertos platform nucleo_f446ze
Selected app: ping_pong
rm -fR /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/build;
rm -f /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/arm_toolchain.cmake; \
cat /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/arm_toolchain.cmake.in | \
	sed "s/@CROSS_COMPILE@/\/home\/microros_ws\/firmware\/freertos_apps\/microros_nucleo_f446ze_extensions\/..\/..\/toolchain\/bin\/arm-none-eabi-/g" | \
	sed "s/@FREERTOS_TOPDIR@/\/home\/microros_ws\/firmware\/freertos_apps\/microros_nucleo_f446ze_extensions\/..\/../g" | \
	sed "s/@ARCH_CPU_FLAGS@/\"-mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F446xx -D_TIMEVAL_DEFINED -O0 -Wall -fdata-sections -ffunction-sections\"/g" | \
	sed "s/@ARCH_OPT_FLAGS@/\"\"/g" \
	> /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/arm_toolchain.cmake
cd /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../mcu_ws; \
colcon build \
	--packages-ignore-regex=.*_cpp \
	--metas /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../mcu_ws/colcon.meta /home/microros_ws/firmware/freertos_apps/apps/ping_pong/app-colcon.meta \
	--cmake-args \
	"--no-warn-unused-cli" \
	-DCMAKE_POSITION_INDEPENDENT_CODE=OFF \
	-DTHIRDPARTY=ON \
	-DBUILD_SHARED_LIBS=OFF \
	-DBUILD_TESTING=OFF \
	-DCMAKE_BUILD_TYPE=Debug \
	-DCMAKE_TOOLCHAIN_FILE=/home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/arm_toolchain.cmake \
	-DCMAKE_VERBOSE_MAKEFILE=ON; \

Starting >>> rcutils 
Starting >>> rosidl_cli                
Starting >>> rosidl_typesupport_interface
Starting >>> microcdr                                                                                        
--- stderr: rcutils                                                                                                            
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../toolchain/bin/arm-none-eabi-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_96b78/fast && gmake[1]: Entering directory '/home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp'
    /usr/bin/gmake  -f CMakeFiles/cmTC_96b78.dir/build.make CMakeFiles/cmTC_96b78.dir/build
    gmake[2]: Entering directory '/home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_96b78.dir/testCCompiler.c.obj
    /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../toolchain/bin/arm-none-eabi-gcc   -std=c11 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F446xx -D_TIMEVAL_DEFINED -O0 -Wall -fdata-sections -ffunction-sections  -DCLOCK_MONOTONIC=0  -o CMakeFiles/cmTC_96b78.dir/testCCompiler.c.obj -c /home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp/testCCompiler.c
    /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../toolchain/bin/arm-none-eabi-gcc: 1: ELF: not found
    /home/microros_ws/firmware/freertos_apps/microros_nucleo_f446ze_extensions/../../toolchain/bin/arm-none-eabi-gcc: 4: Syntax error: "(" unexpected
    gmake[2]: *** [CMakeFiles/cmTC_96b78.dir/build.make:78: CMakeFiles/cmTC_96b78.dir/testCCompiler.c.obj] Error 2
    gmake[2]: Leaving directory '/home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp'
    gmake[1]: *** [Makefile:127: cmTC_96b78/fast] Error 2
    gmake[1]: Leaving directory '/home/microros_ws/firmware/mcu_ws/build/rcutils/CMakeFiles/CMakeTmp'
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


---
Failed   <<< rcutils [3.31s, exited with code 1]
Aborted  <<< microcdr [3.41s]                                                                                    
Aborted  <<< rosidl_cli [4.11s]                                                                              
Aborted  <<< rosidl_typesupport_interface [5.22s]                            

Summary: 0 packages finished [7.53s]
  1 package failed: rcutils
  3 packages aborted: microcdr rosidl_cli rosidl_typesupport_interface
  2 packages had stderr output: microcdr rcutils
  63 packages not processed
make: *** [Makefile:227: colcon_compile] Error 1
[ros2run]: Process exited with failure 2

 

 What is the cause of this issue? How do I fix it?

0 REPLIES 0