• Why and how

    jaromir.sukuba09/19/2016 at 06:52 0 comments

    As I stated in my project description, this project is perhaps not very useful for wide audience, though important to me, from nostalgic reasons. HC08 are dead by stupid Freescale's marketing decision, now after NXP merger it is even more dead and the only reason I'm doing this is my stock of HC08 devices as well as my memories of old days when all you needed (and actually had) to get MCU going was serial port, assembler and datasheet.

    The HC08 was based on MC6805 MCU and it was based on MC6800 CPU, touching back to 70's. It keeps its "as small amount of registers as possible" architecture, familiar to 6502 users too and Von-Neumann memory arrangement, meaning RAM and FLASH in the same memory area, meaning you can execute from RAM and read "variables" from FLASH. The latter specifics was heavily used by the loading mechanism and so-called monitor mode.

    By applying higher-than-usual voltage on IRQ pin the MCU listens to chosen pin to serial commands, allowng user to write/read memory and run the program, either from RAM or FLASH. To program the binary into FLASH, you load it into piece of RAM, the write fragment of executable to write the data from RAM to FLASH and execute the latter fragment to do the desired action. Sounds convoluted - and it gets worse than that, in reality :-)

    I started exploring how the loading mechanism works with project bl08 from Kustaa Nyholm http://www.sparetimelabs.com/bl08/bl08.php and somehow upgraded it to support most of HC08 MCUs from my stock https://github.com/jaromir-sukuba/bl08

    This is starting point to MCU implementation, as the original had one major flaw - it relied on break signal generated from serial/USB converter, which doesn't always fit the HC08 expectations. I went the "just throw MCU for low-level system, the rest is just programming" route.

    Currently I have device able to program, read and run binaries in MC68HC908KX2 MCU, using simple ASCII interaction with user, as I did it for my #PIC89PROG project. The beauty of this simple interface is that you can use it with no other software than serial terminal, on your Windows or Linux machine, or Altair8800.

    Running from Cutecom in Linux - or Bray terminal in Windows.

    This session shows entering programming mode and reading FLASH and RAM of the MCU, and letting the program to continue running. Peeking at internal RAM is useful as application debugger too.

    Flashing blink a LED binary compiled by SDCC (yes, there is free C compiler for HC08) and loading via hc08prog...

    The LED blinks, yay!

    More details to come.