Where to get the Unity test framework in a projoect with no framework?

I am trying to setup Unity unit tests in an STM32H750 project that uses no framework. When I try to #include “Unity.h” in the test file the header file does not exist and my understanding is that platformio provides the Unity code as part of the framework. My question, is, where does the header file and the entire unity library are supposed to come from in a project with no framework?

I read in the link below about custom Unity libraries, and it mentions test_custom_runner.py, unity_config.h, and unity_config.c, but am not sure where to find the unity code itself.

https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/examples/custom_unity_library.html#project-example

My platformio.ini

[env:my_env]
platform = ststm32
extra_scripts = extra_script.py
board = my_genericSTM32H750VBTX
; Linker file is from cube ide.
board_build.ldscript = STM32H750VBTX_FLASH.ld
build_type = debug
debug_tool = stlink
upload_protocol = stlink
debug_build_flags = -O0 -ggdb3 -g3
; debug_init_break = tbreak app_main
debug_init_break = tbreak main
monitor_port = COM6
lib_archive = no
check_skip_packages = yes
lib_deps = 
  cube_ide
  serial_packets
  system
build_flags =
  -fmax-errors=5
  -mfpu=fpv5-sp-d16 
  -mfloat-abi=hard 
  -Wl,-Map,${BUILD_DIR}/firmware.map
  -mthumb 
  -D DEBUG
  -D USE_HAL_DRIVER
  -DSTM32_THREAD_SAFE_STRATEGY=4
  -fstack-usage
  -std=gnu11
  -Ilib/cube_ide/Core/Inc
  -Ilib/cube_ide/Core/ThreadSafe
  -Ilib/cube_ide/Drivers/CMSIS/Device/ST/STM32H7xx/Include
  -Ilib/cube_ide/Drivers/CMSIS/Include
  -Ilib/cube_ide/Drivers/STM32H7xx_HAL_Driver/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  -Ilib/cube_ide/Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/Include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/include
  -Ilib/cube_ide/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F
  -Ilib/cube_ide/USB_DEVICE/App
  -Ilib/cube_ide/USB_DEVICE/Target
  -D CONFIG_MAX_PACKET_DATA_LEN=100
  -D CONFIG_MAX_PENDING_COMMANDS=5

Have you tried to build a project? PlatformIO will pull all dependencies and resolve “VSCode issues”.

That worked. I can see it now under .pio/build. Thanks!

1 Like