Page 1 of 5

How to compile the firmware

Posted: Mon Sep 09, 2013 2:55 pm
by AndreyB
Click here for info on pre-compiled binaries
Click here for info on how to compile rusEfi console

Cygwin required on Windows

Tl,DR: on unix or WSL? see setup_linux_environment.sh
Fanciest 2014 method see https://github.com/rusefi/rusefi/wiki/Custom-Firmware


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" (Not version 4.7 as of 2021 - you are looking at an OLD post)

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/gnuarmeclipse/files/Build%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.

Re: Q&A on how to compile the code

Posted: Sat Oct 19, 2013 11:52 pm
by AndreyB
Oh, by the way IAR Embedded Workbench for ARM is now supported, too. update: not any more :(

Re: Q&A on how to compile the code

Posted: Fri Oct 25, 2013 2:55 pm
by AndreyB
GitHub is the primary repository these days - https://github.com/rusefi/rusefi/

Re: Q&A on how to compile the code

Posted: Thu Nov 14, 2013 6:19 pm
by AndreyB
Just to make things easier I will also publish compiled versions at http://rusefi.com/build_server/

Re: Q&A on how to compile the code

Posted: Wed Nov 20, 2013 2:55 am
by jedediah_frey
russian wrote:Just to make things easier I will also publish compiled versions at http://sourceforge.net/p/rusefi/code/HEAD/tree/trunk/firmware_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/files/ChibiStudio/

And of course delete this message once you do :)

Re: Q&A on how to compile the code

Posted: Wed Nov 20, 2013 3:05 am
by AndreyB
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.

Re: Q&A on how to compile the code

Posted: Wed Nov 20, 2013 2:01 pm
by jedediah_frey
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.

Re: Q&A on how to compile the code

Posted: Wed Nov 20, 2013 2:17 pm
by AndreyB
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? :)

Re: Q&A on how to compile the code

Posted: Wed Nov 20, 2013 2:49 pm
by jedediah_frey
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.

Re: How to compile the code

Posted: Sun Jan 26, 2014 2:15 pm
by AndreyB
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

Re: How to compile the code

Posted: Sun Feb 16, 2014 2:11 am
by E4ODnut
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?

Re: How to compile the code

Posted: Sun Feb 16, 2014 2:30 am
by AndreyB
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.

Re: How to compile the code

Posted: Sun Feb 16, 2014 3:47 am
by E4ODnut
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?

Re: How to compile the code

Posted: Sun Feb 16, 2014 3:56 am
by AndreyB
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.

Re: How to compile the code

Posted: Wed Jul 23, 2014 9:23 am
by legath-t
Hi
i think we need to migrate to linaro toolchain, because it is absolute opensource.
Code sourcery have some limitations.

Re: How to compile the firmware

Posted: Tue Dec 16, 2014 3:05 pm
by ghaem313
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.

Re: How to compile the firmware

Posted: Tue Dec 16, 2014 8:54 pm
by ghaem313
i have removed all arm plugin and installed V 0.5.5 plugin that copied in dropins folder
but problem not resolved

Re: How to compile the firmware

Posted: Tue Dec 16, 2014 8:57 pm
by AndreyB
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)

Re: How to compile the firmware

Posted: Sat Jan 17, 2015 6:30 am
by Tambralinga
Image

Image

I want to solve this problem.

Re: How to compile the firmware

Posted: Sat Jan 17, 2015 12:47 pm
by AndreyB
Tambralinga wrote:I want to solve this problem.
Looks like you need to fix the linker script path
Image

Re: How to compile the firmware

Posted: Fri Apr 03, 2015 6:04 pm
by AndreyB
With the new plugin, finally setting up the debugger is relatively simple

1) download & uncompress https://svn.code.sf.net/p/rusefi/code/trunk/misc/install/openocd-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/trunk/misc/openocd/run_openocd.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!

Re: How to compile the firmware

Posted: Sun Jul 12, 2015 1:56 pm
by kb1gtt
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?

Re: How to compile the firmware

Posted: Sun Jul 12, 2015 3:36 pm
by ScubaSteve
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/4.8/4.8-2014-q3-update
Update 3: Does not work with Eclipse, its not Codebase
Image

Re: How to compile the firmware

Posted: Sun Jul 12, 2015 11:24 pm
by AndreyB
Eclipse is not required to compile the code - there is also a Makefile, you can compile with make

Re: How to compile the firmware

Posted: Fri Oct 16, 2015 3:13 pm
by Rhinoman
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/open-source-development-with-the-stm32-discovery/setting-up-eclipse-for-stm32-discovery-development

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

Re: How to compile the firmware

Posted: Fri Oct 16, 2015 3:23 pm
by AndreyB
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)

Re: How to compile the firmware

Posted: Fri Oct 16, 2015 4:05 pm
by Rhinoman
OK, thanks, I didn't realise that was an older version, I will install the latest version and try again.

Re: How to compile the firmware

Posted: Sat Jul 09, 2016 10:32 pm
by AndreyB
On Windows linker command has just exceeded 8Kb with the addition of a new file, https://mcuoneclipse.com/2015/03/29/solving-the-8192-character-command-line-limit-on-windows/ is now needed to work around this issue.

https://sourceforge.net/projects/gnuarmeclipse/files/Build%20Tools/

Re: How to compile the firmware

Posted: Mon Mar 27, 2017 12:44 am
by marko
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/gnu-toolchain/gnu-rm

Re: How to compile the firmware

Posted: Mon Mar 27, 2017 2:11 am
by AndreyB
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,