
Bonne santé à tous!
La quarantaine m'a obligé à passer tout mon temps à la maison, y compris le temps libre, et bien qu'il y ait beaucoup de choses à faire à la maison, je les ai habilement confiées à mon fils, et j'ai décidé d'étudier enfin l'environnement de développement ClB de JetBrains, surtout depuis la version 2020.1 La prise en charge de la chaîne d'outils IAR est apparue.
Tous ceux qui sont intéressés par un guide étape par étape et un tas de photos avec une soudure ...
introduction
, C++ IAR Workbench . , ++, , , .
IAR, - , , , , , .
( assert IAR ) , Clang, .
IAR — . , , , — "Powered by notepad".
- , , , ( ).
Clion JetBrains.
Clion /++. , . , , IAR . , .
, 2020.1 IAR . Elmot, 2020.1 IAR .
ST Cube, IAR. , Cube, IAR Clion .
Clion CMAKE, CMAKE. , . , , Clion , c cpp (CMAKELIST) .
, , . File->NewProject

, , , Create
. CMAKE.
++17 C++ Executable. .

Embedded->STM32CubeMX
, .ioc, STM32CubeIDE. Clion .ioc , Clion.
, IAR Cub. , , main.cpp
.

, Clion CMAKE, CMakeList.txt, , , , .
:

CMAKE +
+
++, +
— main.cpp
, toolchain
Clion toolchain.
Toolchain — . , , , , , .
Clion — MinGW, CygWin, Visual Studio
IAR toolchain, , , MinGW Visual Studio .
toolchain, Clion.
C Visual Studio , Microsoft ++ ( , C#).
MinGW, http://www.mingw.org/.
: installer, Popular
All time
:

, .
MinGW , :

, Continue, . GNU C++ Compiler ( , , , - ) . — ApplyChanges
.

. MinGW toolchain . .
, Clion , , , IAR toolchain.
, Clion — File->Settings->Build, Execution, Deployment -> Toolchain
.

toolchain MinGW, Visual Studio, . Clion , make , .
, :)

. ++ IAR , .
(Bundled) Clion, GNU ARM ( https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
Clion:

toolchain IAR, MinGW.

make MinGW, , , , clearmake, ClearCase ( , — )
make - , ninja, .
CMAKE
, CMAKE, , , Release Debug. .
File->Settings->Build, Executiion, Deployment -> CMake

"+"

Debug. CMake, , make (Build Options). , -j 16( ), 16 . , , - ( ) , VPN, .
Debug Release Build Type.
Release.
Apply Clion
CMAKE, , :

, , , __write()
, main.cpp.

. CMake.
IAR CMake, .
set(CMAKE_SYSTEM_NAME Generic)
set(EW_ROOT_DIR "C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.3/arm")
set(CMAKE_CXX_FLAGS "--no_cse --no_unroll --no_code_motion --no_tbaa --no_clustering --no_scheduling --endian=little --cpu=Cortex-M4 -e --fpu=VFPv4_sp --c++ --no_exceptions --no_rtti")
set(CMAKE_C_FLAGS "--no_cse --no_unroll --no_code_motion --no_tbaa --no_clustering --no_scheduling --endian=little --cpu=Cortex-M4 -e --fpu=VFPv4_sp ")
set(CMAKE_ASM_FLAGS "-s+ -r -t8 --cpu Cortex-M4 --fpu VFPv4_sp ")
set(CMAKE_C_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe")
set(CMAKE_CXX_COMPILER "${EW_ROOT_DIR}/bin/iccarm.exe" )
set(CMAKE_ASM_COMPILER "${EW_ROOT_DIR}/bin/iasmarm.exe")
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/stm32f411xE.icf")
if (CMAKE_BUILD_TYPE MATCHES Debug)
message ("IAR Debug")
add_compile_definitions( DEBUG=1 )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --dlib_config=normal --no_inline")
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --dlib_config=normal --no_inline")
set(CMAKE_CXX_LINK_FLAGS "--semihosting --config ${LINKER_SCRIPT}")
else(CMAKE_BUILD_TYPE MATCHES Release)
message ("IAR Release")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --dlib_config=normal")
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --dlib_config=normal")
set(CMAKE_CXX_LINK_FLAGS "--config ${LINKER_SCRIPT}")
endif()
, Debug Release.
*.elf set(CMAKE_EXECUTABLE_SUFFIX ".elf")
CMakelist.txt:
cmake_minimum_required(VERSION 3.16)
project(MyFirstProject)
enable_language(C ASM CXX)
set(CMAKE_CXX_STANDARD 17)
include(iarconfig.cmake)
add_executable(MyFirstProject main.cpp)
Cmakelist.txt toolchanin Cmake . , , Reload Cmake, , Cmake , toolbox Cmake Reset Cache and Reload Project

, . — .
OpenOCD gdb , Jlink gdb ST-Link gdb .
, 0.10.0: https://sourceforge.net/projects/openocd/files/openocd/0.10.0/ . , Windows: http://www.freddiechopin.info/en/download/category/4-openocd.
, :
, gdb File->Settings->Build,Execution,Deployment->Toolchains->Debugger: Bundled GDB
Run -> Edit Configurations -> Templates
Embedded GDB Server

, , .
:
Download executable
, Update Only
— , - , .
OpenOCD tcp , .. IP 3333 ( , ). OpenOCD , target remote args
tcp:127.0.0.1:3333
GDB Server
OpenOCD, .
GDB Server args
OpenOCD . Nucleo, XNucleo, st_nucelo, (hla_vid_pid — The vendor ID and product ID of the adapter) . OpenOcd :
-f ../scripts/board/st_xnucleo_f4.cfg -c "reset_config none separate" -c "init" -c "reset halt"
-f , st_xnucleo_f4.cfg, , , .
- , .
-c "reset_config none separate" — , SWD ( ).
-c "init" — "init", OpenOCD
-c "reset halt"_ —
. .

:
Run -> Edit Configurations
- "+"

Template. -

, , .

Advanced GDB Server options
. — monitor arm semihosting enable
. Download executable: Always
.
Debug: Console
. , .
, .svd .
, startup.cpp
, , , fpu main()
.
startup.cpp .

: IAR
Clion File->Open
.
:
, , Clang IAR, , , File->Settings -> Languages&Frameworks -> C/C++ -> Clangd
.
Enable clangd server.

, IAR IDE Clion . IAR, . , , .
Clion , . , Clion , . , .
Clion , . , Clion .

Mais il y a encore plein d'autres choses dont je ne parlerai pas, elles sont décrites sur le site Web de JetBrains. Juste le GIF final montrant la vitesse de travail:
