Skip to content

kodezine/qpc_nucleof031k6

Repository files navigation

The NUCLEO-32 based F031K6 board STM32CubeMX based drivers

This is a repository that uses the IOC file generated from STM32CubeMX driver generation tool for the Nucleo-F031K6 board.

STM32CubeMX generation options

The following options are used while configuration of STM32CubeMX IOC project:

  • generates for STM32CubeIDE (tested on version 1.13.1)
  • generate low level drivers (stm32f0xx_hal_...) as links rather than files to make the driver more portable
  • use the STM32CubeF0 firmware repository on GitHub as the low level drivers
  • enforce the cubemx generated hal configuration file to guide the low level compilation

⚠️ LLVM Fails to find NULL

The auto generated file sysmem.c uses NULL in the source without including string.h header file. This has to be re-introduced each time for a successful build.

CMake definitions

The following CMake definitions are required for a successful build on ARM based llvm.

Type Name Value Description
Environment CORTEX_TYPE CM0 Cortex M7 family name of the ARM controller to be used in cross compiler toolchain, always in UPPER_CASE
Environment LLVM_CLANG_ROOT_FOLDER toolchain path absolute path to the folder location of the toolchain as a string
Environment SEGGER_JLINK_ROOT_FOLDER debugger tool path absolute path to the folder location of the Segger JLink tools, used for tests on target hardware
CMake Cache Variable DEMO boolean String value of true sets the build to include blinky application to work that lights up the LD1 and LD3 on the board alternatively at 50ms interval.
CMake Cache Variable CMAKE_BUILD_TYPE Debug/Release String for debug optimised build.
CMake Cache Variable CMAKE_TOOLCHAIN_FILE path to cross compiler recepie String value that provides path where the toolchain recepie is set, usually one of the cmake files in the toolchain repositiory.
CMake Cache Variable GITHUB_BRANCH_TOOLCHAIN string String value of the GitHub branch or tag of the toolchain repoitory.
CMake Variable STM32_TYPE f0 String value of STM32 family.
CMake Variable STM32_DEVICE STH32F031x6 Case Sensitive string value of STM32 Device.
CMake Variable JLINK_DEVICE STM32F031K6 Case Sensitive string value of STM32 Device for Segger tools
CMake Cache Variable STM32_HAL_CONFIGURATION path to autogenerated HAL config file Absolute path to the autogenerated stm32f0xx_hal_conf.h file to be used for correct configuration of the HAL layer, specially the clocks.

CMake presets

The following presets are available at the time of writing this

$ cmake --list-presets
Available configure presets:

  "llvm-target-test" - llvm-target-test
  "llvm-host-test"   - llvm-host-test

CMake Project structure for each preset

llvm-target-test

This is the preset to perform unity based unit tests directly on the target hardware using Segger RTT based JRun. Alt text

llvm-host-test

This is the preset to perform unity based unit tests on host machine (Windows/Linux/Darwin) Alt text

About

Nucleo F031K6 based projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published