Sign in Join

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

Mailing lists / fpc-pascal / 2010-08

ARM-Cortex port

10 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

Andreas Berger

I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM? One of our major applications is written in C++ simply because it is to run in the future on an embedded system as well as the PC. Well the embedded processor has been chosen - the Luminary (TI) ARM-Cortex processor.

Will FPC run on this processor? Does anyone have experience? If FPC runs I may be able to convert my last C++ app to pascal.

Thanks,
Andreas

Jonas Maebe
to Andreas Berger
Andreas Berger wrote 5 lines
I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM? One of our major applications is written in C+ + simply because it is to run in the future on an embedded system as well as the PC. Well the embedded processor has been chosen - the Luminary (TI) ARM-Cortex processor.

"Cortex" is a whole family of ARM CPUs. FPC full supports the ARM Cortex "A" family of processor (A8, A9). The Luminary cpu is a Cortex- M3. These only support Thumb and Thumb-2. There is support for Thumb-2 (and in particular the Cortex-M3) in FPC trunk, but I don't know how well-tested or maintained it is (the support was added via third party patches).

Jonas

Jeppe Johansen
to Andreas Berger: I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM?…
Andreas Berger wrote 15 lines
I know that FPC works under ARM+Linux. Is this also true for the Cortex version of ARM? One of our major applications is written in C++ simply because it is to run in the future on an embedded system as well as the PC. Well the embedded processor has been chosen - the Luminary (TI) ARM-Cortex processor. Will FPC run on this processor? Does anyone have experience? If FPC runs I may be able to convert my last C++ app to pascal. Thanks, Andreas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

From my findings Luminary is Cortex-M3 based, in which case there's needed a base code RTL for it. FPC will generate code for it, and it should generally work, but it's not very optimized yet(other than generic optimization), and there are many unsupported inline assembler instructions(primarily special system instructions). But there are ofcourse workarounds for the assembler code

Currently there's only half working stub code for the STM32F103 Cortex-M3 based chip, but I'll gladly help if you have any questions

Regards,
Jeppe

Andreas Berger
to Jeppe Johansen

Thanks Jonas and Jeppe for your answers. I will probably wait then to switch (or try to convince the company to use an ARM-9)

Jeppe Johansen wrote 32 lines
Den 23-08-2010 16:09, Andreas Berger skrev: > I know that FPC works under ARM+Linux. Is this also true for the > Cortex version of ARM? One of our major applications is written in > C++ simply because it is to run in the future on an embedded system > as well as the PC. Well the embedded processor has been chosen - the > Luminary (TI) ARM-Cortex processor. > > Will FPC run on this processor? Does anyone have experience? If FPC > runs I may be able to convert my last C++ app to pascal. > > Thanks, > Andreas > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal From my findings Luminary is Cortex-M3 based, in which case there's needed a base code RTL for it. FPC will generate code for it, and it should generally work, but it's not very optimized yet(other than generic optimization), and there are many unsupported inline assembler instructions(primarily special system instructions). But there are ofcourse workarounds for the assembler code Currently there's only half working stub code for the STM32F103 Cortex-M3 based chip, but I'll gladly help if you have any questions Regards, Jeppe _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Geoffrey Barton
Show quoted text 10 lines
Date: Mon, 23 Aug 2010 13:57:30 -0300 From: Andreas Berger Subject: Re: [fpc-pascal] ARM-Cortex port To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Thanks Jonas and Jeppe for your answers. I will probably wait then to switch (or try to convince the company to use an ARM-9)

using Jonas and Jeppe's answers to my idiot questions in this forum, and Jeppe's startup code for the STM32F, I have FPC cross-compiling for the LM3S9B92, one of the TI Luminary processors. Getting interrupts working took some time. I think the next thing for me is to try calling the rom code from FPC. Then it should be possible to re- use all the library of C code supplied by TI and it will no longer be necessary to try and fathom lines such as:-

*((void (*)(void))(*(unsigned long *)0x2c)))();

which occurs in the USB example code :-)
I am not quite sure how to write that in FP, but I am sure someone will have an idea.

Geoffrey

Thomas Schatzl
to Geoffrey Barton

Hi,

Geoffrey Barton wrote 18 lines
> > Date: Mon, 23 Aug 2010 13:57:30 -0300 > Thanks Jonas and Jeppe for your answers. I will probably wait then to > switch (or try to convince the company to use an ARM-9) using Jonas and Jeppe's answers to my idiot questions in this forum, and Jeppe's startup code for the STM32F, I have FPC cross-compiling for the LM3S9B92, one of the TI Luminary processors. Getting interrupts working took some time. I think the next thing for me is to try calling the rom code from FPC. Then it should be possible to re- use all the library of C code supplied by TI and it will no longer be necessary to try and fathom lines such as:- *((void (*)(void))(*(unsigned long *)0x2c)))(); which occurs in the USB example code :-) I am not quite sure how to write that in FP, but I am sure someone will have an idea.

Something like this should work for that case:

type
  TMyProcedure = procedure;
// if the procedures/functions you want to invoke have parameters
// use something like this:
//
// TMyFunction = function(arg1 : type1; arg2 : type2) : result_type;
var
  x : TMyProcedure;
begin
  x := TMyProcedure(0x2c);
  x;  // to invoke it. Or "x()" if you prefer that
end.

Hth,
Thomas

Geoffrey Barton
Florian Klaempfl wrote 12 lines
Am 24.08.2010 11:53, schrieb Geoffrey Barton: > > using Jonas and Jeppe's answers to my idiot questions in this > forum, and > Jeppe's startup code for the STM32F, I have FPC cross-compiling for > the > LM3S9B92, one of the TI Luminary processors. If you've any reusable startup code, we would be happy to include it in official fpc.

certainly! where do you want it?

Geoffrey

Florian Klämpfl
to Geoffrey Barton
Geoffrey Barton wrote 14 lines
On 24 Aug 2010, at 21:52, Florian Klaempfl wrote: > > Am 24.08.2010 11:53, schrieb Geoffrey Barton: >> >> using Jonas and Jeppe's answers to my idiot questions in this forum, and >> Jeppe's startup code for the STM32F, I have FPC cross-compiling for the >> LM3S9B92, one of the TI Luminary processors. > > If you've any reusable startup code, we would be happy to include it in > official fpc. certainly! where do you want it?

Just email it to me or create a bug report and attach it.

Jeppe Johansen
to Geoffrey Barton: certainly! where do you want it? Geoffrey
Geoffrey Barton wrote 20 lines
On 24 Aug 2010, at 21:52, Florian Klaempfl wrote: > > Am 24.08.2010 11:53, schrieb Geoffrey Barton: >> >> using Jonas and Jeppe's answers to my idiot questions in this forum, >> and >> Jeppe's startup code for the STM32F, I have FPC cross-compiling for the >> LM3S9B92, one of the TI Luminary processors. > > If you've any reusable startup code, we would be happy to include it in > official fpc. certainly! where do you want it? Geoffrey _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Supplying a patch on the bug tracker would probably be the best way