[fpc-devel] AVR - assembler error when compiling large files

Christo christo.crause at gmail.com
Wed Nov 29 17:55:49 CET 2017


On Tue, 2017-11-28 at 20:08 +0100, Florian Klämpfl wrote:
> Am 25.11.2017 um 22:19 schrieb Christo:
> > 
> > On Sat, 2017-11-25 at 18:27 +0100, Florian Klämpfl wrote:
> > > 
> > > What happens if you compile them with -CX?
> > Same problem.
> > 
> > > 
> > > > 
> > > >  Is there a way to instruct the compiler to use a larger data
> > > > type
> > > > when
> > > > emitting this information to the assembler file?
> > > This makes no sense as the program code using this data would not
> > > know about this.
> > That was a clue to show I'm in unfamiliar territory.
> > 
> > I experienced the problem when using the supplied make file to
> > build an
> > AVR RTL.  When I compiled the unit by hand, it worked.  I then
> > noticed
> > that the problem seems to be related to the -g option.  If I
> > compile
> > the large unit with -gw3 it was fine but when I compile the large
> > unit
> > with -g it gave the "Error: value of 65611 too large for field of 2
> > bytes at 65609" type errors.
> > 
> > I tried passing OPT=-gw3 to make, but then the system unit cannot
> > compile. Unfortunately this means I cannot use the current makefile
> > to
> > compile AVR RTL with large unit files.
> What command line do you use?

I'm compiling the RTL with ppcrossavr, so I follow the sequence from
the make file from source folder rtl/embedded.  First step:
[path]/ppcrossavr -Cpavr5 @rtl.cfg -Ur -Tembedded -Pavr -XPavr- -Xr -Ur
-Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU../../rtl/units/avr-embedded
-davr -dRELEASE -Us -Sg system.pp

Then:
[path]/ppcrossavr -Cpavr5 @rtl.cfg -Ur -Tembedded -Pavr -XPavr- -Xr -Ur
-Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU../../rtl/units/avr-embedded
-davr -dRELEASE ../avr/intrinsics.pp

Then a shortish unit (1363 lines):
[path]/ppcrossavr -Cpavr5 @rtl.cfg -Ur -Tembedded -Pavr -XPavr- -Xr -Ur
-Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU../../rtl/units/avr-embedded
-davr -dRELEASE -g avr/atmega328p.pp

Then a long unit (2425 lines of code):
[path]/ppcrossavr -Cpavr5 @rtl.cfg -Ur -Tembedded -Pavr -XPavr- -Xr -Ur
-Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU../../rtl/units/avr-embedded
-davr -dRELEASE -g avr/atmega32u4.pp

I then get the stated errors for atmega32u4.pp and other "large" files.
 The differences in content between the file that compiles/assemble and
the one that doesn't is similar, there is just more of the same
declarations in the file because the controller has more hardware
registers.

I can compile atmega32u4.pp by using the following:
[path]/ppcrossavr -Cpavr5 @rtl.cfg -Ur -Tembedded -Pavr -XPavr- -Xr -Ur
-Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU../../rtl/units/avr-embedded
-davr -dRELEASE -gw3 avr/atmega32u4.pp

So simply switching to dwarf3 fixes the assembler problem (error while assembling).



More information about the fpc-devel mailing list