Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2024-07

Building for Arduino

9 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

I am trying to build fpc for Arduino on MacOS 10.8.5, using the fpc-3.0.4 sources and fpc-3.0.4 as bootstrap compiler. GNU binutils have been built and installed (but not yet avrdude). As suggested here <https://forum.lazarus.freepascal.org/index.php/topic,30960.0.html> I use

make clean crossall OS_TARGET=embedded CPU_TARGET=avr SUBARCH=avr5 BINUTILSPREFIX=avr- CROSSOPT="-O3 -XX -CX"

which results in

	objpas.pp(175,24) Fatal: Unknown compilerproc "fpc_ansistr_to_shortstr".

Is this a known problem ? Is a specific minimal version of the fpc sources and a specific bootstrap compiler neeed to build for Arduino ?

Obviously, I wouldn't need all packages.

Regards,

Adriaan van Os

Reply by email

Christo Crause
to Adriaan van Os

On Sun, Jul 7, 2024 at 3:55 PM Adriaan van Os via fpc-pascal <

Show quoted text 28 lines
wrote: I am trying to build fpc for Arduino on MacOS 10.8.5, using the fpc-3.0.4 sources and fpc-3.0.4 as bootstrap compiler. GNU binutils have been built and installed (but not yet avrdude). As suggested here <https://forum.lazarus.freepascal.org/index.php/topic,30960.0.html> I use make clean crossall OS_TARGET=embedded CPU_TARGET=avr SUBARCH=avr5 BINUTILSPREFIX=avr- CROSSOPT="-O3 -XX -CX" which results in objpas.pp(175,24) Fatal: Unknown compilerproc "fpc_ansistr_to_shortstr". Is this a known problem ? Is a specific minimal version of the fpc sources and a specific bootstrap compiler neeed to build for Arduino ? Obviously, I wouldn't need all packages. Regards, Adriaan van Os

The level of support for AVR in 3.0.4 was rudimentary, only atmega128 is supported in the MakeFIle. The support for AVR is still improving with time so use either the development branch, or the latest release version (if you prefer release versions). The bootstrap compiler required is determined by the source version, not the cross target.

Reply by email

Adriaan van Os
to Christo Crause
Christo Crause wrote 5 lines
The level of support for AVR in 3.0.4 was rudimentary, only atmega128 is supported in the MakeFIle. The support for AVR is still improving with time so use either the development branch, or the latest release version (if you prefer release versions). The bootstrap compiler required is determined by the source version, not the cross target.

Thanks for the reply. With fpc-3.2.2 and

make clean crossall FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=embedded CPU_TARGET=avr SUBARCH=avr5 BINUTILSPREFIX=avr- CROSSOPT="-O3 -XX -CX -v"

I get an assembler error

/Users/adriaan/fpc-3.2.2/compiler/ppcrossavr -Cpavr5 -Ur -Tembedded -Pavr -XPavr- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU/Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded -davr -dRELEASE -O3 -XX -CX -v -Us -Sg system.pp @system.cfg
/Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s: Assembler messages: /Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s:28783: Error: `)' required /Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s:28783: Error: garbage at end of line

where the offended assembly line in system.s reads

ldi r20,lo8(gs(FPC_FINALIZE)

and avr-as was built from gnu-binutils version 2.17.

Is there a minimal gnu-binutils version required ?

Regards,

Adriaan van Os

Reply by email

Christo Crause
to Adriaan van Os

On Sun, Jul 7, 2024 at 8:15 PM Adriaan van Os via fpc-pascal <

Show quoted text 42 lines
wrote: Christo Crause via fpc-pascal wrote: > The level of support for AVR in 3.0.4 was rudimentary, only atmega128 is > supported in the MakeFIle. The support for AVR is still improving with > time so use either the development branch, or the latest release version > (if you prefer release versions). The bootstrap compiler required is > determined by the source version, not the cross target. Thanks for the reply. With fpc-3.2.2 and make clean crossall FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=embedded CPU_TARGET=avr SUBARCH=avr5 BINUTILSPREFIX=avr- CROSSOPT="-O3 -XX -CX -v" I get an assembler error /Users/adriaan/fpc-3.2.2/compiler/ppcrossavr -Cpavr5 -Ur -Tembedded -Pavr -XPavr- -Xr -Ur -Xs -O2 -n -Fi../inc -Fi../avr -FE. -FU/Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded -davr -dRELEASE -O3 -XX -CX -v -Us -Sg system.pp @system.cfg /Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s: Assembler messages: /Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s:28783: Error: `)' required /Users/adriaan/fpc-3.2.2/rtl/units/avr-embedded/system.s:28783: Error: garbage at end of line where the offended assembly line in system.s reads ldi r20,lo8(gs(FPC_FINALIZE) and avr-as was built from gnu-binutils version 2.17. Is there a minimal gnu-binutils version required ? Regards, Adriaan van Os

The assembly line you showed above is obviously missing a closing parenthesis, so the error from avr-as is correct. I tested building ppcrosssavr 3.2.2 with all your cross options and added -a to retain the generated assembler source. This worked fine and line 28783 from system.s has balanced parentheses: ldi r20,lo8(gs(FPC_FINALIZE))

