* * *

Author Topic: Small virtual machine to cross compile FPC  (Read 15297 times)

lagprogramming

  • Full Member
  • ***
  • Posts: 159
Re: Small virtual machine to cross compile FPC
« Reply #30 on: July 29, 2015, 09:04:08 pm »
I've tried to help you using a different approach, an alternative to fpcup but I'm stuck:

1. Regarding fpc,
Code: [Select]
make crossall crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~/fpcompiler/ works fine but
Code: [Select]
make crossall crossinstall OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em INSTALL_PREFIX=~/fpcompiler/ returns an error and I'm unable to pinpoint the solution:

Code: [Select]
system.pp(292) Error: Assembler arm-embedded-as not found, switching to external assembling
system.pp(292) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[4]: *** [system.ppu] Error 1
make[4]: Leaving directory `/home/user/fpcompiler/rtl/embedded'
make[3]: *** [embedded_all] Error 2
make[3]: Leaving directory `/home/user/fpcompiler/rtl'
make[2]: *** [rtl_all] Error 2
make[2]: Leaving directory `/home/user/fpcompiler'
make[1]: *** [build-stamp.arm-embedded] Error 2
make[1]: Leaving directory `/home/user/fpcompiler'
make: *** [crossall] Error 2

2.
For now I don't know a Pascal written IDE that fits your needs:
MSE* doesn't compile with the latest fpc trunk version but you need the trunk.
Lazarus has a strange way to use fpc.cfg file and I wonder if this approach may lead to conflicts when having simultaneous fpc installs.
Fpgui can be built with the latest fpc trunk but the status of an internal IDE is unknown to me. Also I don't know if it's possible to completely build Lazarus using the fpgui LCL widged type.

Laksen

  • Hero Member
  • *****
  • Posts: 590
    • J-Software
Re: Small virtual machine to cross compile FPC
« Reply #31 on: July 29, 2015, 11:29:31 pm »
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC

Paul Breneman

  • Full Member
  • ***
  • Posts: 240
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #32 on: August 06, 2015, 03:35:25 pm »
Yesterday I got the ReactOS virtual machine working much better and the http://wiki.freepascal.org/Small_Virtual_Machines page is updated.  My next goal is to try fpcup on ReactOS!
Regards,
Paul Breneman
www.ControlPascal.com

mse

  • Full Member
  • ***
  • Posts: 216
Re: Small virtual machine to cross compile FPC
« Reply #33 on: August 06, 2015, 05:08:51 pm »
2.
For now I don't know a Pascal written IDE that fits your needs:
MSE* doesn't compile with the latest fpc trunk version but you need the trunk.

A Linux x86 -> ARM cross compiling environment with a patched FPC 2.6.4, binutils, cross GDB and the necessary ARM libraries for MSEgui is here:
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/
MSEide has a project template for cross compiling and remote debugging, tested on RaspberryPi. With MSEide plus the cross development environment it is possible to develop and debug RaspberryPi applications on a Linux x86 PC as if one would work on the Raspi, merely faster. ;-)
The RaspberryPi is connected to the development PC by Ethernet. From README.TXT:
Code: [Select]
Crosscompiling and remote debugging i386-linux -> arm-linux
***********************************************************
For Raspberry Pi:
- Establish a ssh login without password (public key authentication).

- On the i386-linux host download and extract
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/crossfpc-i386_linux-eabihf_1.tar.gz
to <your crossfpc directory>.

- Start MSEide, in 'Settings'-'Configure MSEide'-'Global Macros' add:

Name          Value

CROSSMSEDIR   <MSEide+MSEgui directory>
CROSSFPCDIR   <your crossfpc directory>
HOSTIP        <the IP of the host>
REMOTEIP      <the IP of the remote target>
REMOTEPORT    <the remote port, ex: 2345>
REMOTEUSER    pi

- 'Project'-'New'-'From Template', select "crossarmdefault.prj".
- Create the new project.
- 'Project'-'Options'-'Macros', set the TARGETPROJECTDIR value to the project
  path in remote target, ex: "/home/pi/proj/testcase".
