1 /***********************************************************************************************************************
\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
\r
4 * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
\r
5 * applicable laws, including copyright laws.
\r
6 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
\r
7 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
\r
8 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
\r
9 * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
\r
10 * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
\r
11 * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\r
12 * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
\r
13 * this software. By using this software, you agree to the additional terms and conditions found by accessing the
\r
15 * http://www.renesas.com/disclaimer
\r
17 * Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
\r
18 ***********************************************************************************************************************/
\r
19 /***********************************************************************************************************************
\r
20 * File Name : vecttbl.c
\r
22 * Description : Definition of the fixed vector table and option setting memory.
\r
23 ***********************************************************************************************************************/
\r
24 /***********************************************************************************************************************
\r
25 * History : DD.MM.YYYY Version Description
\r
26 * : 08.11.2012 0.01 Beta Release
\r
27 ***********************************************************************************************************************/
\r
29 /***********************************************************************************************************************
\r
30 Includes <System Includes> , "Project Includes"
\r
31 ***********************************************************************************************************************/
\r
32 /* Fixed size integers. */
\r
34 /* Used for nop(). */
\r
35 #include <machine.h>
\r
36 /* BSP configuration. */
\r
37 #include "platform.h"
\r
39 #pragma section IntPRG
\r
41 /***********************************************************************************************************************
\r
42 * Function name: PowerON_Reset_PC
\r
43 * Description : The reset vector points to this function. Code execution starts in this function after reset.
\r
45 * Return value : none
\r
46 ***********************************************************************************************************************/
\r
47 extern void PowerON_Reset_PC(void);
\r
49 /***********************************************************************************************************************
\r
50 * Function name: excep_supervisor_inst_isr
\r
51 * Description : Supervisor Instruction Violation ISR
\r
53 * Return Value : none
\r
54 ***********************************************************************************************************************/
\r
55 #pragma interrupt (excep_supervisor_inst_isr)
\r
56 void excep_supervisor_inst_isr(void)
\r
58 /* If the user defined a callback function in r_bsp_config.h then it will be called here. */
\r
59 #if defined(EXCEP_SUPERVISOR_ISR_CALLBACK)
\r
60 EXCEP_SUPERVISOR_ISR_CALLBACK();
\r
62 /* If you do not put the MCU in Supervisor mode before returning then it will just execute the same violating
\r
63 instruction again and come back in here. Since the PSW is restored from the stack when returning from the
\r
64 exception, you would need to alter the saved PSW on the stack to change to Supervisor mode. We do not do this
\r
65 here because the only 'safe' way to do this would be to write this function in assembly. Even then most users
\r
66 would probably want to handle this someway instead of just going back to the application. */
\r
72 /***********************************************************************************************************************
\r
73 * Function name: excep_undefined_inst_isr
\r
74 * Description : Undefined instruction exception ISR
\r
76 * Return Value : none
\r
77 ***********************************************************************************************************************/
\r
78 #pragma interrupt (excep_undefined_inst_isr)
\r
79 void excep_undefined_inst_isr(void)
\r
81 /* If the user defined a callback function in r_bsp_config.h then it will be called here. */
\r
82 #if defined(EXCEP_UNDEFINED_INSTR_ISR_CALLBACK)
\r
83 EXCEP_UNDEFINED_INSTR_ISR_CALLBACK();
\r
89 /***********************************************************************************************************************
\r
90 * Function name: non_maskable_isr
\r
91 * Description : Non-maskable interrupt ISR
\r
93 * Return Value : none
\r
94 ***********************************************************************************************************************/
\r
95 #pragma interrupt (non_maskable_isr)
\r
96 void non_maskable_isr(void)
\r
98 /* If the user defined a callback function in r_bsp_config.h then it will be called here. */
\r
99 #if defined(NMI_ISR_CALLBACK)
\r
100 NMI_ISR_CALLBACK();
\r
102 /* Clear NMI flag. */
\r
103 ICU.NMICLR.BIT.NMICLR = 1;
\r
109 /***********************************************************************************************************************
\r
110 * Function name: undefined_interrupt_source_isr
\r
111 * Description : All undefined interrupt vectors point to this function.
\r
112 * Set a breakpoint in this function to determine which source is creating unwanted interrupts.
\r
114 * Return Value : none
\r
115 ***********************************************************************************************************************/
\r
116 #pragma interrupt (undefined_interrupt_source_isr)
\r
117 void undefined_interrupt_source_isr(void)
\r
119 /* If the user defined a callback function in r_bsp_config.h then it will be called here. */
\r
120 #if defined(UNDEFINED_INT_ISR_CALLBACK)
\r
121 UNDEFINED_INT_ISR_CALLBACK();
\r
127 /***********************************************************************************************************************
\r
128 * Function name: bus_error_isr
\r
129 * Description : By default, this demo code enables the Bus Error Interrupt. This interrupt will fire if the user tries
\r
130 * to access code or data from one of the reserved areas in the memory map, including the areas covered
\r
131 * by disabled chip selects. A nop() statement is included here as a convenient place to set a breakpoint
\r
132 * during debugging and development, and further handling should be added by the user for their
\r
135 * Return value : none
\r
136 ***********************************************************************************************************************/
\r
137 #pragma interrupt (bus_error_isr(vect=VECT(BSC,BUSERR)))
\r
138 void bus_error_isr (void)
\r
140 /* Clear the bus error */
\r
141 BSC.BERCLR.BIT.STSCLR = 1;
\r
144 To find the address that was accessed when the bus error occurred, read the register BSC.BERSR2.WORD. The upper
\r
145 13 bits of this register contain the upper 13-bits of the offending address (in 512K byte units)
\r
148 /* If the user defined a callback function in r_bsp_config.h then it will be called here. */
\r
149 #if defined(BUS_ERROR_ISR_CALLBACK)
\r
150 BUS_ERROR_ISR_CALLBACK();
\r
161 /***********************************************************************************************************************
\r
162 * The following array fills in the endian and option function select registers, and the fixed vector table
\r
164 ***********************************************************************************************************************/
\r
165 #pragma section C FIXEDVECT
\r
167 void (*const Fixed_Vectors[])(void) = {
\r
168 //;0xffffffd0 Exception(Supervisor Instruction)
\r
169 excep_supervisor_inst_isr,
\r
170 //;0xffffffd4 Reserved
\r
172 //;0xffffffd8 Reserved
\r
174 //;0xffffffdc Exception(Undefined Instruction)
\r
175 undefined_interrupt_source_isr,
\r
176 //;0xffffffe0 Reserved
\r
178 //;0xffffffe4 Reserved
\r
180 //;0xffffffe8 Reserved
\r
182 //;0xffffffec Reserved
\r
184 //;0xfffffff0 Reserved
\r
186 //;0xfffffff4 Reserved
\r
190 //;0xfffffffc RESET
\r
191 //;<<VECTOR DATA START (POWER ON RESET)>>
\r
192 //;Power On Reset PC
\r
194 //;<<VECTOR DATA END (POWER ON RESET)>>
\r
197 #pragma address _MDEreg=0xffffff80 // MDE register (Single Chip Mode)
\r
199 const unsigned long _MDEreg = 0xfffffff8; // big
\r
201 const unsigned long _MDEreg = 0xffffffff; // little
\r