This acticle is about using GCC generate code for the HCS12 Microprocessor. To do this, a modified version of the GNU Development Tools are used (gcc, gdb, ld, etc...)

= Installing GNU HC11/HC12=

Ubuntu Linux

In Ubuntu Linux, use Synaptic to install the packages <tt>gcc-m68hc1x</tt>, <tt>gdb-m68hc1x</tt>, and <tt>binutils-m68hc1x</tt>.

Windows

Using GCC with the HCS12

Memory Layout (Memory Map)

The 1st 16 KB (0x0000 to 0x3FFF) is left undefined. The 2nd 16 KB (0x4000 to 0x7FFF) can be a fixed page, or left undefined. The 3rd 16 KB (0x8000 to 0xBFFF) is the page window. The 4th 16 KB (0xC000 to 0xFFFF) is a fixed page.

The register section, EEPROM, and flash memory can be arranged in the HCS12's memory range using registers. If the chip is running in expanded mode, external memory (i.e. RAM) is used when an address is not defined by these blocked.

Registers

This memory segment represents the memory addresses which the system registers can be accessed. Typically this starts at 0x0000.

EEPROM

What is EEPROM?

EEPROM (Electronically Erasable Programable Read Only Memory) is a volatile form of memory, meaning that it will retain the values it stored even when power is removed. It is possible to "erase" the contents of EEPROM, allowing it to be programmed again. Some of the HCS12 chips have a small amount of EEPROM built in. (At most 4 KB.)

Flash

What Is Flash?

Flash is a form of EEPROM, but it erased in sectors.

Interrupts

Interrupts are subroutines which are called outside of the program's normal flow of execution, thereby interrupting it.

Creating an Interrupt Handler

Interrupt Vector Table

Paging Memory

At any time, only 64 KB of memory is addressable. Paging allow the ability to change a "window" (from 0x8000 to 0xBFFF) of this addressable memory to multiple memory segments, allowing a larger amount of memory to be accessed overall.

Only one page can be loaded at a time. The contents of a page will not be lost when they are paged out, all that is needed to access the data stored there is to return to that page.

Paging allows for larger programs to be flashed on board the chip, which can then be used for self booting. The instructions call and rtc are used to call a subroutine that could be located on another page. Specifically, call will switch to the new page and jump to the appropriate address within the page. The instruction rtc will restore the page from which call was executed.

Links

GNU m6811 pagehttp://www.gnu-m68hc11.org/

HCS12 and gcc (last modified 2007-02-22 18:30:29)