[info] How to compile the firmware

It's all about the code!
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

Starting with ChibiOS3 we now use submodules - already got one confused user. This is mentioned on the bottom of readme.md, on the bottom on https://github.com/rusefi/rusefi/

Code: Select all

git submodule update --init
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
filip5
donator
donator
Posts: 164
Joined: Sat Apr 15, 2017 6:14 pm
Location: MAYWOOD, NJ 07607

Re: How to compile the firmware

Post by filip5 »

Hi there,
I am trying to get this project going in Eclipse environment. I can not get it to run due to an error 127.
Thanks for the help.
Attachments
Eclipse Rusefi compile project error.JPG
Eclipse Rusefi compile project error.JPG (2.19 MiB) Viewed 60917 times
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

First troubleshooting step
arm-none-eabi-gcc -v
in command prompt, what does it show?

I believe your Eclipse does not see arm-none-eabi-gcc installed
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
filip5
donator
donator
Posts: 164
Joined: Sat Apr 15, 2017 6:14 pm
Location: MAYWOOD, NJ 07607

Re: How to compile the firmware

Post by filip5 »

it shows this:
DI Main@DIMain-PC ~
$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=C:\Program Files\GNU Tools ARM Embedded\6 2017-q1-update\bin\arm-none-eabi-gcc.exe
COLLECT_LTO_WRAPPER=c:/program\ files/gnu\ tools\ arm\ embedded/6\ 2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/lto-wrapper.exe
Target: arm-none-eabi
Configured with: /tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/src/gcc/configure --build=x86_64-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi --prefix=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw --libexecdir=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/lib --infodir=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/share/doc/gcc-arm-none-eabi/info --mandir=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-mingw-wildcard --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=yes --with-newlib --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/install-mingw/arm-none-eabi --with-libiconv-prefix=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-gmp=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-mpfr=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-mpc=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-isl=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-libelf=/tmp/jenkins-GCC-6-buildandreg-104_20170216_1487268972/build-mingw/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors 6-2017-q1-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 6.3.1 20170215 (release) [ARM/embedded-6-branch revision 245512] (GNU Tools for ARM Embedded Processors 6-2017-q1-update)

DI Main@DIMain-PC ~
$
filip5
donator
donator
Posts: 164
Joined: Sat Apr 15, 2017 6:14 pm
Location: MAYWOOD, NJ 07607

Re: How to compile the firmware

Post by filip5 »

what is the command for make? I have the folder called stuff under C drive as well.

I can still not compile rusefi using arm GCC compiler.
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: How to compile the firmware

Post by puff »

I guess it has to deal with the settings of that eclipse thing.
It looks like your terminal doesn know arm-none-eabi-gcc, while the eclipe doesn't...
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

puff wrote:It looks like your terminal doesn know arm-none-eabi-gcc, while the eclipe doesn't...
Exactly, looks like arm-none-eabi-gcc is installed by Eclipse cannot find it? Have you restarted Eclipse since installing arm-none-eabi-gcc?

Please type make inside firmware folder, what would it output?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
mobyfab
Posts: 139
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France

Re: How to compile the firmware

Post by mobyfab »

Check your PATH, restart windows if you just installed GCC.
megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye »

Hi,

I've finally managed to set up my Eclipse CDT and GNU ARM Eclipse plug-in so that the firmware has at last compiled fine, but it has not been a trivial task.

There were fare more steps and tricks involved than what is described on the first, sticky post of this thread.

Maybe it's time to update that sticky post with important info? Not with much info, but at least it would be fine to mention the following:

1) Make sure the project you import/create is the right type (mine turned to be "C/C++ Project"). That's not obvious because you have a lot of ARM-typed projects to choose from.
2) Set up your project's toolchain type at: "Project properties -> C/C++ Build -> Current toolchain:". I choose "Cross ARM gcc" there.
3) Configure the toolchain itself at the global level or at your project level: "Project properties -> C/C++ Build -> Settings/Toolchains tab". Input your path to the external GNU ARM distribution's "bin" folder; for example: "D:\dev\gcc-arm-5.4\bin".

It would be nice also to mention that the Chibios3 and Chibios-contrib modules are necessary parts of the source (for the source to compile), but perhaps this info might better go to the README.MD.

D.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

megatroneye wrote:perhaps this info might better go to the README.MD
And this info is actually at the bottom of https://github.com/rusefi/rusefi/blob/master/README.md
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye »

russian wrote:
megatroneye wrote:perhaps this info might better go to the README.MD
And this info is actually at the bottom of https://github.com/rusefi/rusefi/blob/master/README.md
You are right. Anyway, I humbly think that the tips about configuring Eclipse might help other people if they were on the sticky post.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

