Electronics - Atollic - Code completion and content assist

As Atollic is based on the Eclipse IDE, this tutorial is so also available for Eclipse.

We are going to see how to add the completion to the Atollic TrueStudio IDE.

Of course, this turorial admits that you have a project where the code completion is missing because you don't have the correct libraries.

If you have set correctly your project, and still have a completion problem, then I suggest to close and reopen it, it could solve this issue.

The project used as an example is a simple embedded project from the STM32F3 board (but of course, any project will be fine).

First of all

The IDE version is: Atollic TrueStudio for ARM 5.4.1

The board and the microcontroller are taken from the: STM32F3DISCOVERY webpage (but it's only for the example, take microcontroller you want).

Creating a project with no code completion

Let's create a project, from scratch.

File > New > C Project > Project type: > Executable > Embedded Project > Atollic ARM Tools.

Of course, don't forget to set a name like badprog-completion.

Next > then:

  • Vendor: STMicroelectronics
  • Evaluation board: STM32F3_Discovery

Let other values as default > Next > Next > Next > Finish.

You have now the badprog-completion project in your Project Explorer panel.

But if you open the main.c file, you could see that there is no code completion.

For example if you try to write "ADC_" and use the keyboard shortcut CTRL + SPACE you shouldn't see the fonctions such as "ADC_AnalogWatchdog1SingleChannelConfig()" nor "ADC_StructInit()".

It's actually normal because the STM32F30x_StdPeriph_Driver library isn't linked into your project.

Add this library into your project directory, for example: 

  • C:\dev\mcu\atollic\stm32\badprog-completion\Drivers in order to have:
  • C:\dev\mcu\atollic\stm32\badprog-completion\Drivers\STM32F30x_StdPeriph_Driver

Setting the code completion

Right click the project name badprog-completion in the Project Explorer > Properties > C/C++ Build > Settings > Tool Settings > C Compiler > Directories.

On the right there is a panel with some paths.

Click the tiny icon with a "plus" (+) in green in order to add a new Directory.

Find the corresponding library directory, in our example we set it like that: ../Drivers/STM32F30x_StdPeriph_Driver/inc

Dont' forget the "/inc" at the end.

Click Apply > OK.

You can now try to write "ADC_" and click CTRL + SPACE and you should see all the ADC functions of the STM32F3 microcontroller.

Conclusion

An interesting way to understand where are set the microcontroller libraries.

Well done, once again, you made it. cool

Comments

Comment: 

I want auto completion work without the need to press CTRL+SPACE.
is it possible?

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.