Difference between revisions of "Native ARM Systems"

From Free Pascal wiki
Jump to navigationJump to search
(Initial rough copy)
 
(Add detail)
Line 1: Line 1:
This is a placeholder for a page discussing FPC and Lazarus running natively on an ARM-based development system, i.e. as distinct from a target which requires cross-compilation.
+
The ARM architecture is unusual in that it was designed for desktop computers, is now overwhelmingly used for embedded systems, but can still occasionally be found in desktops or small servers. The only comparable architecture is MIPS, although much depends on whether Chinese implementations hit the market at a reasonable price.
  
Like almost all computers, these will contain an internal loader, usually in Flash memory. However there are two basic categories of system:
+
Like almost all computers, ARM-based systems will contain an internal loader, usually in Flash memory. However there are two basic categories of system:
  
*  Those that boot an operating system from internal Flash, such as the Linksys/Cisco NSLU2 "Slugs", and the Sheeva Plug.
+
*  Those that boot an operating system from internal Flash, such as the Linksys/Cisco NSLU2 "Slugs" [http://www.cyrius.com/debian/nslu2/install.html], and the Sheeva Plug.
  
 
*  Those that boot an operating system from a conventional disc, connected via IDE, SCSI or USB.
 
*  Those that boot an operating system from a conventional disc, connected via IDE, SCSI or USB.
Line 9: Line 9:
 
In either case it is necessary to be able to install a general-purpose operating system such as Linux in order to be able to run development tools. This writer (MarkMLl) favours Debian, since he finds that using it results on a very similar system on a wide range of hardware (x86, SPARC, PPC, ARM).
 
In either case it is necessary to be able to install a general-purpose operating system such as Linux in order to be able to run development tools. This writer (MarkMLl) favours Debian, since he finds that using it results on a very similar system on a wide range of hardware (x86, SPARC, PPC, ARM).
  
> Basic OS installation (in Flash).
+
'''If you intend to build Lazarus, make sure you have at least 512Mb memory (RAM + swap) available.'''
  
> Basic OS installation (conventional disc).
+
== Basic OS installation (in Flash) ==
  
> Development tools prerequisites.
+
Where both the initial loader and the operating system (Linux, plus its associated initial ramdisk image) is stored in internal Flash memory, this is typically filled using either a JTAG connection or over Ethernet using a special program running on a host computer. Where a host computer is used the fill protocol might use raw Ethernet, which means that the host and target have to be on the same LAN segment.
  
> Library prerequisites for FPC.
+
== Basic OS installation (conventional disc) ==
  
> Installing FPC from binary release.
+
This relies on the internal firmware (i.e. in Flash) being able to load and transfer control to an operating system from an external disc, e.g. connected by USB. An alternative is to have something like Open Firmware [http://www.openfirmware.info/Open_Firmware] as a second-stage loader, this has limited capability of parsing partition tables etc. but will be familiar to anybody used to Sun, Apple etc. systems.
  
> Getting and compiling FPC sources.
+
== Development tools prerequisites ==
  
> Getting and compiling Lazarus sources.
+
Once the operating system is running it will typically have a default host name and IP address, it is necessary to login using e.g. SSH to change these and to load additional packages.
  
> Prerequisites for running Lazarus.
+
In the case of Debian or derivatives (Ubuntu etc.) there are, by default, no development tools on a newly-installed system. In order of descending importance, the following packages are needed:
  
> known gotchas.
+
* build-essential
 +
 
 +
* gdb
 +
 
 +
* subversion
 +
 
 +
I'm assuming that developers have their own preferences as far as things like sudo vs su are concerned. I also find the screen package useful, since it protects a time-consuming build from being killed if the network connection goes down.
 +
 
 +
== Installing FPC from binary release ==
 +
 
 +
Start off with a binary release from http://www.freepascal.org/down/arm/linux.var [http://www.freepascal.org/down/arm/linux.var]. This is currently (March 2011) version 2.2.2, which is competent to build 2.4.2 on e.g. a "Slug".
 +
 
 +
''That's for a "Slug", your mileage might vary on different ARM variants, due to different FPU implementations.''
 +
 
 +
== Library prerequisites for FPC ==
 +
 
 +
Again assuming Debian or a derivative:
 +
 
 +
* libgpm-dev (formerly libgpmg1-dev)
 +
 
 +
* libncurses5-dev
 +
 
 +
* libncursesw5-dev
 +
 
 +
This assumes that the debugger interface is not built into the IDE, since building libgdb is non-trivial.
 +
 
 +
== Getting and compiling FPC sources ==
 +
 
 +
See http://www.freepascal.org/down/source/sources.var [http://www.freepascal.org/down/source/sources.var], or use Subversion.
 +
 
 +
Unpack the sources in e.g. /usr/local/fpc, which will typically result in a new directory /usr/local/fpc/fpcbuild-2.4.2; optionally set up a symlink fpcbuild -> fpcbuild-2.4.2.
 +
 
 +
In /usr/local/fpc/fpcbuild/fpcsrc use a command such as this to build FPC:
 +
 
 +
$ make NOGDB=1 OPT=-O- -gl -vt -dFPC_ARMEL -CfSOFT clean all
 +
 
 +
''That's for a "Slug", your mileage might vary on different ARM variants, due to different FPU implementations.''
 +
 
 +
Provided that that runs successfully, i.e. leaving a recently-created build-stamp.arm-linux file in the current directory, it should be safe to overwrite the existing binary compiler:
 +
 
 +
# make install
 +
 
 +
Running fpc -? should now show the current date in the banner.
 +
 
 +
== Library prerequisites for Lazarus ==
 +
 
 +
These install the development libraries for both GTK v1 and v1:
 +
 
 +
* libgdk-pixbuf-dev
 +
 
 +
* libgtk1.2-dev
 +
 
 +
* libgtk2.0-dev
 +
 
 +
== Getting and compiling Lazarus sources ==
 +
 
 +
Get the latest stable version from http://sourceforge.net/projects/lazarus/files/ [http://sourceforge.net/projects/lazarus/files/], or use Subversion.
 +
 
 +
Assuming that the sources are unpacked in /usr/local/share/lazarus, in that directory run
 +
 
 +
$ make bigide
 +
 
 +
Provided that that builds, consider setting up symbolic links in /usr/local/bin to point to lazarus, lazbuild and startlazarus.
 +
 
 +
== Prerequisites for running Lazarus ==
 +
 
 +
There are three ways of running lazarus:
 +
 
 +
* Using an X server on the same system as is running the program, either with internal video hardware or over VNC.
 +
 
 +
* Using an X server on the developer's desktop system, logged into a desktop on the system running the program.
 +
 
 +
* Using X tunneled over SSH.
 +
 
 +
The first two of those generally require some sort of desktop manager on the development system. In general, things like a "Slug" are too "resource challenged" to be able to run KDE or Gnome, my (MarkMLl) preference is to install gdm for the sake of the XDMCP protocol and FluxBox as a minimal desktop.
 +
 
 +
== Known gotchas ==
 +
 
 +
At present (March '11) there is a problem which prevents the IDE from running on ARM and SPARC systems, since it's fine on x86 and PPC I suspect this is an alignment issue.

Revision as of 12:59, 25 March 2011

The ARM architecture is unusual in that it was designed for desktop computers, is now overwhelmingly used for embedded systems, but can still occasionally be found in desktops or small servers. The only comparable architecture is MIPS, although much depends on whether Chinese implementations hit the market at a reasonable price.

Like almost all computers, ARM-based systems will contain an internal loader, usually in Flash memory. However there are two basic categories of system:

  • Those that boot an operating system from internal Flash, such as the Linksys/Cisco NSLU2 "Slugs" [1], and the Sheeva Plug.
  • Those that boot an operating system from a conventional disc, connected via IDE, SCSI or USB.

In either case it is necessary to be able to install a general-purpose operating system such as Linux in order to be able to run development tools. This writer (MarkMLl) favours Debian, since he finds that using it results on a very similar system on a wide range of hardware (x86, SPARC, PPC, ARM).

If you intend to build Lazarus, make sure you have at least 512Mb memory (RAM + swap) available.

Basic OS installation (in Flash)

Where both the initial loader and the operating system (Linux, plus its associated initial ramdisk image) is stored in internal Flash memory, this is typically filled using either a JTAG connection or over Ethernet using a special program running on a host computer. Where a host computer is used the fill protocol might use raw Ethernet, which means that the host and target have to be on the same LAN segment.

Basic OS installation (conventional disc)

This relies on the internal firmware (i.e. in Flash) being able to load and transfer control to an operating system from an external disc, e.g. connected by USB. An alternative is to have something like Open Firmware [2] as a second-stage loader, this has limited capability of parsing partition tables etc. but will be familiar to anybody used to Sun, Apple etc. systems.

Development tools prerequisites

Once the operating system is running it will typically have a default host name and IP address, it is necessary to login using e.g. SSH to change these and to load additional packages.

In the case of Debian or derivatives (Ubuntu etc.) there are, by default, no development tools on a newly-installed system. In order of descending importance, the following packages are needed:

  • build-essential
  • gdb
  • subversion

I'm assuming that developers have their own preferences as far as things like sudo vs su are concerned. I also find the screen package useful, since it protects a time-consuming build from being killed if the network connection goes down.

Installing FPC from binary release

Start off with a binary release from http://www.freepascal.org/down/arm/linux.var [3]. This is currently (March 2011) version 2.2.2, which is competent to build 2.4.2 on e.g. a "Slug".

That's for a "Slug", your mileage might vary on different ARM variants, due to different FPU implementations.

Library prerequisites for FPC

Again assuming Debian or a derivative:

  • libgpm-dev (formerly libgpmg1-dev)
  • libncurses5-dev
  • libncursesw5-dev

This assumes that the debugger interface is not built into the IDE, since building libgdb is non-trivial.

Getting and compiling FPC sources

See http://www.freepascal.org/down/source/sources.var [4], or use Subversion.

Unpack the sources in e.g. /usr/local/fpc, which will typically result in a new directory /usr/local/fpc/fpcbuild-2.4.2; optionally set up a symlink fpcbuild -> fpcbuild-2.4.2.

In /usr/local/fpc/fpcbuild/fpcsrc use a command such as this to build FPC:

$ make NOGDB=1 OPT=-O- -gl -vt -dFPC_ARMEL -CfSOFT clean all

That's for a "Slug", your mileage might vary on different ARM variants, due to different FPU implementations.

Provided that that runs successfully, i.e. leaving a recently-created build-stamp.arm-linux file in the current directory, it should be safe to overwrite the existing binary compiler:

  1. make install

Running fpc -? should now show the current date in the banner.

Library prerequisites for Lazarus

These install the development libraries for both GTK v1 and v1:

  • libgdk-pixbuf-dev
  • libgtk1.2-dev
  • libgtk2.0-dev

Getting and compiling Lazarus sources

Get the latest stable version from http://sourceforge.net/projects/lazarus/files/ [5], or use Subversion.

Assuming that the sources are unpacked in /usr/local/share/lazarus, in that directory run

$ make bigide

Provided that that builds, consider setting up symbolic links in /usr/local/bin to point to lazarus, lazbuild and startlazarus.

Prerequisites for running Lazarus

There are three ways of running lazarus:

  • Using an X server on the same system as is running the program, either with internal video hardware or over VNC.
  • Using an X server on the developer's desktop system, logged into a desktop on the system running the program.
  • Using X tunneled over SSH.

The first two of those generally require some sort of desktop manager on the development system. In general, things like a "Slug" are too "resource challenged" to be able to run KDE or Gnome, my (MarkMLl) preference is to install gdm for the sake of the XDMCP protocol and FluxBox as a minimal desktop.

Known gotchas

At present (March '11) there is a problem which prevents the IDE from running on ARM and SPARC systems, since it's fine on x86 and PPC I suspect this is an alignment issue.