Cross-compiling CppUTest (unit testing harness) on STM32MP1 A7 core

45 views Asked by At

I'm working on a project targeting the STM32MP1 Cortex-A7 processor and I'm trying to integrate the CppUTest framework into my build process. I am using VirtualBox Linux for cross-compiling my code. My development environment is set up with a specific toolchain for cross-compilation, activated by sourcing a script provided by the SDK:

source /opt/poky-bytesatwork/3.2.2/environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi

I have a Makefile for my project, and I need to include the compilation of the CppUTest library within this Makefile. Here's the relevant portion of my Makefile setup:

CXX ?= g++
APP = stb
BIN = bin/
GIT_REVISION := $(shell git describe --abbrev=10 --dirty --always)
INCLUDE = -ICommandInterface -ICommon -IDataHandling -IFakeDevices -IHardwareInterface \
          -ILocalTest -ILocalTest/Tests -ILocalTest/Tests/A7tests -ILocalTest/CppUTest/include
SOURCE_FILES = CommandInterface/CommandInterface.cpp \
               Common/Main.cpp \
               Common/MainHandler.cpp \
               Common/ObjectHandler.cpp \
               ...etc

CPPUTEST_LIB_DIR = LocalTest/CppUTest/lib

$(APP): $(BIN)
    $(CXX) -Wall -g -O2 -pthread -DGIT_REVISION=\"$(GIT_REVISION)\" -o $(BIN)$(APP) $(INCLUDE) $(SOURCE_FILES) -Wno-unknown-pragmas -L$(CPPUTEST_LIB_DIR) -lCppUTest -lCppUTestExt

$(BIN):
    @mkdir -p $(BIN)

I'm unsure how to correctly compile the CppUTest library using the cross-compiler specified by the sourced environment. My goal is:

Ensure CppUTest is compiled with the correct cross-compiler.

Questions:

How can I adjust my Makefile (or CppUTest Makefile) to automatically compile CppUTest with the cross-compiler before building my application?

I attempted to configure the CppUTest project for cross-compilation using the following command:

./configure --host=arm-poky-linux-gnueabi-g++

However, after running the ./configure command with the --host option specified for my cross-compiler, the compilation failed with this error:

checking host system type... Invalid configuration `arm-poky-linux-gnueabi-g++': more than four components

configure: error: /bin/bash ././config.sub arm-poky-linux-gnueabi-g++ failed
0

There are 0 answers