Keil unable to build unit test using library approach
Hello,
I am using Keil for our application development. The objective is to create unit tests for our application that will run in the ARMCM4_FP emulator.
For unit testing, I created a "UnitTest" build target that creates a library, verses an executable, of the application code and any non-hardware dependent library functions required by the application. "Project/Properties/Parasoft/C/C++test/Build Settings" have been modified to include the application library in the link line. When I try to compile the unit test "__user_initial_stackheap" is an undefined symbol. (see error message below) Based on the console output it appears that startup_ARMCM4.s is never compiled. (which contains this symbol) I tried adding startup_ARMCM4.s and system_ARMCM4.c in the library build but that did not work.
My guess is that since the uVision project is a library and not an executable, C++test does not have enough information to build an executable.
Any ideas on how to resolve this issue?
C/C++test analysis errors in /etm_ble2/app/app_timer_pool.c
1. Test execution: error linking test executable for Test unit for /etm_ble2/app/app_timer_pool.c.
Error: L6915E: Library reports error: __use_no_semihosting was requested, but __user_initial_stackheap was referenced
Finished: 0 information, 0 warning and 1 error messages.
Comments
-
I think that we need to add the object where those symbols are via additional linker options:
https://docs.parasoft.com/pages/viewpage.action?pageId=50501268
0 -
Thanks Andrey,
I went back to the Keil project and discovered that startup_ARMCM4.s and system_ARMCM4.c were not built as part of the library. Fixed this by adding those files to one of the Keil project groups.
The unit test builds and runs now!
Thanks
0