More about ELESOFTROM Company

ELESOFTROM Company is specializing in firmware development and fixing for embedded systems.

We have more than 10-years of experience in that area.

In developed tasks and projects we value reliability and effectivness of the firmware.

Fixing the Software for Emebedded Systems

Software for Microcontrollers



Home page

Full offer

Experience

About company

Contact


DioneOS - RTOS for embedded devices

ELESOFTROM developed RTOS for ARM Cortex-M3 and msp430.

The system is optimized for short execution time, having short switching time between threads.
The system provides elements (e.g. semaphores, mutexes, timers, queues etc.) used for building multi-threaded firmware.

Cortex version has full tests coverage and was tested by automatic testing framework.

Read more:

DioneOS home page

Reliability

Performance

DioneOS documentation

Tutorials about DioneOS


How to build C++ Builder project in Eclipse (using GNU make)

2014-11-07    Piotr Romaniuk, Ph.D.

Contents

How to create the Eclipse project from C++ Builder project.
Why GNU make and MSYS?
Borland makefile
Differences between the GNU tools and the Borland tools
Generating dependencies
Build tree (cleaning up a mess in the project directory)
Summary of the changes in the makefile
Links

Why GNU make and MSYS?

  • when you use the MSYS environment you can feel like under Linux (shell, basic programs: grep, awk, sed, itp.) - it provides great flexibility in automation of file processing tasks (e.g. automatic package creation, version numbering and marking, etc.),
  • the GNU make provides more options, is newer, better tested than the Borland make (included in C++ Builderze 6.0),
  • the GNU make is very popular, used by many programmers, in the Internet there is a lot of descriptions of different problem solutions,
  • the GNU make is well known standard
  • The transformation into the MSYS/GNU-make may be first step toward moving whole building process to GCC (the compiler that is more modern and better than Borland one)

Borland Makefile

The project description is stored by the Borland IDE (i.e. the C++ Builder) in one file (with .bpr extension) and the XML format. From that file a makefile can be generated using bpr2mak.exe tool. The Borland makefile is specific and needs to be transformed if one wants to use it with GNU make program.
Below some differences are enumerated (
you can find full description here):

  • the directives begins from exclamation mark (e.g. !if ) or dot (np. .autodepend )
  • there are available some predefined macros:
  • $d  - 1 when its parameter is defined,
    $*  - base file name (no ext., no path)
    $<  - full file name (inc. ext. and path)
    $:  - only path
    $.  - only the file name with extension (no path)
    $&  - the file name without extension (no path)
    $@  - full target file name (target in a rule)
    $** - all dependencies
    $?  - all outdated dependencies
    MAKEDIR - the directory where make has been started
    
  • uses old format of implicit rules (e.g. .cpp.obj: ... )
  • provides .autodepend directive - automatic dependencies check
  • parts of variables can be substituted $(VARIABLE:template=change_to)
  • it is possible to point location of files with specific extension (variables .path.c, .path.obj etc.)
  • it uses temporary files for executing multiline series of commands (@&&! - !)

Differences between the GNU tools and the Borland tools

  • different format of paths specification (Borland expects DOS-like format, e.g. c:\directory\file, while GNU tools (i.e. MSYS) uses Linux-like, e.g. /c/directory/file)
  • Borland uses a set of options with semicolon as separator of its items (e.g. symbol definition or paths in included folders)

Generating dependencies

Dependencies define which files from the project need to be recompiled, hence building time can be minimized. For example a changes in one module (.cpp file) cause recompilation of it into new .obj file and next execution of linking into final program .exe. Changes in some header imply rebuilding all modules that includes it.

Because the Borland provides .autodepend directive, all dependencies are determined automatically by make. The GNU make requires to enter dependencies, although they can be created with significant help of the GCC compiler, that can generate them (options -MM).

There is number of methods how the dependencies are created and used, I choose following way:
- the files containing dependencies in a rule format (generated by GCC) - files with extension .d
- in order to have correct extension of image files (obj) the extension in dependency rules is changes from .o to .obj
- inclusion dependency files in project makefile by -include directive (they are treated as additional rules)
- dependencies generation on request (target deps)

Examplar dependencies (main1.d file):

main1.obj: main1.cpp main1.h ../firmware/fclock.h ../firmware/protocol.h

In order to build (update) dependencies you should execute (in windows command line console):

build_by_gnumake.bat deps

or in the MSYS console:

make -f hello1_gnu.mak deps

Dependencies update is performed not very often and is required when new header files are included or new module is added. It is possible to add automatic dependencies build and refresh.

Build tree (cleaning up a mess in the project directory)

The default behavior is that the Borland C++ Builder puts all generated files in one directory. Unfortunatelly, it creates a mess - source and generated files are mixed in one folder. It is possible to force Builder to use different directories. It is set up in Directories/Conditionals tab in project properties window (below they are set to build and _stage respectively):

Of course, you can manage files location also in GNU makefile, just by defining and using a prefix:

$(BUILD_PREFIX)/%.obj : %.cpp 
	$(BCC32) $(CFLAG1) $(WARNINGS) "-I$(INCLUDEPATH)" "-D$(USERDEFINES);$(SYSDEFINES)" $< -o$@

Summary of the changes in the makefile

In order to use the Borland project makefile with the GNU make you need to do following items:

  • change conditional directives - they are mostly symbol definition, that are undefined
  • provide dependencies
  • use double path formats (DOS and Linux) - that matches shell or arguments requirement
  • envelop DOS paths with double quotation - just to suppress interpretation of semicolon and backslashes by the MSYS shell
  • replace temporary files usage by list of commands

Examplar project compiled in the Eclipse using the GNU make and the Borland tools.

Linki

  1. Description of the Borland tools (compiler, linker, etc.) and its command line parameters
  2. The Borland makefile descritpion,
  3. The MinGW/MSYS project site