2010-03-22

mini68k adding libraries and serial port

I admit I haven't been very focused at my hobbies, but that's life. I've been working here and there: getting the Arduino and the SHT11 working together (see here for library), converting a metal-gear servo to continuous rotation (I followed this how-to), trying to design a photodiode amplifier (I'm following this, this and what is available from this), debugging the SolarLight project and working on the schematics of the mini68k and finally getting some code running on it.
I've been feeling a bit more confident with gcc-m68k and I've been increasing the complexity of the programs. I managed to link in the gcc library (libgcc), I tried out the -msoftfloat option (compile, I didn't check the results of a floating operation yet) and I created my own putc and getc functions using the USART of the MC68901 (MFP) in pooled mode.
I want to change my CRT0.S to include some hardware support functions before main() is run. Initialize the interrupt vectors (pointing to a "interrupt error" routine), printing some console message during initialization and doing some hardware test (RAM, MFP).
I'm still unsure of a few things:

  • An interrupt level 7 is basically a NMI, my system switches from ROM to RAM at the 8th clock, at the 9th clock if a NMI is pending the CPU will jump to an uninitialized vector! I must read the specs again but I think this could be a problem. Or not, if the system is int7 incapable (IPL2/0 or IPL1 permanently to 1) or has a gate enabling interrupts;
  • the MFP interrupt is physically enabled (i.e. connected to the CPU or gated by self for example)? (see point above), how does gcc link to interrupts (newer gcc versions work well ex. AVR-gcc), how do I place the vectors in memory?;
  • I want to build a gdb-stub/rom monitor, will it handle the vector allocation/writing? If so, my operating system (loading from somewhere ROM or disk) will also be in supervisor mode? (and also handle these?);
  • Can/Should I implement some sort of memory protection (writes to first 1K-vectors and last 1K-SupervisorStack of RAM must be made in supervisor mode)?;
  • For the end project of a CP/M 68k what type of media do I use? Going back to floppies would be definitely cool but I'm sure I would need some sort of DMA as I don't think the 68000 is fast enough (and surely not at the current speed of 4MHz). With SD I'd use only a few I/O pins (from the MFP?) but some SD cards are only 3.3V and my system runs at 5V. Or I could use a Compact Flash card, most can work at 5V, and it is easy to get some old CF cards (64/128MB) or even a IBM microdrive I've found once here; I would need to build two 8bit ports (A output to control the drive, B for bidirectional data) and this is breadboard space...
  • I would also like to "upgrade" the logic circuits to one of the M4A5-32/32 I've build an adaptor for and change the DTACK circuit to actually drive the line when releasing the bus (until AS goes high).
Well for now that is a still a lot of work in progress, I doubt Spring and/or Summer will allow me more time but I'm trying to keep you posted.

4 comments:

david.schultz said...

Just stumbled on this blog so I hope this isn't too late...

The 4MHZ 68008 is more than fast enough to drive a floppy disk controller. I installed CP/M-68K onto a MEX68KECB many years ago and it used a 4MHz 68000. (At least it did till I doubled the clock speed.)

Getting CP/M-68K running isn't too hard and can be done with minimal tools. The trick is that there is a bare version of the BDOS on disk and all you have to do is patch a couple of addresses into it for your BIOS. Your BIOS can be dead simple. Once it is running you can then use the C compiler to build a better one.

J Silva said...

I David! Thanks for stopping by!
No, your not too late, although I've selected the SDCARD instead of the floppy (breadboard space more than technical).
I have stumbled upon a "mental block" and a new installation of linux... but I'll get back to it once I finish a few other (more simple) projects.
Thanks for the note!
JSilva

david.schultz said...

I was recently updating my simplified FAT code to add support for FAT32 and while I was at it I decided to update my SD code to handle SDHC. You can see the earlier version in the page I cobbled up for the SparkFun Logomatic.

http://home.earthlink.net/~schultdw/logOmatic/

I think that the code you are using is the same as used in the V2 Logomatic and I wasn't impressed with it. It uses a long out of date initialization method and the attempt at buffering doesn't work very well and shouldn't be in this code to begin with.

I dug out my CP/M-68K disks and after some effort I was able to get cmptools to read them. It has been 20 years since I last looked at them so they didn't do too bad.

J Silva said...

Hi again David,
thanks for the link, indeed I'm using normal (SD) access routines (those were the ones I tried with the Arduino).
Unfortunately the project is on hold at the moment, I'm giving a big push to end some loose ends (the power supply for my SBC6120).
Maybe in it's next "life" the mini68K is a PCB... I'll have to think about it, it's too big to live on a breadboard.
Thanks,
JSilva