Compiling ER9X Under Windows

er9x is the best known firmware. It has a superb range of features and is well supported by the community. Well worth trying out.
Post Reply
User avatar
Rob Thomson
Site Admin
Posts: 4543
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Compiling ER9X Under Windows

Post by Rob Thomson »

Hi All

For a while I have been rather irritated by the fact that when I compile under windows certain utilities do not function as expected against the windows tools. This problem is further exasperated by the fact that windows does not by default have a 'bash' shell meaning you have to replace the 'build' script with a batch file.

I now have a 100% perfect solution in place.

Here is what you need to do.
Download and Install WinAVR http://winavr.sourceforge.net/
Download and Install Ruby http://rubyinstaller.org/
Download and Install CygWin http://www.cygwin.com/

Now - Look for this folder:
C:\WinAVR-20100110\utils\bin (path may be different on your system)

Locate the file called 'egrep.exe' and rename it to 'egrep.bak'.

Next:
We need to add the cygwin utils to the OS path.

This can be done as follows under Window7/Vista.
Click on the Start Menu
In the run box type 'systempropertiesadvanced.exe'
Click the 'Advanced Tab'
Click the button at the bottom of the page called 'Environent Variables'
Edit the variable called 'Path'
Add the following: 'C:\cygwin\bin' (e.g.: Other Paths In Var;C:\cygwin\bin)
Click ok and close all windows.

Job done.

Now.. all we need to do is to run the build scripts using 'bash'.

So..

Open up a bash shell. Start->Run [bash]

Change to your 'build folder' ... and you a ready to compile.

Everything works 100% as per the unix compile options.

Have fun!

Rob
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!

ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Compiling ER9X Under Windows

Post by ReSt »

This is my solution on Windows XP:

Prereqs (AFAIK) :
I have installed WinAVR-20100110, AVRStudio4 (v.4.18 SP3), Ruby-1-9-2-p0 and TortoiseSVN (V 1.6.10)
(When installing Ruby, you have to select 'Add Ruby executables to your path' and 'Assiciate .rb and .rbs files with this Ruby installation')

I use SVN to always download a full release into its separate subdirectory e.g. r582, r646, ...


Disadvantage of the original makefile is, it uses egrep that fails on my system and it always creates a new stamp file with a new version number and the actual compilation date

So you loose the link to the original version and date of the code.


Therefore I have modified the makefile, naming it MyMakefile that I start with my batch file MakeMe.bat

MyMakefile uses grep instead of egrep, and that works on my system and it does not create a completely new stamp file.

Instead of, it uses the first five lines of the original stamp file and only modifies the last line, that displays the modifications like NOH or ARDU ...

This way I always get a new stamp file with the original version number and time stamp, but with my actually used compile options.


I can compile the code by double clicking MakeMe.bat. It opens a DOS window and runs the compiles.
My MakeMe.bat runs two compilations, one with options NMEA, NOH and the next with NMEA, NHT.
Every compilation is started with a 'make clean' and when done it copies the created file into the source folder of the version (as usual).
Last command used in the batch file is Pause, so the window stays open and I can check the protocol for possible errors.


Reinhard
Attachments
make_me.bat.txt
Remove the .txt extension
(541 Bytes) Downloaded 445 times
MyMakefile.txt
remove the .txt extension
(19.74 KiB) Downloaded 488 times
User avatar
Rob Thomson
Site Admin
Posts: 4543
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Compiling ER9X Under Windows

Post by Rob Thomson »

Have you tried the er9x-builder script I made?

Does some fancy stuff to make the compile look pretty!
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!
ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Compiling ER9X Under Windows

Post by ReSt »