Technically Eclipse is optional - as long as you have compiler & make, you can use any editor. Also my assumption would be that compiler is added into PATH in which case you do not need steps #2 and #3 in my experience.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye »

russian wrote:Technically Eclipse is optional - as long as you have compiler & make, you can use any editor. Also my assumption would be that compiler is added into PATH in which case you do not need steps #2 and #3 in my experience.
OK then.
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: How to compile the firmware

Post by puff »

What about the makefile? andreika mentioned some sort of optimizations (or, better to say, the absense of optimizations), which caused some problems. As far as I understood, he was compiling the usual firmware with the usual Makefile? In other words, what is needed to compile the firmware as if it is compiled by the buildserver?
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: How to compile the firmware

Post by kb1gtt »

I think that it would be much easier if we used ChibiOS Studio. That is much easier to install, and offers potential debugging tools that are not currently used. Has anyone attempted to compile with a ChibiOS Studio platform? Is it a hard change? I suspect the key difference is that the underlying compiler will likely produce slightly different hex files.
Welcome to the friendlier side of internet crazy :)
megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye »

kb1gtt wrote:I think that it would be much easier if we used ChibiOS Studio. That is much easier to install, and offers potential debugging tools that are not currently used. Has anyone attempted to compile with a ChibiOS Studio platform? Is it a hard change? I suspect the key difference is that the underlying compiler will likely produce slightly different hex files.
I don't want to take part in the discussion because as a contributor-wannabe I don't regard myself as entitled to ;) , but as a matter of fact - with the help of a step-by-step guide, configuring Eclipse CDT/GNU ARM plugin to compile the firmware would not really be hard. A matter of 30 minutes-1 hour starting from zero, in my opinion.

On the other hand, it might be the case that ChibiOS studio offers other advantages beyond ease of configuration.

After downloading RusEFI's code, I decided to stick to Eclipse CDT just because I have to use several Eclipses on my everyday life and I tend to prefer the "one platform, many plugins" approach rather than downloading specific distributions for specific environments/tasks.

But I am just saying... 8-)
User avatar
andreika
donator
donator
Posts: 461
Joined: Mon Feb 13, 2017 2:35 pm
Location: Kiev

Re: How to compile the firmware

Post by andreika »

BTW, here's a little hint if you're using MinGW-make for Windows. It may take a lot of time to start compilation due to many built-in rules (non-existent files access etc.). To disable it, start make with "-r" option:

Code: Select all

make -r
It will run much faster under Windows.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: How to compile the firmware

Post by kb1gtt »

ChibiOS Studio is a pre-packaged eclipse environment with compiler. I agree a good wiki page or set of instructions in on place with other links pointing to that one good source is a good approach. The setup time is not long and is not hard. We could be helped with better documentation though.
Welcome to the friendlier side of internet crazy :)
hossein
Posts: 47
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein »

Hi, i was trying to compile the latest firmware two hours before, and i got the issue now:

Code: Select all

Compiling rusefi.cpp
Compiling main.cpp
Linking build/rusefi.elf
config/stm32f4ems/STM32F407xG.ld:24: nonconstant expression for origin

and the line contains :

Code: Select all

 flash : org = DEFINED(BOOTLOADER) ? 0x08008000 : 0x0800000, len = DEFINED(BOOTLOADER) ? 864k : 896k  /* change address & length if bootloader */
Is something incorrect about addressing by default or I missed ?

Thanks ;).
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

Have not experiensed this one. What version of gcc are you using?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
hossein
Posts: 47
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein »

Code: Select all

gcc-4.9-arm-linux-gnueabihf     4.9.2-10
gcc-4.9-base:armhf      4.9.2-10
gcc-arm-linux-gnueabihf         4.9.2-10.1
gcc-arm-none-eabi       4.8.4-1+11-1
libgcc-4.9-dev:armhf    4.9.2-10
libgcc1:armhf   1:4.9.2-10
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

https://launchpad.net/gcc-arm-embedded seems to show 5.4 or something? Can you please try that?

I am using 5.4 from 2016q3 on my windows box
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
hossein
Posts: 47
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein »

I think my session is hijacked .... :-p
Building elf is done successfully now
gcc version to support correct compile proc
gcc version to support correct compile proc
snapshot524.png (81.17 KiB) Viewed 60187 times
And now i think i might change the values in

Code: Select all

   flash : org = DEFINED(BOOTLOADER) ? 0x08008000 : 0x0800000, len = DEFINED(BOOTLOADER) ? 864k : 896k  /* change address & length if bootloader */
