I want to flash the code I wrote with gtest to an NXP processor with an ARM Cortex-M0 core.
In the end, I want to write bsp_uart on top of the SDK I have and read the LOG.
My primary goal is to run the code and SDK on QEMU. For this reason, I prepared a Makefile to generate an ELF file output and added the toolchain. However, I am getting the following error. What could be the cause of this error?
googletest/googletest/include/gtest/internal/gtest-type-util.h:75: Error: bad instruction `size_t pos=0'
I receive hundreds of messages like the error above, I only wrote one of them.
There is a gtest version 1.8.1 with an example Makefile, do I have to use that one?
Before this error, I was getting the following error:
undefined reference to `testing::Test::~Test
For this, it was necessary to link gtest_main and gtest. I tried to link them myself, but afterwards, I encountered the error mentioned above.
However, when I run the same code with CMake, I don’t get an error.
target_link_libraries(test_foo
gtest_main
gmock
pthread
lib)
There is no issue when I write it. I can’t share the entire Makefile right now, but I can say that I encountered the first error I mentioned when I did it as shown below
GTEST_DIR=googletest/googletest
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h
$(GTEST_DIR)/include/gtest/internal/*.h
SOURCE_DIR+=$(GTEST_HEADERS)
The second error (the undefined reference) I received is from the following Makefile;
GTEST_BASEDIR_SDK:=googletest/googletest/include/
GTEST_BASEDIR_SRC_SDK:=googletest/googletest/src/
SOURCE_DIR+=$(GTEST_BASEDIR_SDK)
SOURCE_DIR+=$(GTEST_BASEDIR_SRC_SDK)
The includes of my test code are as follows;
#include "gtest/gtest.h"
#include <iostream>
extern "C" {
#include "../../lib/assembly/cmsis_gcc.h"
#include "bsp_i2c.h"
}
#include "fff.h"
My goal is to compile the test code written with gtest alongside my source code, then run the generated ELF file on QEMU. Afterward, I will flash this file onto the target using JLink.
Do you have any suggestions or is anyone else experiencing this issue?