[fpc-devel] Arm Thumb2 - Stellaris status

John Clymer john at johnclymer.net
Mon Aug 8 12:49:03 CEST 2011

Kicking it around in the back of my head at work today...

I tried doing a compile to assembly language for the stellaris - and it choked 
giving the error from t_embed.pas.  The error comes from the portion of the 
program trying to generate a linker script.

Looking at t_embed.pas, it looks like every single flavor of ARM controller will 
require it's own subsection of the case() statement.  This can easily get long 
and ugly.  As the only thing that changes between most of the arm variants is 
the memory layout - why not provide a generic "stellaris" switch - with reads in 
a text file containing the memory map and stack top (the rest of the link file 
remains the same for all variants of ARM) ?  

This way - switching to a new variant of stellaris only requires tweaking a 
memory map file - rather than a re-build and patch of t_embed.pas ?  For that 
matter - entirely foreign Cortex M3 parts could be easily supported without 
requiring changes to the compiler.

Just pondering how to make it easier and more flexible ...

From: Geoffrey Barton <mrb at periphon.net>
To: FPC developers' list <fpc-devel at lists.freepascal.org>
Sent: Mon, August 8, 2011 12:17:03 PM
Subject: Re: [fpc-devel] Arm Thumb2 - Stellaris status

On 7 Aug 2011, at 11:14, John Clymer wrote:

Ok.  Give me a week or so (very hectic schedule right now...)  And I will see if 
I can't patch it up some.  

To save you some time perhaps, the following was for lm3s9b92 and 
rtl/embedded/arm/stellaris.pas; I only tested with that device:-

1in cpuinfo.pas,  tcontrollertype should include,  ct_lm3s9b92 rather than 
2also  'stellaris' in controllerunitstr should be 'lm3s9b92

3in compiler/systems/t_embed.pas add:-

      with linkres do
          Add('    flash : ORIGIN = 0x00000000, LENGTH = 256K');
          Add('    ram : ORIGIN = 0x20000000, LENGTH = 96K');
          Add('_stack_top = 0x20017FFC;');

I also found I needed to comment out the controller types other than stellaris 
in rtl/embedded/makefile.fpc.

Then remake make,and make the compiler.

New to this - what is procedure to generate and submit patch set ?

but Florian did offer to integrate any updates himself :)


>Thanks !
From: Florian Klämpfl <florian at freepascal.org>
>To: FPC developers' list <fpc-devel at lists.freepascal.org>
>Sent: Sun, August 7, 2011 12:15:02 AM
>Subject: Re: [fpc-devel] Arm Thumb2 - Stellaris status
>Am 06.08.2011 13:35, schrieb John Clymer:
>> Ok, maybe I'm missing something...
>> I can compile and get a binary for an STM32F103RE.  However, if I
>> attempt for the STELLARIS target, I get an error.  I see where the error
>> is coming from in t_embed.pas.  It looks like the t_embed.pas file is
>> missing linking information for the Stellaris.  
>Yes. arm embedded devices are only supported as far as somebody
>contributed the compiler and rtl support. Problem is: we don't have any
>chance to test it, so only users of these devices can contribute the
>> Can someone confirm this
>> is the case before I go on a wild chase changing things ?
>fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>fpc-devel maillist  -  fpc-devel at lists.freepascal.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110808/2e490d4c/attachment.html>

More information about the fpc-devel mailing list