Skip to main content
pgarista
Visitor II
September 6, 2014
Question

Compilation with files from STM32CubeF4 on linux

  • September 6, 2014
  • 3 replies
  • 741 views
Posted on September 06, 2014 at 09:02

Hello all. I just got a STM32F429-DISCO board and compiled my first successful program. I'm working under linux compiling with the GNU toolchain for ARM.

In order to be able to compile my program, I had to modify some files on the firmware package, due to them having incorrect paths on a lot of #include's: they use a backslash instead of a slash in the header files search paths, which works correctly on Windows but returns an error on unix-like systems. Note that the C standards mandate that a slash should be used in this context regardless of the system, it will work on all contexts.

So I made a little shell script to correct all the incorrect #include lines on .h and .c files inside the firmware package tree, and the purpose of this message is to share it here in the hope that someone will find it useful :) .

Here it is:

#!/bin/sh

rm -f log_copy.txt

for i in `find STM32Cube_FW_F4_V1.3.0 -name ''*.[ch]'' | xargs grep -l -E -e '#include ''\.\.\\\' -e '#include ''\\\'`; do

    echo ''COPY $i -> $i.orig'' | tee log_copy.txt

    cp $i $i.orig

    echo ''CHANGE SLASH $i''

    sed -i '/#include/{s|\\|/|g}' $i | tee log_copy.txt

    diff $i $i.orig | tee log_copy.txt

done

It will backup the original files to .orig and then modify the wrong #include directives. The script must be placed in the directory where the FW package has been decompressed.

As a final word, I'd like to request ST to correct their source files for the next version of the firmware package, and even include makefiles for GNU in addition to the currently present build files.

Best regards!
    This topic has been closed for replies.

    3 replies

    Wright.Simon
    Associate II
    November 23, 2014
    Posted on November 23, 2014 at 16:25

    I had the same problem with Mac OS X. I didn’t do such a thorough check, only fixed the files I needed to for the stm42329i-disco board.

    Patch attached.

    ________________

    Attachments :

    STM32Cube_FW_F4_V1.3.0-unix.diff : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzXV&d=%2Fa%2F0X0000000bNI%2F.0.1MNLYFCAcjbvyJ_5IxS0YIa6Eswj3wrpzw3xQXbk&asPdf=false
    Wright.Simon
    Associate II
    November 23, 2014
    Posted on November 23, 2014 at 16:27

    Ugh, stm32f429i-disco :(

    Montassar BEN ROMDHANE_O
    Visitor II
    November 27, 2014
    Posted on November 27, 2014 at 15:26

    Hi Gad, Simon,

    We’ve notified our development team that this is detected a limitation on Linux platform. Keep an eye out for the next update of STM32Cube_FW_F4 !

    Regards,

    Heisenberg.