Recent

Author Topic: ARM32 & ARM64 targets  (Read 804 times)

440bx

  • Hero Member
  • *****
  • Posts: 1875
ARM32 & ARM64 targets
« on: March 28, 2020, 04:15:33 pm »
Hello,

I would like to use FPC to generate ARM32 and ARM64 executables.  These would be for testing a PE viewer. 

Is there a way to have the Windows FPC (v3.0.4) generate such executables ?

If the answer is "yes", I'd like to know what settings I should use in "Target Platform" since everything I've tried so far has not provided any joy.

Thank you.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 2917
Re: ARM32 & ARM64 targets
« Reply #1 on: March 28, 2020, 04:48:15 pm »
You'll need cross-binutils, rebuild the RTL, ... in fact, do everything needed to cross-compile to the new targets.

I guess you already know so I won't insult you by telling where to find the needed info :)

If you manage to do it, please tell us how. I personally would appreciate it a lot, since we are studying the posibility of moving some of our soft to a kind of "Windows-on-ARM" devices.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 1875
Re: ARM32 & ARM64 targets
« Reply #2 on: March 28, 2020, 05:27:37 pm »
Thank you Lucamar.

I've been looking around for information.  I found this Wiki page that was somewhat helpful https://wiki.freepascal.org/arm-wince

From that Wiki page:
Quote
The easy way: download the cross compiler

The easiest way to start development for WinCE is to download the latest release version of FPC for Win32 and arm-wince cross compiler for Win32.

Download them here: http://www.freepascal.org/download.var

First install FPC for Win32, then install arm-wince cross compiler as add-on package.
[/size=10pt]
I figured I'd try the easy way but the link to the arm-wince cross compiler goes to "cross-not-found".

Knowing there is an "easy way" available is a disincentive to try the hard way. ;)


I also tried with Visual Studio 2017, which supposedly can create ARM32/64 executables but MS mucked around with that and now, the "tricks" needed to have it create such executables have not provided any joy in that environment either.

I know PascalDragon can make that thing produce ARM executables.  Maybe he can point me in the right direction with either FPC or VS.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

mr-highball

  • Full Member
  • ***
  • Posts: 174
    • Highball Github
Re: ARM32 & ARM64 targets
« Reply #3 on: March 28, 2020, 07:36:52 pm »
Sorry, not at my pc to verify but can't fpcupdeluxe get these targets setup for you?
I see wince arm at the bottom of the windows toolchain list here -> https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/wincrossbins_v1.0

tetrastes

  • Jr. Member
  • **
  • Posts: 58
Re: ARM32 & ARM64 targets
« Reply #4 on: March 28, 2020, 08:55:11 pm »
Why not use Lazarus instead of pure FPC?
In official Lazarus distribution for win32:

Add-On for WinCE development:
lazarus-2.0.6-fpc-3.0.4-cross-arm-wince-win32.exe
This file can be installed as add-on to the 32 bit Lazarus IDE, if you wish to develop for WinCE.

lucamar

  • Hero Member
  • *****
  • Posts: 2917
Re: ARM32 & ARM64 targets
« Reply #5 on: March 28, 2020, 09:27:19 pm »
I figured I'd try the easy way but the link to the arm-wince cross compiler goes to "cross-not-found"

Hmmm ... the download pages seem to be acting "funny"; fortunately I have got both the fpc-3.0.4.i386-win32.cross.arm-wince.exe file(1) and, more important, the link to the file at freepascal.org ftp server.

That should do the trick, I think, though IIRC you have to have a "normal" Win32 fpc installed first.


(1) Just so you know that I can pass it to you if you can't find it elsewhere.
« Last Edit: March 28, 2020, 09:29:20 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 1875
Re: ARM32 & ARM64 targets
« Reply #6 on: March 28, 2020, 10:06:43 pm »
Sorry, not at my pc to verify but can't fpcupdeluxe get these targets setup for you?
I see wince arm at the bottom of the windows toolchain list here -> https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/wincrossbins_v1.0
Thank you.  I hadn't thought about fpcupdeluxe but, I followed your suggestion and got an installation that can produce ARM executables.   Now, I finally have an ARM PE file to test with.



Why not use Lazarus instead of pure FPC?
Because as far as Lazarus is concerned, I am an ignorant.  I use it as a front end to GDB and FPC.  That's it and, it took me a good while to have it set up the way I like.  Now, whenever I want to try something different, I do it in a different installation in another VM.  Safe!.

In official Lazarus distribution for win32:

