In-Line Assemble; Prototype Declarations - 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

2 Source Files
2.2.3

In-line Assemble

The xgcc C compiler supports in-line assembly, so the asm statement can be used. As a result, the word "asm" is reserved for
system use.
asm("<character string>");
Format:
Example 1: /* HALT mode */
asm("halt");
Example 2: /* Trap Table*/
asm(" .long
.long
.long
.space
.long
.long
Example 3: BOOT(){
asm("xld.a %sp,0x3f00");
}
For details on how to write an assembly source, refer to Section 2.3, "Grammar of Assembly Source".
2.2.4

Prototype Declarations

 Declaring interrupt handler functions
Interrupt handler functions should be declared in the following format:
<type><function name> __attribute__ ((interrupt_handler));
Example: void foo(void) __attribute__ ((interrupt_handler));
int int_num;
void foo()
{
int_num = 5;
}
Assembler code
foo:
2-4
BOOT\n\
ADDR_ERR\n\
NMI\n\}
4\n\
EINT0\n\
EINT1");
:
ld.a -[%sp],%r2
ld %r2,5
xld [int_num],%r2
ld.a %r2,[%sp]+
reti
Seiko Epson Corporation
/* set SP */
S5U1C17001C Manual
(Rev. 1.0)

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the S5U1C17001C and is the answer not in the manual?

Table of Contents