summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2006-05-27 13:53:15 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2006-05-27 13:53:15 +0000
commita7f6db4b7c409c54c0ea34bf1908ea08ea2219d6 (patch)
treeba5acee62104c87ebe4ae18818b53e0997ca7af0
parentd7dbc0659d07553731bf22aa298adcf5e5e7774d (diff)
downloadfreertos-a7f6db4b7c409c54c0ea34bf1908ea08ea2219d6.tar.gz
freertos-a7f6db4b7c409c54c0ea34bf1908ea08ea2219d6.tar.bz2
freertos-a7f6db4b7c409c54c0ea34bf1908ea08ea2219d6.tar.xz
New demo files for HCS12 GCC port.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@6 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
-rw-r--r--Demo/HCS12_GCC_banked/FreeRTOSConfig.h92
-rw-r--r--Demo/HCS12_GCC_banked/Makefile64
-rw-r--r--Demo/HCS12_GCC_banked/PE_Error.h53
-rw-r--r--Demo/HCS12_GCC_banked/ParTest.c78
-rw-r--r--Demo/HCS12_GCC_banked/README.txt85
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/exit.h43
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/interrupts.h41
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/param.h47
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts-dp256.h197
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts.h54
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/param.h99
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/ports.h192
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/ports_def.h666
-rw-r--r--Demo/HCS12_GCC_banked/asm-m68hcs12/sio.h81
-rw-r--r--Demo/HCS12_GCC_banked/cpu.h39
-rw-r--r--Demo/HCS12_GCC_banked/gelfunc.c25
-rw-r--r--Demo/HCS12_GCC_banked/ldscript-rtos.x266
-rw-r--r--Demo/HCS12_GCC_banked/main.c291
-rw-r--r--Demo/HCS12_GCC_banked/memory.x63
-rw-r--r--Demo/HCS12_GCC_banked/sci.c75
-rw-r--r--Demo/HCS12_GCC_banked/sci.h34
-rw-r--r--Demo/HCS12_GCC_banked/serial.c150
-rw-r--r--Demo/HCS12_GCC_banked/startup.c86
-rw-r--r--Demo/HCS12_GCC_banked/sys/interrupts.h73
-rw-r--r--Demo/HCS12_GCC_banked/sys/param.h56
-rw-r--r--Demo/HCS12_GCC_banked/sys/ports.h69
-rw-r--r--Demo/HCS12_GCC_banked/sys/ports_def.h36
-rw-r--r--Demo/HCS12_GCC_banked/sys/sio.h80
-rw-r--r--Demo/HCS12_GCC_banked/vectors.c115
29 files changed, 3250 insertions, 0 deletions
diff --git a/Demo/HCS12_GCC_banked/FreeRTOSConfig.h b/Demo/HCS12_GCC_banked/FreeRTOSConfig.h
new file mode 100644
index 00000000..03c66915
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/FreeRTOSConfig.h
@@ -0,0 +1,92 @@
+/*
+ FreeRTOS V3.2.3 - Copyright (C) 2003-2005 Richard Barry.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ See http://www.FreeRTOS.org for documentation, latest information, license
+ and contact details. Please ensure to read the configuration and relevant
+ port sections of the online documentation.
+ ***************************************************************************
+*/
+
+/**
+ * FreeRTOSConfig.h configures FreeRTOS for GCC/HCS12 version of FreeRTOS Demo
+ *
+ * Modified by Jefferson L Smith, Robotronics Inc.
+ */
+
+#ifndef FREERTOS_CONFIG_H
+#define FREERTOS_CONFIG_H
+
+/* This port requires the compiler to generate code for the BANKED memory
+model. */
+#define BANKED_MODEL
+
+/*-----------------------------------------------------------
+ * Application specific definitions.
+ *
+ * These definitions should be adjusted for your particular hardware and
+ * application requirements.
+ *
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
+ *----------------------------------------------------------*/
+
+#define configUSE_PREEMPTION 1
+#define configUSE_IDLE_HOOK 1
+#define configUSE_TICK_HOOK 0
+#define configTICK_RATE_HZ ( ( portTickType ) 977 )
+#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
+#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 300/*128*/ )
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10752 ) )
+#define configMAX_TASK_NAME_LEN ( 3 )
+#define configUSE_TRACE_FACILITY 0
+#define configUSE_16_BIT_TICKS 1
+#define configIDLE_SHOULD_YIELD 1
+
+/* Co-routine definitions. */
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
+
+/* This parameter is normally affects the clock frequency. In this port, at the moment
+it might just be used for reference. */
+
+#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 24000000 )
+
+/* Set the following definitions to 1 to include the API function, or zero
+to exclude the API function. */
+
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskCleanUpResources 0
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+
+
+
+
+
+#endif /* FREERTOS_CONFIG_H */
diff --git a/Demo/HCS12_GCC_banked/Makefile b/Demo/HCS12_GCC_banked/Makefile
new file mode 100644
index 00000000..4d19f27c
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/Makefile
@@ -0,0 +1,64 @@
+# Demo for GCC/HCS12 port of FreeRTOS
+# Author Jefferson Smith
+#
+SRCDIR=../..
+RTOS_BASEDIR=$(SRCDIR)/Source
+
+# what board to compile for
+TARGET_BOARD ?= dragon12-rom
+CPU=m68hcs12
+
+DEVC_PREFIX=m6811-elf-
+CC=$(DEVC_PREFIX)gcc
+AS=$(DEVC_PREFIX)as
+AR=$(DEVC_PREFIX)ar
+OBJCOPY=$(DEVC_PREFIX)objcopy
+OBJDUMP=$(DEVC_PREFIX)objdump
+
+CPPFLAGS+=-I. -I./asm-$(CPU)/arch-dragon12 -I../Common/include \
+ -I$(RTOS_BASEDIR)/include -DGCC_HCS12 -DM6812_DEF_SCI=1 -DPORT_LED=M6811_PORTB
+
+CFLAGS+=-$(CPU) -mshort -mlong-calls -g -Os -Wall -Wmissing-prototypes \
+ -Wno-char-subscripts -fomit-frame-pointer -msoft-reg-count=0 -mauto-incdec
+#-Os -fomit-frame-pointer
+
+LDFLAGS+=-$(CPU) -mshort -mlong-calls -Wl,-T,ldscript-rtos.x
+
+OBJCOPY_FLAGS=--srec-len=0x20 --change-addresses 0xffff0000
+
+CSRCS=main.c startup.c vectors.c serial.c sci.c ParTest.c gelfunc.c \
+ ../Common/Minimal/flash.c \
+ ../Common/Minimal/dynamic.c \
+ ../Common/Minimal/BlockQ.c \
+ ../Common/Minimal/PollQ.c \
+ ../Common/Minimal/comtest.c \
+ ../Common/Minimal/integer.c \
+ ../Common/Minimal/death.c \
+
+RTOS_OBJS = $(RTOS_BASEDIR)/portable/GCC/HCS12/port.c \
+ $(RTOS_BASEDIR)/portable/MemMang/heap_2.c \
+ $(RTOS_BASEDIR)/list.c \
+ $(RTOS_BASEDIR)/tasks.c \
+ $(RTOS_BASEDIR)/queue.c
+
+OBJS=$(CSRCS:.c=.o) $(RTOS_OBJS:.c=.o)
+
+#
+# *.elf for the simulator and gdb
+# *.s19 is original S Records from ld
+# *.s2 is S2 Records (from SRecCvt.exe)
+#
+all:: main.elf main.lst main.s19
+
+main.elf: $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $^ -lc -lbcc -lc
+
+%.lst: %.elf
+ $(OBJDUMP) -htS $< >$@
+
+%.s19: %.elf
+ $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
+
+clean::
+ $(RM) $(OBJS) *.elf *.s19
+
diff --git a/Demo/HCS12_GCC_banked/PE_Error.h b/Demo/HCS12_GCC_banked/PE_Error.h
new file mode 100644
index 00000000..bc1ca1a5
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/PE_Error.h
@@ -0,0 +1,53 @@
+/** ###################################################################
+** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
+** Filename : PE_Error.H
+** Project : RTOSDemo
+** Processor : MC9S12DP256BCPV
+** Beantype : PE_Error
+** Version : Driver 01.00
+** Compiler : Metrowerks HC12 C Compiler
+** Date/Time : 13/06/2005, 20:14
+** Abstract :
+** This bean "PE_Error" contains internal definitions
+** of the error constants.
+** Settings :
+** Contents :
+** No public methods
+**
+** (c) Copyright UNIS, spol. s r.o. 1997-2002
+** UNIS, spol. s r.o.
+** Jundrovska 33
+** 624 00 Brno
+** Czech Republic
+** http : www.processorexpert.com
+** mail : info@processorexpert.com
+** ###################################################################*/
+
+#ifndef __PE_Error_H
+#define __PE_Error_H
+
+#define ERR_OK 0 /* OK */
+#define ERR_SPEED 1 /* This device does not work in the active speed mode. */
+#define ERR_RANGE 2 /* Parameter out of range. */
+#define ERR_VALUE 3 /* Parameter of incorrect value. */
+#define ERR_OVERFLOW 4 /* Timer overflow. */
+#define ERR_MATH 5 /* Overflow during evaluation. */
+#define ERR_ENABLED 6 /* Device is enabled. */
+#define ERR_DISABLED 7 /* Device is disabled. */
+#define ERR_BUSY 8 /* Device is busy. */
+#define ERR_NOTAVAIL 9 /* Requested value or method not available. */
+#define ERR_RXEMPTY 10 /* No data in receiver. */
+#define ERR_TXFULL 11 /* Transmitter is full. */
+#define ERR_BUSOFF 12 /* Bus not available. */
+#define ERR_OVERRUN 13 /* Overrun error is detected. */
+#define ERR_FRAMING 14 /* Framing error is detected. */
+#define ERR_PARITY 15 /* Parity error is detected. */
+#define ERR_NOISE 16 /* Noise error is detected. */
+#define ERR_IDLE 17 /* Idle error is detectes. */
+#define ERR_FAULT 18 /* Fault error is detected. */
+#define ERR_BREAK 19 /* Break char is received during communication. */
+#define ERR_CRC 20 /* CRC error is detected. */
+#define ERR_ARBITR 21 /* A node losts arbitration. This error occurs if two nodes start transmission at the same time. */
+#define ERR_PROTECT 22 /* Protection error is detected. */
+
+#endif //__PE_Error_H
diff --git a/Demo/HCS12_GCC_banked/ParTest.c b/Demo/HCS12_GCC_banked/ParTest.c
new file mode 100644
index 00000000..4521014c
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/ParTest.c
@@ -0,0 +1,78 @@
+/*
+ FreeRTOS V3.2.3 - Copyright (C) 2003-2005 Richard Barry.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ See http://www.FreeRTOS.org for documentation, latest information, license
+ and contact details. Please ensure to read the configuration and relevant
+ port sections of the online documentation.
+ ***************************************************************************
+*/
+
+/**
+ * ParTest.c controls bits (LEDs) for GCC/HCS12 version of FreeRTOS Demo
+ *
+ * Modified from CodeWarrior/HCS12 by Jefferson L Smith, Robotronics Inc.
+ */
+
+#include <sys/ports.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "portable.h"
+
+/* Demo application include files. */
+#include "partest.h"
+
+#define LEDIO PORTIO_8(PORT_LED)
+
+/*-----------------------------------------------------------
+ * Simple parallel port IO routines.
+ *-----------------------------------------------------------*/
+
+void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
+{
+ /* This function is required as it is called from the standard demo
+ application files. It manipulates a bit to control one LED. */
+ portENTER_CRITICAL();
+
+ if (xValue) { /* Is it one to be written? */
+ LEDIO |= (1<<uxLED); /* Set appropriate bit on port */
+ }
+ else { /* Is it zero to be written? */
+ LEDIO &= ~(1<<uxLED); /* Clear appropriate bit on port */
+ }
+ portEXIT_CRITICAL();
+}
+/*-----------------------------------------------------------*/
+
+void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
+{
+ /* This function is required as it is called from the standard demo
+ application files. It manipulates a bit to control one LED. */
+ portENTER_CRITICAL();
+ LEDIO ^= (1<<uxLED); /* Invert appropriate bit on port */
+ portEXIT_CRITICAL();
+}
+
diff --git a/Demo/HCS12_GCC_banked/README.txt b/Demo/HCS12_GCC_banked/README.txt
new file mode 100644
index 00000000..87415958
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/README.txt
@@ -0,0 +1,85 @@
+##-------------------------------------------------------------------
+## Readme.txt
+##
+## FreeRTOS Port Example for GCC/HCS12, called "Demo/HCS12_GCC_banked"
+## Author Jefferson L Smith
+##
+##-------------------------------------------------------------------
+This project stationery is designed to get you up and running quickly with GCC for MC9S12.
+
+This port is tested with the development board Dragon12 (http://www.evbplus.com/ ).
+
+This GCC release has been tested:
+ gnu-m68hc1x 3.1 from http://m68hc11.serveftp.org/
+
+The following folders are derived from GEL 1.6 (http://gel.sourceforge.net/ ):
+- sys: starting point for GEL system includes
+- asm-m68hcs12: specific 9S12 support, mostly referenced by sys
+
+The demo was partially derived from Demo HCS12_CodeWarrior_banked.
+
+
+##------------------------------------------------------------------------
+## Getting Started
+##------------------------------------------------------------------------
+
+---
+The COM (SCI) port to use can be changed in the Makefile. Change this parameter in
+CPPFLAGS: -DM6812_DEF_SCI=1
+0 uses SCI0
+1 uses SCI1
+
+---
+The LED port address can be changed in the Makefile. Change this parameter in
+CPPFLAGS: -DPORT_LED=M6811_PORTB
+
+The known ports are: M6811_PORTA, M6811_PORTB, M6811_PTT, M6811_PTP, M6811_PTM, and M6811_PTH. Any other port address could be used.
+
+If a known port (above) is used, "startup.c" will initialize the correct port. If any other port is used (by typing the port address), it will need to be manually configured as outputs.
+
+
+##------------------------------------------------------------------------
+## Memory Banks (PPAGE)
+##------------------------------------------------------------------------
+
+---
+HCS12_GCC_banked uses two methods of placing certain code/data into PPAGE banks. The simple way is to edit each function's prototype or definition with an attribute macro ATTR_BANKn as defined in "cpu.h". Replace the 'n' with the number of the bank [0..13].
+
+Also see "memory.x" sections .bank2 and .bank3 for examples of linking .text and .rodata of a specific ".o" object file into a specific bank.
+
+
+##------------------------------------------------------------------------
+## Technical Issues
+##------------------------------------------------------------------------
+
+---
+Passing a function pointer to vCreateTasks() does not include the PPAGE value. The result is that it's stack is initialized with PPAGE 0x30. That is not a problem because GCC generates a "trampoline" routine in unbanked memory which will bounce to the far address of the target function. The 16-bit function pointer passed is actually pointing to that trampoline. The trampoline would only be called once--when starting the task.
+
+---
+Here are three aspects to consider when defining ISR:
+
+1. The ISR might be simple enough to not generate header code such as saving _.frame and has no local variables. This type can be defined as a normal routine (no interrupt attribute) or "naked" if it were implemented in this GCC. IMPORTANT: Use these special port macros defined in "portmacro.h". They go at the beginning and end of the function:
+
+portISR_HEAD() First line of the ISR
+portISR_TAIL() Last line of the ISR
+
+This ensures all the needed softregs (pseudo CPU registers) are saved on the stack in case of a task swap within the ISR. Because this sets up the stack for a task swap, portTASK_SWITCH_FROM_ISR() could also be used in the ISR to save time and stack space.
+
+2. The ISR may have one or more local variables. Define it using the interrupt attribute. The special portTASK_SWITCH_FROM_ISR() won't work. If a task is awakened within this ISR, use taskYIELD() which completely saves the appropriate softregs again and uses more stack.
+
+3. Writing an ISR in assembly avoids the challenges with compiler-generated code. The steps would have to execute the way they execute in the C ISR.
+
+---
+If editing "startup.c", note that the function __premain() executes before global variables are initialized, and before the BSS section is cleared. So using any global variables may have unexpected results.
+
+---
+If you need to use other softregs, edit "portmacro.h" and "port.c" to save/restore them For example _.d1, _.d2, enabled by "-msoft-reg-count=2" on gcc commandline.
+
+This port expects "-msoft-reg-count=0". This might be the gcc default, but is specified to be certain.
+
+
+##------------------------------------------------------------------------
+## TODO
+##------------------------------------------------------------------------
+
+---
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/exit.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/exit.h
new file mode 100644
index 00000000..c0ca2f93
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/exit.h
@@ -0,0 +1,43 @@
+/* exit.h - Dragon12 development board
+ Copyright (C) 2004 Robotronics, Inc.
+ Author Jefferson Smith, Robotronics
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC12_ARCH_DRAGON12_EXIT_H
+#define _M68HC12_ARCH_DRAGON12_EXIT_H
+
+extern void _exit (short status) __attribute__((noreturn));
+
+/* For Dbug monitor, use swi to enter in the monitor upon exit. */
+extern inline void
+_exit (short status)
+{
+ while (1) {
+ __asm__ __volatile__ ("bgnd" : : );
+ __asm__ __volatile__ ("swi" : : "d"(status));
+ }
+}
+
+#endif
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/interrupts.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/interrupts.h
new file mode 100644
index 00000000..d37a6fec
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/interrupts.h
@@ -0,0 +1,41 @@
+/* interrupts.h - Register interrupt vectors (if ram based)
+ Copyright (C) 2004 Robotronics, Inc.
+ Author Jefferson Smith, Robotronics
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC12_ARCH_DRAGON12_INTERRUPTS_H
+#define _M68HC12_ARCH_DRAGON12_INTERRUPTS_H
+
+#define USE_INTERRUPT_TABLE
+
+/* Only for RAM target. Initializes an interrupt handler vector. */
+extern inline void
+set_interrupt_handler (interrupt_vector_id id ATTRIBUTE_UNUSED,
+ interrupt_t handler ATTRIBUTE_UNUSED)
+{
+ _vectors_addr[id] = handler;
+}
+
+#endif /* _M68HC12_ARCH_DRAGON12_INTERRUPTS_H */
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/param.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/param.h
new file mode 100644
index 00000000..64cb0ddf
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/arch-dragon12/arch/param.h
@@ -0,0 +1,47 @@
+/* param.h - Dragon12 development board
+ Copyright (C) 2004 Robotronics, Inc.
+ Author Jefferson Smith, Robotronics
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68S12_ARCH_DRAGON12_PARAM_H
+#define _M68S12_ARCH_DRAGON12_PARAM_H
+
+/* Wytec Dragon12 board definitions. */
+#define DRAGON12
+
+/* An application can use these to determine resources of MCU. --jeffs */
+#undef RAM_SIZE
+#define RAM_SIZE (12*1024) /* Kb of ram */
+
+#undef ROM_SIZE
+#define ROM_SIZE (256*1024) /* Kb read-only */
+
+#undef DATA_SIZE
+#define DATA_SIZE RAM_SIZE /* Data section size. */
+
+#undef TEXT_SIZE
+#define TEXT_SIZE ROM_SIZE /* Text section size. */
+
+#endif
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts-dp256.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts-dp256.h
new file mode 100644
index 00000000..bd04b745
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts-dp256.h
@@ -0,0 +1,197 @@
+/* Interrupt Vectors defined
+ Copyright (C) 2004 Robotronics, Inc.
+ Author Jefferson Smith, Robotronics
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC12_ASM_INTERRUPTS_DP256_H
+#define _M68HC12_ASM_INTERRUPTS_DP256_H
+
+/** Interrupt vectors as a struct. */
+struct interrupt_vectors
+{
+ interrupt_t res0_handler; /* 0x80 */
+ interrupt_t res1_handler; /* 0x82 */
+ interrupt_t res2_handler; /* 0x84 */
+ interrupt_t res3_handler; /* 0x86 */
+ interrupt_t res4_handler; /* 0x88 */
+ interrupt_t res5_handler; /* 0x8a */
+ interrupt_t pwm_shutdown_handler; /* 0x8c */
+ interrupt_t ptpif_handler;
+
+ /** Controller Area Networking */
+ interrupt_t can4_tx_handler;
+ interrupt_t can4_rx_handler;
+ interrupt_t can4_err_handler;
+ interrupt_t can4_wake_handler;
+ interrupt_t can3_tx_handler;
+ interrupt_t can3_rx_handler;
+ interrupt_t can3_err_handler;
+ interrupt_t can3_wake_handler;
+ interrupt_t can2_tx_handler;
+ interrupt_t can2_rx_handler;
+ interrupt_t can2_err_handler;
+ interrupt_t can2_wake_handler;
+ interrupt_t can1_tx_handler;
+ interrupt_t can1_rx_handler;
+ interrupt_t can1_err_handler;
+ interrupt_t can1_wake_handler;
+ interrupt_t can0_tx_handler;
+ interrupt_t can0_rx_handler;
+ interrupt_t can0_err_handler;
+ interrupt_t can0_wake_handler;
+
+ interrupt_t flash_handler;
+ interrupt_t eeprom_handler;
+ interrupt_t spi2_handler;
+ interrupt_t spi1_handler;
+ interrupt_t iic_handler;
+ interrupt_t bdlc_handler;
+ interrupt_t selfclk_mode_handler;
+ interrupt_t pll_lock_handler;
+ interrupt_t accb_overflow_handler;
+ interrupt_t mccnt_underflow_handler;
+ interrupt_t pthif_handler;
+ interrupt_t ptjif_handler;
+ interrupt_t atd1_handler;
+ interrupt_t atd0_handler;
+ interrupt_t sci1_handler;
+ interrupt_t sci0_handler;
+ interrupt_t spi0_handler;
+
+ /** Timer and Accumulator */
+ interrupt_t acca_input_handler;
+ interrupt_t acca_overflow_handler;
+ interrupt_t timer_overflow_handler;
+
+ /** Input capture / Output compare Timers */
+ interrupt_t tc7_handler;
+ interrupt_t tc6_handler;
+ interrupt_t tc5_handler;
+ interrupt_t tc4_handler;
+ interrupt_t tc3_handler;
+ interrupt_t tc2_handler;
+ interrupt_t tc1_handler;
+ interrupt_t tc0_handler;
+
+ /** External Interrupts */
+ interrupt_t rtii_handler;
+ interrupt_t irq_handler;
+ interrupt_t xirq_handler;
+
+ /** Software Interrupt */
+ interrupt_t swi_handler;
+
+ /** Illegal Instruction Reset */
+ interrupt_t illegal_handler;
+
+ /** COP Timeout Reset */
+ interrupt_t cop_fail_handler;
+
+ /** Clock Monitor Fail Reset */
+ interrupt_t cop_clock_handler;
+
+ /** Start or Reset vector */
+ interrupt_t reset_handler;
+};
+typedef struct interrupt_vectors interrupt_vectors_t;
+
+/** Interrupt vector id. */
+enum interrupt_vector_id
+{
+ RES0_VECTOR = 0,
+ RES1_VECTOR,
+ RES2_VECTOR,
+ RES3_VECTOR,
+ RES4_VECTOR,
+ RES5_VECTOR,
+ PWM_SHUTDOWN_VECTOR,
+ PTPIF_VECTOR,
+ CAN4_TX_VECTOR,
+ CAN4_RX_VECTOR,
+ CAN4_ERR_VECTOR,
+ CAN4_WAKE_VECTOR,
+ CAN3_TX_VECTOR,
+ CAN3_RX_VECTOR,
+ CAN3_ERR_VECTOR,
+ CAN3_WAKE_VECTOR,
+ CAN2_TX_VECTOR,
+ CAN2_RX_VECTOR,
+ CAN2_ERR_VECTOR,
+ CAN2_WAKE_VECTOR,
+ CAN1_TX_VECTOR,
+ CAN1_RX_VECTOR,
+ CAN1_ERR_VECTOR,
+ CAN1_WAKE_VECTOR,
+ CAN0_TX_VECTOR,
+ CAN0_RX_VECTOR,
+ CAN0_ERR_VECTOR,
+ CAN0_WAKE_VECTOR,
+ FLASH_VECTOR,
+ EEPROM_VECTOR,
+ SPI2_VECTOR,
+ SPI1_VECTOR,
+ IIC_VECTOR,
+ BDLC_VECTOR,
+ SELFCLK_MODE_VECTOR,
+ PLL_LOCK_VECTOR,
+ ACCB_OVERFLOW_VECTOR,
+ MCCNT_UNDERFLOW_VECTOR,
+ PTHIF_VECTOR,
+ PTJIF_VECTOR,
+ ATD1_VECTOR,
+ ATD0_VECTOR,
+ SCI1_VECTOR,
+ SCI0_VECTOR,
+ SPI0_VECTOR,
+ ACCA_INPUT_VECTOR,
+ ACCA_OVERFLOW_VECTOR,
+ TIMER_OVERFLOW_VECTOR,
+ TC7_VECTOR,
+ TC6_VECTOR,
+ TC5_VECTOR,
+ TC4_VECTOR,
+ TC3_VECTOR,
+ TC2_VECTOR,
+ TC1_VECTOR,
+ TC0_VECTOR,
+ RTI_VECTOR,
+ IRQ_VECTOR,
+ XIRQ_VECTOR,
+ SWI_VECTOR,
+ ILLEGAL_OPCODE_VECTOR,
+ COP_FAIL_VECTOR,
+ COP_CLOCK_VECTOR,
+ RESET_VECTOR,
+ MAX_VECTORS
+};
+typedef enum interrupt_vector_id interrupt_vector_id;
+
+/** some backwards-compatible equivalents from HC11 */
+#define SCI_VECTOR SCI0_VECTOR
+#define SPI_VECTOR SPI0_VECTOR
+#define ACC_INPUT_VECTOR ACCA_INPUT_VECTOR
+#define ACC_OVERFLOW_VECTOR ACCA_OVERFLOW_VECTOR
+
+#endif /* _M68HC12_ASM_INTERRUPTS_DP256_H */
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts.h
new file mode 100644
index 00000000..10da15fc
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/interrupts.h
@@ -0,0 +1,54 @@
+/* Interrupt Vectors
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+ Modified; Jefferson Smith, Robotronics; for HC12/9S12
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC12_INTERRUPTS_H
+#define _M68HC12_INTERRUPTS_H
+
+/*! @defgroup interrupts Interrupts.
+
+ */
+/*@{*/
+
+/*! Interrupt handler prototype. */
+typedef void (* interrupt_t) (void);
+
+#ifdef mc68hcs12
+# include "interrupts-dp256.h"
+#endif
+
+/*! Interrupt vector table.
+
+ The interrupt vector table is in general located at `0xff80'
+ in memory. It is at the same address as the interrupt
+ vectors structure (alias). */
+extern interrupt_t _vectors_addr[MAX_VECTORS];
+
+extern interrupt_vectors_t _vectors __asm__("_vectors_addr");
+
+/*@}*/
+#endif /* _M68HC12_INTERRUPTS_H */
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/param.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/param.h
new file mode 100644
index 00000000..6a79e9fc
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/param.h
@@ -0,0 +1,99 @@
+/* param.h - Board specific parameters
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC11_PARAM_H
+#define _M68HC11_PARAM_H
+
+/**@name M68HC12 Board Parameters.
+
+ This section contains several '#define' to give configuration
+ characteristics of the target board. */
+/*@{*/
+
+/** CPU Clock frequency.
+
+ Define the frequency of the oscillator plugged on the processor.
+ The value is in hertz. */
+#ifndef M6811_CPU_CLOCK
+# define M6811_CPU_CLOCK (16e6L)
+#endif
+
+/** CPU E clock.
+
+ The E clock frequency. This frequency is used as the
+ basis for timer computation. The value is in hertz. */
+#ifndef M6811_CPU_E_CLOCK
+# define M6811_CPU_E_CLOCK (24e6L)
+#endif
+
+#ifndef M6812_REFCLOCK
+# define M6812_REFCLOCK M6811_CPU_CLOCK
+#endif
+
+#ifndef M6812_REFDVVAL
+# define M6812_REFDVVAL (M6811_CPU_CLOCK / M6812_REFCLOCK) - 1
+#endif
+
+#ifndef M6812_SYNRVAL
+#define M6812_SYNRVAL (M6811_CPU_E_CLOCK / M6812_REFCLOCK) - 1
+#endif
+
+/** SIO default baud rate.
+
+ Defines the default baud rate of the SIO. This value
+ is used to configure the BAUD register.
+ */
+#ifndef M6811_DEF_BAUD
+# define M6811_DEF_BAUD (unsigned short)(M6811_CPU_E_CLOCK / 16 / 9600)
+#endif
+
+/** Use the COP.
+
+ Define this if you are using the COP timer.
+ This activate the COP reset while polling and writing on
+ the serial line. */
+#ifndef M6811_USE_COP
+# define M6811_USE_COP 0
+#endif
+
+/** Timer prescaler value. */
+#ifndef M6811_DEF_TPR
+# define M6811_DEF_TPR 0
+#endif
+
+#ifndef M6811_DEF_RTR
+# define M6811_DEF_RTR 0
+#endif
+
+/** SCI default port. */
+#ifndef M6812_DEF_SCI
+# define M6812_DEF_SCI 0
+#endif
+
+/*@}*/
+
+#endif
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/ports.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/ports.h
new file mode 100644
index 00000000..543e7305
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/ports.h
@@ -0,0 +1,192 @@
+/* m68hc11/ports.h -- Definition of 68HC11 ports
+ Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@nerim.fr)
+
+ Modified by Jefferson L Smith, Robotronics Inc.
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this file; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC11_PORTS_H
+#define _M68HC11_PORTS_H
+
+#include "ports_def.h"
+
+/** Define default SCI port registers */
+#if defined(M6812_DEF_SCI)
+
+#if M6812_DEF_SCI==2
+# define SCI_BASE SCI2_BASE
+#elif M6812_DEF_SCI==1
+# define SCI_BASE SCI1_BASE
+#else /* default M6812_DEF_SCI==0 */
+# define SCI_BASE SCI0_BASE
+#endif /* default M6812_DEF_SCI==0 */
+
+#else /* M6812_DEF_SCI not defined */
+# define SCI_BASE SCI0_BASE
+#endif /* M6812_DEF_SCI */
+
+# define SCIBD PORTIO_16(SCI_BASE + _SCIBD)
+# define SCICR1 PORTIO_8(SCI_BASE + _SCICR1)
+# define SCICR2 PORTIO_8(SCI_BASE + _SCICR2)
+# define SCISR1 PORTIO_8(SCI_BASE + _SCISR1)
+# define SCISR2 PORTIO_8(SCI_BASE + _SCISR2)
+# define SCIDRL PORTIO_8(SCI_BASE + _SCIDRL)
+
+extern inline unsigned short
+get_timer_counter (void)
+{
+ return TCNT;
+}
+
+extern inline void
+set_timer_counter (unsigned short value)
+{
+ TCNT = value;
+}
+#if 0
+extern inline unsigned short
+get_input_capture_1 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0];
+}
+
+extern inline void
+set_input_capture_1 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TIC1_H])[0] = value;
+}
+
+extern inline unsigned short
+get_input_capture_2 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0];
+}
+
+extern inline void
+set_input_capture_2 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TIC2_H])[0] = value;
+}
+
+extern inline unsigned short
+get_input_capture_3 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0];
+}
+
+extern inline void
+set_input_capture_3 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TIC3_H])[0] = value;
+}
+
+/* Get output compare 16-bit register. */
+extern inline unsigned short
+get_output_compare_1 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0];
+}
+
+extern inline void
+set_output_compare_1 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TOC1_H])[0] = value;
+}
+
+extern inline unsigned short
+get_output_compare_2 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0];
+}
+
+extern inline void
+set_output_compare_2 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TOC2_H])[0] = value;
+}
+
+extern inline unsigned short
+get_output_compare_3 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0];
+}
+
+extern inline void
+set_output_compare_3 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TOC3_H])[0] = value;
+}
+
+extern inline unsigned short
+get_output_compare_4 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0];
+}
+
+extern inline void
+set_output_compare_4 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TOC4_H])[0] = value;
+}
+
+extern inline unsigned short
+get_output_compare_5 (void)
+{
+ return ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0];
+}
+
+extern inline void
+set_output_compare_5 (unsigned short value)
+{
+ ((unsigned volatile short*) &_io_ports[M6811_TOC5_H])[0] = value;
+}
+
+#endif
+
+/* Reset the COP. */
+extern inline void
+cop_reset (void)
+{
+ ARMCOP = 0x55;
+ ARMCOP = 0xAA;
+}
+
+extern inline void
+cop_optional_reset (void)
+{
+#if defined(M6811_USE_COP) && M6811_USE_COP == 1
+ cop_reset ();
+#endif
+}
+
+/* Acknowledge the timer interrupt. */
+extern inline void
+timer_acknowledge (void)
+{
+ CRGFLG = RTIF;
+}
+
+/* Initialize the timer. */
+extern inline void
+timer_initialize_rate (unsigned char divisor)
+{
+ RTICTL = divisor;
+}
+
+#endif /* _M68HC11_PORTS_H */
+
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/ports_def.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/ports_def.h
new file mode 100644
index 00000000..057c2112
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/ports_def.h
@@ -0,0 +1,666 @@
+/* IO DEFINITIONS AND MACROS FOR THE MCS912DG256B
+ 09/19/03
+ EMAC.inc
+ Nathan Z. Gustavson ngustavson@emacinc.com
+ Emac.inc
+ May 2005; Modified by Jefferson Smith for general use in GEL
+ */
+#ifndef _ARCH_IODG256B_H
+#define _ARCH_IODG256B_H
+
+#define IO_BASE 0
+/*macros
+*/
+#define ienable() __asm("cli");
+#define idisable() __asm("orcc #0x10")
+#define xenable() __asm("andcc #0xbf")
+#define xdisable()__asm("orcc #0x40")
+
+/* constant offsets to use where a C expression doesn't work
+*/
+#define M6811_PORTA 0x00
+#define M6811_PORTB 0x01
+#define M6811_PTT 0x240
+#define M6811_PTM 0x250
+#define M6811_PTP 0x258
+#define M6811_PTH 0x260
+
+#define PORTIO_8 *(volatile unsigned char *)
+#define PORTIO_16 *(volatile unsigned short int *)
+
+/* Core HC12 Registers
+ */
+#define PORTA PORTIO_8(IO_BASE + 0x00) /* port A */
+#define PORTB PORTIO_8(IO_BASE + 0x01) /* port B */
+#define DDRA PORTIO_8(IO_BASE + 0x02) /* data direction port A */
+#define DDRB PORTIO_8(IO_BASE + 0x03) /* data direction port B */
+#define PORTE PORTIO_8(IO_BASE + 0x08) /* port E */
+#define DDRE PORTIO_8(IO_BASE + 0x09) /* data direction port E */
+#define PEAR PORTIO_8(IO_BASE + 0x0a) /* port E assignment register */
+#define MODE PORTIO_8(IO_BASE + 0x0b) /* mode register */
+#define PUCR PORTIO_8(IO_BASE + 0x0c) /* pull-up control register */
+#define RDRIV PORTIO_8(IO_BASE + 0x0d) /* reduced drive of I/O lines */
+#define EBICTL PORTIO_8(IO_BASE + 0x0e) /* external bus control */
+#define INITRM PORTIO_8(IO_BASE + 0x10) /* RAM mapping register */
+#define INITRG PORTIO_8(IO_BASE + 0x11) /* IO mapping register */
+#define INITEE PORTIO_8(IO_BASE + 0x12) /* EEPROM mapping register */
+#define MISC PORTIO_8(IO_BASE + 0x13) /* mapping control register */
+#define MTST0 PORTIO_8(IO_BASE + 0x14) /* mapping test register 0 */
+#define ITCR PORTIO_8(IO_BASE + 0x15) /* interrupt test control reg. */
+#define ITEST PORTIO_8(IO_BASE + 0x16) /* interrupt test register */
+#define MTST1 PORTIO_8(IO_BASE + 0x17) /* mapping test register 1 */
+#define PARTID PORTIO_16(IO_BASE + 0x1a) /* part ID register */
+#define MEMSIZ0 PORTIO_8(IO_BASE + 0x1c) /* memory size register 0 */
+#define MEMSIZ1 PORTIO_8(IO_BASE + 0x1d) /* memory size register 1 */
+#define INTCR PORTIO_8(IO_BASE + 0x1e) /* interrupt control */
+#define HPRIO PORTIO_8(IO_BASE + 0x1f) /* highest priority */
+
+/*
+bitflags
+*/
+//PEAR
+#define NOACCE 0x80
+#define PIPOE 0x20
+#define NECLK 0x10
+#define LSTRE 0x08
+#define RDWE 0x04
+//INTCR bitflags
+#define IRQE 0x80
+#define IRQEN 0x40
+#define DLY 0x20
+
+/* BKP Module
+ */
+#define BKPCT0 PORTIO_8(IO_BASE + 0x28) /* Breakpoint Control 0 */
+#define BKPCT1 PORTIO_8(IO_BASE + 0x29) /* Breakpoint Control 1 */
+#define BKP0X PORTIO_8(IO_BASE + 0x2a) /* Breakpoint 0 address upper */
+#define BKP0 PORTIO_16(IO_BASE + 0x2b) /* Breakpoint 0 address */
+#define BKP1X PORTIO_8(IO_BASE + 0x2d) /* Breakpoint 1 address upper */
+#define BKP1 PORTIO_16(IO_BASE + 0x2e) /* Breakpoint 1 address */
+
+/* MEBI Module
+ */
+#define PPAGE PORTIO_8(IO_BASE + 0x30) /* program page register */
+#define PORTK PORTIO_8(IO_BASE + 0x32) /* port K data register */
+#define DDRK PORTIO_8(IO_BASE + 0x33) /* port K data direction */
+
+/* CRG Module
+ */
+#define SYNR PORTIO_8(IO_BASE + 0x34) /* synthesizer register */
+#define REFDV PORTIO_8(IO_BASE + 0x35) /* reference divider register */
+#define CTFLG PORTIO_8(IO_BASE + 0x36) /* clock test flag register */
+#define CRGFLG PORTIO_8(IO_BASE + 0x37) /* clock generator flag register */
+#define CRGINT PORTIO_8(IO_BASE + 0x38) /* clock interrupt enable */
+#define CLKSEL PORTIO_8(IO_BASE + 0x39) /* clock select register */
+#define PLLCTL PORTIO_8(IO_BASE + 0x3a) /* PLL control register */
+#define RTICTL PORTIO_8(IO_BASE + 0x3b) /* clock real time control reg. */
+#define COPCTL PORTIO_8(IO_BASE + 0x3c) /* COP control register */
+#define FORBYP PORTIO_8(IO_BASE + 0x3d) /* clock force and bypass register */
+#define CTCTL PORTIO_8(IO_BASE + 0x3e) /* clock test control register */
+#define ARMCOP PORTIO_8(IO_BASE + 0x3f) /* COP arm/reset register with sequence 0x55,0xaa. */
+
+// CRG bitflags
+#define RTIF 0x80
+#define RTIE 0x80
+#define LOCK 0x08
+#define AUTO 0x20
+#define PLLSEL 0x80
+// COPCTL bitflags
+#define WCOP 0x80
+#define RSBCK 0x40
+
+/* ECT Module
+ */
+#define TIOS PORTIO_8(IO_BASE + 0x40) /* timer select register */
+#define TCFORC PORTIO_8(IO_BASE + 0x41) /* compare force register */
+#define TOC7M PORTIO_8(IO_BASE + 0x42) /* oc7 mask register */
+#define TOC7D PORTIO_8(IO_BASE + 0x43) /* oc7 data register */
+#define TCNT PORTIO_16(IO_BASE + 0x44) /* timer counter */
+#define TSCR1 PORTIO_8(IO_BASE + 0x46) /* system control register 1 */
+#define TTOV PORTIO_8(IO_BASE + 0x47) /* toggle on overflow register */
+#define TCTL1 PORTIO_8(IO_BASE + 0x48) /* control register 1 */
+#define TCTL2 PORTIO_8(IO_BASE + 0x49) /* control register 2 */
+#define TCTL3 PORTIO_8(IO_BASE + 0x4a) /* control register 3 */
+#define TCTL4 PORTIO_8(IO_BASE + 0x4b) /* control register 4 */
+#define TIE PORTIO_8(IO_BASE + 0x4c) /* interrupt enable register */
+#define TSCR2 PORTIO_8(IO_BASE + 0x4d) /* system control register 2 */
+#define TFLG1 PORTIO_8(IO_BASE + 0x4e) /* interrupt flag register 1 */
+#define TFLG2 PORTIO_8(IO_BASE + 0x4f) /* interrupt flag register 2 */
+#define TC0 PORTIO_16(IO_BASE + 0x50) /* capture/compare register 0 */
+#define TC1 PORTIO_16(IO_BASE + 0x52) /* capture/compare register 0 */
+#define TC2 PORTIO_16(IO_BASE + 0x54) /* capture/compare register 0 */
+#define TC3 PORTIO_16(IO_BASE + 0x56) /* capture/compare register 0 */
+#define TC4 PORTIO_16(IO_BASE + 0x58) /* capture/compare register 0 */
+#define TC5 PORTIO_16(IO_BASE + 0x5a) /* capture/compare register 0 */
+#define TC6 PORTIO_16(IO_BASE + 0x5c) /* capture/compare register 0 */
+#define TC7 PORTIO_16(IO_BASE + 0x5e) /* capture/compare register 0 */
+#define PACTL PORTIO_8(IO_BASE + 0x60) /* pulse accumulator A control */
+#define PAFLG PORTIO_8(IO_BASE + 0x61) /* pulse accumulator A flag */
+#define PACN3 PORTIO_8(IO_BASE + 0x62) /* pulse accumulator A3 count */
+#define PACN2 PORTIO_8(IO_BASE + 0x63) /* pulse accumulator A2 count */
+#define PACN1 PORTIO_8(IO_BASE + 0x64) /* pulse accumulator A1 count */
+#define PACN0 PORTIO_8(IO_BASE + 0x65) /* pulse accumulator A0 count */
+#define MCCTL PORTIO_8(IO_BASE + 0x66) /* modulus counter control reg */
+#define MCFLG PORTIO_8(IO_BASE + 0x67) /* modulus counter flag reg */
+#define ICPAR PORTIO_8(IO_BASE + 0x68) /* input control pulse acc reg */
+#define DLYCT PORTIO_8(IO_BASE + 0x69) /* delay counter control reg */
+#define ICOVW PORTIO_8(IO_BASE + 0x6a) /* input control overwrite reg */
+#define ICSYS PORTIO_8(IO_BASE + 0x6b) /* input control system reg */
+#define TIMTST PORTIO_8(IO_BASE + 0x6d) /* timer test register */
+#define PBCTL PORTIO_8(IO_BASE + 0x70) /* pulse accumulator B control */
+#define PBFLG PORTIO_8(IO_BASE + 0x71) /* pulse accumulator B flag */
+#define PA3H PORTIO_8(IO_BASE + 0x72) /* pulse accumulator B3 count */
+#define PA2H PORTIO_8(IO_BASE + 0x73) /* pulse accumulator B2 count */
+#define PA1H PORTIO_8(IO_BASE + 0x74) /* pulse accumulator B1 count */
+#define PA0H PORTIO_8(IO_BASE + 0x75) /* pulse accumulator B0 count */
+#define MCCNT PORTIO_16(IO_BASE + 0x76) /* modulus counter count reg */
+#define TC0H PORTIO_16(IO_BASE + 0x78) /* timer input capture hold 0 */
+#define TC1H PORTIO_16(IO_BASE + 0x7a) /* timer input capture hold 1 */
+#define TC2H PORTIO_16(IO_BASE + 0x7c) /* timer input capture hold 2 */
+#define TC3H PORTIO_16(IO_BASE + 0x7e) /* timer input capture hold 3 */
+
+/* ATD0 Module
+ */
+#define ATD0_BASE (IO_BASE + 0x80)
+#define ATD0CTL0 PORTIO_8(IO_BASE + 0x80) /* A/D0 control register 0 */
+#define ATD0CTL1 PORTIO_8(IO_BASE + 0x81) /* A/D0 control register 1 */
+#define ATD0CTL2 PORTIO_8(IO_BASE + 0x82) /* A/D0 control register 2 */
+#define ATD0CTL3 PORTIO_8(IO_BASE + 0x83) /* A/D0 control register 3 */
+#define ATD0CTL4 PORTIO_8(IO_BASE + 0x84) /* A/D0 control register 4 */
+#define ATD0CTL5 PORTIO_8(IO_BASE + 0x85) /* A/D0 control register 5 */
+#define ATD0STAT0 PORTIO_8(IO_BASE + 0x86) /* A/D0 status register 0 */
+#define ATD0STAT1 PORTIO_8(IO_BASE + 0x87) /* A/D0 status register 1 */
+#define ATD0TEST0 PORTIO_8(IO_BASE + 0x88) /* A/D0 test register 0 */
+#define ATD0TEST1 PORTIO_8(IO_BASE + 0x89) /* A/D0 test register 1 */
+#define ATD0DIEN PORTIO_8(IO_BASE + 0x8d) /* A/D0 interrupt enable */
+#define PORTAD0 PORTIO_8(IO_BASE + 0x8f) /* port AD0 data input register */
+#define ATD0DR0 PORTIO_16(IO_BASE + 0x90) /* A/D0 result 0 */
+#define ATD0DR0H PORTIO_8(IO_BASE + 0x90) /* A/D0 result 0 */
+#define ATD0DR1 PORTIO_16(IO_BASE + 0x92) /* A/D0 result 1 */
+#define ATD0DR1H PORTIO_8(IO_BASE + 0x92) /* A/D0 result 1 */
+#define ATD0DR2 PORTIO_16(IO_BASE + 0x94) /* A/D0 result 2 */
+#define ATD0DR2H PORTIO_8(IO_BASE + 0x94) /* A/D0 result 2 */
+#define ATD0DR3 PORTIO_16(IO_BASE + 0x96) /* A/D0 result 3 */
+#define ATD0DR3H PORTIO_8(IO_BASE + 0x96) /* A/D0 result 3 */
+#define ATD0DR4 PORTIO_16(IO_BASE + 0x98) /* A/D0 result 4 */
+#define ATD0DR4H PORTIO_8(IO_BASE + 0x98) /* A/D0 result 4 */
+#define ATD0DR5 PORTIO_16(IO_BASE + 0x9a) /* A/D0 result 5 */
+#define ATD0DR5H PORTIO_8(IO_BASE + 0x9a) /* A/D0 result 5 */
+#define ATD0DR6 PORTIO_16(IO_BASE + 0x9c) /* A/D0 result 6 */
+#define ATD0DR6H PORTIO_8(IO_BASE + 0x9c) /* A/D0 result 6 */
+#define ATD0DR7 PORTIO_16(IO_BASE + 0x9e) /* A/D0 result 7 */
+#define ATD0DR7H PORTIO_8(IO_BASE + 0x9e) /* A/D0 result 7 */
+
+//ATDnCTL5 bitflags
+#define DJM 0x80
+#define DSGN 0x40
+#define SCAN 0x20
+#define MULT 0x10
+//ATDnSTAT0 bitflags
+#define SCF 0x80
+#define ETORF 0x20
+#define FIFOR 0x10
+
+/* PWM Module
+ */
+#define PWME PORTIO_8(IO_BASE + 0xa0) /* PWM Enable */
+#define PWMPOL PORTIO_8(IO_BASE + 0xa1) /* PWM Clock Polarity */
+#define PWMCLK PORTIO_8(IO_BASE + 0xa2) /* PWM Clocks */
+#define PWMPRCLK PORTIO_8(IO_BASE + 0xa3) /* PWM prescale clock select */
+#define PWMCAE PORTIO_8(IO_BASE + 0xa4) /* PWM center align enable */
+#define PWMCTL PORTIO_8(IO_BASE + 0xa5) /* PWM Control Register */
+#define PWMTST PORTIO_8(IO_BASE + 0xa6) /* PWM Test Register */
+#define PWMPRSC PORTIO_8(IO_BASE + 0xa7) /* PWM Test Register */
+#define PWMSCLA PORTIO_8(IO_BASE + 0xa8) /* PWM scale A */
+#define PWMSCLB PORTIO_8(IO_BASE + 0xa9) /* PWM scale B */
+#define PWMSCNTA PORTIO_8(IO_BASE + 0xaa) /* PWM Test Register A */
+#define PWMSCNTB PORTIO_8(IO_BASE + 0xab) /* PWM Test Register B */
+#define PWMCNT0 PORTIO_8(IO_BASE + 0xac) /* PWM Channel Counter 0 */
+#define PWMCNT1 PORTIO_8(IO_BASE + 0xad) /* PWM Channel Counter 1 */
+#define PWMCNT2 PORTIO_8(IO_BASE + 0xae) /* PWM Channel Counter 2 */
+#define PWMCNT3 PORTIO_8(IO_BASE + 0xaf) /* PWM Channel Counter 3 */
+#define PWMCNT4 PORTIO_8(IO_BASE + 0xb0) /* PWM Channel Counter 4 */
+#define PWMCNT5 PORTIO_8(IO_BASE + 0xb1) /* PWM Channel Counter 5 */
+#define PWMCNT6 PORTIO_8(IO_BASE + 0xb2) /* PWM Channel Counter 6 */
+#define PWMCNT7 PORTIO_8(IO_BASE + 0xb3) /* PWM Channel Counter 7 */
+#define PWMPER0 PORTIO_8(IO_BASE + 0xb4) /* PWM Channel Period 0 */
+#define PWMPER1 PORTIO_8(IO_BASE + 0xb5) /* PWM Channel Period 1 */
+#define PWMPER2 PORTIO_8(IO_BASE + 0xb6) /* PWM Channel Period 2 */
+#define PWMPER3 PORTIO_8(IO_BASE + 0xb7) /* PWM Channel Period 3 */
+#define PWMPER4 PORTIO_8(IO_BASE + 0xb8) /* PWM Channel Period 4 */
+#define PWMPER5 PORTIO_8(IO_BASE + 0xb9) /* PWM Channel Period 5 */
+#define PWMPER6 PORTIO_8(IO_BASE + 0xba) /* PWM Channel Period 6 */
+#define PWMPER7 PORTIO_8(IO_BASE + 0xbb) /* PWM Channel Period 7 */
+#define PWMDTY0 PORTIO_8(IO_BASE + 0xbc) /* PWM Channel Duty 0 */
+#define PWMDTY1 PORTIO_8(IO_BASE + 0xbd) /* PWM Channel Duty 1 */
+#define PWMDTY2 PORTIO_8(IO_BASE + 0xbe) /* PWM Channel Duty 2 */
+#define PWMDTY3 PORTIO_8(IO_BASE + 0xbf) /* PWM Channel Duty 3 */
+#define PWMDTY4 PORTIO_8(IO_BASE + 0xc0) /* PWM Channel Duty 4 */
+#define PWMDTY5 PORTIO_8(IO_BASE + 0xc1) /* PWM Channel Duty 5 */
+#define PWMDTY6 PORTIO_8(IO_BASE + 0xc2) /* PWM Channel Duty 6 */
+#define PWMDTY7 PORTIO_8(IO_BASE + 0xc3) /* PWM Channel Duty 7 */
+#define PWMSDN PORTIO_8(IO_BASE + 0xc4) /* PWM shutdown register */
+
+/* SCI register offsets
+ jeffs: Use these to offset any standard SCI base
+ */
+#define _SCIBD 0x0 /* SCI baud rate high */
+#define _SCIBDH 0x0 /* SCI baud rate high */
+#define _SCIBDL 0x1 /* SCI baud rate low */
+#define _SCICR1 0x2 /* SCI control register 1 */
+#define _SCICR2 0x3 /* SCI control register 2 */
+#define _SCISR1 0x4 /* SCI status register 1 */
+#define _SCISR2 0x5 /* SCI status register 2 */
+#define _SCIDRH 0x6 /* SCI data register high */
+#define _SCIDRL 0x7 /* SCI data register low */
+
+/* SCI0 Module
+ jeffs: Use symbols like SCI0_BASE to reference which SCI block
+ */
+#define SCI0_BASE (IO_BASE + 0xc8)
+#define SCI0BD PORTIO_16(IO_BASE + 0xc8) /* SCI 0 baud rate high */
+#define SCI0BDH PORTIO_8(IO_BASE + 0xc8) /* SCI 0 baud rate high */
+#define SCI0BDL PORTIO_8(IO_BASE + 0xc9) /* SCI 0 baud rate low */
+#define SCI0CR1 PORTIO_8(IO_BASE + 0xca) /* SCI 0 control register 1 */
+#define SCI0CR2 PORTIO_8(IO_BASE + 0xcb) /* SCI 0 control register 2 */
+#define SCI0SR1 PORTIO_8(IO_BASE + 0xcc) /* SCI 0 status register 1 */
+#define SCI0SR2 PORTIO_8(IO_BASE + 0xcd) /* SCI 0 status register 2 */
+#define SCI0DRH PORTIO_8(IO_BASE + 0xce) /* SCI 0 data register high */
+#define SCI0DRL PORTIO_8(IO_BASE + 0xcf) /* SCI 0 data register low */
+
+/* SCI1 Module
+ */
+#define SCI1_BASE (IO_BASE + 0xd0)
+#define SCI1BD PORTIO_16(IO_BASE + 0xd0) /* SCI 1 16bit baud rate */
+#define SCI1BDH PORTIO_8(IO_BASE + 0xd0) /* SCI 1 baud rate high */
+#define SCI1BDL PORTIO_8(IO_BASE + 0xd1) /* SCI 1 baud rate low */
+#define SCI1CR1 PORTIO_8(IO_BASE + 0xd2) /* SCI 1 control register 1 */
+#define SCI1CR2 PORTIO_8(IO_BASE + 0xd3) /* SCI 1 control register 2 */
+#define SCI1SR1 PORTIO_8(IO_BASE + 0xd4) /* SCI 1 status register 1 */
+#define SCI1SR2 PORTIO_8(IO_BASE + 0xd5) /* SCI 1 status register 2 */
+#define SCI1DRH PORTIO_8(IO_BASE + 0xd6) /* SCI 1 data register high */
+#define SCI1DRL PORTIO_8(IO_BASE + 0xd7) /* SCI 1 data register low */
+
+//SCInSR1
+#define TDRE 0x80
+#define RDRF 0x20
+#define IDLE 0x10
+
+/* SPI register offsets
+ */
+#define _SPICR1 PORTIO_8(IO_BASE + 0x0) /* SPI control register 1 */
+#define _SPICR2 PORTIO_8(IO_BASE + 0x1) /* SPI control register 2 */
+#define _SPIBR PORTIO_8(IO_BASE + 0x2) /* SPI baud rate register */
+#define _SPISR PORTIO_8(IO_BASE + 0x3) /* SPI status register */
+#define _SPIDR PORTIO_8(IO_BASE + 0x5) /* SPI data register */
+
+/* SPI0 Module
+ */
+#define SPI0_BASE (IO_BASE + 0xd8)
+#define SPI0CR1 PORTIO_8(IO_BASE + 0xd8) /* SPI 0 control register 1 */
+#define SPI0CR2 PORTIO_8(IO_BASE + 0xd9) /* SPI 0 control register 2 */
+#define SPI0BR PORTIO_8(IO_BASE + 0xda) /* SPI 0 baud rate register */
+#define SPI0SR PORTIO_8(IO_BASE + 0xdb) /* SPI 0 status register */
+#define SPI0DR PORTIO_8(IO_BASE + 0xdd) /* SPI 0 data register */
+
+//SPInCR1
+#define SPIE 0x80
+#define SPE 0x40
+#define SPTIE 0x20
+#define MSTR 0x10
+#define CPOL 0x08
+#define CPHA 0x04
+#define SSOE 0x02
+#define LSBFE 0x01
+
+//SPInSR
+#define SPIF 0x80
+#define SPTEF 0x20
+#define MODF 0x10
+
+/* I2C Module
+ */
+#define IBAD PORTIO_8(IO_BASE + 0xe0) /* I2C address register */
+#define IBFD PORTIO_8(IO_BASE + 0xe1) /* I2C freqency divider reg */
+#define IBCR PORTIO_8(IO_BASE + 0xe2) /* I2C control register */
+#define IBSR PORTIO_8(IO_BASE + 0xe3) /* I2C status register */
+#define IBDR PORTIO_8(IO_BASE + 0xe4) /* I2C data register */
+
+//IBSR
+#define TCF 0x80
+#define IAAS 0x40
+#define IBB 0x20
+#define IBAL 0x10
+#define SRW 0x04
+#define IBIF 0x02
+#define RXAK 0x01
+
+/* BDLC Module
+ */
+#define DLCBCR1 PORTIO_8(IO_BASE + 0xe8) /* BDLC control register 1 */
+#define DLCBSVR PORTIO_8(IO_BASE + 0xe9) /* BDLC state vector register */
+#define DLCBCR2 PORTIO_8(IO_BASE + 0xea) /* BDLC control register 2 */
+#define DLCBDR PORTIO_8(IO_BASE + 0xeb) /* BDLC data register */
+#define DLCBARD PORTIO_8(IO_BASE + 0xec) /* BDLC analog round trip delay */
+#define DLCBRSR PORTIO_8(IO_BASE + 0xed) /* BDLC rate select register */
+#define DLCSCR PORTIO_8(IO_BASE + 0xee) /* BDLC control register */
+#define DLCBSTAT PORTIO_8(IO_BASE + 0xef) /* BDLC status register */
+
+/* SPI1 Module
+ */
+#define SPI1_BASE (IO_BASE + 0xf0)
+#define SPI1CR1 PORTIO_8(IO_BASE + 0xf0) /* SPI 1 control register 1 */
+#define SPI1CR2 PORTIO_8(IO_BASE + 0xf1) /* SPI 1 control register 2 */
+#define SPI1BR PORTIO_8(IO_BASE + 0xf2) /* SPI 1 baud rate register */
+#define SPI1SR PORTIO_8(IO_BASE + 0xf3) /* SPI 1 status register */
+#define SPI1DR PORTIO_8(IO_BASE + 0xf5) /* SPI 1 data register */
+
+/* SPI2 Module
+ */
+#define SPI2_BASE (IO_BASE + 0xf8)
+#define SPI2CR1 PORTIO_8(IO_BASE + 0xf8) /* SPI 2 control register 1 */
+#define SPI2CR2 PORTIO_8(IO_BASE + 0xf9) /* SPI 2 control register 2 */
+#define SPI2BR PORTIO_8(IO_BASE + 0xfa) /* SPI 2 baud rate register */
+#define SPI2SR PORTIO_8(IO_BASE + 0xfb) /* SPI 2 status register */
+#define SPI2DR PORTIO_8(IO_BASE + 0xfd) /* SPI 2 data register */
+
+/* FLC Module
+ */
+#define FCLKDIV PORTIO_8(IO_BASE + 0x100) /* flash clock divider */
+#define FSEC PORTIO_8(IO_BASE + 0x101) /* flash security register */
+#define FCNFG PORTIO_8(IO_BASE + 0x103) /* flash configuration register */
+#define FPROT PORTIO_8(IO_BASE + 0x104) /* flash protection register */
+#define FSTAT PORTIO_8(IO_BASE + 0x105) /* flash status register */
+#define FCMD PORTIO_8(IO_BASE + 0x106) /* flash command register */
+
+/* EEPROM Module
+ */
+#define ECLKDIV PORTIO_8(IO_BASE + 0x110) /* eeprom clock divider */
+#define ECNFG PORTIO_8(IO_BASE + 0x113) /* eeprom configuration register */
+#define EPROT PORTIO_8(IO_BASE + 0x114) /* eeprom protection register */
+#define ESTAT PORTIO_8(IO_BASE + 0x115) /* eeprom status register */
+#define ECMD PORTIO_8(IO_BASE + 0x116) /* eeprom command register */
+
+/* ATD1 Module
+ */
+#define ATD1_BASE (IO_BASE + 0x120)
+#define ATD1CTL0 PORTIO_8(IO_BASE + 0x120) /* A/D1 control register 0 */
+#define ATD1CTL1 PORTIO_8(IO_BASE + 0x121) /* A/D1 control register 1 */
+#define ATD1CTL2 PORTIO_8(IO_BASE + 0x122) /* A/D1 control register 2 */
+#define ATD1CTL3 PORTIO_8(IO_BASE + 0x123) /* A/D1 control register 3 */
+#define ATD1CTL4 PORTIO_8(IO_BASE + 0x124) /* A/D1 control register 4 */
+#define ATD1CTL5 PORTIO_8(IO_BASE + 0x125) /* A/D1 control register 5 */
+#define ATD1STAT0 PORTIO_8(IO_BASE + 0x126) /* A/D1 status register 0 */
+#define ATD1STAT1 PORTIO_8(IO_BASE + 0x127) /* A/D1 status register 1 */
+#define ATD1TEST0 PORTIO_8(IO_BASE + 0x128) /* A/D1 test register 0 */
+#define ATD1TEST1 PORTIO_8(IO_BASE + 0x129) /* A/D1 test register 1 */
+#define ATD1DIEN PORTIO_8(IO_BASE + 0x12d) /* A/D1 interrupt enable */
+#define PORTAD1 PORTIO_8(IO_BASE + 0x12f) /* port AD1 data input register */
+#define ATD1DR0 PORTIO_16(IO_BASE + 0x130) /* A/D1 result 0 */
+#define ATD1DR0H PORTIO_8(IO_BASE + 0x130) /* A/D1 result 0 */
+#define ATD1DR1 PORTIO_16(IO_BASE + 0x132) /* A/D1 result 1 */
+#define ATD1DR1H PORTIO_8(IO_BASE + 0x132) /* A/D1 result 1 */
+#define ATD1DR2 PORTIO_16(IO_BASE + 0x134) /* A/D1 result 2 */
+#define ATD1DR2H PORTIO_8(IO_BASE + 0x134) /* A/D1 result 2 */
+#define ATD1DR3 PORTIO_16(IO_BASE + 0x136) /* A/D1 result 3 */
+#define ATD1DR3H PORTIO_8(IO_BASE + 0x136) /* A/D1 result 3 */
+#define ATD1DR4 PORTIO_16(IO_BASE + 0x138) /* A/D1 result 4 */
+#define ATD1DR4H PORTIO_8(IO_BASE + 0x138) /* A/D1 result 4 */
+#define ATD1DR5 PORTIO_16(IO_BASE + 0x13a) /* A/D1 result 5 */
+#define ATD1DR5H PORTIO_8(IO_BASE + 0x13a) /* A/D1 result 5 */
+#define ATD1DR6 PORTIO_16(IO_BASE + 0x13c) /* A/D1 result 6 */
+#define ATD1DR6H PORTIO_8(IO_BASE + 0x13c) /* A/D1 result 6 */
+#define ATD1DR7 PORTIO_16(IO_BASE + 0x13e) /* A/D1 result 7 */
+#define ATD1DR7H PORTIO_8(IO_BASE + 0x13e) /* A/D1 result 7 */
+
+/* CAN0 Module
+ */
+#define CAN0_BASE (IO_BASE + 0x140)
+#define CAN0CTL0 PORTIO_8(IO_BASE + 0x140) /* CAN0 control register 0 */
+#define CAN0CTL1 PORTIO_8(IO_BASE + 0x141) /* CAN0 control register 1 */
+#define CAN0BTR0 PORTIO_8(IO_BASE + 0x142) /* CAN0 bus timing register 0 */
+#define CAN0BTR1 PORTIO_8(IO_BASE + 0x143) /* CAN0 bus timing register 1 */
+#define CAN0RFLG PORTIO_8(IO_BASE + 0x144) /* CAN0 receiver flag register */
+#define CAN0RIER PORTIO_8(IO_BASE + 0x145) /* CAN0 receiver interrupt reg */
+#define CAN0TFLG PORTIO_8(IO_BASE + 0x146) /* CAN0 transmitter flag reg */
+#define CAN0TIER PORTIO_8(IO_BASE + 0x147) /* CAN0 transmitter control reg */
+#define CAN0TARQ PORTIO_8(IO_BASE + 0x148) /* CAN0 transmitter abort request */
+#define CAN0TAAK PORTIO_8(IO_BASE + 0x149) /* CAN0 transmitter abort acknowledge */
+#define CAN0TBSEL PORTIO_8(IO_BASE + 0x14a) /* CAN0 transmit buffer selection */
+#define CAN0IDAC PORTIO_8(IO_BASE + 0x14b) /* CAN0 identifier acceptance */
+#define CAN0RXERR PORTIO_8(IO_BASE + 0x14e) /* CAN0 receive error counter */
+#define CAN0TXERR PORTIO_8(IO_BASE + 0x14f) /* CAN0 transmit error counter */
+#define CAN0IDAR0 PORTIO_8(IO_BASE + 0x150) /* CAN0 id acceptance reg 0 */
+#define CAN0IDAR1 PORTIO_8(IO_BASE + 0x151) /* CAN0 id acceptance reg 1 */
+#define CAN0IDAR2 PORTIO_8(IO_BASE + 0x152) /* CAN0 id acceptance reg 2 */
+#define CAN0IDAR3 PORTIO_8(IO_BASE + 0x153) /* CAN0 id acceptance reg 3 */
+#define CAN0IDMR0 PORTIO_8(IO_BASE + 0x154) /* CAN0 id mask register 0 */
+#define CAN0IDMR1 PORTIO_8(IO_BASE + 0x155) /* CAN0 id mask register 1 */
+#define CAN0IDMR2 PORTIO_8(IO_BASE + 0x156) /* CAN0 id mask register 2 */
+#define CAN0IDMR3 PORTIO_8(IO_BASE + 0x157) /* CAN0 id mask register 3 */
+#define CAN0IDAR4 PORTIO_8(IO_BASE + 0x158) /* CAN0 id acceptance reg 4 */
+#define CAN0IDAR5 PORTIO_8(IO_BASE + 0x159) /* CAN0 id acceptance reg 5 */
+#define CAN0IDAR6 PORTIO_8(IO_BASE + 0x15a) /* CAN0 id acceptance reg 6 */
+#define CAN0IDAR7 PORTIO_8(IO_BASE + 0x15b) /* CAN0 id acceptance reg 7 */
+#define CAN0IDMR4 PORTIO_8(IO_BASE + 0x15c) /* CAN0 id mask register 4 */
+#define CAN0IDMR5 PORTIO_8(IO_BASE + 0x15d) /* CAN0 id mask register 5 */
+#define CAN0IDMR6 PORTIO_8(IO_BASE + 0x15e) /* CAN0 id mask register 6 */
+#define CAN0IDMR7 PORTIO_8(IO_BASE + 0x15f) /* CAN0 id mask register 7 */
+#define CAN0RXFG PORTIO_8(IO_BASE + 0x160) /* CAN0 receive buffer */
+#define CAN0TXFG PORTIO_8(IO_BASE + 0x170) /* CAN0 transmit buffer */
+
+/* CAN1 Module
+ */
+#define CAN1_BASE (IO_BASE + 0x180)
+#define CAN1CTL0 PORTIO_8(IO_BASE + 0x180) /* CAN1 control register 0 */
+#define CAN1CTL1 PORTIO_8(IO_BASE + 0x181) /* CAN1 control register 1 */
+#define CAN1BTR0 PORTIO_8(IO_BASE + 0x182) /* CAN1 bus timing register 0 */
+#define CAN1BTR1 PORTIO_8(IO_BASE + 0x183) /* CAN1 bus timing register 1 */
+#define CAN1RFLG PORTIO_8(IO_BASE + 0x184) /* CAN1 receiver flag register */
+#define CAN1RIER PORTIO_8(IO_BASE + 0x185) /* CAN1 receiver interrupt reg */
+#define CAN1TFLG PORTIO_8(IO_BASE + 0x186) /* CAN1 transmitter flag reg */
+#define CAN1TIER PORTIO_8(IO_BASE + 0x187) /* CAN1 transmitter control reg */
+#define CAN1TARQ PORTIO_8(IO_BASE + 0x188) /* CAN1 transmitter abort request */
+#define CAN1TAAK PORTIO_8(IO_BASE + 0x189) /* CAN1 transmitter abort acknowledge */
+#define CAN1TBSEL PORTIO_8(IO_BASE + 0x18a) /* CAN1 transmit buffer selection */
+#define CAN1IDAC PORTIO_8(IO_BASE + 0x18b) /* CAN1 identifier acceptance */
+#define CAN1RXERR PORTIO_8(IO_BASE + 0x18e) /* CAN1 transmitter control reg */
+#define CAN1TXERR PORTIO_8(IO_BASE + 0x18f) /* CAN1 transmit error counter */
+#define CAN1IDAR0 PORTIO_8(IO_BASE + 0x190) /* CAN1 id acceptance reg 0 */
+#define CAN1IDAR1 PORTIO_8(IO_BASE + 0x191) /* CAN1 id acceptance reg 1 */
+#define CAN1IDAR2 PORTIO_8(IO_BASE + 0x192) /* CAN1 id acceptance reg 2 */
+#define CAN1IDAR3 PORTIO_8(IO_BASE + 0x193) /* CAN1 id acceptance reg 3 */
+#define CAN1IDMR0 PORTIO_8(IO_BASE + 0x194) /* CAN1 id mask register 0 */
+#define CAN1IDMR1 PORTIO_8(IO_BASE + 0x195) /* CAN1 id mask register 1 */
+#define CAN1IDMR2 PORTIO_8(IO_BASE + 0x196) /* CAN1 id mask register 2 */
+#define CAN1IDMR3 PORTIO_8(IO_BASE + 0x197) /* CAN1 id mask register 3 */
+#define CAN1IDAR4 PORTIO_8(IO_BASE + 0x198) /* CAN1 id acceptance reg 4 */
+#define CAN1IDAR5 PORTIO_8(IO_BASE + 0x199) /* CAN1 id acceptance reg 5 */
+#define CAN1IDAR6 PORTIO_8(IO_BASE + 0x19a) /* CAN1 id acceptance reg 6 */
+#define CAN1IDAR7 PORTIO_8(IO_BASE + 0x19b) /* CAN1 id acceptance reg 7 */
+#define CAN1IDMR4 PORTIO_8(IO_BASE + 0x19c) /* CAN1 id mask register 4 */
+#define CAN1IDMR5 PORTIO_8(IO_BASE + 0x19d) /* CAN1 id mask register 5 */
+#define CAN1IDMR6 PORTIO_8(IO_BASE + 0x19e) /* CAN1 id mask register 6 */
+#define CAN1IDMR7 PORTIO_8(IO_BASE + 0x19f) /* CAN1 id mask register 7 */
+#define CAN1RXFG PORTIO_8(IO_BASE + 0x1a0) /* CAN1 receive buffer */
+#define CAN1TXFG PORTIO_8(IO_BASE + 0x1b0) /* CAN1 transmit buffer */
+
+/* CAN2 Module
+ */
+#define CAN2_BASE (IO_BASE + 0x1c0)
+#define CAN2CTL0 PORTIO_8(IO_BASE + 0x1c0) /* CAN2 control register 0 */
+#define CAN2CTL1 PORTIO_8(IO_BASE + 0x1c1) /* CAN2 control register 1 */
+#define CAN2BTR0 PORTIO_8(IO_BASE + 0x1c2) /* CAN2 bus timing register 0 */
+#define CAN2BTR1 PORTIO_8(IO_BASE + 0x1c3) /* CAN2 bus timing register 1 */
+#define CAN2RFLG PORTIO_8(IO_BASE + 0x1c4) /* CAN2 receiver flag register */
+#define CAN2RIER PORTIO_8(IO_BASE + 0x1c5) /* CAN2 receiver interrupt reg */
+#define CAN2TFLG PORTIO_8(IO_BASE + 0x1c6) /* CAN2 transmitter flag reg */
+#define CAN2TIER PORTIO_8(IO_BASE + 0x1c7) /* CAN2 transmitter control reg */
+#define CAN2TARQ PORTIO_8(IO_BASE + 0x1c8) /* CAN2 transmitter abort request */
+#define CAN2TAAK PORTIO_8(IO_BASE + 0x1c9) /* CAN2 transmitter abort acknowledge */
+#define CAN2TBSEL PORTIO_8(IO_BASE + 0x1ca) /* CAN2 transmit buffer selection */
+#define CAN2IDAC PORTIO_8(IO_BASE + 0x1cb) /* CAN2 identifier acceptance */
+#define CAN2RXERR PORTIO_8(IO_BASE + 0x1ce) /* CAN2 transmitter control reg */
+#define CAN2TXERR PORTIO_8(IO_BASE + 0x1cf) /* CAN2 transmit error counter */
+#define CAN2IDAR0 PORTIO_8(IO_BASE + 0x1d0) /* CAN2 id acceptance reg 0 */
+#define CAN2IDAR1 PORTIO_8(IO_BASE + 0x1d1) /* CAN2 id acceptance reg 1 */
+#define CAN2IDAR2 PORTIO_8(IO_BASE + 0x1d2) /* CAN2 id acceptance reg 2 */
+#define CAN2IDAR3 PORTIO_8(IO_BASE + 0x1d3) /* CAN2 id acceptance reg 3 */
+#define CAN2IDMR0 PORTIO_8(IO_BASE + 0x1d4) /* CAN2 id mask register 0 */
+#define CAN2IDMR1 PORTIO_8(IO_BASE + 0x1d5) /* CAN2 id mask register 1 */
+#define CAN2IDMR2 PORTIO_8(IO_BASE + 0x1d6) /* CAN2 id mask register 2 */
+#define CAN2IDMR3 PORTIO_8(IO_BASE + 0x1d7) /* CAN2 id mask register 3 */
+#define CAN2IDAR4 PORTIO_8(IO_BASE + 0x1d8) /* CAN2 id acceptance reg 4 */
+#define CAN2IDAR5 PORTIO_8(IO_BASE + 0x1d9) /* CAN2 id acceptance reg 5 */
+#define CAN2IDAR6 PORTIO_8(IO_BASE + 0x1da) /* CAN2 id acceptance reg 6 */
+#define CAN2IDAR7 PORTIO_8(IO_BASE + 0x1db) /* CAN2 id acceptance reg 7 */
+#define CAN2IDMR4 PORTIO_8(IO_BASE + 0x1dc) /* CAN2 id mask register 4 */
+#define CAN2IDMR5 PORTIO_8(IO_BASE + 0x1dd) /* CAN2 id mask register 5 */
+#define CAN2IDMR6 PORTIO_8(IO_BASE + 0x1de) /* CAN2 id mask register 6 */
+#define CAN2IDMR7 PORTIO_8(IO_BASE + 0x1df) /* CAN2 id mask register 7 */
+#define CAN2RXFG PORTIO_8(IO_BASE + 0x1e0) /* CAN2 receive buffer */
+#define CAN2TXFG PORTIO_8(IO_BASE + 0x1f0) /* CAN2 transmit buffer */
+
+/* CAN3 Module
+ */
+#define CAN3_BASE (IO_BASE + 0x200)
+#define CAN3CTL0 PORTIO_8(IO_BASE + 0x200) /* CAN3 control register 0 */
+#define CAN3CTL1 PORTIO_8(IO_BASE + 0x201) /* CAN3 control register 1 */
+#define CAN3BTR0 PORTIO_8(IO_BASE + 0x202) /* CAN3 bus timing register 0 */
+#define CAN3BTR1 PORTIO_8(IO_BASE + 0x203) /* CAN3 bus timing register 1 */
+#define CAN3RFLG PORTIO_8(IO_BASE + 0x204) /* CAN3 receiver flag register */
+#define CAN3RIER PORTIO_8(IO_BASE + 0x205) /* CAN3 receiver interrupt reg */
+#define CAN3TFLG PORTIO_8(IO_BASE + 0x206) /* CAN3 transmitter flag reg */
+#define CAN3TIER PORTIO_8(IO_BASE + 0x207) /* CAN3 transmitter control reg */
+#define CAN3TARQ PORTIO_8(IO_BASE + 0x208) /* CAN3 transmitter abort request */
+#define CAN3TAAK PORTIO_8(IO_BASE + 0x209) /* CAN3 transmitter abort acknowledge */
+#define CAN3TBSEL PORTIO_8(IO_BASE + 0x20a) /* CAN3 transmit buffer selection */
+#define CAN3IDAC PORTIO_8(IO_BASE + 0x20b) /* CAN3 identifier acceptance */
+#define CAN3RXERR PORTIO_8(IO_BASE + 0x20e) /* CAN3 transmitter control reg */
+#define CAN3TXERR PORTIO_8(IO_BASE + 0x20f) /* CAN3 transmit error counter */
+#define CAN3IDAR0 PORTIO_8(IO_BASE + 0x210) /* CAN3 id acceptance reg 0 */
+#define CAN3IDAR1 PORTIO_8(IO_BASE + 0x211) /* CAN3 id acceptance reg 1 */
+#define CAN3IDAR2 PORTIO_8(IO_BASE + 0x212) /* CAN3 id acceptance reg 2 */
+#define CAN3IDAR3 PORTIO_8(IO_BASE + 0x213) /* CAN3 id acceptance reg 3 */
+#define CAN3IDMR0 PORTIO_8(IO_BASE + 0x214) /* CAN3 id mask register 0 */
+#define CAN3IDMR1 PORTIO_8(IO_BASE + 0x215) /* CAN3 id mask register 1 */
+#define CAN3IDMR2 PORTIO_8(IO_BASE + 0x216) /* CAN3 id mask register 2 */
+#define CAN3IDMR3 PORTIO_8(IO_BASE + 0x217) /* CAN3 id mask register 3 */
+#define CAN3IDAR4 PORTIO_8(IO_BASE + 0x218) /* CAN3 id acceptance reg 4 */
+#define CAN3IDAR5 PORTIO_8(IO_BASE + 0x219) /* CAN3 id acceptance reg 5 */
+#define CAN3IDAR6 PORTIO_8(IO_BASE + 0x21a) /* CAN3 id acceptance reg 6 */
+#define CAN3IDAR7 PORTIO_8(IO_BASE + 0x21b) /* CAN3 id acceptance reg 7 */
+#define CAN3IDMR4 PORTIO_8(IO_BASE + 0x21c) /* CAN3 id mask register 4 */
+#define CAN3IDMR5 PORTIO_8(IO_BASE + 0x21d) /* CAN3 id mask register 5 */
+#define CAN3IDMR6 PORTIO_8(IO_BASE + 0x21e) /* CAN3 id mask register 6 */
+#define CAN3IDMR7 PORTIO_8(IO_BASE + 0x21f) /* CAN3 id mask register 7 */
+#define CAN3RXFG PORTIO_8(IO_BASE + 0x220) /* CAN3 receive buffer */
+#define CAN3TXFG PORTIO_8(IO_BASE + 0x230) /* CAN3 transmit buffer */
+
+/* PIM
+ */
+
+/*Port T register offsets
+*/
+#define PTT PORTIO_8(IO_BASE + 0x240) /* port T data register */
+#define PTIT PORTIO_8(IO_BASE + 0x241) /* port T input register */
+#define DDRT PORTIO_8(IO_BASE + 0x242) /* port T data direction */
+#define RDRT PORTIO_8(IO_BASE + 0x243) /* port T reduce drive */
+#define PERT PORTIO_8(IO_BASE + 0x244) /* port T pull enable */
+#define PPST PORTIO_8(IO_BASE + 0x245) /* port T polarity select */
+
+/*Port S
+ */
+#define PTS PORTIO_8(IO_BASE + 0x248) /* port S data register */
+#define PTIS PORTIO_8(IO_BASE + 0x249) /* port S input register */
+#define DDRS PORTIO_8(IO_BASE + 0x24a) /* port S data direction */
+#define RDRS PORTIO_8(IO_BASE + 0x24b) /* port S reduce drive */
+#define PERS PORTIO_8(IO_BASE + 0x24c) /* port S pull enable */
+#define PPSS PORTIO_8(IO_BASE + 0x24d) /* port S polarity select */
+#define WOMS PORTIO_8(IO_BASE + 0x24e) /* port S wired-or mode */
+
+/* Port M
+ */
+#define PTM PORTIO_8(IO_BASE + 0x250) /* port M data register */
+#define PTIM PORTIO_8(IO_BASE + 0x251) /* port M input register */
+#define DDRM PORTIO_8(IO_BASE + 0x252) /* port M data direction */
+#define RDRM PORTIO_8(IO_BASE + 0x253) /* port M reduce drive */
+#define PERM PORTIO_8(IO_BASE + 0x254) /* port M pull enable */
+#define PPSM PORTIO_8(IO_BASE + 0x255) /* port M polarity select */
+#define WOMM PORTIO_8(IO_BASE + 0x256) /* port M wired-or mode */
+
+/* Port P
+ */
+#define PTP PORTIO_8(IO_BASE + 0x258) /* port P data register */
+#define PTIP PORTIO_8(IO_BASE + 0x259) /* port P input register */
+#define DDRP PORTIO_8(IO_BASE + 0x25a) /* port P data direction */
+#define RDRP PORTIO_8(IO_BASE + 0x25b) /* port P reduce drive */
+#define PERP PORTIO_8(IO_BASE + 0x25c) /* port P pull enable */
+#define PPSP PORTIO_8(IO_BASE + 0x25d) /* port P polarity select */
+#define PIEP PORTIO_8(IO_BASE + 0x25e) /* port P interrupt enable */
+#define PIFP PORTIO_8(IO_BASE + 0x25f) /* port P interrupt flag */
+
+/* Port H
+ */
+#define PTH PORTIO_8(IO_BASE + 0x260) /* port H data register */
+#define PTIH PORTIO_8(IO_BASE + 0x261) /* port H input register */
+#define DDRH PORTIO_8(IO_BASE + 0x262) /* port H data direction */
+#define RDRH PORTIO_8(IO_BASE + 0x263) /* port H reduce drive */
+#define PERH PORTIO_8(IO_BASE + 0x264) /* port H pull enable */
+#define PPSH PORTIO_8(IO_BASE + 0x265) /* port H polarity select */
+#define PIEH PORTIO_8(IO_BASE + 0x266) /* port H interrupt enable */
+#define PIFH PORTIO_8(IO_BASE + 0x267) /* port H interrupt flag */
+
+/* Port J
+ */
+#define PTJ PORTIO_8(IO_BASE + 0x268) /* port J data register */
+#define PTIJ PORTIO_8(IO_BASE + 0x269) /* port J input register */
+#define DDRJ PORTIO_8(IO_BASE + 0x26a) /* port J data direction */
+#define RDRJ PORTIO_8(IO_BASE + 0x26b) /* port J reduce drive */
+#define PERJ PORTIO_8(IO_BASE + 0x26c) /* port J pull enable */
+#define PPSJ PORTIO_8(IO_BASE + 0x26d) /* port J polarity select */
+#define PIEJ PORTIO_8(IO_BASE + 0x26e) /* port J interrupt enable */
+#define PIFJ PORTIO_8(IO_BASE + 0x26f) /* port J interrupt flag */
+/*PIM end
+*/
+
+
+/* CAN4 Module
+ */
+#define CAN4_BASE (IO_BASE + 0x280)
+#define CAN4CTL0 PORTIO_8(IO_BASE + 0x280) /* CAN4 control register 0 */
+#define CAN4CTL1 PORTIO_8(IO_BASE + 0x281) /* CAN4 control register 1 */
+#define CAN4BTR0 PORTIO_8(IO_BASE + 0x282) /* CAN4 bus timing register 0 */
+#define CAN4BTR1 PORTIO_8(IO_BASE + 0x283) /* CAN4 bus timing register 1 */
+#define CAN4RFLG PORTIO_8(IO_BASE + 0x284) /* CAN4 receiver flag register */
+#define CAN4RIER PORTIO_8(IO_BASE + 0x285) /* CAN4 receiver interrupt reg */
+#define CAN4TFLG PORTIO_8(IO_BASE + 0x286) /* CAN4 transmitter flag reg */
+#define CAN4TIER PORTIO_8(IO_BASE + 0x287) /* CAN4 transmitter control reg */
+#define CAN4TARQ PORTIO_8(IO_BASE + 0x288) /* CAN4 transmitter abort request */
+#define CAN4TAAK PORTIO_8(IO_BASE + 0x289) /* CAN4 transmitter abort acknowledge */
+#define CAN4TBSEL PORTIO_8(IO_BASE + 0x28a) /* CAN4 transmit buffer selection */
+#define CAN4IDAC PORTIO_8(IO_BASE + 0x28b) /* CAN4 identifier acceptance */
+#define CAN4RXERR PORTIO_8(IO_BASE + 0x28e) /* CAN4 transmitter control reg */
+#define CAN4TXERR PORTIO_8(IO_BASE + 0x28f) /* CAN4 transmit error counter */
+#define CAN4IDAR0 PORTIO_8(IO_BASE + 0x290) /* CAN4 id acceptance reg 0 */
+#define CAN4IDAR1 PORTIO_8(IO_BASE + 0x291) /* CAN4 id acceptance reg 1 */
+#define CAN4IDAR2 PORTIO_8(IO_BASE + 0x292) /* CAN4 id acceptance reg 2 */
+#define CAN4IDAR3 PORTIO_8(IO_BASE + 0x293) /* CAN4 id acceptance reg 3 */
+#define CAN4IDMR0 PORTIO_8(IO_BASE + 0x294) /* CAN4 id mask register 0 */
+#define CAN4IDMR1 PORTIO_8(IO_BASE + 0x295) /* CAN4 id mask register 1 */
+#define CAN4IDMR2 PORTIO_8(IO_BASE + 0x296) /* CAN4 id mask register 2 */
+#define CAN4IDMR3 PORTIO_8(IO_BASE + 0x297) /* CAN4 id mask register 3 */
+#define CAN4IDAR4 PORTIO_8(IO_BASE + 0x298) /* CAN4 id acceptance reg 4 */
+#define CAN4IDAR5 PORTIO_8(IO_BASE + 0x299) /* CAN4 id acceptance reg 5 */
+#define CAN4IDAR6 PORTIO_8(IO_BASE + 0x29a) /* CAN4 id acceptance reg 6 */
+#define CAN4IDAR7 PORTIO_8(IO_BASE + 0x29b) /* CAN4 id acceptance reg 7 */
+#define CAN4IDMR4 PORTIO_8(IO_BASE + 0x29c) /* CAN4 id mask register 4 */
+#define CAN4IDMR5 PORTIO_8(IO_BASE + 0x29d) /* CAN4 id mask register 5 */
+#define CAN4IDMR6 PORTIO_8(IO_BASE + 0x29e) /* CAN4 id mask register 6 */
+#define CAN4IDMR7 PORTIO_8(IO_BASE + 0x29f) /* CAN4 id mask register 7 */
+#define CAN4RXFG PORTIO_8(IO_BASE + 0x2a0) /* CAN4 receive buffer */
+#define CAN4TXFG PORTIO_8(IO_BASE + 0x2b0) /* CAN4 transmit buffer */
+
+
+#endif
+
diff --git a/Demo/HCS12_GCC_banked/asm-m68hcs12/sio.h b/Demo/HCS12_GCC_banked/asm-m68hcs12/sio.h
new file mode 100644
index 00000000..31be857a
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/asm-m68hcs12/sio.h
@@ -0,0 +1,81 @@
+/* m68hc11/sio.h -- Utility methods to read/write the SIO
+ Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@nerim.fr)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version
+1, or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this file; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _M68HC12_SIO_H
+#define _M68HC12_SIO_H
+
+#include <sys/param.h>
+#include <sys/ports.h>
+
+/* Initialize SCI serial port to default baudrate and enable. */
+extern inline void
+serial_init (void)
+{
+ SCIBD = M6811_DEF_BAUD;
+ SCICR1 = 0x00; //typical 8 bit
+ SCICR2 = 0x0c; //Enable sci for polling
+}
+
+/* Return != 0 if there is something to read on the serial line. */
+extern inline unsigned char
+serial_receive_pending (void)
+{
+ return SCISR1 & RDRF;
+}
+
+/* Wait until the SIO has finished to send the character. */
+extern inline void
+serial_flush (void)
+{
+ while (!(SCISR1 & TDRE))
+ cop_optional_reset ();
+}
+
+/* Return != 0 if serial port is ready to send another char. */
+extern inline unsigned char
+serial_send_ready (void)
+{
+ return SCISR1 & TDRE;
+}
+
+/* Send the character on the serial line. */
+extern inline void
+serial_send (char c)
+{
+ serial_flush ();
+ SCIDRL = c;
+ SCICR2 |= (1<<3);
+}
+
+/* Wait for a character on the serial line and return it. */
+extern inline unsigned char
+serial_recv (void)
+{
+ while (!(SCISR1 & RDRF))
+ cop_optional_reset ();
+
+ return SCIDRL;
+}
+
+extern void serial_print (const char *msg);
+extern void serial_getline (char *buf);
+
+#endif /* _M68HC11_SIO_H */
+
diff --git a/Demo/HCS12_GCC_banked/cpu.h b/Demo/HCS12_GCC_banked/cpu.h
new file mode 100644
index 00000000..dfbfbe76
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/cpu.h
@@ -0,0 +1,39 @@
+/**
+ * sci.c controls SCI for GCC/HCS12 version of FreeRTOS Demo
+ * To replace CodeWarrior Cpu.h
+ *
+ * Author Jefferson L Smith, Robotronics Inc.
+ */
+
+#ifndef __Cpu
+#define __Cpu
+
+/*Types definition*/
+typedef unsigned char bool;
+typedef unsigned char byte;
+typedef unsigned int word;
+typedef unsigned long dword;
+
+#define ATTR_INT __attribute__((interrupt))
+#define ATTR_FAR __attribute__((far))
+#define ATTR_NEAR __attribute__((near))
+#define ATTR_BANK0 __attribute__((far,section (".bank0")))
+#define ATTR_BANK1 __attribute__((far,section (".bank1")))
+#define ATTR_BANK2 __attribute__((far,section (".bank2")))
+#define ATTR_BANK3 __attribute__((far,section (".bank3")))
+#define ATTR_BANK4 __attribute__((far,section (".bank4")))
+#define ATTR_BANK5 __attribute__((far,section (".bank5")))
+#define ATTR_BANK6 __attribute__((far,section (".bank6")))
+#define ATTR_BANK7 __attribute__((far,section (".bank7")))
+#define ATTR_BANK8 __attribute__((far,section (".bank8")))
+#define ATTR_BANK9 __attribute__((far,section (".bank9")))
+#define ATTR_BANK10 __attribute__((far,section (".bank10")))
+#define ATTR_BANK11 __attribute__((far,section (".bank11")))
+#define ATTR_BANK12 __attribute__((far,section (".bank12")))
+#define ATTR_BANK13 __attribute__((far,section (".bank13")))
+
+#include "PE_Error.h"
+#include <sys/param.h>
+#include <sys/ports.h>
+
+#endif /* ifndef __Cpu */
diff --git a/Demo/HCS12_GCC_banked/gelfunc.c b/Demo/HCS12_GCC_banked/gelfunc.c
new file mode 100644
index 00000000..dcecfb4d
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/gelfunc.c
@@ -0,0 +1,25 @@
+/* gelfunc.c -- functions from GEL 1.6
+ Author Jefferson Smith, Robotronics Inc.
+
+*/
+
+#include "asm-m68hcs12/ports_def.h"
+void cop_reset (void);
+void cop_optional_reset (void);
+
+/* Reset the COP. */
+void
+cop_reset (void)
+{
+ ARMCOP = 0x55;
+ ARMCOP = 0xAA;
+}
+
+void
+cop_optional_reset (void)
+{
+#if defined(M6811_USE_COP) && M6811_USE_COP == 1
+ cop_reset ();
+#endif
+}
+
diff --git a/Demo/HCS12_GCC_banked/ldscript-rtos.x b/Demo/HCS12_GCC_banked/ldscript-rtos.x
new file mode 100644
index 00000000..c495844e
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/ldscript-rtos.x
@@ -0,0 +1,266 @@
+/* Linker script for MC689S12DP256 Flash
+ rom banks.
+
+ Author Jefferson L Smith; Robotronics, Inc. 2006
+ */
+OUTPUT_FORMAT("elf32-m68hc12", "elf32-m68hc12",
+ "elf32-m68hc12")
+OUTPUT_ARCH(m68hc12)
+ENTRY(_start)
+
+/* Get memory banks definition from some user configuration file.
+ This file must be located in some linker directory (search path
+ with -L<dir>). See fixed memory banks emulation script. */
+INCLUDE memory.x;
+
+SECTIONS
+{
+ /* Concatenate .page0 sections. Put them in the page0 memory bank
+ unless we are creating a relocatable file. */
+ .page0 :
+ {
+ *(.page0)
+ } > page0
+
+ /* PPAGE memory banks */
+
+ .bank0 :
+ {
+ *(.bank0)
+ . = ALIGN(2);
+ } > bank0 =0xff
+ .bank1 :
+ {
+ *(.bank1)
+ . = ALIGN(2);
+ } > bank1 =0xff
+ .bank2 :
+ {
+ *(.bank2)
+ . = ALIGN(2);
+ } > bank2 =0xff
+ .bank3 :
+ {
+ *(.bank3)
+ . = ALIGN(2);
+ } > bank3 =0xff
+ .bank4 :
+ {
+ *(.bank4)
+ . = ALIGN(2);
+ } > bank4 =0xff
+ .bank5 :
+ {
+ *(.bank5)
+ . = ALIGN(2);
+ } > bank5 =0xff
+ .bank6 :
+ {
+ *(.bank6)
+ . = ALIGN(2);
+ } > bank6 =0xff
+ .bank7 :
+ {
+ *(.bank7)
+ . = ALIGN(2);
+ } > bank7 =0xff
+ .bank8 :
+ {
+ *(.bank8)
+ . = ALIGN(2);
+ } > bank8 =0xff
+ .bank9 :
+ {
+ *(.bank9)
+ . = ALIGN(2);
+ } > bank9 =0xff
+ .bank10 :
+ {
+ *(.bank10)
+ . = ALIGN(2);
+ } > bank10 =0xff
+ .bank11 :
+ {
+ *(.bank11)
+ . = ALIGN(2);
+ } > bank11 =0xff
+ .bank12 :
+ {
+ *(.bank12)
+ . = ALIGN(2);
+ } > bank12 =0xff
+ .bank13 :
+ {
+ *(.bank13)
+ . = ALIGN(2);
+ } > bank13 =0xff
+
+ /* Start of text section. */
+ .text :
+ {
+ /* Put startup code at beginning so that _start keeps same address. */
+ /* Startup code. */
+ KEEP (*(.install0)) /* Section should setup the stack pointer. */
+ KEEP (*(.install1)) /* Place holder for applications. */
+ KEEP (*(.install2)) /* Optional installation of data sections in RAM. */
+ KEEP (*(.install3)) /* Place holder for applications. */
+ KEEP (*(.install4)) /* Section that calls the main. */
+ *(.init)
+ *(.text)
+ *(.text.*)
+ *(.text_c)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ *(.gnu.linkonce.t.*)
+ *(.tramp)
+ *(.tramp.*)
+ /* Finish code. */
+ KEEP (*(.fini0)) /* Beginning of finish code (_exit symbol). */
+ KEEP (*(.fini1)) /* Place holder for applications. */
+ KEEP (*(.fini2)) /* C++ destructors. */
+ KEEP (*(.fini3)) /* Place holder for applications. */
+ KEEP (*(.fini4)) /* Runtime exit. */
+ _etext = .;
+ PROVIDE (etext = .);
+ . = ALIGN(2);
+ } > text AT>bank14 =0xff
+
+ .text_h :
+ {
+ *(.text_h) /* Bootloader; high Flash area unbanked */
+ . = ALIGN(2);
+ } > text_h AT>bank15 =0xff
+ .rodata :
+ {
+ *(.rodata)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ . = ALIGN(2);
+ } > text_h AT>bank15 =0xff
+ .eh_frame :
+ {
+ KEEP (*(.eh_frame))
+ . = ALIGN(2);
+ } > text_h AT>bank15 =0xff
+
+ /* Constructor and destructor tables are in ROM. */
+ .ctors :
+ {
+ PROVIDE (__CTOR_LIST__ = .);
+ KEEP (*(.ctors))
+ PROVIDE(__CTOR_END__ = .);
+ . = ALIGN(2);
+ } > text_h AT>bank15 =0xff
+ .dtors :
+ {
+ PROVIDE(__DTOR_LIST__ = .);
+ KEEP (*(.dtors))
+ PROVIDE(__DTOR_END__ = .);
+ . = ALIGN(2);
+ } > text_h AT>bank15 =0xff
+
+ /* Start of the data section image in ROM. */
+ __data_image = .;
+ PROVIDE (__data_image = .);
+
+ /* All read-only sections that normally go in PROM must be above.
+ We construct the DATA image section in PROM at end of all these
+ read-only sections. The data image must be copied at init time.
+ Refer to GNU ld, Section 3.6.8.2 Output Section LMA. */
+ .data :
+ {
+ __data_section_start = .;
+ PROVIDE (__data_section_start = .);
+ *(.sdata)
+ *(.data)
+ *(.data.*)
+ *(.data1)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = .;
+ PROVIDE (edata = .);
+ . = ALIGN(2);
+ } > data AT>bank15 =0xff
+ __data_section_size = SIZEOF(.data);
+ __data_image_end = __data_image + __data_section_size;
+ PROVIDE (__data_section_size = SIZEOF(.data));
+ /* .install :
+ {
+ . = _data_image_end;
+ } > text */
+ /* Relocation for some bss and data sections. */
+ .softregs :
+ {
+ __softregs_section_start = .;
+ *(.softregs)
+ __softregs_section_end = .;
+ } > data
+ __softregs_section_size = SIZEOF(.softregs);
+ .bss :
+ {
+ __bss_start = .;
+ *(.sbss)
+ *(.scommon)
+ *(.dynbss)
+ *(.bss)
+ *(.bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ PROVIDE (_end = .);
+ } > data
+ __bss_size = SIZEOF(.bss);
+ PROVIDE (__bss_size = SIZEOF(.bss));
+ .eeprom :
+ {
+ *(.eeprom)
+ *(.eeprom.*)
+ . = ALIGN(2);
+ } > eeprom =0xff
+
+ /* If the 'vectors_addr' symbol is defined, it indicates the start address
+ of interrupt vectors. This depends on the 9S12 operating mode:
+ Addr
+ Hardware location LMA 0x10ff80, mirror 0xff80
+ Called by dbug12 LMA 0x10ef80, mirror 0xef80
+ Ram called by dbug12 0x3e00
+ The default vectors address is (LMA) 0x10ff80. This can be overriden
+ with the '-defsym vectors_addr=0x...' ld option.
+ */
+ PROVIDE (_vectors_addr = DEFINED (vectors_addr) ? vectors_addr : 0x10ff80);
+ .vectors DEFINED (vectors_addr) ? vectors_addr : 0x10ff80 :
+ {
+ KEEP (*(.vectors))
+ }
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0.
+ Treatment of DWARF debug section must be at end of the linker
+ script to avoid problems when there are undefined symbols. It's necessary
+ to avoid that the DWARF section is relocated before such undefined
+ symbols are found. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+}
diff --git a/Demo/HCS12_GCC_banked/main.c b/Demo/HCS12_GCC_banked/main.c
new file mode 100644
index 00000000..e1d9683f
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/main.c
@@ -0,0 +1,291 @@
+
+/*
+ FreeRTOS V3.2.3 - Copyright (C) 2003-2005 Richard Barry.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ See http://www.FreeRTOS.org for documentation, latest information, license
+ and contact details. Please ensure to read the configuration and relevant
+ port sections of the online documentation.
+ ***************************************************************************
+*/
+
+
+/*
+ *
+ * main() creates all the demo application tasks, then starts the scheduler.
+ * The WEB documentation provides more details of the demo application tasks.
+ *
+ * main.c also creates a task called "Check". This only executes every three
+ * seconds but has the highest priority so is guaranteed to get processor time.
+ * Its main function is to check that all the other tasks are still operational.
+ * Each task (other than the "flash" tasks) maintains a unique count that is
+ * incremented each time the task successfully completes its function. Should
+ * any error occur within such a task the count is permanently halted. The
+ * check task inspects the count of each task to ensure it has changed since
+ * the last time the check task executed. If all the count variables have
+ * changed all the tasks are still executing error free, and the check task
+ * toggles the onboard LED. Should any task contain an error at any time
+ * the LED toggle rate will change from 3 seconds to 500ms.
+ *
+ * This file also includes the functionality implemented within the
+ * standard demo application file integer.c. This is done to demonstrate the
+ * use of an idle hook. See the documentation within integer.c for the
+ * rationale of the integer task functionality.
+ * */
+
+/* Kernel includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+#include "cpu.h"
+
+/* special prototypes for memory-banked functions */
+void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority );
+portBASE_TYPE xArePollingQueuesStillRunning( void );
+
+/* Demo application includes. */
+#include "flash.h"
+#include "PollQ.h"
+#include "dynamic.h"
+#include "partest.h"
+#include "comtest2.h"
+#include "BlockQ.h"
+#include "integer.h"
+#include "death.h"
+
+
+/*-----------------------------------------------------------
+ Definitions.
+-----------------------------------------------------------*/
+
+/* Priorities assigned to demo application tasks. */
+#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
+#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
+#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 )
+
+/* LED that is toggled by the check task. The check task periodically checks
+that all the other tasks are operating without error. If no errors are found
+the LED is toggled with mainCHECK_PERIOD frequency. If an error is found
+then the toggle rate increases to mainERROR_CHECK_PERIOD. */
+#define mainCHECK_TASK_LED ( 7 )
+#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS )
+#define mainERROR_CHECK_PERIOD ( ( portTickType ) 500 / portTICK_RATE_MS )
+
+/* The constants used in the idle task calculation. */
+#define intgCONST1 ( ( portLONG ) 123 )
+#define intgCONST2 ( ( portLONG ) 234567 )
+#define intgCONST3 ( ( portLONG ) -3 )
+#define intgCONST4 ( ( portLONG ) 7 )
+#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )
+
+
+/* Baud rate used by the serial port tasks (ComTest tasks).
+IMPORTANT: The function COM0_SetBaudRateValue() which is generated by the
+Processor Expert is used to set the baud rate. As configured in the FreeRTOS
+download this value must be one of the following:
+
+0 to configure for 38400 baud.
+1 to configure for 19200 baud.
+2 to configure for 9600 baud.
+3 to configure for 4800 baud. */
+#define mainCOM_TEST_BAUD_RATE ( ( unsigned portLONG ) 2 )
+
+/* LED used by the serial port tasks. This is toggled on each character Tx,
+and mainCOM_TEST_LED + 1 is toggles on each character Rx. */
+#define mainCOM_TEST_LED ( 3 )
+
+/*-----------------------------------------------------------
+ Local functions prototypes.
+-----------------------------------------------------------*/
+
+/*
+ * The 'Check' task function. See the explanation at the top of the file.
+ */
+static void ATTR_BANK1 vErrorChecks( void* pvParameters );
+
+/*
+ * The idle task hook - in which the integer task is implemented. See the
+ * explanation at the top of the file.
+ */
+void ATTR_BANK0 vApplicationIdleHook( void );
+
+/*
+ * Checks the unique counts of other tasks to ensure they are still operational.
+ */
+static portLONG ATTR_BANK0 prvCheckOtherTasksAreStillRunning( void );
+
+
+
+/*-----------------------------------------------------------
+ Local variables.
+-----------------------------------------------------------*/
+
+/* A few tasks are defined within this file. This flag is used to indicate
+their status. If an error is detected in one of the locally defined tasks then
+this flag is set to pdTRUE. */
+portBASE_TYPE xLocalError = pdFALSE;
+
+
+/*-----------------------------------------------------------*/
+
+/* This is called from startup. */
+int ATTR_BANK0 main ( void )
+{
+ /* Start some of the standard demo tasks. */
+ vStartLEDFlashTasks( mainFLASH_PRIORITY );
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
+ vStartDynamicPriorityTasks();
+ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
+ vStartIntegerMathTasks( tskIDLE_PRIORITY );
+
+ /* Start the locally defined tasks. There is also a task implemented as
+ the idle hook. */
+ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
+
+ /* Must be the last demo created. */
+ vCreateSuicidalTasks( mainDEATH_PRIORITY );
+
+ /* All the tasks have been created - start the scheduler. */
+ vTaskStartScheduler();
+
+ /* Should not reach here! */
+ for( ;; );
+ return 0;
+}
+/*-----------------------------------------------------------*/
+
+static void vErrorChecks( void *pvParameters )
+{
+portTickType xDelayPeriod = mainCHECK_PERIOD;
+portTickType xLastWakeTime;
+
+ /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil()
+ functions correctly. */
+ xLastWakeTime = xTaskGetTickCount();
+
+ for( ;; )
+ {
+ /* Delay until it is time to execute again. The delay period is
+ shorter following an error. */
+ vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );
+
+ /* Check all the demo application tasks are executing without
+ error. If an error is found the delay period is shortened - this
+ has the effect of increasing the flash rate of the 'check' task
+ LED. */
+ if( prvCheckOtherTasksAreStillRunning() == pdFAIL )
+ {
+ /* An error has been detected in one of the tasks - flash faster. */
+ xDelayPeriod = mainERROR_CHECK_PERIOD;
+ }
+
+ /* Toggle the LED each cycle round. */
+ vParTestToggleLED( mainCHECK_TASK_LED );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static portLONG prvCheckOtherTasksAreStillRunning( void )
+{
+portBASE_TYPE xAllTasksPassed = pdPASS;
+
+ if( xArePollingQueuesStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFAIL;
+ }
+
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFAIL;
+ }
+
+ if( xAreComTestTasksStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFALSE;
+ }
+
+ if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFALSE;
+ }
+
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFALSE;
+ }
+
+ if( xIsCreateTaskStillRunning() != pdTRUE )
+ {
+ xAllTasksPassed = pdFALSE;
+ }
+
+ /* Also check the status flag for the tasks defined within this function. */
+ if( xLocalError != pdFALSE )
+ {
+ xAllTasksPassed = pdFAIL;
+ }
+
+ return xAllTasksPassed;
+}
+/*-----------------------------------------------------------*/
+
+void vApplicationIdleHook( void )
+{
+/* This variable is effectively set to a constant so it is made volatile to
+ensure the compiler does not just get rid of it. */
+volatile portLONG lValue;
+
+ /* Keep performing a calculation and checking the result against a constant. */
+
+ /* Perform the calculation. This will store partial value in
+ registers, resulting in a good test of the context switch mechanism. */
+ lValue = intgCONST1;
+ lValue += intgCONST2;
+ lValue *= intgCONST3;
+ lValue /= intgCONST4;
+
+ /* Did we perform the calculation correctly with no corruption? */
+ if( lValue != intgEXPECTED_ANSWER )
+ {
+ /* Error! */
+ portENTER_CRITICAL();
+ xLocalError = pdTRUE;
+ portEXIT_CRITICAL();
+ }
+
+ /* Yield in case cooperative scheduling is being used. */
+ #if configUSE_PREEMPTION == 0
+ {
+ taskYIELD();
+ }
+ #endif
+}
+/*-----------------------------------------------------------*/
+
diff --git a/Demo/HCS12_GCC_banked/memory.x b/Demo/HCS12_GCC_banked/memory.x
new file mode 100644
index 00000000..97ff4b6d
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/memory.x
@@ -0,0 +1,63 @@
+/* Flash Memory Banks
+ For Wytec Dragon12, Technological Arts Adapt9S12DP256
+ with DBug12 v4 bootloader
+
+ Author Jefferson L Smith; Robotronics, Inc.
+ */
+
+MEMORY
+{
+ page0 (rwx) : ORIGIN = 0x0, LENGTH = 256
+
+ /* RAM */
+ data (rwx) : ORIGIN = 0x1000, LENGTH = 12k
+
+ eeprom (rx): ORIGIN = 0x0400, LENGTH = 3k
+ text (rx) : ORIGIN = 0x4000, LENGTH = 16k
+
+ /* high fixed bank, reserve 0x100 vectors and security. */
+ text_h (rx) : ORIGIN = 0xc000, LENGTH = 16k-0x100
+
+ /* Flash memory banks */
+ bank0 (rx) : ORIGIN = 0x0d0000, LENGTH = 16k
+ bank1 (rx) : ORIGIN = 0x0d4000, LENGTH = 16k
+ bank2 (rx) : ORIGIN = 0x0d8000, LENGTH = 16k
+ bank3 (rx) : ORIGIN = 0x0dc000, LENGTH = 16k
+ bank4 (rx) : ORIGIN = 0x0e0000, LENGTH = 16k
+ bank5 (rx) : ORIGIN = 0x0e4000, LENGTH = 16k
+ bank6 (rx) : ORIGIN = 0x0e8000, LENGTH = 16k
+ bank7 (rx) : ORIGIN = 0x0ec000, LENGTH = 16k
+ bank8 (rx) : ORIGIN = 0x0f0000, LENGTH = 16k
+ bank9 (rx) : ORIGIN = 0x0f4000, LENGTH = 16k
+ bank10 (rx) : ORIGIN = 0x0f8000, LENGTH = 16k
+ bank11 (rx) : ORIGIN = 0x0fc000, LENGTH = 16k
+ bank12 (rx) : ORIGIN = 0x100000, LENGTH = 16k
+ bank13 (rx) : ORIGIN = 0x104000, LENGTH = 16k
+
+ bank14 (rx) : ORIGIN = 0x108000, LENGTH = 16k
+ bank15 (rx) : ORIGIN = 0x10c000, LENGTH = 16k-0x100
+}
+/* Setup the stack on the top of the data memory bank. */
+PROVIDE (_stack = 0x1000+12k);
+
+/* interrupt/reset vectors*/
+vectors_addr = 0x10ff80;
+
+SECTIONS
+{
+ /* PPAGE memory banks */
+
+ .bank2 :
+ {
+ ../Common/Minimal/flash.o(.text .rodata)
+ *(.bank2)
+ } > bank2
+
+ .bank3 :
+ {
+ ParTest.o(.text .rodata)
+ *(.bank3)
+ } > bank3
+
+}
+
diff --git a/Demo/HCS12_GCC_banked/sci.c b/Demo/HCS12_GCC_banked/sci.c
new file mode 100644
index 00000000..d32f7cde
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sci.c
@@ -0,0 +1,75 @@
+/**
+ * sci.c controls SCI for GCC/HCS12 version of FreeRTOS Demo
+ * Parts taken from the CodeWarrior Demo in order to work similar.
+ *
+ * Author Jefferson L Smith, Robotronics Inc.
+ */
+
+#include "sci.h"
+#include <sys/ports.h>
+
+//static word SerFlag; /* Flags for serial communication */
+ /* Bits: 0 - OverRun error */
+ /* 1 - Framing error */
+ /* 2 - Parity error */
+ /* 3 - Char in RX buffer */
+ /* 4 - Full TX buffer */
+ /* 5 - Running int from TX */
+ /* 6 - Full RX buffer */
+ /* 7 - Noise error */
+ /* 8 - Idle character */
+ /* 9 - Break detected */
+ /* 10 - Unused */
+static word PrescaleValue;
+//static byte NumMode; /* Number of selected baud mode */
+
+
+/**
+ * SCI_SetBaudRateMode
+ *
+ * Changes the speed (baud rate).
+ */
+byte SCI_SetBaudRateMode(byte Mod)
+{
+ // wired for 24 MHz bus --jeffs
+ static const word SCI_Presc[4] = {39,78,156,313};
+
+ if(Mod >= 4) /* Is mode in baud mode list */
+ return ERR_VALUE; /* If no then error */
+ //NumMode = Mod; /* New baud mode */
+ PrescaleValue = SCI_Presc[Mod]; /* Prescaler in high speed mode */
+
+ /* SCI0CR1: LOOPS=0,SCISWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
+ SCICR1 = 0x00; /* Set the SCI configuration */
+ /* SCI0SR2: ??=0,??=0,??=0,??=0,??=0,BRK13=0,TXDIR=0,RAF=0 */
+ SCISR2 = 0x00; /* Set the Break Character Length and Transmitter pin data direction in Single-wire mode */
+ SCISR1; /* Reset interrupt request flags */
+ SCIBD = PrescaleValue; /* Set prescaler bits */
+ /* SCI0CR2: SCTIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
+ SCICR2 = 0x2c; /* Disable error interrupts */
+
+ return ERR_OK; /* OK */
+}
+
+#if 0 //(not used)
+
+/**
+ * SCI_Init (bean AsynchroSerial)
+ *
+ * This enables SCI.
+ */
+void SCI_Init(void)
+{
+ PrescaleValue = 39; /* Precaler in high speed mode */
+
+ /* SCI0CR1: LOOPS=0,SCISWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
+ SCICR1 = 0x00; /* Set the SCI configuration */
+ /* SCI0SR2: ??=0,??=0,??=0,??=0,??=0,BRK13=0,TXDIR=0,RAF=0 */
+ SCISR2 = 0x00; /* Set the Break Character Length and Transmitter pin data direction in Single-wire mode */
+ SCISR1; /* Reset interrupt request flags */
+ SCIBD = PrescaleValue; /* Set prescaler bits */
+ /* SCI0CR2: SCTIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
+ SCICR2 = 0x2c; /* Disable error interrupts */
+}
+#endif
+
diff --git a/Demo/HCS12_GCC_banked/sci.h b/Demo/HCS12_GCC_banked/sci.h
new file mode 100644
index 00000000..8a039f49
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sci.h
@@ -0,0 +1,34 @@
+/**
+ * sci.h controls SCI for GCC/HCS12 version of FreeRTOS Demo
+ * Parts taken from the CodeWarrior Demo in order to work similar.
+ *
+ * Author Jefferson L Smith, Robotronics Inc.
+ */
+
+#ifndef __SCI
+#define __SCI
+
+#include "cpu.h"
+
+#define COM0_Bm_38400baud 0 /* Constant for switch to mode 0 */
+#define COM0_Bm_19200baud 1 /* Constant for switch to mode 1 */
+#define COM0_Bm_9600baud 2 /* Constant for switch to mode 2 */
+#define COM0_Bm_4800baud 3 /* Constant for switch to mode 3 */
+
+
+/**
+ * SCI_SetBaudRateMode
+ *
+ * Changes the speed (baud rate).
+ */
+byte SCI_SetBaudRateMode(byte Mod);
+
+
+/**
+ * SCI_Init (bean AsynchroSerial)
+ *
+ * This enables SCI.
+ */
+void SCI_Init(void);
+
+#endif /* ifndef __SCI */
diff --git a/Demo/HCS12_GCC_banked/serial.c b/Demo/HCS12_GCC_banked/serial.c
new file mode 100644
index 00000000..93bc3b5d
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/serial.c
@@ -0,0 +1,150 @@
+/*
+ serial.c for using FreeRTOS
+ Copyright (C) 2005 Robotronics Inc.
+*/
+
+
+/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER for port 1.
+
+ GCC demo modifications by Jeff Smith, Robotronics Inc. 2005
+*/
+
+#include "cpu.h"
+#include <sys/sio.h>
+
+/* Scheduler include files. */
+#include "FreeRTOS.h"
+#include "queue.h"
+#include "task.h"
+
+/* Demo application include files. */
+#include "sci.h"
+#include "serial.h"
+
+/* The queues used to communicate between the task code and the interrupt
+service routines. */
+static xQueueHandle xRxedChars;
+static xQueueHandle xCharsForTx;
+
+/* Interrupt identification bits. */
+#define serOVERRUN_INTERRUPT ( '\x08' )
+#define serRX_INTERRUPT ( 0x20 )
+#define serTX_INTERRUPT ( 0x80 )
+
+/*-----------------------------------------------------------*/
+
+
+/*
+ * Initialise port for interrupt driven communications.
+ */
+xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
+{
+ /* Hardware setup is performed by the Processor Expert generated code.
+ This function just creates the queues used to communicate between the
+ interrupt code and the task code - then sets the required baud rate. */
+
+ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
+ xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
+
+ SCI_SetBaudRateMode( ( portCHAR ) ulWantedBaud );
+
+ return NULL;
+}
+/*-----------------------------------------------------------*/
+
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
+{
+ /* Get the next character from the buffer queue. Return false if no characters
+ are available, or arrive before xBlockTime expires. */
+ if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
+ {
+ return pdTRUE;
+ }
+ else
+ {
+ return pdFALSE;
+ }
+}
+/*-----------------------------------------------------------*/
+
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
+{
+ /* Place the character in the queue of characters to be transmitted. */
+ if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS )
+ {
+ return pdFAIL;
+ }
+
+ /* Turn on the Tx interrupt so the ISR will remove the character from the
+ queue and send it. This does not need to be in a critical section as
+ if the interrupt has already removed the character the next interrupt
+ will simply turn off the Tx interrupt again. */
+ SCICR2 |= 0x80; // TIE
+
+ return pdPASS;
+}
+/*-----------------------------------------------------------*/
+
+void vSerialClose( xComPortHandle xPort )
+{
+ /* Not supported. */
+ //( void ) xPort;
+}
+/*-----------------------------------------------------------*/
+
+
+/*
+ * Interrupt service routine for the serial port. Must be in non-banked
+ * memory.
+ */
+
+void ATTR_INT ATTR_NEAR vCOM_ISR( void );
+
+void vCOM_ISR( void )
+{
+volatile unsigned portCHAR ucByte, ucStatus;
+portBASE_TYPE xTaskWokenByPost = pdFALSE, xTaskWokenByTx = pdFALSE;
+
+ /* What caused the interrupt? */
+ ucStatus = SCISR1;
+
+ if( ucStatus & serOVERRUN_INTERRUPT )
+ {
+ /* The interrupt was caused by an overrun. Clear the error by reading
+ the data register. */
+ ucByte = SCIDRL;
+ }
+ else
+ if( ucStatus & serRX_INTERRUPT )
+ {
+ /* The interrupt was caused by a character being received.
+ Read the received byte. */
+ ucByte = SCIDRL;
+
+ /* Post the character onto the queue of received characters - noting
+ whether or not this wakes a task. */
+ xTaskWokenByPost = xQueueSendFromISR( xRxedChars, ( void * ) &ucByte, pdFALSE );
+ }
+
+ if( ( ucStatus & serTX_INTERRUPT ) && ( SCICR2 & 0x80 ) )
+ {
+ /* The interrupt was caused by a character being transmitted. */
+ if( xQueueReceiveFromISR( xCharsForTx, ( void * ) &ucByte, &xTaskWokenByTx ) == pdTRUE )
+ {
+ /* Clear the SCRF bit. */
+ SCIDRL = ucByte;
+ }
+ else
+ {
+ /* Disable transmit interrupt */
+ SCICR2 &= ~0x80; // TIE
+ }
+ }
+
+ if( ( xTaskWokenByPost ) || ( xTaskWokenByTx ) )
+ {
+ portYIELD();
+ }
+
+}
+
diff --git a/Demo/HCS12_GCC_banked/startup.c b/Demo/HCS12_GCC_banked/startup.c
new file mode 100644
index 00000000..48a7de53
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/startup.c
@@ -0,0 +1,86 @@
+/*
+ FreeRTOS V3.2.3 - Copyright (C) 2003-2005 Richard Barry.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ FreeRTOS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with FreeRTOS; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ A special exception to the GPL can be applied should you wish to distribute
+ a combined work that includes FreeRTOS, without being obliged to provide
+ the source code for any proprietary components. See the licensing section
+ of http://www.FreeRTOS.org for full details of how and when the exception
+ can be applied.
+
+ ***************************************************************************
+ See http://www.FreeRTOS.org for documentation, latest information, license
+ and contact details. Please ensure to read the configuration and relevant
+ port sections of the online documentation.
+ ***************************************************************************
+*/
+
+
+/*
+ * startup.c
+ * Author Jefferson L Smith, Robotronics Inc.
+ *
+ * __premain() is the startup code to init hardware and ram to execute the
+ * C application.
+ *
+ */
+
+#include <sys/ports.h>
+#include "cpu.h"
+
+void ATTR_NEAR __premain (void);
+
+void
+__premain (void)
+{
+ // in case special mode enabled, avoid conflict on PORTE
+ PEAR |= NECLK;
+ // bgnd mode stops COP and RTI clocks
+ COPCTL = RSBCK;
+ // stops TCNT counter when debugging stops
+ TSCR1 |= (1<<5); // TFRZ
+
+ // PLL
+ CLKSEL = 0; // disable PLL to configure
+ // xtal 16MHz, bus 24MHz
+ SYNR = 3 - 1;
+ REFDV = 2 - 1;
+ while (!(CRGFLG & 0x08)) // wait for PLL LOCK
+ cop_optional_reset();
+ CLKSEL |= 0x80; // use PLL
+
+ // init switch inputs
+ PERH = 0xff; // pullups
+
+ // outputs
+#if PORT_LED==M6811_PORTB //PORTB
+ DDRB = 0xff; // init LED
+#elif PORT_LED==M6811_PORTA //PORTA
+ DDRA = 0xff;
+#elif PORT_LED==M6811_PTT //PTT
+ DDRT = 0xff;
+#elif PORT_LED==M6811_PTM //PTM
+ DDRM = 0xff;
+#elif PORT_LED==M6811_PTP //PTP
+ DDRP = 0xff;
+#elif PORT_LED==M6811_PTH //PTH
+ DDRH = 0xff;
+#endif
+
+}
+
diff --git a/Demo/HCS12_GCC_banked/sys/interrupts.h b/Demo/HCS12_GCC_banked/sys/interrupts.h
new file mode 100644
index 00000000..b783e4b9
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sys/interrupts.h
@@ -0,0 +1,73 @@
+/* Interrupt Vectors
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@nerim.fr)
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_INTERRUPTS_H
+#define _SYS_INTERRUPTS_H
+
+#include <sys/param.h>
+
+#ifdef mc6811
+//# include <asm-m68hc11/interrupts.h>
+#endif
+
+#ifdef mc68hcs12
+# include <asm-m68hcs12/interrupts.h>
+#elif defined(mc6812)
+//# include <asm-m68hc12/interrupts.h>
+#endif
+
+/*! Install an interrupt handler.
+
+ Install the interrupt handler for an exception. The handler
+ is installed for \b bootstrap mode and also for \b normal operating
+ mode.
+
+ @param id the interrupt number to be installed
+ @param handler the interrupt handler entry point
+*/
+extern void
+set_interrupt_handler (interrupt_vector_id id, interrupt_t handler);
+
+/*! Default and fatal interrupt handler.
+
+ This function is an interrupt handler intended to be used to
+ handle all interrupt not used by a program. Since it is an
+ error to have an interrupt when it is not handled, the default
+ behavior is to print a message and stop. */
+extern void __attribute__((interrupt, noreturn))
+fatal_interrupt (void);
+
+#include <arch/interrupts.h>
+
+/*! Entry point of any program.
+
+ This function should never be called by itself. It represents the
+ entry point of any program. It is intended to be used in an
+ interrupt table to specify the function to jump to after reset. */
+extern void _start (void);
+
+#endif
diff --git a/Demo/HCS12_GCC_banked/sys/param.h b/Demo/HCS12_GCC_banked/sys/param.h
new file mode 100644
index 00000000..8dbf1a3a
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sys/param.h
@@ -0,0 +1,56 @@
+/* param.h - Board specific parameters
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@nerim.fr)
+
+This file is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+This file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+/*! Attribute unused.
+ Use this attribute to indicate that a parameter, a variable or a
+ static function is not used. The compiler will not warn about the
+ unused variable. */
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+
+/*! Attribute page0.
+ Use this attribute to put a global or static variable in page0. */
+#define PAGE0_ATTRIBUTE __attribute__((section(".page0")))
+
+#ifdef mc6811
+//# include <asm-m68hc11/param.h>
+#endif
+
+#ifdef mc68hcs12
+# include <asm-m68hcs12/param.h>
+#elif defined(mc6812)
+//# include <asm-m68hc12/param.h>
+#endif
+
+#include <arch/param.h>
+
+#define GNU_LINKER_WARNING(SYMBOL, MSG) \
+ asm (".section .gnu.warning." SYMBOL "\n\t.string \"" MSG "\"\n\t.previous");
+
+#endif
diff --git a/Demo/HCS12_GCC_banked/sys/ports.h b/Demo/HCS12_GCC_banked/sys/ports.h
new file mode 100644
index 00000000..934c2f39
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sys/ports.h
@@ -0,0 +1,69 @@
+/* sys/ports.h -- Definition of system ports
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GEL.
+
+GEL is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GEL is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GEL; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_PORTS_H
+#define _SYS_PORTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ extern unsigned short get_timer_counter (void);
+ extern void set_timer_counter (unsigned short);
+ extern unsigned short get_input_capture_1 (void);
+ extern void set_input_capture_1 (unsigned short);
+ extern unsigned short get_input_capture_2 (void);
+ extern void set_input_capture_2 (unsigned short);
+ extern unsigned short get_input_capture_3 (void);
+ extern void set_input_capture_3 (unsigned short);
+ extern unsigned short get_output_compare_1 (void);
+ extern void set_output_compare_1 (unsigned short);
+ extern unsigned short get_output_compare_2 (void);
+ extern void set_output_compare_2 (unsigned short);
+ extern unsigned short get_output_compare_3 (void);
+ extern void set_output_compare_3 (unsigned short);
+ extern unsigned short get_output_compare_4 (void);
+ extern void set_output_compare_4 (unsigned short);
+ extern unsigned short get_output_compare_5 (void);
+ extern void set_output_compare_5 (unsigned short);
+ extern void set_bus_expanded (void);
+ extern void set_bus_single_chip (void);
+ extern void cop_reset (void);
+ extern void cop_optional_reset (void);
+ extern void timer_acknowledge (void);
+ extern void timer_initialize_rate (unsigned char);
+
+#ifdef mc6811
+//# include <asm-m68hc11/ports.h>
+#endif
+
+#ifdef mc68hcs12
+# include <asm-m68hcs12/ports.h>
+#elif defined(mc6812)
+//# include <asm-m68hc12/ports.h>
+#endif
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _SYS_PORTS_H */
+
diff --git a/Demo/HCS12_GCC_banked/sys/ports_def.h b/Demo/HCS12_GCC_banked/sys/ports_def.h
new file mode 100644
index 00000000..8d2c7493
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sys/ports_def.h
@@ -0,0 +1,36 @@
+/* sys/ports_def.h -- Definition of system ports
+ Copyright 2000 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GEL.
+
+GEL is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GEL is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GEL; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_PORTS_DEF_H
+#define _SYS_PORTS_DEF_H
+
+#ifdef mc6811
+//# include <asm-m68hc11/ports_def.h>
+#endif
+
+#ifdef mc68hcs12
+# include <asm-m68hcs12/ports_def.h>
+#elif defined(mc6812)
+//# include <asm-m68hc12/ports_def.h>
+#endif
+
+#endif /* _SYS_PORTS_DEF_H */
+
diff --git a/Demo/HCS12_GCC_banked/sys/sio.h b/Demo/HCS12_GCC_banked/sys/sio.h
new file mode 100644
index 00000000..a28fe94f
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/sys/sio.h
@@ -0,0 +1,80 @@
+/* sys/sio.h -- Utility methods to read/write the SIO
+ Copyright 2000 Free Software Foundation, Inc.
+ Written by Stephane Carrez (stcarrez@worldnet.fr)
+
+This file is part of GEL.
+
+GEL is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GEL is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GEL; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_SIO_H
+#define _SYS_SIO_H
+
+#include <sys/param.h>
+#include <sys/ports.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void serial_init (void);
+
+/* Return != 0 if there is something to read on the serial line. */
+extern unsigned char serial_receive_pending (void);
+
+/* Wait until the SIO has finished to send the character. */
+extern void serial_flush (void);
+
+/* Return != 0 if serial port is ready to send another char. */
+extern unsigned char serial_send_ready (void);
+
+/* Send the character on the serial line. */
+extern void serial_send (char c);
+
+/* Wait for a character on the serial line and return it. */
+extern unsigned char serial_recv (void);
+
+/** Write the string on the serial line.
+
+ @param msg null terminated string to write.
+
+ @see serial_init, serial_send
+*/
+extern void serial_print (const char *msg);
+
+/** Wait for a string from serial line.
+
+ @param msg buffer that will hold the string.
+
+ @see serial_init, serial_recv
+*/
+extern void serial_getline (char *buf);
+
+#ifdef mc6811
+//# include <asm-m68hc11/sio.h>
+#endif
+
+#ifdef mc68hcs12
+# include <asm-m68hcs12/sio.h>
+#elif defined(mc6812)
+//# include <asm-m68hc12/sio.h>
+#endif
+
+
+#ifdef __cplusplus
+};
+#endif
+#endif /* _SYS_SIO_H */
+
diff --git a/Demo/HCS12_GCC_banked/vectors.c b/Demo/HCS12_GCC_banked/vectors.c
new file mode 100644
index 00000000..2375a73b
--- /dev/null
+++ b/Demo/HCS12_GCC_banked/vectors.c
@@ -0,0 +1,115 @@
+/* modrx.c -- wireless controller receiver for robots
+ Copyright 2004 Robotronics, Inc.
+ Author Jefferson Smith
+
+ This file is part of the Modular Robot Design.
+*/
+
+#include "cpu.h"
+#include <sys/ports.h>
+#include <sys/interrupts.h>
+
+void fatal_interrupt ()
+{
+ /* Infinite loop for debugging
+ Returning would not help as it's necessary to clear the interrupt flag.
+ */
+ for (;;) cop_optional_reset();
+}
+
+#ifdef USE_INTERRUPT_TABLE
+
+/* NOTE: these ISR must be in non-banked memory (near) */
+
+/* Manual context switch function. This is the SWI ISR. */
+void ATTR_INT ATTR_NEAR vPortYield( void );
+
+/* Tick context switch function. This is the timer ISR. */
+void ATTR_INT ATTR_NEAR vPortTickInterrupt( void );
+
+void ATTR_INT ATTR_NEAR vCOM_ISR( void );
+
+/* Interrupt vectors table.
+
+ Note: the `XXX_handler: foo' notation is a GNU extension which is
+ used here to ensure correct association of the handler in the struct.
+ This is why the order of handlers declared below does not follow
+ the MCU order. */
+const struct interrupt_vectors __attribute__((section(".vectors"))) vectors =
+{
+ pwm_shutdown_handler: fatal_interrupt,
+ ptpif_handler: fatal_interrupt,
+ can4_tx_handler: fatal_interrupt,
+ can4_rx_handler: fatal_interrupt,
+ can4_err_handler: fatal_interrupt,
+ can4_wake_handler: fatal_interrupt,
+ can3_tx_handler: fatal_interrupt,
+ can3_rx_handler: fatal_interrupt,
+ can3_err_handler: fatal_interrupt,
+ can3_wake_handler: fatal_interrupt,
+ can2_tx_handler: fatal_interrupt,
+ can2_rx_handler: fatal_interrupt,
+ can2_err_handler: fatal_interrupt,
+ can2_wake_handler: fatal_interrupt,
+ can1_tx_handler: fatal_interrupt,
+ can1_rx_handler: fatal_interrupt,
+ can1_err_handler: fatal_interrupt,
+ can1_wake_handler: fatal_interrupt,
+ can0_tx_handler: fatal_interrupt,
+ can0_rx_handler: fatal_interrupt,
+ can0_err_handler: fatal_interrupt,
+ can0_wake_handler: fatal_interrupt,
+ flash_handler: fatal_interrupt,
+ eeprom_handler: fatal_interrupt,
+ spi2_handler: fatal_interrupt,
+ spi1_handler: fatal_interrupt,
+ iic_handler: fatal_interrupt,
+ bdlc_handler: fatal_interrupt,
+ selfclk_mode_handler: fatal_interrupt,
+ pll_lock_handler: fatal_interrupt,
+ accb_overflow_handler: fatal_interrupt,
+ mccnt_underflow_handler: fatal_interrupt,
+ pthif_handler: fatal_interrupt,
+ ptjif_handler: fatal_interrupt,
+ atd1_handler: fatal_interrupt,
+ atd0_handler: fatal_interrupt,
+ sci1_handler: fatal_interrupt,
+ sci0_handler: fatal_interrupt,
+ spi0_handler: fatal_interrupt,
+
+ /** Timer and Accumulator */
+ acca_input_handler: fatal_interrupt,
+ acca_overflow_handler: fatal_interrupt,
+ timer_overflow_handler: fatal_interrupt,
+
+ /** Input capture / Output compare Timers */
+ tc7_handler: fatal_interrupt,
+ tc6_handler: fatal_interrupt,
+ tc5_handler: fatal_interrupt,
+ tc4_handler: fatal_interrupt,
+ tc3_handler: fatal_interrupt,
+ tc2_handler: fatal_interrupt,
+ tc1_handler: fatal_interrupt,
+ tc0_handler: fatal_interrupt,
+
+ /** External Interrupts */
+ rtii_handler: fatal_interrupt,
+ irq_handler: fatal_interrupt,
+ xirq_handler: fatal_interrupt,
+
+ illegal_handler: fatal_interrupt,
+ cop_fail_handler: fatal_interrupt,
+ cop_clock_handler: fatal_interrupt,
+
+ /** Vectors in use */
+ swi_handler: vPortYield,
+ rtii_handler: vPortTickInterrupt,
+#if M6812_DEF_SCI==1
+ sci1_handler: vCOM_ISR,
+#else
+ sci0_handler: vCOM_ISR,
+#endif
+ reset_handler: _start
+};
+#endif
+