[fpc-pascal] ARM-Cortex port
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 - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ARM-Cortex port
On 23 Aug 2010, at 16:09, Andreas Berger wrote: 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 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ARM-Cortex port
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 - fpc-pascal@lists.freepascal.org 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 - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ARM-Cortex port
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) On 23/8/2010 11:21 AM, Jeppe Johansen wrote: 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 - fpc-pascal@lists.freepascal.org 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 - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] How to set a type as a variable?
I did this kind of thing some time ago, but have forgotten the details. Let us say you have something like TBaseType(Variable).Method, you want to let TBaseType be a variable so you can have some code like this. procedure (value:someType) var variableType: TClass; //not quite sure here variableType := TypeOf(value); then further on you execute something like variableType(Variable).Method, rather than TBaseType(Variable).Method because you can't hard code TBaseType because can't tell what it will be at runtime. I remember doing something like that with Delphi of old, probably Delphi 3 or Delphi 7 Can someone help me with this, with some use cases as well? Thanks -- Frank Church === http://devblog.brahmancreations.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
Like so: procedure Test; var SomeType: TClass; SomeObject: TObject; begin SomeType := TStringList; SomeObject := SomeType.Create; (SomeObject as TStrings).Add('Hello World'); ShowMessage((SomeObject as TStrings)[0]); SomeObject.Free; end; On Mon, Aug 23, 2010 at 7:05 PM, Frank Church wrote: > > I did this kind of thing some time ago, but have forgotten the details. > > Let us say you have something like TBaseType(Variable).Method, you want to > let TBaseType be a variable so you can have some code like this. > > procedure (value:someType) > var > variableType: TClass; //not quite sure here > variableType := TypeOf(value); > > then further on you execute something like > > variableType(Variable).Method, rather than TBaseType(Variable).Method > because you can't hard code TBaseType because can't tell what it will be at > runtime. I remember doing something like that with Delphi of old, probably > Delphi 3 or Delphi 7 > > Can someone help me with this, with some use cases as well? > > Thanks > > -- > Frank Church > > === > http://devblog.brahmancreations.com > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] make smart doesn't work for cross build
I see no -CX / -XX appeared in the command line. Florian Klämpfl wrote: > >> So, I try removing smart target. It works! But the binaries aren't >> smartlinked... > > What makes you think so? > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- View this message in context: http://old.nabble.com/make-smart-doesn%27t-work-for-cross-build-tp29497353p29518804.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
It can be implemented with RTTI or variants perhaps. Anthony Walter-3 wrote: > > Like so: > > procedure Test; > var > SomeType: TClass; > SomeObject: TObject; > begin > SomeType := TStringList; > SomeObject := SomeType.Create; > (SomeObject as TStrings).Add('Hello World'); > ShowMessage((SomeObject as TStrings)[0]); > SomeObject.Free; > end; > > On Mon, Aug 23, 2010 at 7:05 PM, Frank Church wrote: > >> >> I did this kind of thing some time ago, but have forgotten the details. >> >> Let us say you have something like TBaseType(Variable).Method, you want >> to >> let TBaseType be a variable so you can have some code like this. >> >> procedure (value:someType) >> var >> variableType: TClass; //not quite sure here >> variableType := TypeOf(value); >> >> then further on you execute something like >> >> variableType(Variable).Method, rather than TBaseType(Variable).Method >> because you can't hard code TBaseType because can't tell what it will be >> at >> runtime. I remember doing something like that with Delphi of old, >> probably >> Delphi 3 or Delphi 7 >> >> Can someone help me with this, with some use cases as well? >> >> Thanks >> >> -- >> Frank Church >> >> === >> http://devblog.brahmancreations.com >> >> ___ >> fpc-pascal maillist - fpc-pascal@lists.freepascal.org >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- View this message in context: http://old.nabble.com/How-to-set-a-type-as-a-variable--tp29517255p29518818.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
Anthony Walter-3 wrote: > > Like so: > > procedure Test; > var > SomeType: TClass; > SomeObject: TObject; > begin > SomeType := TStringList; > SomeObject := SomeType.Create; > (SomeObject as TStrings).Add('Hello World'); > ShowMessage((SomeObject as TStrings)[0]); > SomeObject.Free; > end; > > On Mon, Aug 23, 2010 at 7:05 PM, Frank Church wrote: > >> >> I did this kind of thing some time ago, but have forgotten the details. >> >> Let us say you have something like TBaseType(Variable).Method, you want >> to >> let TBaseType be a variable so you can have some code like this. >> >> procedure (value:someType) >> var >> variableType: TClass; //not quite sure here >> variableType := TypeOf(value); >> >> then further on you execute something like >> >> variableType(Variable).Method, rather than TBaseType(Variable).Method >> because you can't hard code TBaseType because can't tell what it will be >> at >> runtime. I remember doing something like that with Delphi of old, >> probably >> Delphi 3 or Delphi 7 >> >> Can someone help me with this, with some use cases as well? >> >> Thanks >> >> -- >> Frank Church >> >> === >> http://devblog.brahmancreations.com >> >> ___ >> fpc-pascal maillist - fpc-pascal@lists.freepascal.org >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- View this message in context: http://old.nabble.com/How-to-set-a-type-as-a-variable--tp29517255p29518821.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
No, if all your types are classes descending from the same root you can do it is like this: type TBaseType = class; procedure somemethod(); end; TExtendedType = class(TBaseType); TBaseTypeClass = class of TBaseType; procedure (value: TBaseType; type_: TBaseTypeClass) begin value := type_.Create(); value.somemethod(); end; And you can call your procedure as: proc(somevar, TExtendedType); For other types you need to use generics. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] make smart doesn't work for cross build
On 21 Aug 2010, at 08:59, leledumbo wrote: > I want to build a smartlinked (stripped and optimized as well) version of fpc > for win64 from win32, so I call: > make all smart STRIP=1 OPTIMIZE=1 OS_TARGET=win64 CPU_TARGET=x86_64 > > but this ends in failing to call ppcx64. Hey, shouldn't it call ppcrossx64? I don't think that calling "make smart" in the top level directory is supported at all. "make all" will automatically build all units in a smartlinkable way on platforms where this is supported. Smartlinking the compiler and the utilities is never done (which saved at least saved one FPC release until now from being partially broken due to bugs in the smartlinking support). Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] make smart doesn't work for cross build
Oh, is that so? What about defining CREATE_SMART and LINK_SMART? Jonas Maebe-2 wrote: > > > On 21 Aug 2010, at 08:59, leledumbo wrote: > >> I want to build a smartlinked (stripped and optimized as well) version of >> fpc >> for win64 from win32, so I call: >> make all smart STRIP=1 OPTIMIZE=1 OS_TARGET=win64 CPU_TARGET=x86_64 >> >> but this ends in failing to call ppcx64. Hey, shouldn't it call >> ppcrossx64? > > I don't think that calling "make smart" in the top level directory is > supported at all. "make all" will automatically build all units in a > smartlinkable way on platforms where this is supported. Smartlinking the > compiler and the utilities is never done (which saved at least saved one > FPC release until now from being partially broken due to bugs in the > smartlinking support). > > > Jonas___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- View this message in context: http://old.nabble.com/make-smart-doesn%27t-work-for-cross-build-tp29497353p29518959.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
In our previous episode, Frank Church said: > I did this kind of thing some time ago, but have forgotten the details. > > Let us say you have something like TBaseType(Variable).Method, you want to > let TBaseType be a variable so you can have some code like this. > > procedure (value:someType) > var > variableType: TClass; //not quite sure here > variableType := TypeOf(value); > > then further on you execute something like > > variableType(Variable).Method, rather than TBaseType(Variable).Method > because you can't hard code TBaseType because can't tell what it will be at > runtime. I remember doing something like that with Delphi of old, probably > Delphi 3 or Delphi 7 > > Can someone help me with this, with some use cases as well? There is typeinfo in Delphi/fpc, but that is for RTTI, and quite different The above is a bit strange in Pascals with unit system, since it potentially creates a var of a type that might not be in the scope. So I think it is not even possible to implement this in a straight way. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal