1.1. Getting started

1. Atollic TrueSTUDIO® install

Download Atollic TrueSTUDIO® for STM32 installer from official website : https://atollic.com/truestudio/

At time of writing this tutorial, current version is 9.3.0. TrueStudio® is not getting into any further development, being replaced by STM32CubeIDE. Nevertheless, as CubeMX features are not under the scope of these tutorials, we'll stick to that version based on common Ecplipse/GCC assembly.

Run the installer. It is advised to select a short and simple installation path (e.g. C:\Atollic). Avoid spaces, and any special characters (including accents) in the installation path. Allow installation of ST-Link and J-Link drivers when asked.

Once installed, you can launch Atollic TrueSTUDIO®:
Atollic is based on Eclipse IDE and GCC toolchain. If you're familiar with theses tools, you'll feel at home using this IDE. There are actually little differences between Atollic TrueSTUDIO and a custom Eclipse/GCC open environment. The main difference is that Atollic relies on a proprietary plugin to connect to the debug probe (ST-Link® or J-Link®) and does not involve such thing as OpenOCD.
Since it is an Eclipse environment, the first thing you need at startup is to set the current workspace.
The workspace is nothing more than a directory to store projects and settings.
Within Eclipse, various settings may be applied:
-    Globally (for all your eclipse tasks)
-    At workspace level (for all projects inside a given workspace)
-    At project level (for one project only)
For now, let us specify a workspace dedicated to tutorials, under C:\Atollic\tuto_workspace if you are on your own computer.
You should point to a folder related to your network drive (P:\) if you are working on school computer (e.g. P:\Atollic\tuto_workspace). Again, avoid spaces and special characters in the workspace path.
Once started, into the Atollic main window you may close the Information Center:

2. Create a new project

Open File → New → C Project

Give a project name ‘blink’. Use Empty Project profile.



Click Next and leave the configurations as proposed:



Click Finish.

You should get the following project structure. All you have is an empty file structure with only few include definitions. These includes are for the GCC compiler libraries, and are part of any GCC related project:

Right-click on the  folder icon and select New → Source File.
In the dialog window, name the file "main.c" and then click Finish.
Again, right-click on the  folder icon and select New → File.
Name the file "linkerscript.ld" and then click Finish.
Now, the project structure should be like this:
Double-click the file to open it in the editor and copy/paste the following code:
 * main.c

#define PERIOD	100000
static void reset_handler 		(void);
static void default_handler		(void);

int main (void);

/* Minimal vector table */
__attribute__ ((section(".isr_vector")))
void (* const table_interrupt_vector[])(void) =
	(void *)0x20000800, 	// 0 - stack
	reset_handler, 	 	// 1 - reset handler
	default_handler, 	// 2 - NMI handler
	default_handler, 	// 3 - Hardfault handler

/* Main program */
int main(void)
    int i;

    *(int *)0x40021014 |=  (0x01 <<17U);
    *(int *)0x48000000 &= ~(0xC00);
    *(int *)0x48000000 |=  (0x01 <<10U);

	*(int *)0x48000014 ^= 0x00000020U;
	for (i=0; i<PERIOD; i++);

/* Reset handler */
void reset_handler (void)

/* Default handler */
void default_handler(void)


Save it , then double-click the file. Copy/paste the following code and save it.

 * linkerscript.ld

/* Specify the memory areas */
	RAM   (xrw)     : ORIGIN = 0x20000000,  LENGTH = 16K
	FLASH (rx)      : ORIGIN = 0x08000000,  LENGTH = 128K

/* Specify sections */
    .isr_vectors : 
    	*(.isr_vector)	/* Interrupts vector table */
    } >FLASH

    .text :
        *(.text)      	/* Program code */
        *(.rodata)    	/* Read only data */
    } >FLASH
    .data :
        *(.data)      	/* Initialized data memory */
    } >RAM AT> FLASH

    .bss :
        *(.bss)       	/* Uninitialized data memory */
    } >RAM


Click the Build Settings button.

A dialog window appears telling you that no target been set for this project.


Click OK. Then select the device you want to build the project for. Here, select STM32F0 → MCU → STM32F072RB as the target:

Click OK.

Next, Atollic prompts you about the linkerscript that should be generated based on the previous target selection. For the need of this tutorial, we will provide our own linkerscript file, therefore select Cancel to avoid the generation of an automatic linkerscript.


Click the Build Settings button again. This opens the Properties window.

If not already selected, select the category (in the left treeview) C/C++ Build → Settings.

Then, open the Tool Settings tab. Select the C Linker → General subcategory:


Then, use the Browse button to find the linkerscript file you've saved earlier. It should be in your workspace/blink folder:

When you're done, click OK at the bottom of the Properties window.


With the project beeing selected, click the Build button and watch the Console window:

This window reports build (i.e. compile and link) process execution. There should be no errors or warnings. Note that project structure has been populated with new items:

  • A Binaries section
  • A Debug folder that contains all the files generated during the build process (including the blink.elf binary file).


With the project beeing selected, click the Configure Debug button.

In the Debug Configurations dialog, select Embedded C/C++ Application category and click the New Launch Configutation button.



Review the new configuration settings, starting with the Main tab. Both C/C++ Application and Project fields should be populated with project binary file (.elf) and project name:


Then, review settings in the Debugger tab. Select the correct Debug probe (ST-Link when using a Nucleo board) with SWD Interface.


When done, click Apply and then Close.


From the Atollic main window, start the debugger by clicking the Debug button. Watch the console for any error. When everything is OK, after a short time, the debugging perspective should open. If it doesn’t work, make sure you have a connected Nucleo at the end of the USB cable !

Once in the debugger environment, you can control program execution via usual toolbar commands (, , , , , , ...), add variables or expressions to watch, etc.

For instance you may watch the i variable:

Step over  the code lines to discover which line actually turns the green LED on and off.
Then, Run the program full-speed by clicking the Resume button. You should get the blinking LED as expected:

Then, suspend the debugger and terminate image041.png the debug session and switch back to C/C++ perspective.