because of error
error because of invalid values
error because of invalid values
snapshot525.png (132.35 KiB) Viewed 60187 times
atntpt
Posts: 102
Joined: Tue Apr 17, 2018 8:21 pm

Re: How to compile the firmware

Post by atntpt »

Hi guys, I'm having difficulties with the firmware part. my English is somewhat limited and when it comes time to understand more technical things I have some difficulty.
and first of all I am not being able to compile the firmware, I think I already have everything installed. this appears"Makefile:353: ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk: No such file or directory"
then wanted to understand the part of the different configurations for the various PCBs. From what I understand it is necessary to compile the firmware for each board. right?! for example how would I compile for prometheus with the 405? or to the 469?
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

atntpt wrote:
Fri Dec 14, 2018 2:14 am
I think I already have everything installed. this appears"Makefile:353: ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk: No such file or directory"
I have two great news for you.
You are not the first one who did not read the bottom of https://github.com/rusefi/rusefi where it says

Code: Select all

We now use submodules:

git submodule update --init
And - more importantly - the Makefile will now tell you to invoke this command: https://github.com/rusefi/rusefi/commit/106d6b8b7b22e95ccfa20abd749f8505f1d54e52
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
atntpt
Posts: 102
Joined: Tue Apr 17, 2018 8:21 pm

Re: How to compile the firmware

Post by atntpt »

Yup missed that, did some search and was able to clone git via command line and update submodules somthing went wrong tho.. error 1..
but about the second question? is the firmware compliled for the board ? and how to select a target board to build for
Attachments
error1.PNG
error1.PNG (179.26 KiB) Viewed 57721 times
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

no option -wimplicit-fallthrough means you use old version of compiler - see https://github.com/rusefi/rusefi/issues/517

Yes default files are for stm32f407 see !compile-prometheus.bat to see how different configuration is selected. I only use default stm32f407 so not the best person to consult on other boards.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
andreika
donator
donator
Posts: 461
Joined: Mon Feb 13, 2017 2:35 pm
Location: Kiev

Re: How to compile the firmware

Post by andreika »

russian wrote:
Fri Dec 14, 2018 4:12 am
see !compile-prometheus.bat to see how different configuration is selected.
The "!compile-prometheus.bat" is for Prometheus with 469 chip.
For 405 chip, you need to replace "-DSTM32F469xx" makefile option with "-DSTM32F405xx".
yyj876790646
Posts: 11
Joined: Tue Jan 01, 2019 1:55 am

Re: How to compile the firmware

Post by yyj876790646 »

I have trouble compile the firmware.I've done the git clone and git submodule update --init operation but the make4.bat didn't succeed.
My gcc version is cc version 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615] (GNU Tools for ARM Embedded Processors)
C:\Users\Administrator\rusefi\firmware>make -j4
Compiling crt0_v7m.S
Compiling vectors.S
Compiling chcoreasm_v7m.S
Compiling crt1.c
cc1.exe: error: -Werror=implicit-fallthrough: no option -Wimplicit-fallthrough
cc1.exe: error: -Werror=bool-operation: no option -Wbool-operation
make: *** [ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk:253: build/obj/crt0_v7m.o] Error 1
make: *** Waiting for unfinished jobs....
cc1.exe: error: -Werror=implicit-fallthrough: no option -Wimplicit-fallthrough
cc1.exe: error: -Werror=bool-operation: no option -Wbool-operation
cc1.exe: error: -Werror=implicit-fallthrough: no option -Wimplicit-fallthrough
cc1.exe: error: -Werror=bool-operation: no option -Wbool-operation
make: *** [ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk:253: build/obj/vectors.o] Error 1
make: *** [ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk:253: build/obj/chcoreasm_v7m.o] Error 1
cc1.exe: error: -Werror=implicit-fallthrough: no option -Wimplicit-fallthrough
cc1.exe: error: -Werror=bool-operation: no option -Wbool-operation
make: *** [ChibiOS4/os/common/startup/ARMCMx/compilers/GCC/rules.mk:235: build/obj/crt1.o] Error 1

Hope someone can help me.Thanks in advance! :)
Attachments
TC][KHT8[$2TI744NV97VLU.png
TC][KHT8[$2TI744NV97VLU.png (46.15 KiB) Viewed 57153 times
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: How to compile the firmware

Post by AndreyB »

yyj876790646 wrote:
Sun Feb 10, 2019 2:59 am
My gcc version is cc version 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615] (GNU Tools for ARM Embedded Processors)
the part about 2013 looks to be the problem. Please use current gnu arm 8 or recent gnu arm 7.3

At the moment I am using 7.3.1 20180622
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply