Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
One of the key components of getting really serious about developing on the crazyflie, is time to dive into the C-based firmware. If you really want to do some major changes to the intrinsic of the code, it is essential to have proper tools to be able to debug the code (place breakpoints, read real-time values ect…). On this page, we will put a few examples how to do this with IDE's and different environments.
This page requires our debug adapter! See this page: Debug adapter
First install GDB and openOCD:
sudo apt-get update sudo apt-get install gdb sudo apt-get install openocd
Then install java:
sudo apt install default-jre
Then install eclipse itself: Go to their download page: eclipse 20
and then go into you download folder in the terminal en type
tar -zxvf eclipse-cpp-2019-03-R-linux-gtk-x86_64.tar.gz
and start up eclipse:
cd EXTRACT FOLDER/eclipse/cpp-2019-03/eclipse/ ./eclipse
Install the c++ development tools and GNU MCU plugin by following the instructions on this website. We used the following instructions to set it up ourselves:
First import the crazyflie-firmware into eclipse:
Now input the following settings in the debug configurations:
check the following settings: OpenOCD setup → Config options: -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c targets GDB Client Setup → Commands: set mem inaccessible-by-default off
If you don't see any errors, eclipse should go to an dedicated debugging environment automatically and it automatically halts the crazyflie's firmware before it goes into the main function of src/init/main.c. Press F8 or Run > Resume to let it continue and place a breakpoints anywhere in the code (double clicking just in front of the line in the gray area or press Shift+Ctrl+B). Now you should be able to read out the values of the defined variables at that very position.
Make sure that your cf2.elf is the same as the one you uploaded to the crazyflie.