Compile for WinCE 7, target ARM, CPU Cortex-A9

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile for WinCE 7, target ARM, CPU Cortex-A9

LacaK
Hi,

Is there needed something special to setup when I want compile for my
Symbol MC9200 device, which has Windows Embedded Compact 7 and Dual core
1GHz OMAP 4 processor (ARM Cortex-A9).

When I set up simplest project with only few lines of code and compile
for OS="WinCE", CPU family="arm" and I run this application I get Access
Violation on target device. I have tested with target CPU = (default),
ARMv3, ARMv4 but other CPUs like ARMv5,... does not compile ("Error
while assembling exitcode 1").

Is ARM Cortex-A9 supported in Free Pascal compiler and does "Access
violation" can be caused by wrong cross compiler setup?
What to do to get working solution?

Thanks in advance

-Laco.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

LacaK

> Hi,
>
> Is there needed something special to setup when I want compile for my
> Symbol MC9200 device, which has Windows Embedded Compact 7 and Dual
> core 1GHz OMAP 4 processor (ARM Cortex-A9).
>
> When I set up simplest project with only few lines of code and compile
> for OS="WinCE", CPU family="arm" and I run this application I get
> Access Violation on target device. I have tested with target CPU =
> (default), ARMv3, ARMv4 but other CPUs like ARMv5,... does not compile
> ("Error while assembling exitcode 1").
>
> Is ARM Cortex-A9 supported in Free Pascal compiler and does "Access
> violation" can be caused by wrong cross compiler setup?
> What to do to get working solution?
>
Answering my own question:

When I build cross compiler using FpcUpDeluxe, where I set "Cross Build
Options Override" to "-Cparmv7A" (The Cortex -A9 cores implement the
ARMv7-A architecture) then I can sucessfully compile my application for
WinCE 7.

Drawback is that I must now maintain 2 FPC installations/cross-compilers
(Win32-WinCE): one for targer WinCE 5,6 with CPUs ARMv5 and another for
WinCE 7 with ARMv7 CPU (It is not sufficient to setup build modes in
project ... also all units must be pre-compiled ... at least I do not
know how to bypass this limitation)

-Laco.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

Christo Crause
On Thu, Apr 4, 2019 at 1:13 PM LacaK <[hidden email]> wrote:
Answering my own question:

When I build cross compiler using FpcUpDeluxe, where I set "Cross Build
Options Override" to "-Cparmv7A" (The Cortex -A9 cores implement the
ARMv7-A architecture) then I can sucessfully compile my application for
WinCE 7.

Drawback is that I must now maintain 2 FPC installations/cross-compilers
(Win32-WinCE): one for targer WinCE 5,6 with CPUs ARMv5 and another for
WinCE 7 with ARMv7 CPU (It is not sufficient to setup build modes in
project ... also all units must be pre-compiled ... at least I do not
know how to bypass this limitation)

-Laco.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

I suspect your problem is related to this feature request: https://bugs.freepascal.org/view.php?id=30294

Note that you probably don't need two different cross compilers if your cpu-OS target is the same, only two different versions of the RTL (and perhaps packages) in a way that enables the compiler to pick the correct version.  For avr-embedded I change the unit output folder name to avr-embedded-SUBARCH and add the subarch macro to fpc.cfg.  For arm you may also need to handle different ABI versions (I don't cross compile for arm).

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

LacaK

Drawback is that I must now maintain 2 FPC installations/cross-compilers
(Win32-WinCE): one for targer WinCE 5,6 with CPUs ARMv5 and another for
WinCE 7 with ARMv7 CPU (It is not sufficient to setup build modes in
project ... also all units must be pre-compiled ... at least I do not
know how to bypass this limitation)

I suspect your problem is related to this feature request: https://bugs.freepascal.org/view.php?id=30294

Yes seems so ...


Note that you probably don't need two different cross compilers if your cpu-OS target is the same

Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ...

So I do not know if this requires two pre-compiled cross-compilers or not?


