How to install GCC 4.7.1

er9x is the best known firmware. It has a superb range of features and is well supported by the community. Well worth trying out.
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: How to install GCC 4.7.1

Post by MikeB »

Just tried this myself. Saves nearly 480 bytes, but doesn't work! I'll have a little look.

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

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

Re: How to install GCC 4.7.1

Post by MikeB »

The 4.8.0 compiler seems to be compiling the function evalChkSum() into a single jump to itself!
Very odd, and clearly stops the program from running.
I've tried a few variations on the code, and also put it into another source file, still the same!

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: How to install GCC 4.7.1

Post by ReSt »

I still have a full copy of my 4.8.0 directory available. So if there will be a simple fix for it, I can try it.
(Simple means, replace file x with file y from z)

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

Re: How to install GCC 4.7.1

Post by MikeB »

4.8.0 seems to dislike accessing past the end of an array. In pers.cpp, replace evalChkSum() with this version.

Code: Select all

uint16_t evalChkSum()
{
  uint16_t sum=0;
	uint16_t *p ;
	p = ( uint16_t *)g_eeGeneral.calibMid ;
  for (int i=0; i<12;i++)
	{
    sum += *p++ ;
	}
  return sum;
}
This seems to fix the problem.

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: How to install GCC 4.7.1

Post by ReSt »

Thanks,
will give it a try.


Reinhard

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

Re: How to install GCC 4.7.1

Post by ReSt »

Modified the pers.cpp file accordingly.
It now compiles, but the resulting hex files are greater, around 100 bytes, than the files from 4.7.1

My 4.8.0 is obviously not the very best one. IIRR I had to use some files from the 4.7.2 version to get it going.
Do you have a link to an actual 4.8.0 version for windows, that simply can be installed ?


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

Re: How to install GCC 4.7.1

Post by MikeB »

No, I did the same as before, downloaded a ZIP file, then copied files over the top of the existing compiler.
This is where I got the download from:

http://kent.dl.sourceforge.net/project/ ... ingw32.zip

Went to my WINAVR-20100110 directory and created a 4.8.0 sub-directory.
Copied the five sub-directories (avr, bin, lib, libexec and share) from the zip file to it.
Copied the sub directory WinAVR-20100110\4.8.0\libexec\gcc\avr\4.8.0 to WinAVR-20100110\libexec\gcc\avr\4.8.0
Copied WinAVR-20100110\4.8.0\avr to C:\WinAVR-20100110\avr
Copied the contents of \WinAVR-20100110\4.8.0\bin (except avr-size.exe) to C:\WinAVR-20100110\bin

I have previous compiler versions in 4.7.2, 4.7.0 and 4.3.3 sub-directories.
To revert to 4.7.2, copy WinAVR-20100110\4.7.2\avr to C:\WinAVR-20100110\avr and the contents of \WinAVR-20100110\4.7.2\bin (except avr-size.exe) to C:\WinAVR-20100110\bin

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: How to install GCC 4.7.1

Post by ReSt »

Mike, thanks for the link.

I downloaded the zip and unpacked it into a folder.
From there I copied all subfolders, avr, bin, lib........(except the avr-size.exe) into an existing 4.7.2 setup, replacing all existing files.

This does work and my newly compiled FrSky.hex (with heli and templates)/ NMEA.hex were 250 / 194 bytes smaller than with 4.7.2.
And the flashed radio seems to work normally.

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

Re: How to install GCC 4.7.1

Post by MikeB »

I've been using AVR-GCC 4.8.0 for nearly 2 years so I thought I'd try the latest release, which is 4.9.2.
I did the update as described above.
Unfortunately, the compiled code is some 3.7% larger than with 4.8.0 (66224 insterad of 63874).
I've reverted to 4.8.0!

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

Post Reply

Return to “er9x”