NEWS
2007-12-10
hc12mem has been renamed to hcs12mem, see the hcs12mem page.
This page is obsolete now.
2007-04-10
- version 1.3.2 available, see below, section "changes" for what's new (short: fixed bug in setting extended speed for new PODEX version using ATTINY2313)
2006-02-08
- version 1.3.1 available, see below, section "changes"
for what's new (small improvements and bug fixes)
- project moved onto
SourceForge,
all SourceForge development support is available
2005-12-16
version 1.3 available, see below, section "changes" for what's new (short: added support for TBDML and long options under Windows).
2005-11-25
hc12mem added to "official" FreeBSD's ports tree, so one can install it from packages or ports.
2005-11-23
version 1.2 available, see below, section "changes" for what's new.
SourceForge project page
http://sourceforge.net/projects/hc12mem - on this page all development support for hc12mem is available: cvs, lists, forum, downloads, etc.
General information
hc12mem is command line tool for operating on internal HC12/S12 MCU memories - EEPROM and FLASH. It can:
- load any program into HC12 RAM and execute it
- erase, read, write EEPROM, set EEPROM protection
- erase, read, write FLASH
- secure/unsecure MCU
hc12mem is free, open source software, released under GPL license. It can run under FreeBSD, GNU/linux, other unix-like systems, and MS Windows (as native win32 binary, without cygwin).
Target connection
hc12mem can connect with target via BDM or serial port. First type of connection - BDM requires usege of special interface device, called BDM POD. Connection via serial port requires presence of Freescale's LRAE serial bootloader or serial monitor in target device.
BDM POD
The following types of BDM POD are supported:
- Marek Peca's PODEX,
- my own improved version of PODEX with some firmware bugfixes,
- Kevin Ross's BDM12 POD,
- Daniel Malik's TBDML (Turbo BDM Light) USB POD.
hc12mem is designed in modular fashion, and is very easy to add support for any other POD. Code for accessing POD is separated under strictly defined interface.
LRAE serial bootloader
LRAE is Freescale's serial bootloader (LRAE: Load RAM And Execute). It's documented in Application Note AN2546, and available for many HCS12 MCUs as ready to use S-record file (Freescale www login required). hc12mem currently can use LRAE to erase, read and write target FLASH memory. Using LRAE in target requires some special layout of code - read AN2546. It's also somewhat tricky to use LRAE when your program is started by LRAE, because it doesn't support any run/load switch, so you have to implement it in your code, and enter LRAE on request to load new code.
Freescale's serial monitor
hc12mem supports Freescale's serial monitor. It's documented in Application Note AN2548, and available for many HCS12 MCUs. This monitor uses serial port connection (SCI0 on target hardware). Prior to all operations, presence of serial monitor is required in target's FLASH memory. Monitor is available for a wide selection of HCS12 MCUs. My port of the source code of monitor to GNU tools is available too.
hc12mem with cooperation of serial monitor can: read,write,erase,protect EEPROM; erase,read,write FLASH; reset the target. Securing/unsecuring MCU is not supported.
Supported MCUs (targets)
Although name says hc12, currently it works only for HCS12 MCUs.
hc12mem utilizes target description files for various targets. Almost every HCS12 derivative is supported, althouhg not all are tested. Especially ones with multiple FLASH blocks were not tested yet. Current list of devices: <MC9S12> A32, A64, A128, A256, A512, C32, C64, C96, C128, GC16, GC32, GC64, GC96, GC128, D32, D64, D128, D256, D512, E32, E64, E128, E256, H128, H256, UF32, NE64.
Every supported MCU has it's own "target description file", and accompanying "target agents" - small pieces of HC12 code that gets loaded into targat RAM to perform some operations. Source code for target agents is included inside distribution file.
Download
Current version
-
UNIX:
hc12mem-1.3.1.tar.gz -
Windows:
hc12mem-1.3.1.zip
Available also from SourceForge file release system.
Previous versions
-
UNIX:
hc12mem-1.3.2.tar.gz
hc12mem-1.3.1.tar.gz
hc12mem-1.3.tar.gz
hc12mem-1.2.tar.gz
hc12mem-1.1.tar.gz
hc12mem-1.0.tar.gz -
Windows:
hc12mem-1.3.2.zip
hc12mem-1.3.1.zip
hc12mem-1.3.zip
hc12mem-1.2.zip
hc12mem-1.1.zip
hc12mem-1.0.zip
Installation
UNIX
Under FreeBSD, you usually have to substitute make with gmake, because make under BSDs is different from GNU make, and this package requires GNU make.
tar xzf hc12mem-x.y.z.tar.gz cd hc12mem-x.y.z ./configure make su make install
MS Windows
Unzip hc12mem-x.y.z-win32zip file to directory of your choice. Add this directory to $PATH, or specify full path to hc12mem.exe when calling.
Downloadable zip file is compiled binary only. If you're interested in source code for Windows, please get tar.gz file for unix platform, it contains common source code for all platforms. There's workspace file for MS Visual Studio in top directory.
TBDML via USB
If you plan to use TBDML, you need to install libusb for USB bus access. For MS Windows, you can get this in driver form dedicated for TBDML from download section of www.freegeeks.org. For unixes, just install libusb from packages available for your system, or from sources, available from libusb.sourceforge.net.
Usage
More details: hc12mem man page.
After installation undex UNIX, you get man page describing all the options
and usage examples. Just man hc12mem and read it. Also calling
with -h or --help shows usage help. Under Windows, you get hc12mem.html file
with this manual page contents.
Changes
version 1.3.2 (2007-04-10)
- bug fix: proper setting of extended speed (other than 1/2/4/8MHz) for new PODEX version using ATTINY2313
version 1.3.1 (2006-02-08)
- relaxed timing for PODEX - handshake timeout increased, because on slower computers or even with heavy task switching timeouts happened
- bug fix: FPROT was read directly from memory, thus when the MCU was secured, false readouts occured - now it is accessed via register, with proper FLASH bank selection
- bug fix: bits of FPROT were misinterpreted, depending on bits pattern
- non-programmed FLASH area detection has changed block threshold size from 2 to 4 bytes, so less non-contiguous blocks are reported (2 bytes of 0xff were quite common in the code)
version 1.3 (2005-12-16)
- support for Daniel Malik's TBDML - Turbo BDM Light USB POD
bulk USB transfers with TBDML are also supported, although not by default, because they are violating USB specification. To activate them, --tbdml-bulk option is required, giving faster data transfer rates (works under FreeBSD and MS Windows, linux rejects it, but Your Mileage May Vary) - more improvements to reporting FLASH address ranges to program
- long options supported on MS Windows
- some minor bugfixes affecting all interfaces, so users of previous versions should upgrade even if new functionality is of no importance
version 1.2 (2005-11-23)
- support for Freescale's serial monitor - Application Note AN2548,
using this monitor, hc12mem can:
- erase,read,write,protect EEPROM
- erase,read,write FLASH
- reset target
- no support for securing/unsecuring whole MCU
- detailed report for FLASH writing with list of address ranges defined for programming
- improved FLASH writing logic - skipping empty areas even if defined in S-record file
version 1.1 (2005-11-17)
- support for Freescale's LRAE (Load RAM And Execute) bootloader, see Application Note AN2546 from Freescale. LRAE currently can erase, read and write FLASH memory, with option to leave or erase LRAE itself
- support for much more chips - almost every HCS12 MCU is supported, but not all are tested, though. Especially parts with multiple FLASH blocks were not tested yet
- resolved some problems with serial port timing under unix systems
- changed option -V for --verify into -v
- included S-record files for target loadable RAM agents, so no more requirement for GNU gcc for hc11/12 for installation from sources
version 1.0 (2005-11-08)
- first version released
- support for Kevin Ross's BDM12 POD, Marek Peca's PODEX and my own improved version of PODEX
- supported targets: MC9S12A64, MC9S12NE64
- tested under FreeBSD, GNU/linux and MS Windows