[sw,cov] Add asm code coverage framework
This PR enables basic block coverage for assembly code.
Initially, this coverage framework is activated on crt.S for testing purposes; support for additional assembly files will be incorporated in subsequent PRs.
./bazelisk.sh coverage --config=ot_coverage \
//sw/device/tests:crt_test_fpga_cw340_test_rom
genhtml -o /tmp/$USER/coverage --ignore-errors inconsistent \
bazel-out/_coverage/_coverage_report.dat
# ...
# Processing file sw/device/lib/crt/crt.S
# lines=51 hit=51 functions=2 hit=2
# ...
It introduces a tool to automatically instrument assembly files with markers for coverage analysis:
./util/coverage/asm/run_instrument.sh --dryrun
Due to certain special cases requiring manual instrumentation (e.g. reg clobbering), this auto-instrumentation tool is not integrated into the automated build process, but integrated as a CI linter check.
Instrumented assembly files must be manually reviewed and committed to the repository.
When assembly files are modified, re-running the ./util/coverage/asm/run_instrument.sh --apply tool will update the auto-generated markers.
Hi, Could I get some feedback on this PR? I apologize for its size, but this is the minimum amount that can still be tested end-to-end with ./bazelisk.sh coverage. Thanks!