Sign in Join

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

Mailing lists / fpc-devel / 2010-04

arm embedded

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Geoffrey Barton

I have been trying to build and run the arm embedded compiler as instructed on http://wiki.freepascal.org/
Embedded#Adding_new_controllers on windowsXP. I had fpc version 2.4.0 installed (and working). I then installed the latest version from SVN.

I copied the file 'tled1.pp' into fpc and then ran 'fpc -Parm - Tembedded -Wplpc2124 tled1.pp'

(incidentally, I found I had to copy the file ppcrossarm.exe from the 'compiler' directory into the bin path, otherwise fpc did not find it.)

At this point a fatal error occurred:-

C:\FPC>fpc -Parm -Tembedded -Wplpc2124 tled1.pp
Free Pascal Compiler version 2.5.1 [2010/04/02] for arm Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Embedded
Compiling tled1.pp
Fatal: Can't find unit system used by Program
Fatal: Compilation aborted
Error: c:\fpc\2.4.0\bin\i386-win32\ppcrossarm.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

What is the missing unit, and where should it be?

Geoffrey

Reply by email

Jeppe Johansen
to Geoffrey Barton

Your installation probably didn't went well. installbase should copy both binaries and units to the proper directories. Try running "make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm PREFIX=C:\FPC"

Geoffrey Barton wrote 34 lines
I have been trying to build and run the arm embedded compiler as instructed on http://wiki.freepascal.org/Embedded#Adding_new_controllers on windowsXP. I had fpc version 2.4.0 installed (and working). I then installed the latest version from SVN. I copied the file 'tled1.pp' into fpc and then ran 'fpc -Parm -Tembedded -Wplpc2124 tled1.pp' (incidentally, I found I had to copy the file ppcrossarm.exe from the 'compiler' directory into the bin path, otherwise fpc did not find it.) At this point a fatal error occurred:- C:\FPC>fpc -Parm -Tembedded -Wplpc2124 tled1.pp Free Pascal Compiler version 2.5.1 [2010/04/02] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Embedded Compiling tled1.pp Fatal: Can't find unit system used by Program Fatal: Compilation aborted Error: c:\fpc\2.4.0\bin\i386-win32\ppcrossarm.exe returned an error exitcode (normal if you did not specify a source file to be compiled) What is the missing unit, and where should it be? Geoffrey ------------------------------------------------------------------------ _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Geoffrey Barton
Show quoted text 14 lines
Message: 1 Date: Fri, 02 Apr 2010 12:42:37 +0200 From: Jeppe Johansen Subject: Re: [fpc-devel] arm embedded To: FPC developers' list Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Your installation probably didn't went well. installbase should copy both binaries and units to the proper directories. Try running "make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm PREFIX=C:\FPC"

yes, that fixed it, thanks.

Geoffrey

Reply by email

Geoffrey Barton

Two related questions (FPC 2.5.1):-

1 In the rtl/embedded/arm directory are three target processor files. The one for stm32f103 does not get compiled into the units/arm- embedded/rtl directory. I added it to the CPU_UNITS line in the makefile.fpc in the embedded directory before building ppcrossarm, but this does not fix it.

2 Which files have to be edited to add a new ARM chip variant? I can see the types in cpuinfo.pas and t_embed.pas, and the register definitions+startup code as above, but it is not clear to me where to set the correct instruction set, eg. cortexm3 rather than armv4.

Geoffrey

Reply by email

Jonas Maebe
to Geoffrey Barton
Geoffrey Barton wrote 5 lines
1 In the rtl/embedded/arm directory are three target processor files. The one for stm32f103 does not get compiled into the units/ arm-embedded/rtl directory. I added it to the CPU_UNITS line in the makefile.fpc in the embedded directory before building ppcrossarm, but this does not fix it.

You have to run "fpcmake -Tall" after modifying makefile.fpc to regenerate the makefile (and make sure you are using an fpcmake from FPC 2.5.1).

Jonas

Reply by email

Jeppe Johansen
to Geoffrey Barton: Two related questions (FPC 2.5.1):- 1 In the rtl/embedded/arm directory are three target…

1)
stm32f103 is a thumb2 only device, and you cannot generate a rtl for both <=armv5 and thumb2. You need to modify the makefile to generate either a thumb2 rtl or a arm rtl. You can do that by removing the arm core units from CPU_UNITS and overriding the FPC_OPT to include -Cpcortexm3

2)
You don't set the instruction set. You have to override it if you compile for a specific chip, when you call the compiler, otherwise it'll simply default to armv5, no matter what the compiler(rtl) was built for

A short guide, which you probably already knew:

To include a new arm chip, you have to edit compiler/arm/cpuinfo.pas: -Add an identifier in tcontrollertype
-Add a related name in controllertypestr
-Add a unit name string in controllerunitstr

-Create a unit in rtl/embedded/arm/ with startup code like the other files

-Create a linkerscript in compiler/systems/t_embed.pas which matches the memory map of the target device

Geoffrey Barton wrote 17 lines
Two related questions (FPC 2.5.1):- 1 In the rtl/embedded/arm directory are three target processor files. The one for stm32f103 does not get compiled into the units/arm-embedded/rtl directory. I added it to the CPU_UNITS line in the makefile.fpc in the embedded directory before building ppcrossarm, but this does not fix it. 2 Which files have to be edited to add a new ARM chip variant? I can see the types in cpuinfo.pas and t_embed.pas, and the register definitions+startup code as above, but it is not clear to me where to set the correct instruction set, eg. cortexm3 rather than armv4. Geoffrey _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email