[info] How to compile the firmware

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

How to compile the firmware

Post by russian » Mon Sep 09, 2013 2:55 pm

Click here for info on pre-compiled binaries
Click here for info on how to compile rusEfi console

The firmware code is written in mixture of C and C++ languages, in this post I will briefly list all the tools needed to compile or edit this code. There is another thread about the code itself.

Step #1: First you need to download current version of the code from our source code repository.

Step #2: Let's begin with just compiling code from command line. I am using Windows, but there is not much difference with other platforms.

#2.1: Install Arm port of GCC compiler: - that's gnu-toolchain

Validation: in cmd, type "arm-none-eabi-gcc -v" and you should see "...gcc version ... something"

Image

#2.2: Install make. I use make which comes with Cygwin, in package menu select 'Devel' > 'make: The GNU version of the 'make' utility'.

UPDATE: see below why https://sourceforge.net/projects/gnuarm ... d%20Tools/ is needed

Image

Add "bin/" subfolder into system PATH. In case of default installation folder, it would be C:\cygwin\bin

Image

(alternatively you can use some path editor like http://rix0rrr.github.io/WindowsPathEditor/)

Validation: in cmd, type "make -version" and you should see "GNU Make ... for cygwin"

Image

With these two pieces of software, you should be able to compile the code by executing "make" command in the root folder of the source code location.

Image

Step #3: Now, if you also want to change the code & compile using the integrated development environment,
#3.0: GNU Arm toolchain
#3.1: Eclipse Downloads - scroll down a bit and select "Eclipse IDE for C/C++ Developers Eclipse IDE for C/C++ Developers"
#3.2: Eclipse GNU ARM plugin - http://gnuarmeclipse.sourceforge.net/updates

Here is a snapshot of my "Help->About Eclipse->Installation details dialog:
Image
The required ones are
Eclipse IDE for C/C++ Developers
GNU ARM C/C++ Cross Compiler
Optional for SVN integration are JavaHL and Sub* entries
Optional for debugging is C/C++ GDB Hardware Debugging

#3.3: Close that weird 'Welcome' windows
#3.4: Click "File->Import->Existing project into Workspace" and point to the folder containing the source code bundle - 'firmware'.
Here is how this should look like once you've imported the 'firmware' project:
Image

#3.5: Time for 'Project->Build All'
It might take couple of minutes, once it's done you should see
Image

Once you see this, you've got yourself your own version of rusefi.hex compiled within the IDE which you can now program into your brain board :) It's in the Debug folder.
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
russian
Site Admin
Posts: 9779
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Q&A on how to compile the code

Post by russian » Sat Oct 19, 2013 11:52 pm

Oh, by the way IAR Embedded Workbench for ARM is now supported, too. update: not any more :(
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
russian
Site Admin
Posts: 9779
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Q&A on how to compile the code

Post by russian » Fri Oct 25, 2013 2:55 pm

GitHub is the primary repository these days - https://github.com/rusefi/rusefi/
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
russian
Site Admin
Posts: 9779
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Soldering skill: yes
Coding skill?: yes
Contact:

Re: Q&A on how to compile the code

Post by russian » Thu Nov 14, 2013 6:19 pm

Just to make things easier I will also publish compiled versions at http://rusefi.com/build_server/
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Q&A on how to compile the code

Post by jedediah_frey » Wed Nov 20, 2013 2:55 am

russian wrote:Just to make things easier I will also publish compiled versions at http://sourceforge.net/p/rusefi/code/HE ... re_binary/

The folder contains the .hex file along with the version.txt which tells how old this binary is - so far this would be done manually.
ChibiStudio is a MUCH easier way to get setup with this. You unzip it and it has openocd, make, and GCC all in the tools directory. For some reason minGW/Cygwin make takes a long time to get running. It takes 2-3 seconds to 'run' no clue why. It has 4.7 2013q2 but you can always get the latest version from https://launchpad.net/gcc-arm-embedded. Either way it's single file to expand and place at C:\

http://sourceforge.net/projects/chibios ... ibiStudio/

And of course delete this message once you do :)

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

Re: Q&A on how to compile the code

Post by russian » Wed Nov 20, 2013 3:05 am

jedediah_frey wrote:ChibiStudio is a MUCH easier way to get setup with this.
Can you please check if rusEfi default eclipse projects opens and compiles with ChibiStudio? Technically I am using Sourcery GCC, not sure if this would make a difference.

If you could confirm this and start a separate thread for ChibiStudio that would help a lot.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Q&A on how to compile the code

Post by jedediah_frey » Wed Nov 20, 2013 2:01 pm

russian wrote:
jedediah_frey wrote:ChibiStudio is a MUCH easier way to get setup with this.
Can you please check if rusEfi default eclipse projects opens and compiles with ChibiStudio? Technically I am using Sourcery GCC, not sure if this would make a difference.

If you could confirm this and start a separate thread for ChibiStudio that would help a lot.
Works great doing GDB debugging was just as easy, (literally just copied some settings over) and I had a GDB/OpenOCD running.

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

Re: Q&A on how to compile the code

Post by russian » Wed Nov 20, 2013 2:17 pm

jedediah_frey wrote:Works great doing GDB debugging was just as easy, (literally just copied some settings over) and I had a GDB/OpenOCD running.
Any chance you can write a more detailed step by step pretty please? :)
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

