eLua with Olimex SAM7-P256 board

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

eLua with Olimex SAM7-P256 board

To get an understanding of how eLua works at a low level I'm starting with getting it running on an Olimex SAM7-P256 board that I purchased from SparkFun.  This board has an AT91SAM7S256 on it, but the board is simpler and configured a bit differently from the Olimex SAM7-EX256 board described in the eLua documentation.

http://www.olimex.com/dev/sam7-p256.html

Thus far I have the:

1. Arm7 toolchain built as described without problems on Ubuntu and Mac OS X.
2. Atmel SAM-PROG v2.4
3. Tested board functionality and ability to write flash using SAM-PROG with LED blink test from SparkFun site.

Unfortunately, flashing either the "elua_lua_at91sam7x256.bin" I built or the pre-compiled binary downloaded from the eLua web site produces no response on the UART0.  Darn, I was just hoping it would work :-).

My presumption at this point is the AT91SAM7S256 is different enough from the AT91SAMX256 that things are failing during the initialization of peripherals on the chip.

Any suggestions are where I should begin?  Since I have very few debug resources available to me (I don't have an Arm JTAG cable) I guess I'll start seeing if I can blink the LEDs early in the eLua initialization process and start working up from there.

I also presume that I should use the 'at91sam7x256' as a template for defining a configuration for the 'at91sam7s256' chip -- hopefully they are 90% the same.

-Mike
mpthompson mpthompson
Reply | Threaded
Open this post in threaded view
|

Re: eLua with Olimex SAM7-P256 board

mpthompson wrote
To get an understanding of how eLua works at a low level I'm starting with getting it running on an Olimex SAM7-P256 board that I purchased from SparkFun.
...
I know it's poor form to respond to my own email, but I guess I'll do it anyways.  After a bit of head scratching and scouring the internet to understand subtleties of Arm initialization I've managed to add the AT91SAM7S and Olimex SAM7-P256 as a new platform for eLua.  Fortunately, the AT91SAM7S is closely related to the AT91SAM7X so examining that project that got me 75% of the way there, but I needed to dig up some of the Atmel specific configuration files for this specific chip and make minor changes throughout the platform.c file.  A board.h for the SAM7-P256 needed to be created as well.  Things are working to the point where I get the Lua prompt on the serial port and I can run the demos on the romfs.

I'll be happy to share these files with anyone wanting to work specifically with the AT91SAM7S.  Hopefully over time I'll be able to merge this work with pieces of pbLua to create both a generic AT91SAM7S platform as well one specifically tailored to the LEGO NXT Brick with it's unique peripherals.

Mike

BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: eLua with Olimex SAM7-P256 board

Hi,

Very good work there. Funny though, I didn't expect the two CPUs to be that different.
Note that the AT91SAM7 platforms needs some special defines (for the Atmel library). Look at conf.py:

if cputype == 'AT91SAM7X256':
  ldscript = "flash256.lds"
  cdefs = cdefs + " -Dat91sam7x256"
elif cputype == 'AT91SAM7X512':
  ldscript = "flash512.lds"
  cdefs = cdefs + " -Dat91sam7x512"
else:
  print "Invalid AT91SAM7X CPU %s" % cputype
  sys.exit( -1 ) 

Can't remember where they are used, but a simple grep in the at91sam7x directory should give you a good hint probably. You should probably add a "-Dat91sam7s256" just like above, but please verify this first, it's just an unverified assumption.

Best,
Bogdan

On Wed, Mar 25, 2009 at 7:31 AM, mpthompson <[hidden email]> wrote:


To get an understanding of how eLua works at a low level I'm starting with getting it running on an Olimex SAM7-P256 board that I purchased from SparkFun.
...


I know it's poor form to respond to my own email, but I guess I'll do it anyways.  After a bit of head scratching and scouring the internet to understand subtleties of Arm initialization I've managed to add the AT91SAM7S and Olimex SAM7-P256 as a new platform for eLua.  Fortunately, the AT91SAM7S is closely related to the AT91SAM7X so examining that project that got me 75% of the way there, but I needed to dig up some of the Atmel specific configuration files for this specific chip and make minor changes throughout the platform.c file.  A board.h for the SAM7-P256 needed to be created as well.  Things are working to the point where I get the Lua prompt on the serial port and I can run the demos on the romfs.

I'll be happy to share these files with anyone wanting to work specifically with the AT91SAM7S.  Hopefully over time I'll be able to merge this work with pieces of pbLua to create both a generic AT91SAM7S platform as well one specifically tailored to the LEGO NXT Brick with it's unique peripherals.

Mike


--
View this message in context: http://n2.nabble.com/eLua-with-Olimex-SAM7-P256-board-tp2529137p2530834.html
Sent from the eLua Development mailing list archive at Nabble.com.

_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
mpthompson mpthompson
Reply | Threaded
Open this post in threaded view
|

Re: eLua with Olimex SAM7-P256 board

Bogdan Marinescu wrote:
> Very good work there. Funny though, I didn't expect the two CPUs to be
> that different.

You are right, they aren't very different.  It's just that when all you
have is a blinking LED to debug things seem a lot more different than
they really are.  I basically needed to get the AT91SAM7S256.h header
files from Atmel, create a new board.h file specific to the SAM7-P256
dev board and edit the platform.c file to PIO ports the AT91SAM7S256
doesn't have.  I ran into some problems with the newer board_lowlevel.c
and board_memories.c file I got from Atmel and things worked better when
I went back to ones derived from the AT91SAM7X256 platform.  I believe
their files assumed FLASH/SRAM was being remapped.

I sent the platform additions to you in a separate email.

Mike
_______________________________________________
Elua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev