|
|
||
IntroductionThis tool kit allows in-application programming of the on-chip FLASH block on the Motorola 68HC908AZ32 single chip microcontrollers. In-application programming is required when field updates are necessary of programs contained in the on-chip FLASH. The version here is for the 68HC908AZ32 but to convert it to be used with the 68HC908GP32 is reasonably easy. The tricky bit is getting the C compiler and linker to accommodate the strange memory map required and that does not change! The initial programming of the device is carried out using the special monitor mode and tools from Motorola, HiWARE and Cosmic permit this. However in the field, the monitor mode is not suitable and the application already programmed into the device needs to be able to receive a new version of itself and program it into FLASH. This requires some special tricks as the FLASH programming code itself must be run from the 68HC908GP32's internal RAM area. To allow this, the application must store an image of the program high up in the FLASH ROM and then copy the relevant FLASH programming parts into the RAM. There is no direct support in any HC08
compiler/linker for these kinds of techniques so Hitex has developed
a simple example that shows how it can be done. The example program is in two parts: (i) A main application, beginning at 0x8000.
This is the user's real HC08 application. A trick is used to build the FLASH programming routines. A separate program is built which locates the routines at their eventual run time address of 0xC0. This program is completely self-contained and is represented by a HEX file (FPROG.H86). # LINK COMMAND FILE FOR FLASH ROUTINES # Copyright (c) 1999 by HITEX UK LTD # +seg .text -b 0xc0 -n .text # program start address +seg .flash_code -b 0xc0 -n .text +seg .const -a .text # constants follow code +seg .bsct -b 0x50 -ib -m 0x48 # zero page start address +seg .data -b 0xA8 -ib # data start address +seg .uflashdata -b 0xB0 -ib +seg .iflashdata -b 0xb0 -ib flash.o c:/cx32/lib/libi.h08 # C library (if needed) c:/cx32/lib/libm.h08 # machine library +def __memory=@.bss # symbol used by library +def __stack=0x250 # stack pointer value A simple QBASIC program is then used to
convert it into a valid C array of 319 bytes in length. void copy_func_to_ram(unsigned short func_ptr, unsigned short length) { unsigned short i ; ta = (unsigned short)&program_FLASH_row
; ((unsigned char *) ta)[i]
= *(unsigned char *) func_ptr++ ; To transmit a program to the FLASH, a simple
Visual Basic application is included. This will send your Intel
Hexfile to the HC08's UART (SCI) and blow it into the FLASH.
Note: We regret that as this was originally written for our own internal use, it is not an official Hitex product, we cannot provide our usual level of technical support, although we will try to answer queries via email! Hitex cannot be held resposible for the consequences arising from the deployment of this tool. |
||
| View The README file for the programmer that explains the installation procedure | ||
| Download The Programmer Utility | ||