The 15 Best Code Navigation Techniques [for ARM Cortex-M Developers and TrueSTUDIO Users]

Posted by Magnus Unemyr on Nov 29, 2016 9:19:45 AM

Atollic TrueSTUDIO and other embedded C/C++ IDE's based on Eclipse inherit an incredibly powerful source code editor. Many ARM Cortex-M developers could improve their editing efficiency if they knew what powerful features are available.

Read this blog post to learn how you can use the editor's convenient and advanced code navigation features to its maximum potential. Upcoming blog posts will cover other cool features of the editor too!




One of the best code navigation features is hyperlinks in the source code editor. Press the CTRL key while hovering the mouse over any C/C++ symbol in the source code, and the symbol becomes a clickable hyperlink.


If you click on the hyperlink, the editor opens the code location where the corresponding symbol is implemented. This is probably one of the best time-saving features of the editor!

Brace Navigation

If you place the cursor by a curly bracket that is enclosing a code block, the editor will give visual feedback on what corresponding curly bracket match the one you are at.


Furthermore, using the CTRL-SHIFT-P keyboard shortcut, you can quickly move the cursor forwards and backwards between the opening and closing curly brackets.

Call Hierarchy

Right-click in the editor and select "Open Call Hierarchy" or press the CTRL-ALT-H keyboard shortcut to visualize the function call hierarchy.


Using this view, you can easily visualize the function call dependencies in your project. You can invert the dependency tree and toggle between a "this function calls" mode to a "this function is called by" mode as well. Click on any function in the tree to open its implementation.

Type Hierarchy

The Call Hierarchy view presented the function calls in a graphical manner. A similar functionality is available to browse the hierarchy of complex data type dependencies. This functionality is called the Type Hierarchy in the Eclipse editor; other IDE's may refer to this functionality as the "class browser".


To inspect the data type dependencies, right-click on the data type in the editor and select Open Type Hierarchy in the context menu. You can then browse the design of complex data types in a tree widget.


A simple but useful code navigation feature is bookmarks. Right-click in the left editor margin, and select "Add Bookmark" in the context menu to create a new bookmark.


Whenever you want to come back to the same code location again in the future, double-click on the bookmark in the Bookmarks view, and the editor will open the same code location for you automatically.

#Include Dependency Browser

The #include file dependency browser visualize the hierarchy of #include files. Open the Include Browser using the Window > Show View > Include Browser menu command, and drag a C/C++ file from the Project Explorer view to the Include Browser view.


The Include file browser visualize the file dependency hierarchy, which can be a great help when working out what files include what other files.

The Symbol Indexer View

The C/C++ editor in Atollic TrueSTUDIO (and other Eclipse-based IDE's) include a C/C++ symbol indexer; which in reality is a full C/C++ parser that scans the source code in real-time, and builds a database storing all symbol definitions and references throughout the project.


Using the C/C++ symbol indexer view, all the symbols in a project is listed. Double-click on any symbol to open the code location of its implementation, or right-click and select Open Definition, Find Declarations, or Find References, to understand its use.

Outline View

A simple, but useful functionality, is the Outline view. It displays the active source code file in condensed form; almost like a table of contents in a book or document.


Double-click on any item in the Outlook view to open the corresponding location in the editor.

Quick Outline

A very convenient editor functionality is the Quick Outline, that you can easily reach from the editor context menu (right-click to open it) or using the CTRL-O keyboard shortcut.


The Quick Outline is a smart tool-tip that lists a table of contents of the active editor file. Click on any item in the list, and the editor will jump to the corresponding code location.

Expand and Collapse Code Blocks

A simple but highly useful functionality is the capability to expand or collapse code blocks (that are enclosed by curly brackets). You can collapse the code block by clicking the "-" icon immediately to the right of the left editor margin.


If you hover the mouse over a collapsed code block, the full implementation is displayed temporarily as a tool-tip. Click on the "+" icon to expand the code block again.

Macro Expansion Browser

Sometimes you #DEFINE macros that build upon other macro definitions; and the pre-processor then have to do a multi-step macro expansion to resolve what source code to compile.


Understanding what source code will eventually be compiled can be a tough task in such case. Thankfully, the editor have a "macro expansion debugger" that can come to help. Right-click on a macro, and select Explore Macro Expansion in the context menu. A macro expansion explorer dialog box is displayed, where you can step forwards and backwards across the different macro expansion steps and study the results. This removes the need to navigate to different macro definitions for further study altogether.

Preprocessor Color Coding

A cool feature of the editor is that #IFDEF evaluation-results affect the color coding. If an #IFDEF evaluates to false, the code inside it will not be compiled. The editor indicate this by presenting this code with a gray background.


Not only do the editor resolve what #DEFINE's are set (or not) in the source code. It can also detect if symbols are #DEFINE'd using command line settings in the build options. How cool isn't that?

Keyboard Shortcut Assist

There are a large number of other editor functions that aid code navigation and code editing. So many, in fact, that you may not remember all keyboard shortcuts used to access them.


A convenient function is to press the CTRL-SHIFT-L keyboard shortcut. It brings up a tool-tip with all keyboard shortcut bindings for reference.

To-Do Items in the Tasks View

You can use the Tasks view to to remember certain code locations for later reference. The difference to the Bookmarks view is the Tasks view can auto-create tasks when C/C++ comments contain certain task tag keywords.


Enter a task tag keyword (such as "FIXME" or "TODO") in a source code comment, and a corresponding task will be created automatically. Read this blog post for more information on this feature.

Editor Zoom

Starting with TrueSTUDIO v7.0.0, you can "zoom" in the text editors; to either get a better overview of a larger code section using a smaller font, or see details of a particular code section better using a larger font. Use the keyboard shortcut "CTRL" and "+" to zoom in, and "CTRL" and "-" to zoom out.

The capability to zoom the source code can improve editing efficiency a lot; in particular for large files where it is much easier to scroll to the right location when the code is temporarily zoomed-out to provide a better overview of a larger code section.


Do you want to learn more on ARM Cortex-M development and debugging? Read this free whitepaper:

 ARM Development White Paper - TrueSTUDIO


Topics: editing