Skip to content

toorajtaraz/stm32-emacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

STM32 for DOOM EMACS

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.

Installation

Follow doom emacs documents and add C/C++ to supported languages, You can find my exact configuration in doom.d folder.

How to setup?

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:

  1. Open stm32cubeide and create a new project as usual and configure anything you might need: alt text alt text
  2. Run and Build your project in both Debug and Release mode
  3. Now you can close stm32cubeide, we won't need it anymore.
  4. Open up emacs and use projectile-add-known-project to add your brand new project: alt text
  5. Now if you open up main.c you'll get lots of errors, that's because you haven't initialized your irony server: alt text
  6. All you need to do in order to start coding is to run these commands:
    1. Init project:
    stm32-init-project
    
    1. Add project's root to cdb path:
    irony-cdb-json-add-compile-commands-path 
    
    1. Select recently added CDB
    irony-cdb-json-select 
    
    1. click on error count and wait (When Irony server encounters too many errors it goes into sleep mode and evaluate the file again unless it's forced to do so)
    2. No errors now, you'll also have access to function definitions (jump to definition) and ... alt text
  7. If you want to run and debug the code, here is what you'll need to do:
    1. This command will start st-link server and changes the layout to debug mode:
    stm32-start-gdb-debug 
    
    alt text 2. The rest is classic gdb command, load, run, if you are interested in debugging your code refer to GDB documentations: alt text alt text alt text
  8. 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.

About

Add support for stm32 to doom emacs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published