This repository contains configurations for adding stm32 support to doom emacs. This project is based on Alexander Lutsai's work at https://github.com/SL-RU/stm32-emacs Keep in mind that build system and many other things are fundamentally different.
Follow doom emacs documents and add C/C++ to supported languages, You can find my exact configuration in doom.d folder.
Firstly, please replace your $HOME/.doom.d folder with ./doom.d in this repository (just its contents not the name), feel free to remove packages you don't like or need. In the end you should get this tree:
.
├── config.el
├── custom.el
├── init.el
├── packages.el
└── stm32
├── correct_cdb.py
├── stm32.el
└── stm32prj_init.sh
Now run:
doom sync
All you need to do to start coding is to follow this procedure:
- Open stm32cubeide and create a new project as usual and configure anything you might need:
- Run and Build your project in both Debug and Release mode
- Now you can close stm32cubeide, we won't need it anymore.
- Open up emacs and use projectile-add-known-project to add your brand new project:
- Now if you open up main.c you'll get lots of errors, that's because you haven't initialized your irony server:
- All you need to do in order to start coding is to run these commands:
- Init project:
stm32-init-project
- Add project's root to cdb path:
irony-cdb-json-add-compile-commands-path
- Select recently added CDB
irony-cdb-json-select
- If you want to run and debug the code, here is what you'll need to do:
- This command will start st-link server and changes the layout to debug mode:
stm32-start-gdb-debug
2. The rest is classic gdb command, load, run, if you are interested in debugging your code refer to GDB documentations:
- For killing everything and releasing the st-link run:
stm32-kill-gdb
There are a few other commands available in stm32.el, if you are interested in them you can take a look for yourself, that file is well documented.