- 219 -

7.3.1 C Language Startup Program (crt0mr.a30)

Figure 7.11 shows the C language startup program(crt0mr.a30).

1 ; ****************************************************************
2 ;
3 ; MR100 start up program for C language
4 ; COPYRIGHT(C) 2003,2006,2007 RENESAS TECHNOLOGY CORPORATION
5 ; AND RENESAS SOLUTIONS CORPORATION ALL RIGHTS RESERVED
6 ; MR100
7 ;
8 ; ****************************************************************
9 ; "$Id: crt0mr.a30 512 2007-07-09 10:11:36Z inui $"
10 ;*A1* 2005-02-28 for ES
11 ;*G0* 2006-06-15 for MR100/4
12 ;
13 .LIST OFF
14 .INCLUDE c_sec.inc
15 .INCLUDE mr100.inc
16 .INCLUDE sys_rom.inc
17 .INCLUDE sys_ram.inc
18 .LIST ON
19
20 .GLB __SYS_INITIAL
21 .GLB __END_INIT
22 .GLB __init_sys,__init_tsk
23
24 regoffset .EQU 0
25
26 ;-----------------------------------------------------------------
27 ; SBDATA area definition
28 ;-----------------------------------------------------------------
29 .GLB __SB__
30 .SB __SB__
31
32 ;=================================================================
33 ; Initialize Macro declaration
34 ;-----------------------------------------------------------------
35 BZERO .macro TOP_,SECT_
36 XOR.B R0L,R0L
37 mov.l #TOP_,A1
38 mov.l #sizeof SECT_,R7R5
39 sstr.b
40 .endm
41 BCOPY .macro FROM_,TO_,SECT_
42 mov.l #FROM_,A0
43 mov.l #TO_,A1
44 mov.l #sizeof SECT_,R7R5
45 smovf.b
46 .endm
47 ;=================================================================
48 ; Interrupt section start
49 ;-----------------------------------------------------------------
50 .SECTION MR_KERNEL,CODE,ALIGN
51
52 ;-----------------------------------------------------------------
53 ; after reset,this program will start
54 ;-----------------------------------------------------------------
55 __SYS_INITIAL:
56 LDC #__Sys_Sp,ISP ; set initial ISP
57
58 ; MOV.B #2,0AH
59 ; MOV.B #00,PMOD ; Set Processor Mode Register
60 ; MOV.B #0,0AH ;
61 LDC #00000010H,FLG
62 LDC #__SB__,SB
63 LDC #00000000H,FLG
64 LDC #__Sys_Sp,FB
65 LDC #__SB__,SB
66
67 ;=================================================================
68 ; MR_RAM zero clear
69 ;--------------------------------------------------------
70 BZERO
MR_RAM_top,MR_RAM
71
72 ;=================================================================
73 ; NEAR area initialize.
74 ; FAR area initialize.