Search code examples
unit-testingstm32keilldratbrun

Why is LDRA TBRun missing its own seemingly basic function calls?


I'm using LDRA's TBRun on an existing project for an STM32L4 chip using Keil uVision, and trying to run a unit test sequence that is known to have succeeded on another person's machine. I'm now tasked with trying to open it on my own machine and make some small edits.

On compilation, I'm getting this error below. At first glance, it's of course quite an obvious compilation error message -- it's missing a function by the name of ldra_qq_test_comment() with the right number of parameters.

../src/my_source.cpp:626:6: note: candidate function not viable: requires 3 arguments, but 1 was provided
void ldra_qq_test_comment (char* fmt, int start, int new_line)
^
../src/my_source.cpp:2730:5: error: no matching function for call to 'ldra_qq_test_comment'
ldra_qq_test_comment ("Set Return Value : ldra_qq_retval equals 900.0f");

But that's... not part of my source code in my_source.cpp. The line number and code does not match anything from my code. And I certainly do not myself call any LDRA function from my source code.

On closer inspection, it appears to be some injected code by LDRA itself, ldra_qq_test_comment(), to mention about perhaps one of the stubs or mocked functions it controls. But, why can't LDRA find its own comment function?

Am I missing a plugin or something? Any idea on how to resolve this?


Solution

  • I found the solution.

    The key thing to know here is, even if you have the Keil TLP (armcc) compiler for the project installed in LDRA TBrun's list of compilers, and you have it selected -- LDRA's TBrun must also successfully perform a second step of compiling its own libraries with that compiler.

    LDRA's TBrun will not let you know that it's missing its own libraries, other than in this round-a-bout way of deciphering the tea leaves in the compiler's log.

    When you install the compiler, there's a checkbox at the end that gives you the choice to compile the LDRA libraries for that compiler after the install. This is a separate step from the install by calling a batch script afterwards, so if it fails, which happened in my case, the install will still appear to have succeeded.

    You'll need to watch the logs on that step carefully to make sure it succeeds, and if not, try to figure out which STM32 CMSIS and DFP packages it's missing, and go into the Keil uVision IDE and make sure to install what it expects.

    In my case, it was confusing, because I had the CMSIS and DFP installed for my chip, but it was expecting older versions of each and failed to warn about that. Check the cmd prompt output for what CMSIS and DFP include paths it's using when compiling the LDRA libraries for your given chip, and that should tell you which version it wants.