Interrupt Vector And Boot Processing Descriptions - Epson S5U1C17001C Manual

Cmos 16-bit single chip microcontroller (c compiler package for s1c17 family) (ver. 3.1)
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

3.3.4

Interrupt Vector and Boot Processing Descriptions

The library crt0.o provides an interrupt vector table and processing from when the target is reset until the main function is called
(boot processing).
For detailed information on crt0.o, refer to Section 5.2, "Startup Processing Library".
 Adding boot processing
Specific processing can be executed on booting by defining the following functions. If they are not defined, the details defined by
crt0.o will be enabled.
void _init_device (void)
void _start_device (void)
void _stop_device (void)
 Setting the stack pointer initial value
crt0.o sets the stack pointer initial value in accordance with the __START_stack value. Set the __START_stack value to suit the
amount of RAM installed on the target model. If set by a C source file, the __START_stack value should be described as follows
somewhere in the C source file:
asm(".global __START_stack");
asm(".set __START_stack, 0x7c0"); /* initial value of SP register */
If set by a linker symbol file (ldsyms.ini), the __START_stack value should be described as follows:
__START_stack = 0x7c0; /* initial value of SP register */
In the above example, the value is set to 0x7c0. If no value is set, the value defined by the default linker script will be used.
 Registering an interrupt vector
With crt0.o, the name of the interrupt handler function is fixed at _vectorXX_handler (where XX is a two-digit base-10 vector
number). Providing a _vector08_handler function as shown below registers it in the interrupt vector table as an interrupt handler
function for vector number 8.
void _vector08_handler(void) __attribute__((interrupt_handler));
To register the existing interrupt handler function sampleInterrupt to vector number 8, add the following description to the C
source file defining sampleInterrupt:
void _vector08_handler(void) __attribute__((alias("sampleInterrupt")));
This description defines the _vector08_handler with the alias sampleInterrupt. The sampleInterrupt function is an interrupt
handler function and must have a prototype declaration as shown below:
void sampleInterrupt(void) __attribute__((interrupt_handler));
S5U1C17001C Manual
(Rev. 1.0)
Initializes the device. This is called before _init_section, _init_lib, _init_sys.
In crt0.o, this is defined as a function that does nothing.
Starts device operation. This is called after _init_section, _init_lib, _init_sys,
and before main.
In crt0.o, this is defined as a function that executes interrupt enable ei.
Stops device operation. This is called after main.
In crt0.o, this is defined as a function that executes interrupt disable di.
Seiko Epson Corporation
3 GNU17 IDE
3-5

Advertisement

Table of Contents
loading

Table of Contents