From 64a9c748eff718da572423ba78aed985da342493 Mon Sep 17 00:00:00 2001 From: "r.koeppe" Date: Tue, 18 Jun 2024 11:51:46 +0000 Subject: [PATCH] Improved Readme --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 43dec23..6600e31 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Now you have set up your ssh key! # Installation ```(cmd) -git clone --recurse-submodules git@github.com:rimakoe/stm32.git +git clone --recurse-submodules ssh://git@git.fasttube.de:313/FaSTTUBe/stm32_devcontainer.git ``` # Usage @@ -154,24 +154,45 @@ stm32cubemx ``` If it does not work you may have to play around with the DISPLAY environment variable. -## Create a CMake Repo +## Add a new Repository + +0. Firstly create a new repo in gitea. Then add it as submodule from the projects folder with + + ```(cmd) + git submodule add + ``` 1. Open STM32CubeMX with the terminal command ```stm32cubemx``` 1. Choose a MCU family. If it is one of the supporterd ones you dont even have to login here. -1. Configure the Project as CMake project and set it up in the *projects* directory. +1. Configure the Project as CMake project and set the directory to the repo you just created. 1. Hit *Generate Code* and see how the repo structure appears. Now you can work with the project like a standard CMake project. Create a build folder and hit ```cmake .. && make``` e.g. -The CMakeLists.txt file will not be regenerated when the code is regenerated if something changes in the ioc file. So feel free to link your own libraries here. +>**_NOTE_ :** The CMakeLists.txt file will not be regenerated when the code is regenerated if something changes in the ioc file. So feel free to link your own libraries here. + Compile main.c always with c++ compiler + +### Configure main.c via CMake for C++ + +If you want to use C++ it can be annoying, that the main.c is compiled with the C compiler and regenerated as main.c if something changed in the ioc file. To enforce a compilation with the C++ compiler you just have to add the following line to your CMakeLists.txt project +``` +SET_SOURCE_FILES_PROPERTIES(Core/Src/main.c PROPERTIES LANGUAGE CXX) +``` # Debug -For debugging you have to configure the launch.json +For debugging you have to configure the *launch.json*. +- Create your own configuration for your project based on the existing ones. +- Set the environment variable (like in the existing launchfiles) +- Add it to the *docker-compose.yaml* file. +- Rebuild the container using ```Ctrl + Shift + P``` and ```Rebuild Container```. Then the environment variable should be available everywhere. +- Hit F5 and your project should be build, the debugger starts and flashes the code onto the MCU + +>**_HINT_ :** Sometimes the flashrate is critical when it comes to long cables on SWD flashing. This can be set in the stm32f3x.cfg e.g. Just get your specific one from ```/usr/share/openocd/scripts/target``` and look for *adapter speed*. Change it accordingly to your needs. # Hints