[fpc-devel] arm embedded

Jeppe Johansen jepjoh2 at kom.aau.dk
Mon Apr 19 15:06:23 CEST 2010


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 skrev:
> 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  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list