Installation of the MBF Framework and it's dependencies - michael-ring/mbf GitHub Wiki
To be able to use MBF with all boards supported there are some steps necessary to prepare your computer.
When you are new to programming embedded controllers with FreePascal then best follow this guide by the word, there are some bits and pieces that need to be in place so that you can have an easy start.
First Step: Use fpcupdeluxe to create a working environment on your computer:
Download latest fpcupdeluxe here:
fpcupdeluxe releases on github
Select the current stable fpc version and trunk version of Lazarus. You will need trunk version for better support of Debugging, when you do not plan to use IDE based debugging the stable lazarus is also OK.
Then select C:\fpcupdeluxe-mbf or $HOME/fpcupdeluxe-mbf 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:
Second Step: Clone/Download MBF Framework:
Go to MBF's github page (Actually, when reading this you are already here very close) and clone/download MBF Framework to a directory of your choice
Third Step: Download Compiler and Debugger Pack for you fpcupdeluxe installation
Windows:
Binutils for arm-embedded (x86_64)
FPC Pack for arm-embedded (x86_64)
MacOSX
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-mbf directory.
There are also patches available so that you can patch and build a compiler on your own, but the easiest way is to just download the packs and to install them inside of your fpcupdeluxe installation
Last Step: Minor Fixes in the fpcupdeluxe installation
The provided 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 the fpcdeluxe installation needs a small change to be able to find the proper libraries for building.
Windows:
Open the fpc.cfg file located here:
C:\fpcupdeluxe-mbf\fpc\bin\x86_64-win64\fpc.cfg
with your favorite editor and search for those lines:
# searchpath for units and other system dependent things
-FuC:\fpcupdeluxe-mbf\fpc\units\$fpctarget
-FuC:\fpcupdeluxe-mbf\fpc\units\$fpctarget\*
-FuC:\fpcupdeluxe-mbf\fpc\units\$fpctarget\rtl
and add this line:
-FuC:\fpcupdeluxe-mbf\fpc\units\$fpctarget\$fpcsubarch\rtl
The last thing to do is to doublecheck that all went well....
Take the Path
C:\fpcupdeluxe-mbf\fpc\units\$fpctarget\$fpcsubarch\rtl
and replace $fpctarget with 'arm-embedded' and $fpcsubarch with 'armv7m'
which will give you:
C:\fpcupdeluxe-mbf\fpc\units\arm-embedded\armv7m\rtl
Check that this directory exists and that it contains system.ppu
Then change to the Directory
C:\fpcupdeluxe-mbf\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.....
MacOSX:
Open the fpc.cfg file located here:
$HOME/fpcupdeluxe-mbf/fpc/bin/x86_64-darwin/fpc.cfg
with your favorite editor and search for those lines:
-Fu/Users/XXXXX/fpcupdeluxe-mbf/fpc/units/$fpctarget
-Fu/Users/XXXXX/fpcupdeluxe-mbf/fpc/units/$fpctarget/*
-Fu/Users/XXXXX/fpcupdeluxe-mbf/fpc/units/$fpctarget/rtl
and add this line:
-Fu/Users/XXXXX/fpcupdeluxe-mbf/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.
The last thing to do is to doublecheck that all went well....
Take the Path
$HOME/fpcupdeluxe-mbf/fpc/units/$fpctarget/$fpcsubarch/rtl
and replace $fpctarget with 'arm-embedded' and $fpcsubarch with 'armv7m'
which will give you:
$HOME/fpcupdeluxe-mbf/fpc/units/arm-embedded/armv7m/rtl
Check that this directory exists and that it contains system.ppu:
ls -l $HOME/fpcupdeluxe-mbf/fpc/units/arm-embedded/armv7m/rtl/system.ppu
Then change to the directory
$HOME/fpcupdeluxe-mbf/fpc/bin/x86_64-darwin
and check that the file arm-embedded-as exists:
ls -l $HOME/fpcupdeluxe-mbf/fpc/bin/x86_64-darwin/arm-embedded-as
When all checks are done you should be ready to compile your first program.....
Linux:
ToDo