All Projects → rgujju → STM32_Base_Project

rgujju / STM32_Base_Project

Licence: other
STM32 Base project with a lot of stuff

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
assembly
5116 projects
ruby
36898 projects - #4 most used programming language
CMake
9771 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to STM32 Base Project

FreeRTOS-rust
Rust crate for FreeRTOS
Stars: ✭ 159 (+174.14%)
Mutual labels:  embedded, stm32, freertos
Tinyframe
A simple library for building and parsing data frames for serial interfaces (like UART / RS232)
Stars: ✭ 151 (+160.34%)
Mutual labels:  embedded, stm32
Lwmem
Lightweight dynamic memory manager library for embedded systems with memory constraints. It implements malloc, calloc, realloc and free functions
Stars: ✭ 92 (+58.62%)
Mutual labels:  embedded, stm32
stm32 framework
一个志在实现STM32F1、F2和F4工程模板的项目,集成了FreeRTOS、LWIP、FATFS、DSP、USB、IAP、菜单库、有限状态机模板等等的组件,以及未来将加入的加密、BPNN、最小二乘、音频图片视频解码、LittlevGL等诸多常用的算法或组件,并具有良好的易用性、解耦性和可剪裁性!
Stars: ✭ 91 (+56.9%)
Mutual labels:  stm32, freertos
Robot Software
CVRA monorepo - All software running on our bots lives here
Stars: ✭ 39 (-32.76%)
Mutual labels:  embedded, stm32
Stm32l4xx Hal
A Hardware abstraction layer for the stm32l432xx series chips written in rust.
Stars: ✭ 65 (+12.07%)
Mutual labels:  embedded, stm32
Jled
Non-blocking LED controlling library for Arduino and friends.
Stars: ✭ 197 (+239.66%)
Mutual labels:  embedded, stm32
Teenyusb
Lightweight USB device and host stack for STM32 and other MCUs.
Stars: ✭ 287 (+394.83%)
Mutual labels:  embedded, stm32
Modbus-STM32-HAL-FreeRTOS
Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
Stars: ✭ 272 (+368.97%)
Mutual labels:  stm32, freertos
pid-stm32f746
Embedded graphical interface for PID control
Stars: ✭ 29 (-50%)
Mutual labels:  stm32, freertos
Awesome Embedded
A curated list of awesome embedded programming.
Stars: ✭ 831 (+1332.76%)
Mutual labels:  embedded, stm32
stm32f7xx-hal
A Rust embedded-hal HAL for all MCUs in the STM32 F7 family
Stars: ✭ 71 (+22.41%)
Mutual labels:  embedded, stm32
Atomvm
Tiny Erlang VM
Stars: ✭ 834 (+1337.93%)
Mutual labels:  embedded, stm32
Awesome Canbus
🚛 A curated list of awesome CAN bus tools, hardware and resources
Stars: ✭ 73 (+25.86%)
Mutual labels:  embedded, stm32
Platformio Core
PlatformIO is a professional collaborative platform for embedded development 👽 A place where Developers and Teams have true Freedom! No more vendor lock-in!
Stars: ✭ 5,539 (+9450%)
Mutual labels:  embedded, freertos
Frosted
Frosted: Free POSIX OS for tiny embedded devices
Stars: ✭ 194 (+234.48%)
Mutual labels:  embedded, stm32
Awtk
AWTK = Toolkit AnyWhere(为嵌入式、手机和PC打造的通用GUI系统)
Stars: ✭ 2,328 (+3913.79%)
Mutual labels:  embedded, stm32
Stlink
Open source STM32 MCU programming toolset
Stars: ✭ 3,158 (+5344.83%)
Mutual labels:  embedded, stm32
XC-OS
Open source graphics operating system for microcontroller
Stars: ✭ 66 (+13.79%)
Mutual labels:  stm32, freertos
libDaisy
Hardware Library for the Daisy Audio Platform
Stars: ✭ 164 (+182.76%)
Mutual labels:  embedded, stm32

STM32 Base/Template Project

