|
Part 1ýConstructing the Platform
by Ed Sutter
Start ý The
Typical Package ý What are the Alternatives?
ý Key Ingredients ý MicroMonitor
Run Time Startup ý Just After Reset
ý Establish Exception Handlers ý I/O
Initialization ý Flash Memory Drivers
ý Sources and PDF
ESTABLISH EXCEPTION HANDLERS
The next step is to initialize the CPU
vector table, which is a block of memory (either in a fixed location
or pointed to by a system register) that contains either code or pointers
to code. The code is asynchronously branched to from running application
code as a result of some system condition occurring. This could be
an interrupt, invalid instruction, breakpoint trap, address alignment
error, or so on. There are a lot of different exceptions, and for
each CPU, the list is different, as well as the implementation of
the vector table itself. This is CPU-specific, and it is beyond the
scope of this article to go much further regarding specific CPU implementations.
From a generic point of view, the monitor
has two jobsýit must create the table and be prepared to handle the
exception. Afterward, it must cache the state of the registers at
the time of the exception. The table could be part of the boot flash
if the boot flash is in memory space that allows this. However, I
find it more practical to create the table in RAM space whenever possible.
This means that at startup there is a window of time when there is
no table, but it provides the flexibility of allowing the content
of the table to be changed. This is handy if you are trying to share
the table between an application and monitor because the monitor can
write default handlers for all exceptions, then the application can
overwrite the handlers that it needs to deal with, leaving the others
to default to monitor-based exception handling.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |