[E3-hacking] Quick update on E2 work

Matt Evans e3-hacking@earth.li
Wed, 13 Apr 2005 15:28:34 +0100


Hi all,

Just thought I'd say what I've been working on currently - had a slow 
fortnight w/o much time to spare for it but...  I am writing a 2ndstage 
boot monitor for the E2 with the aim to drop it into the first block 
(or two ;) of NAND flash via David's pblq program.  I currently haven't 
touched the flash at all, and am using JTAG to download it to RAM - 
that actually works very nicely, about 3K/s too..

Anyway, it provides a basic shell on the serial port with 
peek/poke/dump/go style commands.  It'll also support YMODEM transfers 
(when I get them working) to/from DRAM and from NAND - so it'll provide 
an easy means to prototype bigger programs on top of itself, with quick 
downloads to DRAM.

I've found the NAND support to be interesting.  It's my intention to 
have it be able to scan internal NAND (and SmartMedia) for headers of 
code to load/jump to, much as PBL does.  The raw NAND contains some 
strange stuff;  there is some sort of FTL in force here.  At this point 
I got a bit exasperated trying to work out exactly what 
ECC/badblock-remapping scheme they've used in the NAND flash; however 
I've found the PBL high-level "read offset N" routines (e.g. 0x4d18), 
and can call them (in ROM) from my own code (in RAM) with success.... 
These routines seem to perform ECC/FTL-style remapping.  I haven't 
found out how to get them to read SmartMedia though... (Incidentally 
0xa0002007 bit 0x02 is an active high 'smartmedia inserted' flag, 
0xa0002005 bit 0x01 being the NAND CS for the card.)  Thinking about it 
it would make sense for the ECC/remapping stuff of the internal NAND to 
be the same as the SmartMedia standard, no point duplicating code for a 
different system for internal flash...

Anyway; anyone have any comments/input/help with regard to the PBL 
routines to access SMC or internal flash?  I haven't looked for/found 
the writeBlock routines yet, but they'll be next on the list.  Ideally 
this loader (it's about 8K now since I'm lazy and most is in C) would 
sit at the (logical ;) ) start of NAND, be brought up by PBL and then 
boot from either SMC if inserted or else search internal NAND for 
another image.  Would be a cool development cycle to just blast stuff 
onto SMC card and plug it in rather than waiting for it to download 
over serial.

Hope to get something ready over the weeken that ppl can play with if 
anyone's interested.

-Matt