jedediah_frey
contributor
contributor
Posts: 51
Joined: Tue Nov 05, 2013 1:43 pm

Re: Q&A on how to compile the code

Post by jedediah_frey » Wed Nov 20, 2013 2:49 pm

russian wrote:
jedediah_frey wrote:Works great doing GDB debugging was just as easy, (literally just copied some settings over) and I had a GDB/OpenOCD running.
Any chance you can write a more detailed step by step pretty please? :)
Of course, I'll get to it after work today.

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

Re: How to compile the code

Post by russian » Sun Jan 26, 2014 2:15 pm

Speaking of Eclipse, the two most important features are:

1) "Ctrl+mouse click" - go to declaration of whatever you've clicked on while holding 'Ctrl'
2) "Ctrl-Shift-G" - find usages of whatever your cursor is at
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

E4ODnut
Posts: 207
Joined: Mon Feb 10, 2014 11:52 pm
Location: Gibsons, BC, Canada
Contact:

Re: How to compile the code

Post by E4ODnut » Sun Feb 16, 2014 2:11 am

I think I have the correct version of Eclipse installed. When I go to Help>About Eclipse, it returns:
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release/
Build ID: 20130919-0819

I can't seem to load the rusEFI project that I downloaded from

http://rusefi.com/build_server/rusefi_firmware.zip

Suggestions?
Robert
1995 Ford E-150, 300 CID I6 E4OD, Custom MS1-Extra
1992 Winnebago Elante 33 RQ, Ford 460 CID V8, E4OD, Custom MS1-Extra
1992 Bayliner 3288, Twin Ford 351CID Windsor V8s, Custom MS1-Extra
1995 Dodge Ram 2500 4x4 488 CID V10 5 spd. MS3 (in progress)

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

Re: How to compile the code

Post by russian » Sun Feb 16, 2014 2:30 am

build server is the place where the binaries are uploaded by the... build server which builds and tests the binaries every time there is an official code change.

You want to import your 'firmware' folder which cobtains main.c and other source code files. The easy option is rusefi.rXXXX.zip from soueceforge files but the better option is a subfolder of the stuff you've checked out using the SVN client.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

E4ODnut
Posts: 207
Joined: Mon Feb 10, 2014 11:52 pm
Location: Gibsons, BC, Canada
Contact:

Re: How to compile the code

Post by E4ODnut » Sun Feb 16, 2014 3:47 am

Sorry, you lost me. What's an SVN client? Remember, I'm just blindly following instructions here.

The Zip file I downloaded was unzipped under the folder "code". In that folder there were sub folders, "firmware", "Firmware Bineries", Hardware", "Java Consol" and a bunch of others. Was this the correct download?
Robert
1995 Ford E-150, 300 CID I6 E4OD, Custom MS1-Extra
1992 Winnebago Elante 33 RQ, Ford 460 CID V8, E4OD, Custom MS1-Extra
1992 Bayliner 3288, Twin Ford 351CID Windsor V8s, Custom MS1-Extra
1995 Dodge Ram 2500 4x4 488 CID V10 5 spd. MS3 (in progress)

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