No, I havn't used it, because it doesn't run on my Win XP (or I don't know how to :cry: )

I need new compilations only when I 'play around' with modifying the NMEA code.
So I don't need every possible version to be newly compiled, only a very limited number of versions.


Reinhard
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

I had a hunt around and found suitable bash.exe (renamed to sh.exe), egrep.exe and grep.exe (can't remember where I got the from!). I put these in the C:\WinAVR-20100110\utils\bin directory, then the standard makefile just works. I could post these if required (zip file is 1.5Meg).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Compiling ER9X Under Windows

Post by ReSt »

Thanks, would be nice to have.

Reinhard
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

Try unzipping this into your WinAVR-20100110\utils\bin directory, back up existing files of the same name first.
Then see if a build under windows works fine.
wbuild.zip
(1.21 MiB) Downloaded 463 times
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
DLONE
Posts: 11
Joined: Sun Mar 04, 2012 9:45 pm
Country: -

Re: Compiling ER9X Under Windows

Post by DLONE »

Hi all,

I'm new here so I take the change to say hi to all!

I have a propably stupid question... I try to compile the firmware, by just to use make all command. Everithing is seems to be fine, but, the generated hex file is not identical with the file is included in the main deirectory of the project. I downloaded the latest build, r742. I could not figure out how to compile to get the files identical.... This fact makes me head each.... Is there any explanation for that? Or even better, some solution?

Or is it so easy, you guys using linux, and under windows the generated binaries will not identical with the linux compiled ones???

Thanks for any advice,

Laci
MGeo
Posts: 21
Joined: Fri Feb 03, 2012 4:43 pm
Country: -

Re: Compiling ER9X Under Windows

Post by MGeo »

Open script file "domake" in root directory to see the flags needed to build individual hex versions.

Example from "domake" for FRSKY:

echo
echo "===== Making FRSKY Version ====="
echo ">>> cleaning"
make clean
echo ">>> making"
make EXT=FRSKY TEMPLATES=NO
echo ">>> moving"
mv er9x.hex ../er9x-frsky.hex
User avatar
erazz
9x Developer
Posts: 682
Joined: Tue Dec 27, 2011 6:25 pm
Country: -
Location: NJ-USA
Contact:

Re: Compiling ER9X Under Windows

Post by erazz »

You're not going to get an identical file when compiling under windows.
There are going to be differences in the stamp file most likely.

It shouldn't matter. It should still work fine.
Z

BEWARE - WE ARE IN THE AIR!!!
What goes up... Should be controlled by a 9X!
DLONE
Posts: 11
Joined: Sun Mar 04, 2012 9:45 pm
Country: -

Re: Compiling ER9X Under Windows

Post by DLONE »

Thank you both for the answer!

I can imagine the difference likely in the stamp file... but the problem is, the generated hex files terrible different.
Is still ok?

Anyway, it is sure I make something stupid, I beleive... I do like this:

- Installed WINAVR, path varibles properly set.
- downloaded the rev. 742.
- went to cmd
- changed the work directory to root\src
- make clean
- make all
Compared the root\er9x.hex against the root\src\er9x.hex => one part of the code is identical, an other more or less identical, but the rest is almost different.

Is it possible, the windows version generates totally different code? At least I would like to know.

In fact, I'm totally newby to AVR programming, and the open source tools as well, so I can not say I understood exactly how the tools working, but on project homepage there is a guide to compile under windows, so I tougt it is straightforward... but seems not to be.

If I do as above, is that the right way? And if I do that way, what domake file does??

Thanks for the any help, and if you have any recommended reading, please share with me.
Thanks,
Laci
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

I compile under windows, it generally produces the same code, but since the stamp file is generated as part of the compile there is always some difference. In particular, the stamp file may be a different size, this will cause the hex file to be a slightly different size, but also most of the addresses in the code will be different making it appear very different.
The best test is to load it on a 9x and try it, if it doesn't work (it should), just put the release version back on.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
DLONE
Posts: 11
Joined: Sun Mar 04, 2012 9:45 pm
Country: -

Re: Compiling ER9X Under Windows

Post by DLONE »

MikeB,

Thank you for the answer!

Ok, I see. In fact my 9x is not modified yet for reflashing, I will do it soon, as the time allows.
I just wont this question make clear, before I do anything, this is why I spend a lot of time on this.
But if you say, tought the differences in hex file it still have to be ok, then I relax.

Just to make my soul easy, could you please compile the original .hex file for rev 472, and post here, then I could compare with my result. Are them indetical, then I will be relaxed.. :D Of course only if your time allows and you have the mood..
Thanks in advance!

Laci
User avatar
erazz
9x Developer
Posts: 682
Joined: Tue Dec 27, 2011 6:25 pm
Country: -
Location: NJ-USA
Contact:

Re: Compiling ER9X Under Windows

Post by erazz »

If it compiles without errors then you won't have any problems. Don't go comparing files.... It really leads no where. Just go right ahead and flash the FW. As long as you don't change the fuses you will not hurt your radio.
Z

BEWARE - WE ARE IN THE AIR!!!
What goes up... Should be controlled by a 9X!
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

Even if I did compile it, it would be different, my system puts my name in the stamp file so we know I built it. As Erazz says, go with your build.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
DLONE
Posts: 11
Joined: Sun Mar 04, 2012 9:45 pm
Country: -

Re: Compiling ER9X Under Windows

Post by DLONE »

Erazz, Mike,

Thanks for your reply!
Ok, I got it, I will not worry then. You guys know the way, I'm just a newcomer in AVR programming and to ER9X development.

@Erazz, this is not the radio I worry about, this is the functionality, repeatability... Just to filter out one possible error source. But ok, I understand, there is no way for that in this case.

Thanks again for the help, and most importantly for the nice firmware!
Sould it happend, I coming with some brilliant idea, then I will tell it.. :D

Keep going with the nice work!

Laci
ReSt
Posts: 1581
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Compiling ER9X Under Windows

Post by ReSt »

I compile the code regularily under Windows (Xp SP2) and it works. Due to your posts, I compared a er9x.hex file from the repository with a er9x.hex file that I compiled on my PC.
They are really different, even though I maintain the original stamp file.
So as stated above, if the files compile without errors, there probably will be no problem with them.

I for myself have modified the Makefile (--> MyMakefile) to retain the first five lines of the stamp file and only add/replace the modifications, that go into the last line.
I call 'MyMakefile' from a batchfile (-->'make_me.bat'). This file contains all required commands (make ... clean, make ... parameters, copy er9x.hex -> xxxx.hex).

So I simply double click the batchfile and my 2 or 3 versions are compiled without manual intervention.

Reinhard
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

OK, I just did a svn checkout of r742, and a clean build keeping the same stamp file. The standard version of er9x I built is 56178 long, the info in the make.log file shows 56306.
I'm using WINAVR-20100110.
I don't know what version of the compiler Erazz is using.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
erazz
9x Developer
Posts: 682
Joined: Tue Dec 27, 2011 6:25 pm
Country: -
Location: NJ-USA
Contact:

Re: Compiling ER9X Under Windows

Post by erazz »

I'd have to check but it's the current one from the Ubuntu repositories...
Z

BEWARE - WE ARE IN THE AIR!!!
What goes up... Should be controlled by a 9X!
DLONE
Posts: 11
Joined: Sun Mar 04, 2012 9:45 pm
Country: -

Re: Compiling ER9X Under Windows

Post by DLONE »

Hi Mike,

Thanks a lot. My standard version regarding the log file is:
Program: 56178 bytes (85.7% Full)

I did not really understood, how to interpret your info in the log file shows 56306.... What is 56178 then? Sorry if I asked one more stupid question...

Laci
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

The make.log file is on the er9x site, it is created every time a full build of all versions is done, so you can find their sizes from it. If you have the same size as I do, then you really don't have any problems.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
erazz
9x Developer
Posts: 682
Joined: Tue Dec 27, 2011 6:25 pm
Country: -
Location: NJ-USA
Contact:

Re: Compiling ER9X Under Windows

Post by erazz »

Not that it makes much of a difference but I'm running avr-gcc (GCC) 4.5.3.
Z

BEWARE - WE ARE IN THE AIR!!!
What goes up... Should be controlled by a 9X!
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Compiling ER9X Under Windows

Post by MikeB »

I'm using WINAVR 4.3.3. I installed it in Jan. 2010, and haven't bothered to check for a newer version since, its working - don't mess with it!

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

Return to “er9x”