- Check the TARGETENV macro.

Press F9 and hope the best. ;-)
MSEide also runs amazingly fast on RaspberryPi directly. ARM MSEide binary is here:
http://sourceforge.net/projects/mseide-msegui/files/mseide-msegui/3.8/

Paul Breneman

  • Full Member
  • ***
  • Posts: 240
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #34 on: August 06, 2015, 07:48:59 pm »
Thanks mse but lagprogramming and myself are trying to get ARM Embedded (not ARM Linux) to work on small virtual machines.  I have a RPi so what you wrote is interesting anyway.
Regards,
Paul Breneman
www.ControlPascal.com

mse

  • Full Member
  • ***
  • Posts: 216
Re: Small virtual machine to cross compile FPC
« Reply #35 on: August 07, 2015, 07:08:57 am »
I also use MSEide for development of ARM M3 microprocessor projects with the gcc toolchain. Host is Linux, target flashing and debugging is done by a debugger probe like Segger J-Link, see the MSEide debugger settings in attachment. I assume it should be possible to use FPC instead of gcc.

lagprogramming

  • Full Member
  • ***
  • Posts: 159
Re: Small virtual machine to cross compile FPC
« Reply #36 on: August 07, 2015, 09:18:35 pm »
   Would it be enough to install fpc and fpgui? Do you think fpgui's IDE(Maximus) is in a sufficiently advanced state to fulfill your requirements? You may not need fancy stuff of modern IDEs for embedded programming, I don't know. If fpgui would be enough, then with some minor changes to the Maximus IDE, I think you will have some advantages like:
1. I might be able to provide you a console mode installer. With it's presence, a single command line would be enough to install everything.
2. You would need only X server, not additional 3rd party libraries like qt or gtk, this reduces download sizes and installation complexity.
3. Updates to both fpc and fpgui may be applied with a single command line or IDE menu entry.
   Same thing with mseIDE/GUI, it's just that support for Teensy in fpc is added after the 3rd of June. See http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240. If mse* is not able to compile using a fpc trunk later than that date then you will loose probably your most important target. Maybe there is a workaround for this situation, compile mse* with the stable fpc and compile your programs with a recent fpc trunk. But this would complicate things a little bit.
   I'm looking forward for a reply because I'm curious if this approach would fit your needs.

mse

  • Full Member
  • ***
  • Posts: 216
Re: Small virtual machine to cross compile FPC
« Reply #37 on: August 08, 2015, 09:05:33 am »
   Same thing with mseIDE/GUI, it's just that support for Teensy in fpc is added after the 3rd of June. See http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240. If mse* is not able to compile using a fpc trunk later than that date then you will loose probably your most important target.
MSEide compiled with FPC 2.6.4 has no problems to work with FPC trunk compiler. MSEide+MSEgui for FPC 3.0 is available soon.

mse

  • Full Member
  • ***
  • Posts: 216
Re: Small virtual machine to cross compile FPC
« Reply #38 on: August 10, 2015, 03:05:44 pm »
MSEide+MSEgui current GitLab master branch is FPC 3.0 compatible, please test.
https://gitlab.com/mseide-msegui/mseide-msegui

Martin

lagprogramming

  • Full Member
  • ***
  • Posts: 159
Re: Small virtual machine to cross compile FPC
« Reply #39 on: August 16, 2015, 06:54:25 pm »
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC

1. Is the presence of "BINUTILSPREFIX=..." parameter mandatory? Can I ommit it if the involved utils are installed in a directory that's included in the PATH environment?

2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path? I mean somewhere where the build process would be searching by default. I give an example to explain better what I mean. I can find if I have fpc installed and added in the PATH environment by doing the following test: run a TProcess.Execute with "fpc" as executable and "-i" as parameter. If the output starts with "Free Pascal Compiler" then I consider it's installed.
Can I do something like that with arm-embedded- or arm-none-eabi- binutils?

lagprogramming

  • Full Member
  • ***
  • Posts: 159