Re: How to compile the code

Post by russian » Sun Feb 16, 2014 3:56 am

E4ODnut wrote:Sorry, you lost me. What's an SVN client? Remember, I'm just blindly following instructions here.

The Zip file I downloaded was unzipped under the folder "code". In that folder there were sub folders, "firmware", "Firmware Bineries", Hardware", "Java Consol" and a bunch of others. Was this the correct download?
TortoiseSVN as described here is our SVN client of choice. Wikipedia: SVN and Wikipedia: Version Control

I do not think we have a .zip file which contains 'hardware', do we?

Anyway. You should have a folder which would have main.c and rusefi.c and a bunch of other files in it. Point eclipse at this folder, I am expecting this folder to be called 'firmware'.

Remeber - you do not have to use Eclipse. You can use clean_build.bat which you should have next to the main.c.
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

legath-t
contributor
contributor
Posts: 10
Joined: Mon Jun 23, 2014 6:48 pm
Location: Ryazan

Re: How to compile the code

Post by legath-t » Wed Jul 23, 2014 9:23 am

Hi
i think we need to migrate to linaro toolchain, because it is absolute opensource.
Code sourcery have some limitations.

ghaem313
Posts: 2
Joined: Mon Dec 15, 2014 8:56 pm

Re: How to compile the firmware

Post by ghaem313 » Tue Dec 16, 2014 3:05 pm

I wonder if you've installed the right ARM plugin?
I have downloaded all off Required things from links that you put them on last page.
you can see the installed plugin and error in the attachment.
Attachments
eclipse err.png
eclipse err.png (237.75 KiB) Viewed 14682 times

ghaem313
Posts: 2
Joined: Mon Dec 15, 2014 8:56 pm

Re: How to compile the firmware

Post by ghaem313 » Tue Dec 16, 2014 8:54 pm

i have removed all arm plugin and installed V 0.5.5 plugin that copied in dropins folder
but problem not resolved

User avatar
russian
Site Admin
Posts: 9779
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 Dec 16, 2014 8:57 pm

ghaem313 wrote:i have removed all arm plugin and installed V 0.5.5 plugin that copied in dropins folder
but problem not resolved
At this point best I can offer would be installing http://www.teamviewer.com/ and getting in touch with me on Skype (my Skype ID is below)
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
Tambralinga
donator
donator
Posts: 174
Joined: Wed Jun 18, 2014 8:36 am
Location: Bangkok, Thailand

Re: How to compile the firmware

Post by Tambralinga » Sat Jan 17, 2015 6:30 am

Image

Image

I want to solve this problem.
Skype : shiva-p
+66 8 5357 5159

User avatar
russian
Site Admin
Posts: 9779
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 Jan 17, 2015 12:47 pm

Tambralinga wrote:I want to solve this problem.
Looks like you need to fix the linker script path
Image
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
russian
Site Admin
Posts: 9779
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 Apr 03, 2015 6:04 pm

With the new plugin, finally setting up the debugger is relatively simple

1) download & uncompress https://svn.code.sf.net/p/rusefi/code/t ... d-0.8.0.7z add bin/ folder to path

2) install ARM Cross-compiling & OpenOCD debugging
Image

3) use https://svn.code.sf.net/p/rusefi/code/t ... penocd.bat to start openocd

4) create OpenOCD Debug configuration, un-check the "run OpenOCD locally"
Image
Image

5) run openocd with run_openocd.bat

it should work!
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
kb1gtt
contributor
contributor
Posts: 3489
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA
Contact:

Re: How to compile the firmware

Post by kb1gtt » Sun Jul 12, 2015 1:56 pm

It's been a while sense I looked to download it, but last I recall, the file you wanted was semi hidden, such that you typically got the wrong file instead of the actual free edition. If you ignore what your eyes come to first for the download, do you notice another file linked somewhere else on the page?
Welcome to the friendlier side of internet crazy :)