, only two different versions of the RTL (and perhaps packages) in a way that enables the compiler to pick the correct version.  For avr-embedded I change the unit output folder name to avr-embedded-SUBARCH and add the subarch macro to fpc.cfg.  For arm you may also need to handle different ABI versions (I don't cross compile for arm).

I can set in Project Options "Unit Output Directory", but how to set where RTL/packages are located ...

Perphas recompilation RTL/packages for given target processor from sources is okay for me, but is it doable in one Lazarus with one cross compiler?

-Laco.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

Free Pascal - General mailing list
LacaK <[hidden email]> schrieb am Fr., 5. Apr. 2019, 13:18:


Note that you probably don't need two different cross compilers if your cpu-OS target is the same

Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ...

So I do not know if this requires two pre-compiled cross-compilers or not?

You only need different compilers if you have different ABIs (e.g. Soft Float vs. Hard Float). For WinCE that isn't applicable however. 

Regards, 
Sven 


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

LacaK



Note that you probably don't need two different cross compilers if your cpu-OS target is the same

Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ...

So I do not know if this requires two pre-compiled cross-compilers or not?

You only need different compilers if you have different ABIs (e.g. Soft Float vs. Hard Float). For WinCE that isn't applicable however. 

So it does not matter how I build cross-compiler using FpcUpDeluxe: wheter I use "-Cparmv5" or "-Cparmv7A" ?

Then there is still problem with precompiled RTL/packages?

Because when I only change "Target processor" (in Lazarus build using FpcUpDeluxe) I can compile application, but I can not run it on target system (so I guess, that resulting EXE is not compiled for target processor).

When I add to Custom options: -CfVFPV2 then I get error while compiling: Fatal: Can't find unit system used by Test1

When I download and install default Lazarus and cross-compiler then when I change "Target processor" to "ARMv5" or "ARMv7A" I get: "project1.lpr(22,0) Error: Error while assembling exitcode 1"

-Laco.



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

Free Pascal - General mailing list
LacaK <[hidden email]> schrieb am Fr., 5. Apr. 2019, 14:56:



Note that you probably don't need two different cross compilers if your cpu-OS target is the same

Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ...

So I do not know if this requires two pre-compiled cross-compilers or not?

You only need different compilers if you have different ABIs (e.g. Soft Float vs. Hard Float). For WinCE that isn't applicable however. 

So it does not matter how I build cross-compiler using FpcUpDeluxe: wheter I use "-Cparmv5" or "-Cparmv7A" ?


Correct. 

Then there is still problem with precompiled RTL/packages?

Because when I only change "Target processor" (in Lazarus build using FpcUpDeluxe) I can compile application, but I can not run it on target system (so I guess, that resulting EXE is not compiled for target processor).

When I add to Custom options: -CfVFPV2 then I get error while compiling: Fatal: Can't find unit system used by Test1

When I download and install default Lazarus and cross-compiler then when I change "Target processor" to "ARMv5" or "ARMv7A" I get: "project1.lpr(22,0) Error: Error while assembling exitcode 1"


As said by Christo you need to select the correct set of compiled units. Also you need to select the correct processor type when building your application. 

Regards, 
Sven 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

LacaK






Note that you probably don't need two different cross compilers if your cpu-OS target is the same

Target CPU family is same: "arm", but Target processor is not the same: "ARMv4" versus "ARMv7" ...

So I do not know if this requires two pre-compiled cross-compilers or not?

You only need different compilers if you have different ABIs (e.g. Soft Float vs. Hard Float). For WinCE that isn't applicable however. 

So it does not matter how I build cross-compiler using FpcUpDeluxe: wheter I use "-Cparmv5" or "-Cparmv7A" ?


Correct. 

Then there is still problem with precompiled RTL/packages?

Because when I only change "Target processor" (in Lazarus build using FpcUpDeluxe) I can compile application, but I can not run it on target system (so I guess, that resulting EXE is not compiled for target processor).

When I add to Custom options: -CfVFPV2 then I get error while compiling: Fatal: Can't find unit system used by Test1

When I download and install default Lazarus and cross-compiler then when I change "Target processor" to "ARMv5" or "ARMv7A" I get: "project1.lpr(22,0) Error: Error while assembling exitcode 1"


As said by Christo you need to select the correct set of compiled units. Also you need to select the correct processor type when building your application. 

I did this test:

1. I have precompiled units for "-Cparmv5" and "-Cparmv7A"and I have saved these precompiled units
2. Then I copy "v5" units to expected directory (of FpcUpDeluxe structure) fpc\units\arm-wince
3. Then I run Lazarus and try build for Target processor ARMv5 and run on target system ... works

4. Then I have copied "v7" units over prior "v5" units
5. I repeated step 3 ... works on target system with ARMv7 processor

Until now only question is :
Can I set somewhere (in Project Options), in inteligent way, where compiler will look for precompiled units ... to be able in one project switch between Build modes, where each build mode will look in other directory ?

But when I try set also "-CfFPV2" (in Project Options / Custom Options ) then I get:

Fatal: Cannot find system used by fcllaz. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=D:\TEMP\fpcupdeluxe\fpc\units\arm-wince\rtl\system.ppu..

I can resolve this error (beside using precompiled units with same flag set) by adding "-CfFPV2" also in fpc.cfg after:
#IFDEF FPC_CROSSCOMPILING
#IFDEF WINCE
#IFDEF CPUARM

So in this use case it is not sufficient only have two (or third) distinct sets of precompiled units ...

So can these problems be solved somehow using only Project Options without need to modify fpc.cfg ?

Btw. in fpc.cfg I have:
# searchpath for units and other system dependent things
-FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget
-FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget/*
-FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget/rtl

Can this be avoided in fpc.cfg and transfered to Project Options ? (is /* supported in Lazarus, becuase Lazarus complains about non-existent directory)

TIA

-Laco.


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Compile for WinCE 7, target ARM, CPU Cortex-A9

Cyrax
On 9.4.2019 12.45, LacaK wrote:

>
>
>>
>>>
>>>
>>>>         Note that you probably don't need two different cross
>>>>         compilers if your cpu-OS target is the same
>>>
>>>         Target CPU family is same: "arm", but Target processor is not
>>>         the same: "ARMv4" versus "ARMv7" ...
>>>
>>>         So I do not know if this requires two pre-compiled
>>>         cross-compilers or not?
>>>
>>>     You only need different compilers if you have different ABIs
>>>     (e.g. Soft Float vs. Hard Float). For WinCE that isn't applicable
>>>     however.
>>>
>>     So it does not matter how I build cross-compiler using
>>     FpcUpDeluxe: wheter I use "-Cparmv5" or "-Cparmv7A" ?
>>
>>
>> Correct.
>>
>>     Then there is still problem with precompiled RTL/packages?
>>
>>     Because when I only change "Target processor" (in Lazarus build
>>     using FpcUpDeluxe) I can compile application, but I can not run it
>>     on target system (so I guess, that resulting EXE is not compiled
>>     for target processor).
>>
>>     When I add to Custom options: -CfVFPV2 then I get error while
>>     compiling: Fatal: Can't find unit system used by Test1
>>
>>     When I download and install default Lazarus and cross-compiler
>>     then when I change "Target processor" to "ARMv5" or "ARMv7A" I
>>     get: "project1.lpr(22,0) Error: Error while assembling exitcode 1"
>>
>>
>> As said by Christo you need to select the correct set of compiled
>> units. Also you need to select the correct processor type when
>> building your application.
>>
> I did this test:
>
> 1. I have precompiled units for "-Cparmv5" and "-Cparmv7A"and I have
> saved these precompiled units
> 2. Then I copy "v5" units to expected directory (of FpcUpDeluxe
> structure) fpc\units\arm-wince
> 3. Then I run Lazarus and try build for Target processor ARMv5 and run
> on target system ... works
>
> 4. Then I have copied "v7" units over prior "v5" units
> 5. I repeated step 3 ... works on target system with ARMv7 processor
>
> Until now only question is :
> Can I set somewhere (in Project Options), in inteligent way, where
> compiler will look for precompiled units ... to be able in one project
> switch between Build modes, where each build mode will look in other
> directory ?
>
> But when I try set also "-CfFPV2" (in Project Options / Custom Options )
> then I get:
>
> Fatal: Cannot find system used by fcllaz. Make sure all ppu files of a
> package are in its output directory. ppu in wrong
> directory=D:\TEMP\fpcupdeluxe\fpc\units\arm-wince\rtl\system.ppu..
>
> I can resolve this error (beside using precompiled units with same flag
> set) by adding "-CfFPV2" also in fpc.cfg after:
> #IFDEF FPC_CROSSCOMPILING
> #IFDEF WINCE
> #IFDEF CPUARM
>
> So in this use case it is not sufficient only have two (or third)
> distinct sets of precompiled units ...
>
> So can these problems be solved somehow using only Project Options
> without need to modify fpc.cfg ?
>
> Btw. in fpc.cfg I have:
> # searchpath for units and other system dependent things
> -FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget
> -FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget/*
> -FuD:\TEMP\fpcupdeluxe\fpc/units/$fpctarget/rtl
>
> Can this be avoided in fpc.cfg and transfered to Project Options ? (is
> /* supported in Lazarus, becuase Lazarus complains about non-existent
> directory)
>
> TIA
>
> -Laco.
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

You can use IDE macros in path names at Project Options.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal