[fpc-pascal] Free Pascal Support for ARM Architecture

Bernd Mueller mueller.b at gmx.net
Tue Dec 9 19:18:01 CET 2008

Marc Santhoff wrote:
> Am Dienstag, den 09.12.2008, 09:53 +0100 schrieb Marco van de Voort:
>> In our previous episode, Marc Santhoff said:
>>>> some small THUMB things, but FPC doesn't generate THUMB code).
>>> One possible difference coming to my mind (although only a speed issue,
>>> not influencing nonetheless working code):
>>> There are some ARM7 (and maybe ARM9, not sure) core variants having no
>>> hardware multiplication unit. IIRC the M in TDMI stands for "hardware
>>> multiplier unit". Experiences with gcc showed me that the 32x32=64 mult
>>> commands are not used in that case.
>> Wikipedia also calls ARM7 ARMV3 arch, and only ARM7TDMI ARMV4. This could be
>> the reason why. (and maybe the D and the I)
>>> It would be nice to have the chance of setting some extra command line
>>> arguments to the call to the assembler - I think that is what Riley is
>>> is asking for.
>> The trick is that if you give FPC that info, it can check both code
>> generated and the assembler reader, and do the same AND provide a valid
>> source line. IOW, I don't see a good reason to do this in the backend
>> assembler, if it can be better done in the frontend.
> Since I've been enlighted that I'm mistakenly ignored the fact that fpc
> does the code generation and since ARM v4 is only mentioned on ARMs web
> site as an ancient architecture mostly faded away I'm strongly with you:


The oldest version of the processor architecture supported today. All 
previous versions are now obsolete. Implementations include some members 
of the ARM7™ processor family and Intel StrongARM® processors. ARMv4 can 
be considered a 32-bit ISA operating in a 32-bit address space."

Maybe, the fancy pictures on the ARM website concerning the ARM 
architectures could lead to the assumption, that ARMv4 is mostly faded 
away ;-) But this is not correct. A lot of ARM7 embedded controllers are 
ARMv4 devices, including ATMEL AT91SAM7x, NXP LPC2x and STM STR7x. FPC 
targets them perfectly. BTW the Openmoko Neo 1973 and Neo FreeRunner use 
a Samsung S3C2442 (ARM9) which is ARMv4 too.

> The compiler(s code generator) should take care of target cpu variants
> and architectures.

I think, this would be a lot of work. Which architecture should be 
implemented first? ARMv5 or better the latest ARMv7 (CORTEX) variants. 
But what about the Thumb/Thumb-2 instruction set? Also very interesting.

 From my point of view the current situation with FPC/ARM is pretty 
good. And if someone really needs architecture specific implementations, 
he could try to add these features to the compiler.

Regards, Bernd.

More information about the fpc-pascal mailing list