Re: Small virtual machine to cross compile FPC
« Reply #40 on: September 04, 2015, 12:15:39 am »
When building fpc, what's the philosophy of having an "embedded" OS instead of "none"?  :-\

molly

  • Hero Member
  • *****
  • Posts: 1611
Re: Small virtual machine to cross compile FPC
« Reply #41 on: September 04, 2015, 12:56:21 am »
When building fpc, what's the philosophy of having an "embedded" OS instead of "none"?  :-\
AFAIK that is a little different from what you interpreted, see also here (scroll down, if wanted follow link)

So that would mean that in arm-none-eabi, the none part isn't the OS part rather the vendor part and targeting no particular OS using embedded ABI ?

molly

  • Hero Member
  • *****
  • Posts: 1611
Re: Small virtual machine to cross compile FPC
« Reply #42 on: September 04, 2015, 01:43:21 am »
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC

1. Is the presence of "BINUTILSPREFIX=..." parameter mandatory? Can I ommit it if the involved utils are installed in a directory that's included in the PATH environment?
The binutils prefix isn't a path, rather a way to distinguish between different binutils.

Most known/used binutils are: ar, as, ld, objcopy and objdump.

But... they are all named the same for each target. So how to distinguish ? By placing a prefix before their 'common' name, which depends on the target. That's when BINUTILSPREFIX comes into play -> so that you can tell the compiler which particular set of binutils to use (or in case you are living the wild live and named them differently you are still able to use them).

Quote
2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path?
In practice: you don't.

If someone's sole target is a single one, then he/she can name the binutils by their 'common' name like ar and ld. There is no other way of telling if it's the right binutils then reading their --help output and seeing which targets the specific binutil supports. Of course attempting to compile for a particular target and receiving an missing binutil error also is a way to determine if the binutil is in place or not.

Quote
I mean somewhere where the build process would be searching by default. I give an example to explain better what I mean. I can find if I have fpc installed and added in the PATH environment by doing the following test: run a TProcess.Execute with "fpc" as executable and "-i" as parameter. If the output starts with "Free Pascal Compiler" then I consider it's installed.
I don't have any of my installed FPC compilers in my path, neither are any of my binutils in the path. Still i am able to compile perfectly with FPC, using different targets as i wish.

FPC and its configuration file, are awesome (and completely self-contained) in that regards  :D

^^ the only thing missing to make it completely independent would be to be able to retrieve/obtain the path to the FPC executable to be used in the fpc.cfg configuration file. Right now i need an environment variable for that.

Quote
Can I do something like that with arm-embedded- or arm-none-eabi- binutils?
I don't know of a particular option other then --help that is able to display the supported targets (and if not mistaken that could depend per binutil).

lagprogramming

  • Full Member
  • ***
  • Posts: 159
Re: Small virtual machine to cross compile FPC
« Reply #43 on: September 04, 2015, 09:55:53 am »
Quote
2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path?
In practice: you don't.

   In a different thread marcov gave me a great hint: "make info". I think it's possible to use this command prior to actually building the compiler. By doing so I might be able to get the paths of involved tools(like as, ar, ld) because I see the values are affected by parameters like BINUTILSPREFIX and CROSSBINDIR.
   But even this approach appears to have some flaws. For example, in Windows, I've noticed that make.exe must be in the same directory as binutils, or place all of them in PATH, otherwise make info will fail.
   Also, apparently the lines shown by the "make info" might not contain full path or even executable extension, even though binutils are not in the PATH environment. If the tools are in the same directory as make.exe then "make info" will show just "As........ as", in windows.
   Slowly, I'm moving forward. I start believing that it's possible to have some good checks prior to building the compiler. This should be better than just interpreting the output of the error messages after a failed build attempt.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 701
Re: Small virtual machine to cross compile FPC
« Reply #44 on: September 10, 2015, 06:58:06 am »
@Paul:
Just installed a Debian VM.
And I can reproduce your problem with fpcup !
Will report back if I can find a solution.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus