# Julians Rodos Template ## Steps to make it work ### Compiling Rodos Compiling rodos for discovery / stm32f4: ```shell script $ cd build $ cmake -DCMAKE_TOOLCHAIN_FILE=../rodos/cmake/port/discovery.cmake -DEXECUTABLE=ON .. ``` ### Run stm32f4-load Make *openocd/stm32f4-load* executable and run it once as sudo. This will add some files to */etc/udev/rules.d/* so you wont have to use sudo in the future. ```shell script $ cd openocd $ sudo chmod +x stm32f4-load $ sudo ./stm32f4-load ``` ### Openocd installation To make it work you need to install openocd on your system (e.g. via package manager). The installation should create one of these folders: - _/usr/share/openocd_ - _/usr/local/share/openocd_ There you can find the files referenced in *openocd/openocd_debug.cfg* and *openocd/openocd_flash.cfg*. Since I did not find *stm32f4x_stlink.cfg* there, I changed it in the config file to *stm32f4x.cfg*. ### Edit Eclipse launch configs Eclipse needs to find the folder *eclipse_launch_cfgs*. For me it worked to create a new launch configuration and go to **Common** and select the folder unter **Shared files**. You should also edit all three configurations through the Eclipse run configurations window to update your project name and binary name. Sometimes *debug_stm32f4.launch* is not recognized by the big launch configuration window in Eclipse (top left). Sometimes using the small bug icon on the top right of the toolbar instead works. ### Add build folder to Eclipse Open Project settings, go to **C/C++ Build**, untick **Generate Makefiles automatically** and change the build directory to the *build* folder. ### Edit CMakeLists.txt Edit *CMakeLists.txt* to add all your cpp files etc. ## How to run it ### Flashing To flash your program just run the external tool configuration *flash_stm32f4* in Eclipse. ### Debugging To debug first run the external tool configuration *connect_stm32f4.launch* in Eclipse once. Then to really start debugging run the debug configuration *debug_stm32f4* in Eclipse. This should compile your code, open debug mode and run it.