Hello All,
I have been trying to integrate Unity Testing Framework into Keil version 5, naturally I faced a lot of issues and errors and was able to solve a lot of them, now I am facing an error that I would like to get your support with.
A brief summary:
This is my thesis project, which is Embedded software testing and the implementation teams are using Keil uvision 5 with code skeleton and configuration generated using STM32CubeMx for the development of a self-driving car project at my university.
The enviroment
OS: Windows 10 IDE-Version: µVision V5.24.2.0 Tool Version Numbers: Toolchain: MDK-ARM Professional Version: 5.24.1 Toolchain Path: C:\Keil_v5\ARM\ARMCC\Bin C Compiler: Armcc.exe V5.06 update 5 (build 528) Assembler: Armasm.exe V5.06 update 5 (build 528) Linker/Locator: ArmLink.exe V5.06 update 5 (build 528) Library Manager: ArmAr.exe V5.06 update 5 (build 528) Hex Converter: FromElf.exe V5.06 update 5 (build 528) CPU DLL: SARMCM3.DLL V5.24.1 Dialog DLL: DCM.DLL V1.16.0.0 Target DLL: STLink\ST-LINKIII-KEIL_SW0.dll V3.0.1.0 Dialog DLL: TCM.DLL V1.32.0.0
Practice board: STM32F446ZETx
The approach I plan to integrate Unity FW by using a makefile to compile and run the tests in the pre-build option available withing Keil. for now I am trying to make the makefile work using commandline outside Keil, once it works, I believe it will easy to just run it with a make command from Keil pre-build option. I followed this tutorial to create the makefile www.throwtheswitch.org/.../make
I edited the makefile by adding the appropriate armcc and armlinker with the commandline options that were present in the keil configuration of the project and the arm compiler alternatives for what the tutorial was adding to their gcc as you will see in the makefile below
The structure The following is sample structure of a Blinky project using TIM10 timer created using STM32CubeMx and Unity FW is added manually to the folder
--root ----Drivers --------CMSIS --> "Drivers related files" --------STM32F4xx_HAL-Driver --> "Drivers related files" ----Inc ---------gpio.h ---------main.h ---------stm32f4xx_hal_config.h ---------stm32f4xx_it.h ---------tim.h ----MDK-ARM ---------"Other STM32 related folders and files" ----Src ---------gpio.c ---------main.c ---------stm32f4xx_hal_msp.c ---------stm32f4xx_hal_config.c ---------stm32f4xx_it.c ---------tim.c ----Unity ---------build -------------depends --> "autogenerated by makefile" -------------objs --> "autogenerated by makefile" -------------results --> "autogenerated by makefile" -------------testing --> "autogenerated by makefile" -------------TIM10_LED_1_Ceedling_try1.map ---------src -------------stm32f4xx_hal.h -------------unity_internals.h -------------unity.c -------------unity.h ---------test -------------testgpio.c --.mxproject --makefile --mx.scratch --TIM10_LED_1_Ceedling_try1.ioc
The makefile
ifeq ($(OS),Windows_NT) ifeq ($(shell uname -s),) # not in a bash-like shell CLEANUP = del /F /Q MKDIR = mkdir else # in a bash-like shell, like msys CLEANUP = rm -f MKDIR = mkdir -p endif TARGET_EXTENSION=exe else CLEANUP = rm -f MKDIR = mkdir -p TARGET_EXTENSION=out endif .PHONY: clean .PHONY: test PATHU = Unity/src/ PATHS = Src/ PATHI = Unity/src/ PATHI2 = Inc PATHI3 = Drivers/STM32F4xx_HAL_Driver/Inc PATHI4 = Drivers/STM32F4xx_HAL_Driver/Inc/Legacy PATHI5 = Drivers/CMSIS/Device/ST/STM32F4xx/Include PATHI6 = Drivers/CMSIS/Include PATHT = Unity/test/ PATHB = Unity/build/testing/ PATHD = Unity/build/depends/ PATHO = Unity/build/objs/ PATHR = Unity/build/results/ BUILD_PATHS = $(PATHB) $(PATHD) $(PATHO) $(PATHR) SRCT = $(wildcard $(PATHT)*.c) COMPILE=armcc -c --cpu Cortex-M4.fp -D__MICROLIB -g -O3 --apcs=interwork --split_sections LINK=armlink --library_type=microlib --libpath="C:\Keil_v5\ARM\ARMCC\lib" --strict --scatter "MDK-ARM\TIM10_LED_1_Ceedling_try1\TIM10_LED_1_Ceedling_try1.sct" --diag_suppress=L6329 --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers --list "TIM10_LED_1_Ceedling_try1.map" -o "MDK-ARM\TIM10_LED_1_Ceedling_try1\TIM10_LED_1_Ceedling_try1.axf" DEPEND=armcc --no_depend_system_headers --depend_dir=$(PATHD) CFLAGS=-I. -I$(PATHU) -I$(PATHS) -I$(PATHI) -I$(PATHI2) -I$(PATHI3) -I$(PATHI4) -I$(PATHI5) -I$(PATHI6) RESULTS = $(patsubst $(PATHT)Test%.c,$(PATHR)Test%.txt,$(SRCT) ) PASSED = 'grep -s PASS $(PATHR)*.txt' FAIL = 'grep -s FAIL $(PATHR)*.txt' IGNORE = 'grep -s IGNORE $(PATHR)*.txt' test: $(BUILD_PATHS) $(RESULTS) @echo "-----------------------\nIGNORES:\n-----------------------" @echo "$(IGNORE)" @echo "-----------------------\nFAILURES:\n-----------------------" @echo "$(FAIL)" @echo "-----------------------\nPASSED:\n-----------------------" @echo "$(PASSED)" @echo "\nDONE" $(PATHR)%.txt: $(PATHB)%.$(TARGET_EXTENSION) -./$< > $@ 2>&1 $(PATHB)Test%.$(TARGET_EXTENSION): $(PATHO)Test%.o $(PATHO)%.o $(PATHU)unity.o $(PATHD)Test%.d $(LINK) $@ $^ $(PATHO)%.o:: $(PATHT)%.c $(COMPILE) $(CFLAGS) $< -o $@ $(PATHO)%.o:: $(PATHS)%.c $(COMPILE) $(CFLAGS) $< -o $@ $(PATHO)%.o:: $(PATHU)%.c $(PATHU)%.h $(COMPILE) $(CFLAGS) $< -o $@ $(PATHD)%.d:: $(PATHT)%.c $(DEPEND) $@ $< $(PATHB): $(MKDIR) $(PATHB) $(PATHD): $(MKDIR) $(PATHD) $(PATHO): $(MKDIR) $(PATHO) $(PATHR): $(MKDIR) $(PATHR) clean: $(CLEANUP) $(PATHO)*.o $(CLEANUP) $(PATHB)*.$(TARGET_EXTENSION) $(CLEANUP) $(PATHR)*.txt .PRECIOUS: $(PATHB)Test%.$(TARGET_EXTENSION) .PRECIOUS: $(PATHD)%.d .PRECIOUS: $(PATHO)%.o .PRECIOUS: $(PATHR)%.txt
The current output and error
$ makecc -I. -IUnity/src/ -ISrc/ -IUnity/src/ -IInc -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IDrivers/CMSIS/Include -c -o Unity/src/unity.o Unity/src/unity.c armcc --no_depend_system_headers --depend_dir=Unity/build/depends/ Unity/build/depends/Testgpio.d Unity/test/Testgpio.c Error: C4065E: type of input file 'Unity/build/depends/Testgpio.d' unknown make: *** [makefile:74: Unity/bui