Add-On for WinCE development:
lazarus-2.0.6-fpc-3.0.4-cross-arm-wince-win32.exe
This file can be installed as add-on to the 32 bit Lazarus IDE, if you wish to develop for WinCE.
How is that add-on installed ?



...fortunately I have got both the fpc-3.0.4.i386-win32.cross.arm-wince.exe file(1) and, more important, the link to the file at freepascal.org ftp server.

That should do the trick, I think, though IIRC you have to have a "normal" Win32 fpc installed first.

(1) Just so you know that I can pass it to you if you can't find it elsewhere.
Thank you Lucamar, I appreciate that.  It _looks_ like I might have an installation that can produce ARM PEs.  I'm going to play with that to figure out what else, if anything, I need.


Thank you everyone.  I appreciate all the help.

FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 2917
Re: ARM32 & ARM64 targets
« Reply #7 on: March 28, 2020, 10:40:38 pm »
In official Lazarus distribution for win32:

Add-On for WinCE development:
lazarus-2.0.6-fpc-3.0.4-cross-arm-wince-win32.exe
This file can be installed as add-on to the 32 bit Lazarus IDE, if you wish to develop for WinCE.
How is that add-on installed ?

As all the other add-ons (e.g. the Win64 cross-compiler): you just run the EXE and let it install the cross-compiler (+binutils+RTL+config ...) in the same folder as your normally installed Lazarus-Win32.

After it's installed Lazarus should let you configure (and use) the corresponding OS, processor family, etc. targets.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 1875
Re: ARM32 & ARM64 targets
« Reply #8 on: March 28, 2020, 11:22:00 pm »
As all the other add-ons (e.g. the Win64 cross-compiler): you just run the EXE and let it install the cross-compiler (+binutils+RTL+config ...) in the same folder as your normally installed Lazarus-Win32.

After it's installed Lazarus should let you configure (and use) the corresponding OS, processor family, etc. targets.
Thank you Lucamar.  I found the .exe

For now, I'll use the other installation fpcupdeluxe created.  I'm not adventurous when it comes to adding stuff to my development environment. <chuckle>
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

mr-highball

  • Full Member
  • ***
  • Posts: 174
    • Highball Github
Re: ARM32 & ARM64 targets
« Reply #9 on: March 28, 2020, 11:32:33 pm »
Nice, glad it helped

lucamar

  • Hero Member
  • *****
  • Posts: 2917
Re: ARM32 & ARM64 targets
« Reply #10 on: March 29, 2020, 10:54:14 am »
I'm not adventurous when it comes to adding stuff to my development environment. <chuckle>

Yeah, me neither :D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.8/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

PascalDragon

  • Hero Member
  • *****
  • Posts: 1692
  • Compiler Developer
Re: ARM32 & ARM64 targets
« Reply #11 on: March 29, 2020, 01:13:03 pm »
I also tried with Visual Studio 2017, which supposedly can create ARM32/64 executables but MS mucked around with that and now, the "tricks" needed to have it create such executables have not provided any joy in that environment either.

I know PascalDragon can make that thing produce ARM executables.  Maybe he can point me in the right direction with either FPC or VS.

FPC currently only supports PE executables for ARM, but not Aarch64.

When installing Visual Studio (or updating/changing it using the Visual Studio Installer) make sure that the toolsets for ARM and ARM64 are selected in the “Single Components” tab (named “Visual Studio C++ compiler and libraries for ARM” or “... ARM64” respectively).
Now create a project (e.g. “Command line application C++”), then you go to the configuration settings in the top bar, the combobox which contains by default “x86”, “x64” and “Configuration manager”. Select the later. A dialog should pop up. At the top right there is a combobox title “active solution platform” (or so, I have a German VS :-[ ). Select the entry “New”. Then select “ARM” go to okay (with the “add project platform” checkbox selected) and then again “ARM64” and okay again.
You should be able to create applications for both ARM and ARM64 now.

440bx

  • Hero Member
  • *****
  • Posts: 1875
Re: ARM32 & ARM64 targets
« Reply #12 on: March 29, 2020, 01:31:18 pm »
You should be able to create applications for both ARM and ARM64 now.
Thank you.  With the explanation you provided above, I'm sure I can get VS2017 to produce ARM64 executables.  That said, since it isn't something I would personally use and my installation of V2017 is already in the many tens of gigabytes, if you can provide a couple of Aarch64 executables, that would make my life simpler. :)
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

 

TinyPortal © 2005-2018