Type Tool used
Build framework cmake
Toolchain arm-none-eabi-gcc
RTOS FreeRTOS
HAL STM32 CubeMX
Test framework Unity
Mocking framework FFF
Code coverage lcov
GDB utilities GDB dashboard
GDB server openocd
Documentation doxygen

Installation

Method 1

  • Clone complete repo including submodules
    git clone --recurse-submodules --depth 1 --single-branch https://github.com/rgujju/STM32_Base_Project <your_project_name>
    But the problem with this is the CMSIS and FreeRTOS repos (submodules) are huge due to history and takes time to download.

Method 2

  • Clone this repo only and change paths of CMSIS and FreeRTOS in the CmakeLists.txt to the ones you already have.
    git clone --depth 1 --single-branch https://github.com/rgujju/STM32_Base_Project <your_project_name>

Usage

  • components folder includes external libraries like RTOS, HAL, CMSIS, unity, and FFF mostly as git submodules.

  • modules folder contains sources for individual parts which can be unit tested.

  • test folder contains the tests for the modules.

  • Debug build is the default build if CMAKE_BUILD_TYPE is not specified during cross-compiling

  • ARM Semihosting is turned on by default. To turn off use -DSEMIHOSTING=0. SEMIHOSTING is also a macro which is set if ARM semihosting is enabled.

  • Most of the values like HSE, linker script, RTOS path, HAL path, CMSIS path, etc can be set in the configurable section of CMakeLists.txt in project root.

  • To add new modules, copy modules/simple_module to modules/<your_module_name> and rename simple_module with <your_module_name> in the modules/<your_module_name>/CMakeLists.txt file, and add add_subdirectory(<your_module_name>) to the modules/CMakeLists.txt. Finally add <your_module_name> to the MODULES_USED variable in CMakeLists.txt.

  • For adding test for the modules, create test/test_<your_module_name>.c and add two lines as follows in test/CMakeLists.txt

    list(APPEND tests_names "test_<your_module_name>")
    list(APPEND tests_flags " ")
    
  • For make flash to work openocd should be running.

Build Tests for host

mkdir -p build/test
Generate Makefile
cmake ../.. -DTARGET_GROUP=test
Build the tests
make
To run the tests
ctest --verbose
or to test and generate coverage report all together.
make coverage
The coverage report will be in build/test/coverage/index.html

Build Release for cross-compiling

mkdir -p build/release
Generate Makefile
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cross.cmake -DTARGET_GROUP=production
Generate elf
make <your_project_name>.elf
Load the board with elf
make flash

Note: To make FreeRTOS link with -flto option during Release build -Wl,--undefined=vTaskSwitchContext is passed to the linker.

Build Debug (default) for cross-compiling

mkdir -p build/debug
Generate Makefile
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../cross.cmake -DTARGET_GROUP=production
Generate elf
make <your_project_name>.elf
Start GDB and load the board with elf with GDB dashboard output to eg: /dev/pts/12
make flash GDB_TTY=/dev/pts/12
Note: flash target is not present when -DTARGET_GROUP=test is provided.
Currently using terminator to split the terminal to two and output the GDB dashboard to the terminal on the right

Generate documentation

In the above created folders (build/release, build/debug), use command
make docs
Documentation files will be generated in html and latex format. For example if command is used in build/release dir then documentation will be generated in build/release/html/index.html
Note: docs target is not present when -DTARGET_GROUP=test is provided.

Porting

  • This project uses the STM32F429 mcu but should be portable to any mcu.
  • Replace components/STM32F4xx_HAL_Driver and include/stm32f4xx_hal_conf.h with the HAL of your mcu.
  • Replace include/STM32F4xx with the vendor files for your mcu. These files are basically the system, startup and header files of your mcu.
  • The above 2 folders are provided by the vendor. In case of STM32, it is possible to use STM32CubeMX to generate them.
  • Change MCU Setup, HAL Setup, and optionally RTOS Setup and CMSIS Setup in the CMakeLists.txt file.
  • Linker script linker.ld needs to be changes according to your mcu memory. layout_base.ld also may be requried to be changed.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].