IDE Setup: Sublime Text 3 - Aghosh993/EL6483_EmbeddedSystems GitHub Wiki

Supported operating systems

  • Windows
  • Linux
  • Mac OS X

The process

Getting the prerequisites

First, download Sublime Text 3. It is a free (as in freeware) text editor + IDE. Get the latest download at https://www.sublimetext.com/3. Make sure you select the link appropriate for the operating system and architecture you are using.

Now, go to https://packagecontrol.io/installation and follow the installation instructions to install Package Control on Sublime Text. This basically installs a package manager so you can add various capabilities to Sublime Text. Make sure you follow the steps for Sublime Text 3!! Once the install is complete, the console window at the bottom of the Sublme window should show a few messages starting with "reloading..." Once you see these, you can restart Sublime Text.

The next step is to install Clang. Below are the steps depending on your OS:

Linux

If you are on Ubuntu, just type:

sudo apt-get install clang

On Arch Linux, type:

sudo pacman -Sy clang

OS X

You already should have Clang installed, nothing to do!!

Windows

Download one of the following based on your architecture:

32-bit

64-bit

Install the downloaded package by running the installer EXE file. Make sure to select "Add LLVM to the System Path" when prompted, as in the image below:

LLVM PATH Prompt

Installing the Clang plugin to enable auto-completion

Restart Sublime Text, and press CTRL+Shift+P keys to bring up the command editor. Type "Install" and you should see an entry that says "Package Control: Install Package". Select it with the arrow keys, and press enter. You will be prompted to now enter a package name. Enter "EasyClangComplete" and press Enter. After the installation finishes (a README will pop up with some information; you can close this) you can restart Sublime Text.

Now, just go to File->Open Folder and open up the EL6483_EmbeddedSystems repository folder. You can now navigate to any sub-folder within the repository and open the project of interest. When you modify source code, now you should see suggestions from auto-completion, and based on the included headers (so you should see suggestions for the various fields in the structs, etc.) Enjoy!!

Optional: Serial Monitor

It is quite useful to be able to have a serial port open while debugging on the STM32 (especially if using something an interface board). This most excellent plugin is therefore highly recommended, as it lets the user directly open and read/write from/to serial ports from within Sublime Text 3. This does rely on the Pyserial library, so Python and the Pyserial are required. A short tutorial on Pyserial installation can be found here and here.

After installation, simply restart Sublime Text 3, press Control-Shift-P and type "Serial". A list of self-explanatory options should appear, starting with "Serial Monitor". Just select "Serial Monitor: Connect" and go through the steps that follow to select COM port and baud rate. A new tab will open in Sublime and it will show the serial data stream. If you press Control-Shift-P again and search for "write" you should get a "Serial Monitor: Write Line" option that will let you send characters to the STM32. For more options and documentation, visit the Serial plug-in Github page noted at the beginning of the last paragraph (i.e. here) Enjoy!!

Optional: etc items

Now that you have Package Control installed in Sublime, here are a few other useful plug-ins that you might want to install in a similar fashion to the procedure followed when installing the Clang plug-in above:

ARM Assembly (This provides source highlighting support for ARM assembly code, and auto-indentation)

SublimeGDB (This allows you to experience the capabilities of GDB within Sublime, by stepping through code and setting/removing breakpoints)