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

From Free Pascal wiki
Jump to navigationJump to search
m (Fix typos; add markup; MacOSX -> macOS)
Line 1: Line 1:
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.
  
Download latest fpcupdeluxe here:
+
Download latest fpcupdeluxe from [https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases fpcupdeluxe releases on github].
  
[https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases 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.
  
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, you have to use the trunk (development version) of FPC.
  
Only exception is darwin-aarch64, for this platform no stable fpc exists, you have to use trunk fpc.
+
Then select <tt>C:\fpcupdeluxe-embedded</tt> or <tt>$HOME/fpcupdeluxe-embedded</tt> as the installation target and hit the button to build both FPC and Lazarus.
 
 
 
 
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.
 
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:
+
More information on fpcupdeluxe can be found here: [[fpcupdeluxe|FpcUpDeluxe Wiki]].
 
 
[https://wiki.lazarus.freepascal.org/fpcupdeluxe FpcUpDeluxe Wiki]
 
  
 
== Download Compiler and Debugger Pack for you fpcupdeluxe installation ==
 
== Download Compiler and Debugger Pack for you fpcupdeluxe installation ==
  
'''Windows'''
+
=== Windows ===
  
 
[http://temp.michael-ring.org/binutils-gdb-arm-embedded-win64.zip Binutils for arm-embedded (x86_64)]
 
[http://temp.michael-ring.org/binutils-gdb-arm-embedded-win64.zip Binutils for arm-embedded (x86_64)]
Line 26: Line 21:
 
[http://temp.michael-ring.org/fpc-arm-embedded-3.3.1-win64-20210129.zip FPC Pack for arm-embedded (x86_64)]
 
[http://temp.michael-ring.org/fpc-arm-embedded-3.3.1-win64-20210129.zip FPC Pack for arm-embedded (x86_64)]
  
'''MacOSX'''
+
=== macOS ===
  
 
[http://temp.michael-ring.org/binutils-gdb-arm-embedded-darwin-x86_64.zip Binutils for arm-embedded (x86_64)]
 
[http://temp.michael-ring.org/binutils-gdb-arm-embedded-darwin-x86_64.zip Binutils for arm-embedded (x86_64)]
Line 36: Line 31:
 
[http://temp.michael-ring.org/fpc-arm-embedded-3.3.1-darwin-aarch64-20210129.zip FPC Pack for arm-embedded (aarch64)]
 
[http://temp.michael-ring.org/fpc-arm-embedded-3.3.1-darwin-aarch64-20210129.zip FPC Pack for arm-embedded (aarch64)]
  
'''Linux'''
+
=== Linux ===
  
 
Todo
 
Todo
Line 43: Line 38:
  
 
== Minor Fixes in the installation ==
 
== 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'''
+
The FPC pack provides support for several architectures (armv6m, armv7m and armv7em) in one package. To make this work properly the <tt>fpc.cfg</tt> file located inside of your installation needs a small change to be able to find the proper libraries for building.
  
Open the fpc.cfg file located here:
+
=== Windows ===
  
    C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\fpc.cfg
+
Open the <tt>fpc.cfg</tt> file located in <tt>C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\</tt> with your favorite editor and search for these lines:
 
 
with your favorite editor and search for those lines:
 
  
 
     # searchpath for units and other system dependent things
 
     # searchpath for units and other system dependent things
Line 62: Line 54:
 
     -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl
 
     -FuC:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl
  
The last thing to do is to doublecheck that all went well....
+
The last thing to do is to double check that all went well....
  
 
Take the Path
 
Take the Path
 
   
 
   
     C:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl  
+
     C:\fpcupdeluxe-embedded\fpc\units\$fpctarget\$fpcsubarch\rtl
  
and replace $fpctarget with 'arm-embedded' and $fpcsubarch with 'armv7m'
+
and replace <tt>$fpctarget</tt> with <tt>arm-embedded</tt> and <tt>$fpcsubarch</tt> with <tt>armv7m</tt> which will give you:
 
 
which will give you:
 
  
 
     C:\fpcupdeluxe-embedded\fpc\units\arm-embedded\armv7m\rtl
 
     C:\fpcupdeluxe-embedded\fpc\units\arm-embedded\armv7m\rtl
  
Check that this directory exists and that it contains system.ppu
+
Check that this directory exists and that it contains <tt>system.ppu</tt>. Then change to the Directory
 
 
Then change to the Directory
 
  
 
     C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\
 
     C:\fpcupdeluxe-embedded\fpc\bin\x86_64-win64\
  
and check that the file arm-embedded-as.exe exists.
+
and check that the file <tt>arm-embedded-as.exe</tt> exists.
  
When all checks are done you should be ready to compile your first program.....
+
When all checks are done, you should be ready to compile your first program.
  
'''MacOSX'''
+
=== macOS ===
  
Open the fpc.cfg file located here:
+
Open the <tt>fpc.cfg</tt> file located here:
  
 
     $HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin/fpc.cfg
 
     $HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin/fpc.cfg
  
with your favorite editor and search for those lines:
+
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
Line 100: Line 88:
 
     -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl`
 
     -Fu/Users/XXXXX/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl`
  
''Please note that you have to substitute the '/Users/XXXXX' part of the path with the actual path of your $HOME.''
+
''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 doublecheck that all went well....
+
The last thing to do is to double check that all went well...
  
 
Take the Path  
 
Take the Path  
  
     $HOME/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl  
+
     $HOME/fpcupdeluxe-embedded/fpc/units/$fpctarget/$fpcsubarch/rtl
  
and replace $fpctarget with 'arm-embedded' and $fpcsubarch with 'armv7m'
+
and replace <tt>$fpctarget</tt> with <tt>arm-embedded</tt> and <tt>$fpcsubarch</tt> with <tt>armv7m</tt>
  
 
which will give you:
 
which will give you:
Line 114: Line 102:
 
     $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl
 
     $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl
  
Check that this directory exists and that it contains system.ppu:
+
Check that this directory exists and that it contains <tt>system.ppu</tt>:
  
 
     ls -l $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl/system.ppu
 
     ls -l $HOME/fpcupdeluxe-embedded/fpc/units/arm-embedded/armv7m/rtl/system.ppu
  
Then change to the directory
+
Then change to the directory <tt>$HOME/fpcupdeluxe-embedded/fpc/bin/x86_64-darwin</tt> and check that the file <tt>arm-embedded-as</tt> exists:
 
 
    $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
 
     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.....
+
When all checks are done, you should be ready to compile your first program.
  
'''Linux'''
+
=== Linux ===
  
 
ToDo
 
ToDo

Revision as of 23:37, 29 January 2021

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, 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