Difference between revisions of "ARM Embedded Tutorial - Installing Lazarus and Free Pascal"

From Lazarus wiki
Jump to navigationJump to search
m (Add ARM category)
(Added template. Categories moved to template.)
Line 1: Line 1:
 +
{{ARM Embedded Tutorial - Installing Lazarus and Free Pascal}}
 +
 
The easiest way to install Embedded Support for a huge variety of embedded controllers is to use fpcupdeluxe and to then load a pre-compiled version of FPC and other tools.
 
The easiest way to install Embedded Support for a huge variety of embedded controllers is to use fpcupdeluxe and to then load a pre-compiled version of FPC and other tools.
  
Line 115: Line 117:
  
 
ToDo
 
ToDo
 
 
[[Category:FPC]]
 
[[Category:Lazarus]]
 
[[Category:Install]]
 
[[Category:Embedded]]
 
[[Category:Tutorials]]
 
[[Category:ARM]]
 
[[Category:Linux]]
 
[[Category:macOS]]
 
[[Category:Windows]]
 

Revision as of 15:40, 30 January 2021

English (en)

The easiest way to install Embedded Support for a huge variety of embedded controllers is to use fpcupdeluxe and to then load a pre-compiled version of FPC and other tools.

Download latest fpcupdeluxe from fpcupdeluxe releases on github.

Select the current stable FPC version and trunk version of Lazarus. You will need trunk version of Lazarus for better support of debugging, when you do not plan to use IDE-based debugging the stable Lazarus is also OK. It is important that you select FPC stable.

The only exception is darwin-aarch64, for this platform no stable FPC exists, so you have to use the trunk (development version) of FPC.

Then select C:\fpcupdeluxe-embedded or $HOME/fpcupdeluxe-embedded as the installation target and hit the button to build both FPC and Lazarus.

For now, do not install anything else, especially do not install the embedded support as this part is currently limited to support for armv6m targets.

More information on fpcupdeluxe can be found here: FpcUpDeluxe Wiki.

Download Compiler and Debugger Pack for you fpcupdeluxe installation

Windows

Binutils for arm-embedded (x86_64)

FPC Pack for arm-embedded (x86_64)

macOS

Binutils for arm-embedded (x86_64)

FPC Pack for arm-embedded (x86_64)

Binutils for arm-embedded (aarch64)

FPC Pack for arm-embedded (aarch64)

Linux

Todo

Unzip the downloaded files inside of the fpcupdeluxe-embedded directory.

Minor Fixes in the installation

The FPC pack provides support for several architectures (armv6m, armv7m and armv7em) in one package. To make this work properly the fpc.cfg file located inside of your installation needs a small change to be able to find the proper libraries for building.

Windows

Open the fpc.cfg file located in C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\ with your favorite editor and search for these lines:

   # searchpath for units and other system dependent things
   -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget
   -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget\*
   -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget\rtl

and add this line:

   -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl

The last thing to do is to double check that all went well....

Take the Path

   C:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl

and replace $fpctarget with arm-embedded and $fpcsubarch with armv7m which will give you:

   C:\fpcupdeluxe-embedded\fpc\units\arm-embedded\armv7m\rtl

Check that this directory exists and that it contains system.ppu. Then change to the Directory

   C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\

and check that the file arm-embedded-as.exe exists.

When all checks are done, you should be ready to compile your first program.

macOS

Open the fpc.cfg file located here:

   $HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin/fpc.cfg

with your favorite editor and search for these lines:

   -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget
   -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget/*
   -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget/rtl

and add this line:

   -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl`

Please note that you have to substitute the actual path of your $HOME for the '/Users/XXXXX' part of the path above.

The last thing to do is to double check that all went well...

Take the Path

   $HOME/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl

and replace $fpctarget with arm-embedded and $fpcsubarch with armv7m

which will give you:

   $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl

Check that this directory exists and that it contains system.ppu:

   ls -l $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl/system.ppu

Then change to the directory $HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin and check that the file arm-embedded-as exists:

   ls -l $HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin/arm-embedded-as

When all checks are done, you should be ready to compile your first program.

Linux

ToDo