embedded-gcov
embedded-gcov copied to clipboard
unable to get correct gcda data from ARM cortex M4 microcontroller
Hi, I really appreciate the effort you put into developing embedded gcov code. I am using your code to get coverage data from ARM cortex M4 microcontroller using embedded GCC ARM toolchain in EmBitz. I received supposedly gcda HEX dump data on serial port and tried to use your gcov_convert.sh to convert it to binary gcda. However, I only receive 12 bytes of fixed gcda data for each files of my project which is sort of weird. I am wondering why am I not able to run your code on my target to get complete coverage data.
Any help would be highly appreciated!
Hi,
Did you manage to make it work further ?
I'm trying to accomplish the same, on Cortex M33. I'm using the following toolchain :
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1 20210621 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have a main.c which looks like this :
int main(void)
{
// before __gcov_call_constructors(), only some init stuff like clock configuration
__gcov_call_constructors();
RUN_TEST(testDummy);
__gcov_exit();
return 0;
}
I'm building with the following options :
...
arm-none-eabi-gcc -O0 -mcpu=cortex-m33 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DSTM32U5 -DSTM32U585xx -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -specs=nosys.specs -lm -lgcov -fprofile-arcs -ftest-coverage -Wall -Werror -Wall -Werror -Wno-unknown-pragmas -I ./BoardConfig/ -I ./CMSIS/Compiler -I ./CMSIS/Core -I ./CMSIS/Device -I ./HAL/ -I ./HAL/Legacy -I ./HIL/ -I ./Startup/ -I ./libs/GFW.Tools.Unity/src -I ./libs/embedded-gcov/code -c feature1_test.c -o obj/feature1_test.o
...
When i run the my tests on target, i do some output over my uart, /dev/ttyACM0
(it's the ST-LINK's uart) :
main.c:125:testDummy:PASS
gcov_exit
Gcov End
First line is printed by the unit test framework i'm using, the other lines are printed by __gcov_exit
.
It does not print anything else because the GcovInfo *listptr
list seems empty in gcov_exit
. In gcov_call_constructors
, the loop that loops over constructors doesn't do anything, i assume this is why i get no output but i can't figure why it remains empty.
Do you guys have any idea why the constructor list is empty ?
I am using embedded arm gcc V5.4 in my IDE and cross compiling it for cortex M4. I do not have to call gcov_call_constructors in my application explicitly as my gcc compiler automatically calls __gcov_init function before my application is started. It initializes gcov_info struct for each of my object files. Why your compiler is not calling __gcov_init?
I also get only 12 bytes from gcov_convert_to_gcda
, furthermore the filenames are not correct and always empty \0
.