First step would be to visit

http://wiki.freepascal.org/TARGET_Embedded

This page helps to set up basic things like cross toolchain for arm and to compile trunk of fpc.

Once you have worked through this you are ready to go.

ppcrossarm -i should give you a list of available controllers, when you use trunk you should see:

LPC1343FBD48 and LPC1343FHN33 in the list of supported controllers.

When you have followed the steps of the instructions you have also checked out latest FPC from trunk, you should now make yourself familiar with the file ./rtl/embedded/arm/lpc13xx.pp, this file holds all the register information.

If you want I can send you a newer version of this file, it also includes translations of most of the #defines of the original header files, but for learning first steps the checked in version is perhaps easier, it is not that big.

Now you are ready to compile your first hello.pas, this is the commandline that I usually use:

ppcrossarm -MObjFPC -Ch1024 -Cs1024 -Tembedded -Parm -vi -Cparmv7m -WpLPC1343FBD48 -XParm-none-eabi- hello.pas

When you use objects you need to initialize the heap, change -Ch (Heapsize) and -Cs (Stacksize) to your needs. -vi give you info about code and data size.

arm-none-eabi- is the prefix of your binutils binaries for cross compiling, if they are not in you path you can also put the full path in the commandline, but remember to only use the prefix. something like /usr/local/bin/arm-none-eabi- will work, C:\tools\bin\arm-none-aebi- should also work

For debugging you need gdb compiled as a cross debugger, I built my own gdb to support text UI, so --tui brings you into a basic GUI inside of gdb, without this you end up in plain gdb commandline.

arm-none-eabi-gdb hello.elf --tui --eval-command="target extended :3333" --eval-command="monitor reset halt" --eval-command="set mem inaccessible-by-default off" --eval-command="load"

After this you are ready to debug.

I have written an integration into lazarus looooong time ago, not sure if it still compiles after the huge changes thst Martin did in the last months, once you have everything up and running so far we can work on the integration into lazarus.

Michael



Am 17.05.14 01:33, schrieb Justin Smyth:
Hi everyone,

I have recently got open ocd v8 to talk to my nxp lpc 1343 via a stlinkv2 , should fpc ( 2.6.4 or higher support this type of CPU and does anyone have any ideas how to hook up gdb to openocd ? I am thinking of using Lazarus to step through some code if possible)

Justin


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to