Improved Readme

This commit is contained in:
Richard Koeppe 2024-06-18 11:51:46 +00:00
parent 0922c5089b
commit 64a9c748ef
1 changed files with 26 additions and 5 deletions

View File

@ -112,7 +112,7 @@ Now you have set up your ssh key!
# Installation # Installation
```(cmd) ```(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 # Usage
@ -154,24 +154,45 @@ stm32cubemx
``` ```
If it does not work you may have to play around with the DISPLAY environment variable. 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 <ssh link to your new repo>
```
1. Open STM32CubeMX with the terminal command ```stm32cubemx``` 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. 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. 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. 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 # 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 # Hints