ScubaSteve
Posts: 12
Joined: Fri Jul 10, 2015 2:22 am

Re: How to compile the firmware

Post by ScubaSteve » Sun Jul 12, 2015 3:36 pm

kb1gtt wrote:It's been a while sense I looked to download it, but last I recall, the file you wanted was semi hidden, such that you typically got the wrong file instead of the actual free edition. If you ignore what your eyes come to first for the download, do you notice another file linked somewhere else on the page?
Well I dug deep and ended up here.
They literately made only the ARM edition a 30 day trial :\

I'm gonna look around and see if anyone has archived an installer for the old free edition.

Update 1: Think I found a working version!

Update 2: AOK! Just built the firmware
Download: https://launchpad.net/gcc-arm-embedded/ ... -q3-update
Update 3: Does not work with Eclipse, its not Codebase
Image

User avatar
russian
Site Admin
Posts: 9779
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 Jul 12, 2015 11:24 pm

Eclipse is not required to compile the code - there is also a Makefile, you can compile with make
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

Rhinoman
contributor
contributor
Posts: 247
Joined: Thu Sep 24, 2015 2:14 pm
Location: Wiltshire, UK
Contact:

Re: How to compile the firmware

Post by Rhinoman » Fri Oct 16, 2015 3:13 pm

I'm trying to install the Eclipse IDSE following these instructions:

(edit by @: please do not use this link to install anything for rusEfi) http://stm32discovery.nano-age.co.uk/op ... evelopment

As usual with Eclipse nothing works, so who has a working set up and what versions of the different packages do you have? I have got past the Java 32/64-bit incompatibility but I can't update the software, I'm guessing its another Java/Eclipse incompatibility.
I have:
Eclipse IDE for C/C++ Developers
Version: Helios Service Release 1
Build id: 20100917-0705

Java Version 8 update 60

User avatar
russian
Site Admin
Posts: 9779
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 Oct 16, 2015 3:23 pm

I think part of the issue is that you are trying to use a version from 5 years ago. The article is referencing Eclipse and GCC probably from the times when the article was written, these older versions would not be compatible with the current version of the ARM Eclipse plugin I am using.
Rhinoman wrote:Build id: 20100917-0705

In order to get latest Eclipse CDT one would look at https://eclipse.org/cdt/downloads.php

On the other hand, you do not really need eclipse in order to compile - you only need current eclipse if you want to integrate all the tools. A bare bones installation just to compile would be some ARM gcc and some 'make' - I am using somewhat old Sourcery CodeBench Lite 2014.05-28 from http://go.mentor.com/31xl6 and current Cygwin make (I like on Windows)
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

Rhinoman
contributor
contributor
Posts: 247
Joined: Thu Sep 24, 2015 2:14 pm
Location: Wiltshire, UK
Contact:

Re: How to compile the firmware

Post by Rhinoman » Fri Oct 16, 2015 4:05 pm

OK, thanks, I didn't realise that was an older version, I will install the latest version and try again.

User avatar
russian
Site Admin
Posts: 9779
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 Jul 09, 2016 10:32 pm

On Windows linker command has just exceeded 8Kb with the addition of a new file, https://mcuoneclipse.com/2015/03/29/sol ... n-windows/ is now needed to work around this issue.

https://sourceforge.net/projects/gnuarm ... d%20Tools/
https://rusefi.com/s/howtocontribute
very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions
my skype is arro239

marko
Posts: 8
Joined: Sat Mar 25, 2017 5:20 pm

Re: How to compile the firmware

Post by marko » Mon Mar 27, 2017 12:44 am

Why do you use sourcery? Can you not get it to work with normal arm gcc? the one formally called launchpad. That's what I've always used for STM32 in the past. Looks like ARM is actually doing the development now.

https://developer.arm.com/open-source/g ... ain/gnu-rm

User avatar
russian
Site Admin
Posts: 9779
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 » Mon Mar 27, 2017 2:11 am

Thank you CodeSourcery - we now use arm gcc See https://github.com/rusefi/rusefi/issues/376

I am not aware of any major differences, just keeping up with current version of everything,
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