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 : flash_options.c
\r
22 * Description : Some options of the RX63x are set through registers that are found in ROM. These registers and options
\r
23 * are defined in the 'Option-Setting Memory' section of the HW Manual. These memory locations are defined
\r
24 * below with descriptions of what is being set.
\r
25 ***********************************************************************************************************************/
\r
26 /***********************************************************************************************************************
\r
27 * History : DD.MM.YYYY Version Description
\r
28 * : 31.10.2011 1.00 First Release
\r
29 * : 13.03.2012 1.10 USER_BOOT_ENABLE macro from r_bsp_config.h is now used to set Option-Setting Memory
\r
30 * area to boot into User Boot Mode.
\r
31 ***********************************************************************************************************************/
\r
33 /***********************************************************************************************************************
\r
34 Includes <System Includes> , "Project Includes"
\r
35 ***********************************************************************************************************************/
\r
36 /* Used for fixed-width typedefs. */
\r
38 /* Determines whether user boot is used or not. */
\r
39 #include "platform.h"
\r
41 /* The UB Code A, UB Code B, and Endian select register B (MDEB) are located in the User Boot space. Immediately
\r
42 following the MDEB register is the User Boot Reset Vector so it is defined below as well. These settings will only
\r
43 be used when the MCU is reset in User Boot Mode. In order for the MCU to start up in User Boot Mode the following
\r
44 conditions must be met:
\r
45 1) UB code A is 55736572h and 426F6F74h.
\r
46 2) UB code B is FFFF FF07h and 0008 C04Ch.
\r
47 3) The low level is being input on the MD pin.
\r
48 4) The high level is being input on the PC7 pin.
\r
49 Please see the Option-Setting Memory section of your MCU's HW manual for more information. */
\r
51 /* 0xFF7FFFE8 - 0xFF7FFFEF : UB Code A register
\r
52 0xFF7FFFF0 - 0xFF7FFFF7 : UB Code B register
\r
53 0xFF7FFFF8 - 0xFF7FFFFB : MDEB register
\r
54 0xFF7FFFFC - 0xFF7FFFFF : User Boot Reset Vector */
\r
56 #pragma address user_boot_settings = 0xFF7FFFE8
\r
58 #if USER_BOOT_ENABLE == 1
\r
59 extern void PowerON_Reset_PC(void);
\r
61 /* Use this array if you are using User Boot. Make sure to fill in valid address for UB Reset Vector. */
\r
62 const uint32_t user_boot_settings[6] =
\r
64 0x55736572, //Required setting for UB Code A to get into User Boot
\r
65 0x426f6f74, //Required setting for UB Code A to get into User Boot
\r
66 0xffffff07, //Required setting for UB Code B to get into User Boot
\r
67 0x0008c04c, //Required setting for UB Code B to get into User Boot
\r
68 /* Choose endian for user application code
\r
69 MDEB Register - Endian Select Register B
\r
70 b31:b3 Reserved (set to 1)
\r
71 b2:b0 MDE - Endian Select (0 = Big Endian, 7 = Little Endian) */
\r
72 0xFFFFFFFF, //Select Little Endian for User Boot Code
\r
73 (uint32_t) PowerON_Reset_PC //This is the User Boot Reset Vector. When using User Boot put in the reset address here
\r
77 /* The Endian select register S (MDES), Option function select register 1 (OFS1), and Option function select register 0
\r
78 (OFS0) are located in User ROM. */
\r
80 /* 0xFFFFFF80 - 0xFFFFFF83 : MDES register
\r
81 0xFFFFFF84 - 0xFFFFFF87 : Reserved space (0xFF's)
\r
82 0xFFFFFF88 - 0xFFFFFF8B : OFS1 register
\r
83 0xFFFFFF8C - 0xFFFFFF8F : OFS0 register */
\r
85 #pragma address flash_options = 0xFFFFFF80
\r
87 const uint32_t flash_options[] =
\r
89 /* Choose endian for user application code
\r
90 MDES Register - Endian Select Register S
\r
91 b31:b3 Reserved (set to 1)
\r
92 b2:b0 MDE - Endian Select (0 = Big Endian, 7 = Little Endian) */
\r
93 0xFFFFFFFF, //Little Endian chosen for User Application
\r
94 0xFFFFFFFF, //Reserved space
\r
95 /* Configure whether voltage detection 0 circuit and HOCO are enabled after reset.
\r
96 OFS1 - Option Function Select Register 1
\r
97 b31:b9 Reserved (set to 1)
\r
98 b8 HOCOEN - Enable/disable HOCO oscillation after a reset (0=enable, 1=disable)
\r
99 b7:b3 Reserved (set to 1)
\r
100 b2 LVDAS - Choose to enable/disable Voltage Detection 0 Circuit after a reset (0=enable, 1=disable)
\r
101 b1:b0 Reserved (set to 1) */
\r
102 0xFFFFFFFF, //Both are disabled.
\r
103 /* Configure WDT and IWDT settings.
\r
104 OFS0 - Option Function Select Register 0
\r
105 b31:b29 Reserved (set to 1)
\r
106 b28 WDTRSTIRQS - WDT Reset Interrupt Request - What to do on underflow (0=take interrupt, 1=reset MCU)
\r
107 b27:b26 WDTRPSS - WDT Window Start Position Select - (0=25%, 1=50%, 2=75%, 3=100%,don't use)
\r
108 b25:b24 WDTRPES - WDT Window End Position Select - (0=75%, 1=50%, 2=25%, 3=0%,don't use)
\r
109 b23:b20 WDTCKS - WDT Clock Frequency Division Ratio - (1=/4, 4=/64, 0xF=/128, 6=/512, 7=/2048, 8=/8192)
\r
110 b19:b18 WDTTOPS - WDT Timeout Period Select - (0=1024 cycles, 1=4096, 2=8192, 3=16384)
\r
111 b17 WDTSTRT - WDT Start Mode Select - (0=auto-start after reset, halt after reset)
\r
112 b16:b15 Reserved (set to 1)
\r
113 b14 IWDTSLCSTP - IWDT Sleep Mode Count Stop Control - (0=can't stop count, 1=stop w/some low power modes)
\r
114 b13 Reserved (set to 1)
\r
115 b12 IWDTRSTIRQS - IWDT Reset Interrupt Request - What to do on underflow (0=take interrupt, 1=reset MCU)
\r
116 b11:b10 IWDTRPSS - IWDT Window Start Position Select - (0=25%, 1=50%, 2=75%, 3=100%,don't use)
\r
117 b9:b8 IWDTRPES - IWDT Window End Position Select - (0=75%, 1=50%, 2=25%, 3=0%,don't use)
\r
118 b7:b4 IWDTCKS - IWDT Clock Frequency Division Ratio - (0=none, 2=/16, 3 = /32, 4=/64, 0xF=/128, 5=/256)
\r
119 b3:b2 IWDTTOPS - IWDT Timeout Period Select - (0=1024 cycles, 1=4096, 2=8192, 3=16384)
\r
120 b1 IWDTSTRT - IWDT Start Mode Select - (0=auto-start after reset, halt after reset)
\r
121 b0 Reserved (set to 1) */
\r