[info] How to compile the firmware

It's all about the code!
User avatar
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Sat Apr 08, 2017 12:46 am

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
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

filip5
donator
donator
Posts: 144
Joined: Sat Apr 15, 2017 6:14 pm

Re: How to compile the firmware

Post by filip5 » Wed May 03, 2017 3:44 pm

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 4851 times

User avatar
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Wed May 03, 2017 3:45 pm

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
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

filip5
donator
donator
Posts: 144
Joined: Sat Apr 15, 2017 6:14 pm

Re: How to compile the firmware

Post by filip5 » Wed May 03, 2017 3:59 pm

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: 144
Joined: Sat Apr 15, 2017 6:14 pm

Re: How to compile the firmware

Post by filip5 » Wed May 03, 2017 4:00 pm

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: 2720
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: How to compile the firmware

Post by puff » Wed May 03, 2017 4:02 pm

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Wed May 03, 2017 10:10 pm

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?
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

User avatar
mobyfab
Posts: 137
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France
Soldering skill: yes
Coding skill?: yes

Re: How to compile the firmware

Post by mobyfab » Thu May 04, 2017 12:46 pm

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 » Tue May 23, 2017 11:58 am

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Tue May 23, 2017 12:11 pm

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
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye » Tue May 23, 2017 2:05 pm

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Tue May 23, 2017 2:21 pm

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.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

megatroneye
Posts: 18
Joined: Mon Jan 09, 2017 10:52 pm

Re: How to compile the firmware

Post by megatroneye » Tue May 23, 2017 2:26 pm

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: 2720
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: How to compile the firmware

Post by puff » Tue May 23, 2017 2:27 pm

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: 3409
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA
Contact:

Re: How to compile the firmware

Post by kb1gtt » Tue May 23, 2017 4:03 pm

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 » Tue May 23, 2017 5:21 pm

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: 411
Joined: Mon Feb 13, 2017 2:35 pm
Location: Kiev

Re: How to compile the firmware

Post by andreika » Tue May 23, 2017 7:45 pm

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: 3409
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA
Contact:

Re: How to compile the firmware

Post by kb1gtt » Tue May 23, 2017 8:17 pm

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: 44
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein » Tue Aug 15, 2017 9:25 pm

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Tue Aug 15, 2017 9:27 pm

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

hossein
Posts: 44
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein » Tue Aug 15, 2017 9:28 pm

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Tue Aug 15, 2017 11:25 pm

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
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

hossein
Posts: 44
Joined: Mon Apr 10, 2017 8:10 am

Re: How to compile the firmware

Post by hossein » Wed Aug 16, 2017 8:40 am

I think my session is hijacked .... :-p
Building elf is done successfully now
snapshot524.png
gcc version to support correct compile proc
snapshot524.png (81.17 KiB) Viewed 4260 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
snapshot525.png
error because of invalid values
snapshot525.png (132.35 KiB) Viewed 4260 times

atntpt
Posts: 70
Joined: Tue Apr 17, 2018 8:21 pm
Soldering skill: yes
Coding skill?: yes

Re: How to compile the firmware

Post by atntpt » Fri Dec 14, 2018 2:14 am

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
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Fri Dec 14, 2018 2:30 am

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 ... 05f1d54e52
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

atntpt
Posts: 70
Joined: Tue Apr 17, 2018 8:21 pm
Soldering skill: yes
Coding skill?: yes

Re: How to compile the firmware

Post by atntpt » Fri Dec 14, 2018 3:44 am

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 1794 times

User avatar
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Fri Dec 14, 2018 4:12 am

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.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

User avatar
andreika
donator
donator
Posts: 411
Joined: Mon Feb 13, 2017 2:35 pm
Location: Kiev

Re: How to compile the firmware

Post by andreika » Fri Dec 14, 2018 6:05 am

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
Soldering skill: yes
Coding skill?: yes

Re: How to compile the firmware

Post by yyj876790646 » Sun Feb 10, 2019 2:59 am

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 1226 times

User avatar
russian
Site Admin
Posts: 9525
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: How to compile the firmware

Post by russian » Sun Feb 10, 2019 4:08 am

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
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

Post Reply