English German

How STM32 developers can speed-up development with a mouse-click

By Magnus Unemyr, April 14th 2015.
Computers today are fast, and I suspect yours is no exception. However, embedded projects tend to be larger and larger, now often comprising hundreds of C/C++ source code files. With the new STM32 F7 (the Cortex-M7 based STM32 family with 512KB or 1MB of Flash) for example, you have a lot of memory to fill with code. The same goes for the smaller STM32F3 and STM32F4 families too for that matter. And so, also with the most powerful PC’s, compilation time can be lengthy, which adds to development time if you develop incrementally with a lot of re-compilations of your application.
So, what should an STM32 developer do to reduce compilation times? I suggest you choose a great development tool for your STM32 project; and in this context that means a tool that can compile your source code files in parallel, rather than sequentially. Development tools supporting parallel compilation can vastly reduce your waiting time (and as a negative side, your coffee breaks too). This is how it works.

Traditionally, the C/C++ compiler build system of embedded development IDE’s compile each C/C++ source code file in sequence; and linking the generated object files together at the very end. This work metaphor probably came about in the old days of MS/DOS, when the operating system could not run multiple applications in parallel. And until recently, this build mode have stayed in embedded IDE’s, despite the fact that Windows have been able to run multiple tasks in parallel for many years by now.

As this illustration clearly shows, compiling the C/C++ files in parallel will reduce the total build time quite a lot:

Atollic-Blog-14-04-1.png

The illustration above presents a simplified case, but shows the important conceptual differences. Actual build-time improvements may differ dependent on the project and other circumstances of course.

In general, parallel builds shorten build time, if:
  • Projects contain many C/C++ source code files
  • Build is done on a multicore CPU
  • Disk I/O is relatively slow

Parallel builds can also be of benefit on computers without a multicore CPU, as program execution (compilation) and disk I/O can generally be done at least partly in parallel on modern operating systems. I.e., when compilation of one program is waiting for disk access, another compilation can use the processor and vice versa.

The illustration below shows how total build time can be reduced using parallel builds also on a single-core CPU, as program execution and disk I/O does not need to wait for each other. The processor can be utilized for compilation to a higher degree. R is short for reading source code from disk, C is short for compiling, and W is short for writing the compiled object file to disk:

Atollic-Blog-14-04-2.png

Again, the illustration presents a simplified case which is not likely to be reproduced exactly in practice, but nevertheless it shows the conceptual solution of avoiding program execution and disk I/O to wait for each other, thus increasing CPU utilization for compilation. Practical results may vary dependent on many circumstances.

Some of the more powerful STM32 development tools have built-in support for parallel compilation. In Atollic TrueSTUDIO for example, you just select the checkbox “Enable parallel compilation” in the build configuration dialog box to enable this great time saver.  And so, with virtually just one mouse-click, you can enable parallel compilation and reduce the development time of your STM32 project.

If you want to read more on STM32 development and debugging, and related STM32 development tool capabilities, read this white paper:

Read our STM32 development whitepaper!