Somehow that line got truncated when you were building the cross compiler, but I have no idea what could have caused that.

PS. My avr binutils version is 2.26 - old, but your version is about 10 years older still.

Reply by email

Adriaan van Os
to Christo Crause
Christo Crause wrote 5 lines
The assembly line you showed above is obviously missing a closing parenthesis, so the error from avr-as is correct. I tested building ppcrosssavr 3.2.2 with all your cross options and added -a to retain the generated assembler source. This worked fine and line 28783 from system.s has balanced parentheses: ldi r20,lo8(gs(FPC_FINALIZE))

My mistake while copying the line, sorry.

Show quoted text 6 lines
Somehow that line got truncated when you were building the cross compiler, but I have no idea what could have caused that. PS. My avr binutils version is 2.26 - old, but your version is about 10 years older still.

I use 2.17 because of this still unresolved bug
<https://sourceware.org/bugzilla/show_bug.cgi?id=11337> but that is probably relevant for windows only. I will try 2.26 and report the result.

Regards,

Adriaan van Os

Reply by email

Christo Crause
to Adriaan van Os

On Sun, 7 Jul 2024, 22:35 Adriaan van Os via fpc-pascal, <

Show quoted text 24 lines
wrote: Christo Crause via fpc-pascal wrote: > The assembly line you showed above is obviously missing a closing > parenthesis, so the error from avr-as is correct. I tested building > ppcrosssavr 3.2.2 with all your cross options and added -a to retain the > generated assembler source. This worked fine and line 28783 from > system.s has balanced parentheses: ldi r20,lo8(gs(FPC_FINALIZE)) My mistake while copying the line, sorry. > > Somehow that line got truncated when you were building the cross > compiler, but I have no idea what could have caused that. > > PS. My avr binutils version is 2.26 - old, but your version is about 10 > years older still. I use 2.17 because of this still unresolved bug <https://sourceware.org/bugzilla/show_bug.cgi?id=11337> but that is probably relevant for windows only. I will try 2.26 and report the result.

I would not worry about windres for AVR.

Reply by email

Adriaan van Os
to Christo Crause: On Sun, Jul 7, 2024 at 8:15 PM Adriaan van Os via fpc-pascal < The assembly line you…
Christo Crause wrote
PS. My avr binutils version is 2.26 - old, but your version is about 10 years older still.

WIth avr binutils 2.26 built and installed, the compiler builds !

adriaan% /usr/local/bin/ppcrossavr -v

Free Pascal Compiler version 3.2.2

Compiler date : 2024/07/08
Compiler CPU target: avr

Supported targets (targets marked with '{*}' are under development): embedded: Embedded

Supported CPU instruction sets:
AVR1,AVR2,AVR25,AVR3,AVR31,AVR35,AVR4,AVR5,AVR51,AVR6

Supported FPU instruction sets:
NONE,SOFT,LIBGCC

etcetera

Thanks for the help !

Regards,

Adriaan van Os

Reply by email

Adriaan van Os
to Adriaan van Os
Adriaan van Os wrote 5 lines
Christo Crause via fpc-pascal wrote: > PS. My avr binutils version is 2.26 - old, but your version is about > 10 years older still. WIth avr binutils 2.26 built and installed, the compiler builds !

/usr/local/bin/ppcrossavr -i says

Supported FPU instruction sets:
NONE,SOFT,LIBGCC

but NONE seems to be the default and the other two produce an error:

Cannot find system type "s32real". Check if you use the correct run time library.

Is this something unimplemented or under development or added after the fpc-3.2.2 release ?

I also got an error

error: Can't find unit macpas used by Blinky

for mode macpas. I guess a unit macpas.pp could easily be added (which I could do).

Regards,

Adriaan van Os

Reply by email

Christo Crause
to Adriaan van Os

On Tue, Jul 9, 2024 at 2:56 PM Adriaan van Os via fpc-pascal <

Show quoted text 22 lines
wrote: Adriaan van Os via fpc-pascal wrote: > Christo Crause via fpc-pascal wrote: >> PS. My avr binutils version is 2.26 - old, but your version is about >> 10 years older still. > > WIth avr binutils 2.26 built and installed, the compiler builds ! /usr/local/bin/ppcrossavr -i says Supported FPU instruction sets: NONE,SOFT,LIBGCC but NONE seems to be the default and the other two produce an error: Cannot find system type "s32real". Check if you use the correct run time library. Is this something unimplemented or under development or added after the fpc-3.2.2 release ?

I vaguely recall Florian mentioning somewhere that there was some problem compiling the internal soft float support for AVR. It is not something I tested myself so I don't know what the exact status is.

Show quoted text 8 lines
I also got an error error: Can't find unit macpas used by Blinky for mode macpas. I guess a unit macpas.pp could easily be added (which I could do).

Again not something I tested, but would assume a patch to make MacPas mode work on AVR would be accepted.

Reply by email