2
votes

Since a longer time, I write software for an embedded system for a stm32f4 processor.

Until now, I worked with my own toolchain with my own makefiles to build the binary. To have the advantage of an IDE, I decided to integrate the project into Eclipse (stm32 workbench: eclipse for the stm32 controller). To stop having an own toolchain, I now use the integrated AC6 toolchain.

Most of the things I have to do are working fine.

My Problem

In my own makefile, I have the following entries:

SVNREPREV := $(shell ./svnversion.sh ./inc/ ./Drivers/ ./libs/ ./linkerscripts/ ./makefsdata/ ./src/)
XCFLAGS += -DSVNREPOVERSION=\"$(SVNREPREV)\"

(The shell script returns a value like that -> 1234:1234M and it will be converted to a string)

I can use this value in my c code like this:

const char svnRepoRevision[] = SVNREPOVERSION;

My Question

How can I realize a similar behavior in Eclipse/stm32 workbench with the AC6 toolchain and created makefiles?

My Tries

Add the symbols under Project -> Properties -> C/C++ Build -> Settings -> Build Steps -> Symbols

SVNREPREV=$(shell ../svnversion.sh ../inc/ ../Drivers/ ../libs/ ../linkerscripts/ ../makefsdata/ ../src/)
SVNREPOVERSION="SVNREPREV"

the build ends with the following error:

arm-none-eabi-gcc: error: ../src/): No such file or directory

I tried different versions of set the "", but it had no effect, alway received an error.

Any help would be appreciated.

1
This page has some hints for how to do this, through Eclipse's makefiles which seems a bit easier. - unwind
Nice link, thx :) I try the eclipse way with the makefile.defs. It seams to work fine. I will add a answer to my question asap - i3luefire

1 Answers

1
votes

Manual

Link to the used documentation: here

Thanks to unwind for showing me this link

Solution/Answer

  1. create empty makefile.defs file in project root folder

Right-Click on projectroot folder -> New -> File

  1. write needed command for svn revision in makefile.defs

SVNREV:='"$(shell ../svnversion.sh ../inc/ ../src/)"'

  1. open c/c++ build settings, symbols

Project -> Properties -> C/C++ Build -> Settings -> Build Steps -> MCU GCC Compiler -> Symbols

  1. add symbol used in code

Add value SVNREPOVERSION="$(SVNREV)" as Symbol

  1. Save the project settings and build

The build is now working fine and I receive my svn revision number. The makefile.defs is executed once. This will read the needed svnrevisions from the used folders. This value will be written into SVNREPOVERSION, which I use in my code.