Hi,
I've been given an E2, it has never been connected to the 'phone line, so is still running factory fresh software. Has anyone managed to get their own code running on one of these beasts? Any pointers on where to start?
cheers, Dave
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Dave Mills wrote: [...]
I've been given an E2, it has never been connected to the 'phone line, so is still running factory fresh software. Has anyone managed to get their own code running on one of these beasts? Any pointers on where to start?
Yes, it's actually fairly straightforward, provided you have the special cable. I have some information here:
http://www.cowlark.com/amstrad/index.html
Once you have the cable, you can use pblq to upload code via the serial cable or to reflash it. Be aware that pblq 0.2 is a bit old; I was in the process of working on it when I managed to fry my E2. I'll try and get 0.3 up on the website soon, along with some more technical stuff I figured out.
You should be aware that the E2's processor has no MMU, which means you can't run normal Linux on it. Porting ucLinux is quite possible but most likely a horrible job. I was partway through porting Prex (a rather nice little Minix-like embedded OS) onto mine when I my UART esplode, but I'll I managed was the boot loader and the very basics of the kernel startup procedure; so while running custom code on an E2 isn't hard, there's not a lot of code to run...
- -- David Given dg@cowlark.com
David Given wrote:
Dave Mills wrote: [...]
I've been given an E2, it has never been connected to the 'phone line, so is still running factory fresh software. Has anyone managed to get their own code running on one of these beasts? Any pointers on where to start?
Yes, it's actually fairly straightforward, provided you have the special cable. I have some information here:
http://www.cowlark.com/amstrad/index.html
Once you have the cable, you can use pblq to upload code via the serial cable or to reflash it.
Great stuff. I'd looked at your software before, but wasn't exactly sure it would let you up upload code and execute it, I thought it was just to upload & download to the Emailer.
Be aware that pblq 0.2 is a bit old; I was in the process of working on it when I managed to fry my E2. I'll try and get 0.3 up on the website soon, along with some more technical stuff I figured out.
You should be aware that the E2's processor has no MMU, which means you can't run normal Linux on it. Porting ucLinux is quite possible but most likely a horrible job. I was partway through porting Prex (a rather nice little Minix-like embedded OS) onto mine when I my UART esplode, but I'll I managed was the boot loader and the very basics of the kernel startup procedure; so while running custom code on an E2 isn't hard, there's not a lot of code to run...
Yep, I'm aware that linux on the E2 is a no-go unless you use the MMU-less variants. My main interest is really a cheap and well featured platform for learning a bit about ARM. I could go buy a proper dev board, but where is the fun in that?
cheers, Dave
On 8 Nov 2008, at 19:20, Dave Mills wrote:
David Given wrote:
Dave Mills wrote: [...]
I've been given an E2, it has never been connected to the 'phone line, so is still running factory fresh software. Has anyone managed to get their own code running on one of these beasts? Any pointers on where to start?
Yes, it's actually fairly straightforward, provided you have the special cable. I have some information here:
http://www.cowlark.com/amstrad/index.html
Once you have the cable, you can use pblq to upload code via the serial cable or to reflash it.
Great stuff. I'd looked at your software before, but wasn't exactly sure it would let you up upload code and execute it, I thought it was just to upload & download to the Emailer.
I hacked a quick bootloader/monitor for the E2 which you can reflash in using pblq; it's a little more convenient/quicker as it just supports XMODEM from the serial terminal, and will boot Other Stuff out of flash. List archives should have a bunch of waffle about it if you're interested, search for "e2-monitor".
Never did get round to finishing the OS, or the uclinux port... (It's too painful to keep downloading dev kernels at 11k/s, I embarked on getting the e2-monitor to boot from MMC but that too got sidetracked... :D )
Cheers,
Matt
Matt Evans wrote:
I hacked a quick bootloader/monitor for the E2 which you can reflash in using pblq; it's a little more convenient/quicker as it just supports XMODEM from the serial terminal, and will boot Other Stuff out of flash. List archives should have a bunch of waffle about it if you're interested, search for "e2-monitor".
Never did get round to finishing the OS, or the uclinux port... (It's too painful to keep downloading dev kernels at 11k/s, I embarked on getting the e2-monitor to boot from MMC but that too got sidetracked... :D )
Cheers,
Matt
Hi Matt,
I'm definitely interested in your boot loader, my first plan of attack was going to be getting some kind of bootloader going on the E2 - if you've already done a lot of the work then that's a plus for me :-)
I'll take a look though the archives, but is the code directly available from you for now?
cheers, Dave
Matt Evans wrote: [...]
Never did get round to finishing the OS, or the uclinux port... (It's too painful to keep downloading dev kernels at 11k/s, I embarked on getting the e2-monitor to boot from MMC but that too got sidetracked... :D )
Before my e2 esploded I got the Prex boot loader up and running --- it would pull an ar file full of ELF files out of flash (using the PBL entry points, so it was compatible with PBL's NFTL system and you could upload files with pblq), and link and relocate them into RAM. Of course, since I never got as far as trying to run the kernel I don't know if it's doing it *right*, but the code might be useful to someone.
BTW, if by MMC you mean SMC, then you should be aware that at least some E2s (such as mine) don't have the card reader. There's a slot in the case and an unpopulated set of pads on the motherboard, but no socket.
Howdy DG, DM,
I am displaying an extraordinary lack of etiquette by replying to you both in one email. Shock! :D But it's lazy time so:
On 12 Nov 2008, at 20:26, David Given wrote:
Matt Evans wrote: [...]
Never did get round to finishing the OS, or the uclinux port... (It's too painful to keep downloading dev kernels at 11k/s, I embarked on getting the e2-monitor to boot from MMC but that too got sidetracked... :D )
Before my e2 esploded I got the Prex boot loader up and running --- it would pull an ar file full of ELF files out of flash (using the PBL entry points, so it was compatible with PBL's NFTL system and you could upload files with pblq), and link and relocate them into RAM. Of course, since I never got as far as trying to run the kernel I don't know if it's doing it *right*, but the code might be useful to someone.
Yeah post it! :) Prex sounds cool, get anywhere fun with it? I got about 5 lines into uclinux booting and ... Well, it's covered in dust now. :-/
BTW, if by MMC you mean SMC, then you should be aware that at least some E2s (such as mine) don't have the card reader. There's a slot in the case and an unpopulated set of pads on the motherboard, but no socket.
By MMC, I mean an MMC card. A bit like an SD card. Or, an SD card in MMC mode. :-) (I was just bit-banging it from the smartcard header.) I got fairly tired of the smartmedia cards & NAND in general & didn't finish convincing PBL to do more than fetch blocks from it (it wanted something else to select it as 'current FS' -- possible it plainly doesn't work, but the code appeared to support selection of either device). (It may have missed initialisation & required some other tickle early on to look for the SM card.)
DaveMills,
The last link I posted was http://axio.ms/projects/e2/e2-monitor-0.25.tgz but there appears to be an e2-monitor-0.26.tgz archive in that dir. too. :-) (I don't think I emailed about it but try the .26 version.) You'll need an ARM cross compiler (anything little-endian should do) to build it. (There's an -mcpu=arm7tdmi in the Makefile that should force fancier compilers back into line.)
Any probs give me a shout! It's not snazzy, will load a flat binary blob out of flash with a simple/funny header to a specified address -- never got round to an ELF loader.
Cheers & happy hacking (& post what you get up to!),
Matt
Matt Evans wrote: [...]
Yeah post it! :) Prex sounds cool, get anywhere fun with it? I got about 5 lines into uclinux booting and ... Well, it's covered in dust now. :-/
Here you go.
My UART got fried just as I was about to do the first boot calling into the kernel, to see if I would get any tracing out. In other words, none of my kernel changes are at all trustworthy (a lot of the code is just copied straight from the Game Boy port to make it run). The boot loader ought to work, though.
The boot loader (built to boot/bootldr) is created with a PBL header and should be written to the beginning of the flash. When booted it will look at each 8kB page header in the first 256MB of flash. If it finds one, it'll get loaded, and then the Prex boot code will continue. AFAICT, what Prex does is:
- load and relocate the first file in the .ar (the kernel). - load, relocate and link the second file to the first file (the device drivers). - load and relocate any subsequent files (the applications).
Then it'll pass control to the kernel. But I haven't gone into this stuff in detail because ELF makes me come out in hives. All I know is that I flash it with prexos.a and it seems to work.
The patch includes my handy scripts for doing the blessing and flashing; but you'll probably need pblq-0.3 for that, which I haven't uploaded yet. Hopefully tonight or tomorrow.
This is all against Prex 0.8.0, BTW. It'll probably need work for Prex 0.8.1 (which, incidentally, now supports ARMs with MMUs and so would probably be suitable for the E3 as well. However, the low-traffic mailing list does seem to suggest that the MMU support is a bit buggy.)
[...]
By MMC, I mean an MMC card. A bit like an SD card. Or, an SD card in MMC mode. :-) (I was just bit-banging it from the smartcard header.) I got fairly tired of the smartmedia cards & NAND in general & didn't finish convincing PBL to do more than fetch blocks from it (it wanted something else to select it as 'current FS' -- possible it plainly doesn't work, but the code appeared to support selection of either device). (It may have missed initialisation & required some other tickle early on to look for the SM card.)
I never even knew PBL *did* support the SM card --- it would be awesome if we could make it work, if my E2 had a SMC socket, if my E2 still worked... but yes, I quite agree about SMC vs MMC. MMC and SD are so wonderfully simple to drive that they could almost have been designed for homebrewers...
Hola DG!
On 13 Nov 2008, at 12:02, David Given wrote:
Matt Evans wrote: [...]
Yeah post it! :) Prex sounds cool, get anywhere fun with it? I got about 5 lines into uclinux booting and ... Well, it's covered in dust now. :-/
Here you go. [snip]
Great, thanks! Will have a play with that, looks fun. :)
I never even knew PBL *did* support the SM card --- it would be awesome if we could make it work, if my E2 had a SMC socket, if my E2 still worked... but yes, I quite agree about SMC vs MMC. MMC and SD are so wonderfully simple to drive that they could almost have been designed for homebrewers...
From distant vague disassembly memory, the NAND routines take a "struct nandDevice *" and all of the FTL and IO stuff indirects through this. I *think* I remember the routines using this to switch the GPIO to /CS the internal NAND or /CS the SM card, too -- so There Is Some Code To Support It But It May Not Work. (I can well believe it was just built that way, perhaps an internal build would boot NastyOS from an SM card if you held down something, could be just that trigger would've been removed in shipping vsns?) I had some code in e2-monitor that would read/write the SM card (just raw sectors) but my enthusiasm for dealing with the FTL/bad blocks etc. severely waned so I took it out. ;)
Cheers,
Matt
PS: You got a scope? The EXP serial port's buffered through a couple of transistors IIRC, your bare serial port on the MCU may still work...maybe? :)
Matt Evans wrote: [...]
Great, thanks! Will have a play with that, looks fun. :)
Prex looks rather nice. Dead simple but sufficiently powerful to be useful. Rather like Minix, but more flexible and better laid out. All the work of one guy, too. It's worth playing with the PC bootable floppy image.
[...]
From distant vague disassembly memory, the NAND routines take a "struct nandDevice *" and all of the FTL and IO stuff indirects through this.
Hmm. The routine I found at 0x4d18, which I got from rifling through the code that searches for BOT files, doesn't seem to take one of these... see boot/arm/ae2/head.S, boot/arm/ae2/bootinfo.c.
It's at times like this that I find myself hoping that the PBL symbol tables might fall off the back of a lorry... unlikely, though, given that it's probably based on some commercial embedded OS executive.
[...]
PS: You got a scope? The EXP serial port's buffered through a couple of transistors IIRC, your bare serial port on the MCU may still work...maybe? :)
Someone's offered me a logic probe --- er, sorry Andy, I forgot to get back to you. But as I'm currently swamped with Nanowrimo and another coding project it'll have to wait until December. I want to figure out the E1 serial port, as well.
Semirelated: what's the easiest way of hooking up an I2C/SPI device to a PC? Given that most computers these days have about a dozen such buses in them, it should be easy --- but I'm not convinced about the wisdom of connecting random bits of dev hardware to critical peripheral buses.
On 13 Nov 2008, at 15:26, David Given wrote:
Semirelated: what's the easiest way of hooking up an I2C/SPI device to a PC? Given that most computers these days have about a dozen such buses in them, it should be easy --- but I'm not convinced about the wisdom of connecting random bits of dev hardware to critical peripheral buses.
Personally I'd use an AVR to drive it & forward stuff to its UART. Or the Obdev USB stack for AVR -- check out the USBasp programmer, that is effectively a "USB to SPI" adapter. I'm using that USB software a fair bit as I don't have a computer with a real UART (non-USB I mean) anymore... progress, eh.
Cheers,
Matt
Hi,
Matt Evans wrote:
On 13 Nov 2008, at 15:26, David Given wrote:
Semirelated: what's the easiest way of hooking up an I2C/SPI device to a PC? Given that most computers these days have about a dozen such buses in them, it should be easy --- but I'm not convinced about the wisdom of connecting random bits of dev hardware to critical peripheral buses.
Personally I'd use an AVR to drive it & forward stuff to its UART. Or the Obdev USB stack for AVR -- check out the USBasp programmer, that is effectively a "USB to SPI" adapter. I'm using that USB software a fair bit as I don't have a computer with a real UART (non-USB I mean) anymore... progress, eh.
There's also the USBprog to tinker with. Open Source drivers.
http://www.embedded-projects.net/index.php?page_id=165
Cheers,
Ralph.