i need to do code coverage in several very resource constrained device in bare metal.
when i try to enable this stuff my ram usage doubles and code size blows up nothing fits.
its functionally not possible to use as implemented in gcc it will not fit
what gcc seems to be creating is a small data structure to hold info then when the app exits it dumps the data to a file.
sorry my target does not have a file system so that will not work and i need it to work in the target on my board and not in a simulator (trying to do code coverage for itq handlers etc)
what i think would work is to insert a series of function calls at each interesting point in the generated code
example : at an if statement i need to record where the if is true, and when false.
so if i create 2 functions: _gcc_condition_true(), or _gcc_condition_false()maybe two more: _gcc_func_enter(), and _gcc_func_exit()
these would be return void and take void parameters
i can easily implement these on my embedded target.
for example on an big arm64 - i can use the the system trace module, or on a coretexM the one wire trace (SWV) or even a high speed synchronous uart, or a simple spi interface that ran at some high speed (say 100mhz)
for example say a spi or uart interface might output 4 (or 5) bytes, ie an ascii T,F (true/false) or E or X (enter exit) followed by the 32 bit return address. if the code size is not large i could use the low 24bits of the address and the upper 8bits as the reason code
externally i capture this data some how small fpga with ddr… then reconstruct the call flow needed for coverage.
another tough part is i would need to build 10-20 different instrumented test apps because the whole thing will not fit on the device (ie: i have 256k total flash and 20-30k ram there is no other chip, this chip is my only solution, and i need to do coverage over the hardware drivers
the idea is the external process would map the call back to the source code via “addr2line” operations. thus i can create a score board of what is and is not yet tested
any ideas on how or where inside gcc to start hacking… its been 15 years since i was last hacking gcc internals and it has changed quite a lot…
i need to do this for: cortexm3, m4, arm64, riscv, and xilinx microblaze targets.
nothing commercial can come close… they only support linux apps or simulations that do not support my targets.