Armv7 fpc openocd v8

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Armv7 fpc openocd v8

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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Armv7 fpc openocd v8

Jeppe Johansen-3
Den 17-05-2014 01:33, Justin Smyth skrev:
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 supports that, yes.

To build fpc for it run:
make buildbase installbase OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7m CROSSINSTALL=1

To compile an application for it:
fpc -Parm -Tembedded -Cparmv7m -WpLPC1343FHN33 -gw yourprogram.pas

In Lazarus you can use "GNU remote debugger (gdbserver)" to connect to openocd. You'll need to point it at a GDB compiled for arm-elf.
I'm not sure it will work though, but I think that was what that was developed for.

Best Regards,
Jeppe

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Armv7 fpc openocd v8

Michael Ring-2
In reply to this post by Justin Smyth
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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Armv7 fpc openocd v8

Justin Smyyth
In reply to this post by Justin Smyth
if you have an updated version of lpc13xx.pp ( I wrote the orginal) that would be good.
 
 
I would prob re check the C# i had for the nxp lpc 1343 chip agaist this file , now i can target the board i can see if i get any errors.( also check the specs to make sure its right too ).
 
A bit of work . thats ok
 
 
Justin
 
 
ps delphian@smythconsulting & [hidden email] both route to me
 
 
 
-----Original Message-----
From: Michael Ring <[hidden email]>
To: FPC-Pascal users discussions <[hidden email]>
Date: Sat, 17 May 2014 10:35:58 +0200
Subject: Re: [fpc-pascal] Armv7 fpc openocd v8

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  -  [hidden email]

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Armv7 fpc openocd v8

Michael Ring-2
I have sent you the header files via pm, there is only minor improvement to what is currently checked in, i mixed the lpc header files up with the stm header files, there I did more work.

Michael

Am 19.05.14 04:39, schrieb Justin Smyyth:
if you have an updated version of lpc13xx.pp ( I wrote the orginal) that would be good.
 
 
I would prob re check the C# i had for the nxp lpc 1343 chip agaist this file , now i can target the board i can see if i get any errors.( also check the specs to make sure its right too ).
 
A bit of work . thats ok
 
 
Justin
 
 
ps delphian@smythconsulting & [hidden email] both route to me
 
 
 
-----Original Message-----
From: Michael Ring [hidden email]
To: FPC-Pascal users discussions [hidden email]
Date: Sat, 17 May 2014 10:35:58 +0200
Subject: Re: [fpc-pascal] Armv7 fpc openocd v8

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  -  [hidden email]

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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal