- CMake
- program make or Ninja
- gcc, g++ (in Windows with MinGW)
- gcc-arm-none-eabi
- git - for downloading
- create standard project in STM32CubeMX
- in Project Manager Project:
- Application Structure: Basic
- Toolchain / IDE: Makefile
- in Project Manager Code Generator:
- Copy only the necessary library files
- copy generated files to target/arm directory
- create cmake_build_debug directory and go
- run cmake -DTARGET=arm -G "MinGW Makefiles" ..
- -DTARGET=arm(for STM project)/x86(for GoogleTests)
- -DCMAKE_BUILD_TYPE=debug/release
- -G "MinGW Makefiles" for windows
- download and install CLion
- File -> Open
- find first CMakeLists.txt file in project directory
- Open as Project
- File -> Settings -> Build, Execution, Deployment -> CMake -> Build type
- Release (recomended)
- Debug
- in Windows add -G "MinGW Makefiles"
In C or C++ code write:
int _write(int file, char *ptr, int len) {
(void) file;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++){
ITM_SendChar(*ptr++);
}
return len;
}
And use printf:
printf("Hello world\n");
Using openOCD:
openocd -f board/stm32f4discovery.cfg -f interface/stlink.cfg -c "transport select hla_swd" -c "tpiu config internal - uart off clock_rate" -c "itm ports on" -c "tcl_port 6666"
Where clock_rate should be changed with number, ex. 180000000 for 180 MHz