Update the RX63N RSK demo to use the latest (at the time of writing) Renesas RSK BSP.
Ethernet is still not included. The configuration is still set for the ES chip.pull/1/head
parent
1bd702777d
commit
84ddb2abd6
Binary file not shown.
@ -0,0 +1,83 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : dbsct.c
|
||||
* Device(s) : RX
|
||||
* Description : Defines the structure of the ROM and RAM areas.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Defines type structures used in this file */
|
||||
#include <stdint.h>
|
||||
|
||||
/* Preprocessor directive */
|
||||
#pragma unpack
|
||||
|
||||
/* Section start */
|
||||
#pragma section C C$DSEC
|
||||
|
||||
/* MCU ROM and RAM structure definition */
|
||||
extern const struct {
|
||||
uint8_t *rom_s; /* Start address of the initialized data section in ROM */
|
||||
uint8_t *rom_e; /* End address of the initialized data section in ROM */
|
||||
uint8_t *ram_s; /* Start address of the initialized data section in RAM */
|
||||
} _DTBL[] = {
|
||||
{ __sectop("D"), __secend("D"), __sectop("R") },
|
||||
{ __sectop("D_2"), __secend("D_2"), __sectop("R_2") },
|
||||
{ __sectop("D_1"), __secend("D_1"), __sectop("R_1") }
|
||||
};
|
||||
|
||||
/* Section start */
|
||||
#pragma section C C$BSEC
|
||||
|
||||
/* MCU ROM and RAM structure definition */
|
||||
extern const struct {
|
||||
uint8_t *b_s; /* Start address of non-initialized data section */
|
||||
uint8_t *b_e; /* End address of non-initialized data section */
|
||||
} _BTBL[] = {
|
||||
{ __sectop("B"), __secend("B") },
|
||||
{ __sectop("B_2"), __secend("B_2") },
|
||||
{ __sectop("B_1"), __secend("B_1") }
|
||||
};
|
||||
|
||||
/* Section start */
|
||||
#pragma section
|
||||
|
||||
/* CTBL prevents excessive output of L1100 messages when linking.
|
||||
Even if CTBL is deleted, the operation of the program does not change. */
|
||||
uint8_t * const _CTBL[] = {
|
||||
__sectop("C_1"), __sectop("C_2"), __sectop("C"),
|
||||
__sectop("W_1"), __sectop("W_2"), __sectop("W")
|
||||
};
|
||||
|
||||
/* Preprocessor directive */
|
||||
#pragma packoption
|
||||
|
||||
/* This is to ensure compatibility with new L section in version 1.1 and up of the RXC compiler. Do not remove! */
|
||||
#pragma section C L
|
||||
const unsigned long deadSpace = 0xDEADDEAD;
|
||||
#pragma section
|
||||
|
||||
|
@ -0,0 +1,124 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : flash_options.c
|
||||
* Device(s) : RX63x
|
||||
* Description : Some options of the RX63x are set through registers that are found in ROM. These registers and options
|
||||
* are defined in the 'Option-Setting Memory' section of the HW Manual. These memory locations are defined
|
||||
* below with descriptions of what is being set.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 31.10.2011 1.00 First Release
|
||||
* : 13.03.2012 1.10 USER_BOOT_ENABLE macro from r_bsp_config.h is now used to set Option-Setting Memory
|
||||
* area to boot into User Boot Mode.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Used for fixed-width typedefs. */
|
||||
#include <stdint.h>
|
||||
/* Determines whether user boot is used or not. */
|
||||
#include "platform.h"
|
||||
|
||||
/* The UB Code A, UB Code B, and Endian select register B (MDEB) are located in the User Boot space. Immediately
|
||||
following the MDEB register is the User Boot Reset Vector so it is defined below as well. These settings will only
|
||||
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
|
||||
conditions must be met:
|
||||
1) UB code A is 55736572h and 426F6F74h.
|
||||
2) UB code B is FFFF FF07h and 0008 C04Ch.
|
||||
3) The low level is being input on the MD pin.
|
||||
4) The high level is being input on the PC7 pin.
|
||||
Please see the Option-Setting Memory section of your MCU's HW manual for more information. */
|
||||
|
||||
/* 0xFF7FFFE8 - 0xFF7FFFEF : UB Code A register
|
||||
0xFF7FFFF0 - 0xFF7FFFF7 : UB Code B register
|
||||
0xFF7FFFF8 - 0xFF7FFFFB : MDEB register
|
||||
0xFF7FFFFC - 0xFF7FFFFF : User Boot Reset Vector */
|
||||
|
||||
#pragma address user_boot_settings = 0xFF7FFFE8
|
||||
|
||||
#if USER_BOOT_ENABLE == 1
|
||||
extern void PowerON_Reset_PC(void);
|
||||
|
||||
/* Use this array if you are using User Boot. Make sure to fill in valid address for UB Reset Vector. */
|
||||
const uint32_t user_boot_settings[6] =
|
||||
{
|
||||
0x55736572, //Required setting for UB Code A to get into User Boot
|
||||
0x426f6f74, //Required setting for UB Code A to get into User Boot
|
||||
0xffffff07, //Required setting for UB Code B to get into User Boot
|
||||
0x0008c04c, //Required setting for UB Code B to get into User Boot
|
||||
/* Choose endian for user application code
|
||||
MDEB Register - Endian Select Register B
|
||||
b31:b3 Reserved (set to 1)
|
||||
b2:b0 MDE - Endian Select (0 = Big Endian, 7 = Little Endian) */
|
||||
0xFFFFFFFF, //Select Little Endian for User Boot Code
|
||||
(uint32_t) PowerON_Reset_PC //This is the User Boot Reset Vector. When using User Boot put in the reset address here
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The Endian select register S (MDES), Option function select register 1 (OFS1), and Option function select register 0
|
||||
(OFS0) are located in User ROM. */
|
||||
|
||||
/* 0xFFFFFF80 - 0xFFFFFF83 : MDES register
|
||||
0xFFFFFF84 - 0xFFFFFF87 : Reserved space (0xFF's)
|
||||
0xFFFFFF88 - 0xFFFFFF8B : OFS1 register
|
||||
0xFFFFFF8C - 0xFFFFFF8F : OFS0 register */
|
||||
|
||||
#pragma address flash_options = 0xFFFFFF80
|
||||
|
||||
const uint32_t flash_options[] =
|
||||
{
|
||||
/* Choose endian for user application code
|
||||
MDES Register - Endian Select Register S
|
||||
b31:b3 Reserved (set to 1)
|
||||
b2:b0 MDE - Endian Select (0 = Big Endian, 7 = Little Endian) */
|
||||
0xFFFFFFFF, //Little Endian chosen for User Application
|
||||
0xFFFFFFFF, //Reserved space
|
||||
/* Configure whether voltage detection 0 circuit and HOCO are enabled after reset.
|
||||
OFS1 - Option Function Select Register 1
|
||||
b31:b9 Reserved (set to 1)
|
||||
b8 HOCOEN - Enable/disable HOCO oscillation after a reset (0=enable, 1=disable)
|
||||
b7:b3 Reserved (set to 1)
|
||||
b2 LVDAS - Choose to enable/disable Voltage Detection 0 Circuit after a reset (0=enable, 1=disable)
|
||||
b1:b0 Reserved (set to 1) */
|
||||
0xFFFFFFFF, //Both are disabled.
|
||||
/* Configure WDT and IWDT settings.
|
||||
OFS0 - Option Function Select Register 0
|
||||
b31:b29 Reserved (set to 1)
|
||||
b28 WDTRSTIRQS - WDT Reset Interrupt Request - What to do on underflow (0=take interrupt, 1=reset MCU)
|
||||
b27:b26 WDTRPSS - WDT Window Start Position Select - (0=25%, 1=50%, 2=75%, 3=100%,don't use)
|
||||
b25:b24 WDTRPES - WDT Window End Position Select - (0=75%, 1=50%, 2=25%, 3=0%,don't use)
|
||||
b23:b20 WDTCKS - WDT Clock Frequency Division Ratio - (1=/4, 4=/64, 0xF=/128, 6=/512, 7=/2048, 8=/8192)
|
||||
b19:b18 WDTTOPS - WDT Timeout Period Select - (0=1024 cycles, 1=4096, 2=8192, 3=16384)
|
||||
b17 WDTSTRT - WDT Start Mode Select - (0=auto-start after reset, halt after reset)
|
||||
b16:b15 Reserved (set to 1)
|
||||
b14 IWDTSLCSTP - IWDT Sleep Mode Count Stop Control - (0=can't stop count, 1=stop w/some low power modes)
|
||||
b13 Reserved (set to 1)
|
||||
b12 IWDTRSTIRQS - IWDT Reset Interrupt Request - What to do on underflow (0=take interrupt, 1=reset MCU)
|
||||
b11:b10 IWDTRPSS - IWDT Window Start Position Select - (0=25%, 1=50%, 2=75%, 3=100%,don't use)
|
||||
b9:b8 IWDTRPES - IWDT Window End Position Select - (0=75%, 1=50%, 2=25%, 3=0%,don't use)
|
||||
b7:b4 IWDTCKS - IWDT Clock Frequency Division Ratio - (0=none, 2=/16, 3 = /32, 4=/64, 0xF=/128, 5=/256)
|
||||
b3:b2 IWDTTOPS - IWDT Timeout Period Select - (0=1024 cycles, 1=4096, 2=8192, 3=16384)
|
||||
b1 IWDTSTRT - IWDT Start Mode Select - (0=auto-start after reset, halt after reset)
|
||||
b0 Reserved (set to 1) */
|
||||
0xFFFFFFFF
|
||||
};
|
||||
|
@ -0,0 +1,161 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : hwsetup.c
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Defines the initialisation routines used each time the MCU is restarted.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 22.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* I/O Register and board definitions */
|
||||
#include "platform.h"
|
||||
/* Contains delcarations for the functions defined in this file */
|
||||
#include "hwsetup.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Private global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
/* MCU I/O port configuration function delcaration */
|
||||
static void output_ports_configure(void);
|
||||
|
||||
/* Interrupt configuration function delcaration */
|
||||
static void interrupts_configure(void);
|
||||
|
||||
/* MCU peripheral module configuration function declaration */
|
||||
static void peripheral_modules_enable(void);
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: hardware_setup
|
||||
* Description : Contains setup functions called at device restart
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void hardware_setup(void)
|
||||
{
|
||||
output_ports_configure();
|
||||
interrupts_configure();
|
||||
peripheral_modules_enable();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: output_ports_configure
|
||||
* Description : Configures the port and pin direction settings, and sets the pin outputs to a safe level.
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void output_ports_configure(void)
|
||||
{
|
||||
SYSTEM.PRCR.WORD = 0xA50B; /* Protect off */
|
||||
MPC.PWPR.BIT.B0WI = 0 ; /* Unlock protection register */
|
||||
MPC.PWPR.BIT.PFSWE = 1 ; /* Unlock MPC registers */
|
||||
|
||||
/* Enable LEDs. */
|
||||
/* Start with LEDs off. */
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
LED2 = LED_OFF;
|
||||
LED3 = LED_OFF;
|
||||
|
||||
/* Set LED pins as outputs. */
|
||||
LED0_PDR = 1;
|
||||
LED1_PDR = 1;
|
||||
LED2_PDR = 1;
|
||||
LED3_PDR = 1;
|
||||
|
||||
/* Enable switches. */
|
||||
/* Set pins as inputs. */
|
||||
SW1_PDR = 0;
|
||||
SW2_PDR = 0;
|
||||
SW3_PDR = 0;
|
||||
|
||||
/* Set port mode registers for switches. */
|
||||
SW1_PMR = 0;
|
||||
SW2_PMR = 0;
|
||||
SW3_PMR = 0;
|
||||
|
||||
/* Initialize RSPI pins that are used with on-board SPI flash. */
|
||||
/* Set pin outputs to low to begin with. */
|
||||
PORT2.PODR.BIT.B7 = 0x00; /* RSPCKB */
|
||||
PORT2.PODR.BIT.B6 = 0x00; /* MOSIB */
|
||||
PORT3.PODR.BIT.B0 = 0x00; /* MISOB */
|
||||
PORT3.PODR.BIT.B1 = 0x00; /* SSLB0 */
|
||||
|
||||
/* All GPIO for now */
|
||||
PORT2.PMR.BIT.B7 = 0x00;
|
||||
PORT2.PMR.BIT.B6 = 0x00;
|
||||
PORT3.PMR.BIT.B0 = 0x00;
|
||||
PORT3.PMR.BIT.B1 = 0x00;
|
||||
|
||||
/* Unlock MPC registers to enable writing to them. */
|
||||
MPC.PWPR.BIT.B0WI = 0 ; /* Unlock protection register */
|
||||
MPC.PWPR.BIT.PFSWE = 1 ; /* Unlock MPC registers */
|
||||
|
||||
/* Set MPC for RSPI pins */
|
||||
MPC.P27PFS.BYTE = 0x0D;
|
||||
MPC.P26PFS.BYTE = 0x0D;
|
||||
MPC.P30PFS.BYTE = 0x0D;
|
||||
|
||||
/* RSPI pins assigned to RSPI peripheral. */
|
||||
PORT2.PMR.BIT.B7 = 1;
|
||||
PORT2.PMR.BIT.B6 = 1;
|
||||
PORT3.PMR.BIT.B0 = 1;
|
||||
PORT3.PMR.BIT.B1 = 1;
|
||||
|
||||
/* RSPCKB is output. */
|
||||
PORT2.PDR.BIT.B7 = 1;
|
||||
/* MOSIB is output. */
|
||||
PORT2.PDR.BIT.B6 = 1;
|
||||
/* MISOB is input. */
|
||||
PORT3.PDR.BIT.B0 = 0;
|
||||
/* SSLB0 is output. */
|
||||
PORT3.PDR.BIT.B1 = 1;
|
||||
|
||||
/* Configure the pin connected to the ADC Pot as an input */
|
||||
PORT4.PDR.BIT.B0 = 0;
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: interrupts_configure
|
||||
* Description : Configures interrupts used
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void interrupts_configure(void)
|
||||
{
|
||||
/* Add code here to setup additional interrupts */
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: peripheral_modules_enable
|
||||
* Description : Enables and configures peripheral devices on the MCU
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void peripheral_modules_enable(void)
|
||||
{
|
||||
/* Add code here to enable peripherals used by the application */
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : hwsetup.h
|
||||
* Description : Hardware setup header file.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
/* Multiple inclusion prevention macro */
|
||||
#ifndef HWSETUP_H
|
||||
#define HWSETUP_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Exported global functions (to be accessed by other files)
|
||||
***********************************************************************************************************************/
|
||||
/* Hardware setup funtion declaration */
|
||||
void hardware_setup(void);
|
||||
|
||||
/* End of multiple inclusion prevention macro */
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; FILE :lowlvl.src
|
||||
; DATE :Wed, Jul 01, 2009
|
||||
; DESCRIPTION :Program of Low level
|
||||
; CPU TYPE :RX
|
||||
;
|
||||
;-----------------------------------------------------------------------
|
||||
.GLB _charput
|
||||
.GLB _charget
|
||||
|
||||
FC2E0 .EQU 00084080h
|
||||
FE2C0 .EQU 00084090h
|
||||
DBGSTAT .EQU 000840C0h
|
||||
RXFL0EN .EQU 00001000h
|
||||
TXFL0EN .EQU 00000100h
|
||||
|
||||
.SECTION P,CODE
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
; _charput:
|
||||
;-----------------------------------------------------------------------
|
||||
_charput:
|
||||
.STACK _charput = 00000000h
|
||||
__C2ESTART: MOV.L #TXFL0EN,R3
|
||||
MOV.L #DBGSTAT,R4
|
||||
__TXLOOP: MOV.L [R4],R5
|
||||
AND R3,R5
|
||||
BNZ __TXLOOP
|
||||
__WRITEFC2E0: MOV.L #FC2E0,R2
|
||||
MOV.L R1,[R2]
|
||||
__CHARPUTEXIT: RTS
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
; _charget:
|
||||
;-----------------------------------------------------------------------
|
||||
_charget:
|
||||
.STACK _charget = 00000000h
|
||||
__E2CSTART: MOV.L #RXFL0EN,R3
|
||||
MOV.L #DBGSTAT,R4
|
||||
__RXLOOP: MOV.L [R4],R5
|
||||
AND R3,R5
|
||||
BZ __RXLOOP
|
||||
__READFE2C0: MOV.L #FE2C0,R2
|
||||
MOV.L [R2],R1
|
||||
__CHARGETEXIT: RTS
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
|
||||
; End of conditional code
|
||||
.END
|
||||
|
||||
|
||||
|
@ -0,0 +1,332 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : lowsrc.c
|
||||
* Description : Functions to support stream I/O
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
/*Number of I/O Stream*/
|
||||
#define IOSTREAM 20
|
||||
|
||||
/* file number */
|
||||
#define STDIN 0 /* Standard input (console) */
|
||||
#define STDOUT 1 /* Standard output (console) */
|
||||
#define STDERR 2 /* Standard error output (console) */
|
||||
|
||||
#define FLMIN 0 /* Minimum file number */
|
||||
#define _MOPENR 0x1
|
||||
#define _MOPENW 0x2
|
||||
#define _MOPENA 0x4
|
||||
#define _MTRUNC 0x8
|
||||
#define _MCREAT 0x10
|
||||
#define _MBIN 0x20
|
||||
#define _MEXCL 0x40
|
||||
#define _MALBUF 0x40
|
||||
#define _MALFIL 0x80
|
||||
#define _MEOF 0x100
|
||||
#define _MERR 0x200
|
||||
#define _MLBF 0x400
|
||||
#define _MNBF 0x800
|
||||
#define _MREAD 0x1000
|
||||
#define _MWRITE 0x2000
|
||||
#define _MBYTE 0x4000
|
||||
#define _MWIDE 0x8000
|
||||
/* File Flags */
|
||||
#define O_RDONLY 0x0001 /* Read only */
|
||||
#define O_WRONLY 0x0002 /* Write only */
|
||||
#define O_RDWR 0x0004 /* Both read and Write */
|
||||
#define O_CREAT 0x0008 /* A file is created if it is not existed */
|
||||
#define O_TRUNC 0x0010 /* The file size is changed to 0 if it is existed. */
|
||||
#define O_APPEND 0x0020 /* The position is set for next reading/writing */
|
||||
/* 0: Top of the file 1: End of file */
|
||||
|
||||
/* Special character code */
|
||||
#define CR 0x0d /* Carriage return */
|
||||
#define LF 0x0a /* Line feed */
|
||||
|
||||
#if defined( __RX )
|
||||
const long _nfiles = IOSTREAM; /* The number of files for input/output files */
|
||||
#else
|
||||
const int _nfiles = IOSTREAM; /* The number of files for input/output files */
|
||||
#endif
|
||||
char flmod[IOSTREAM]; /* The location for the mode of opened file. */
|
||||
|
||||
unsigned char sml_buf[IOSTREAM];
|
||||
|
||||
#define FPATH_STDIN "C:\\stdin"
|
||||
#define FPATH_STDOUT "C:\\stdout"
|
||||
#define FPATH_STDERR "C:\\stderr"
|
||||
|
||||
/* H8 Normal mode ,SH and RX */
|
||||
#if defined( __2000N__ ) || defined( __2600N__ ) || defined( __300HN__ ) || defined( _SH )
|
||||
/* Output one character to standard output */
|
||||
extern void charput(char);
|
||||
/* Input one character from standard input */
|
||||
extern char charget(void);
|
||||
/* Output one character to the file */
|
||||
extern char fcharput(char, unsigned char);
|
||||
/* Input one character from the file */
|
||||
extern char fcharget(char*, unsigned char);
|
||||
/* Open the file */
|
||||
extern char fileopen(char*, unsigned char, unsigned char*);
|
||||
/* Close the file */
|
||||
extern char fileclose(unsigned char);
|
||||
/* Move the file offset */
|
||||
extern char fpseek(unsigned char, long, unsigned char);
|
||||
/* Get the file offset */
|
||||
extern char fptell(unsigned char, long*);
|
||||
|
||||
/* RX */
|
||||
#elif defined( __RX )
|
||||
/* Output one character to standard output */
|
||||
extern void charput(unsigned char);
|
||||
/* Input one character from standard input */
|
||||
extern unsigned char charget(void);
|
||||
|
||||
/* H8 Advanced mode */
|
||||
#elif defined( __2000A__ ) || defined( __2600A__ ) || defined( __300HA__ ) || defined( __H8SXN__ ) || defined( __H8SXA__ ) || defined( __H8SXM__ ) || defined( __H8SXX__ )
|
||||
/* Output one character to standard output */
|
||||
extern void charput(char);
|
||||
/* Input one character from standard input */
|
||||
extern char charget(void);
|
||||
/* Output one character to the file */
|
||||
extern char fcharput(char, unsigned char);
|
||||
/* Input one character from the file */
|
||||
extern char fcharget(char*, unsigned char);
|
||||
/* Open the file */
|
||||
/* Specified as the number of register which stored paramter is 3 */
|
||||
extern char __regparam3 fileopen(char*, unsigned char, unsigned char*);
|
||||
/* Close the file */
|
||||
extern char fileclose(unsigned char);
|
||||
/* Move the file offset */
|
||||
extern char fpseek(unsigned char, long, unsigned char);
|
||||
/* Get the file offset */
|
||||
extern char fptell(unsigned char, long*);
|
||||
|
||||
/* H8300 and H8300L */
|
||||
#elif defined( __300__ ) || defined( __300L__ )
|
||||
/* Output one character to standard output */
|
||||
extern void charput(char);
|
||||
/* Input one character from standard input */
|
||||
extern char charget(void);
|
||||
/* Output one character to the file */
|
||||
extern char fcharput(char, unsigned char);
|
||||
/* Input one character from the file */
|
||||
extern char fcharget(char*, unsigned char);
|
||||
/* Open the file */
|
||||
/* Specified as the number of register which stored paramter is 3 */
|
||||
extern char __regparam3 fileopen(char*, unsigned char, unsigned char*);
|
||||
/* Close the file */
|
||||
extern char fileclose(unsigned char);
|
||||
/* Move the file offset */
|
||||
/* Move the file offset */
|
||||
extern char __regparam3 fpseek(unsigned char, long, unsigned char);
|
||||
/* Get the file offset */
|
||||
extern char fptell(unsigned char, long*);
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
FILE *_Files[IOSTREAM]; // structure for FILE
|
||||
char *env_list[] = { // Array for environment variables(**environ)
|
||||
"ENV1=temp01",
|
||||
"ENV2=temp02",
|
||||
"ENV9=end",
|
||||
'\0' // Terminal for environment variables
|
||||
};
|
||||
|
||||
char **environ = env_list;
|
||||
|
||||
/****************************************************************************/
|
||||
/* _INIT_IOLIB */
|
||||
/* Initialize C library Functions, if necessary. */
|
||||
/* Define USES_SIMIO on Assembler Option. */
|
||||
/****************************************************************************/
|
||||
void _INIT_IOLIB( void )
|
||||
{
|
||||
/* A file for standard input/output is opened or created. Each FILE */
|
||||
/* structure members are initialized by the library. Each _Buf member */
|
||||
/* in it is re-set the end of buffer pointer. */
|
||||
|
||||
/* Standard Input File */
|
||||
if( freopen( FPATH_STDIN, "r", stdin ) == NULL )
|
||||
stdin->_Mode = 0xffff; /* Not allow the access if it fails to open */
|
||||
stdin->_Mode = _MOPENR; /* Read only attribute */
|
||||
stdin->_Mode |= _MNBF; /* Non-buffering for data */
|
||||
stdin->_Bend = stdin->_Buf + 1; /* Re-set pointer to the end of buffer */
|
||||
|
||||
/* Standard Output File */
|
||||
if( freopen( FPATH_STDOUT, "w", stdout ) == NULL )
|
||||
stdout->_Mode = 0xffff; /* Not allow the access if it fails to open */
|
||||
stdout->_Mode |= _MNBF; /* Non-buffering for data */
|
||||
stdout->_Bend = stdout->_Buf + 1;/* Re-set pointer to the end of buffer */
|
||||
|
||||
/* Standard Error File */
|
||||
if( freopen( FPATH_STDERR, "w", stderr ) == NULL )
|
||||
stderr->_Mode = 0xffff; /* Not allow the access if it fails to open */
|
||||
stderr->_Mode |= _MNBF; /* Non-buffering for data */
|
||||
stderr->_Bend = stderr->_Buf + 1;/* Re-set pointer to the end of buffer */
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* _CLOSEALL */
|
||||
/****************************************************************************/
|
||||
void _CLOSEALL( void )
|
||||
{
|
||||
long i;
|
||||
|
||||
for( i=0; i < _nfiles; i++ )
|
||||
{
|
||||
/* Checks if the file is opened or not */
|
||||
if( _Files[i]->_Mode & (_MOPENR | _MOPENW | _MOPENA ) )
|
||||
fclose( _Files[i] ); /* Closes the file */
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* open:file open */
|
||||
/* Return value:File number (Pass) */
|
||||
/* -1 (Failure) */
|
||||
/**************************************************************************/
|
||||
#if defined( __RX )
|
||||
long open(const char *name, /* File name */
|
||||
long mode, /* Open mode */
|
||||
long flg) /* Open flag */
|
||||
#else
|
||||
int open(char *name, /* File name */
|
||||
int mode, /* Open mode */
|
||||
int flg) /* Open flag */
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
if( strcmp( name, FPATH_STDIN ) == 0 ) /* Standard Input file? */
|
||||
{
|
||||
if( ( mode & O_RDONLY ) == 0 ) return -1;
|
||||
flmod[STDIN] = mode;
|
||||
return STDIN;
|
||||
}
|
||||
else if( strcmp( name, FPATH_STDOUT ) == 0 )/* Standard Output file? */
|
||||
{
|
||||
if( ( mode & O_WRONLY ) == 0 ) return -1;
|
||||
flmod[STDOUT] = mode;
|
||||
return STDOUT;
|
||||
}
|
||||
else if(strcmp(name, FPATH_STDERR ) == 0 ) /* Standard Error file? */
|
||||
{
|
||||
if( ( mode & O_WRONLY ) == 0 ) return -1;
|
||||
flmod[STDERR] = mode;
|
||||
return STDERR;
|
||||
}
|
||||
else return -1; /*Others */
|
||||
}
|
||||
|
||||
#if defined( __RX )
|
||||
long close( long fileno )
|
||||
#else
|
||||
int close( int fileno )
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/* write:Data write */
|
||||
/* Return value:Number of write characters (Pass) */
|
||||
/* -1 (Failure) */
|
||||
/**************************************************************************/
|
||||
#if defined( __RX )
|
||||
long write(long fileno, /* File number */
|
||||
const unsigned char *buf, /* The address of destination buffer */
|
||||
long count) /* The number of chacter to write */
|
||||
#else
|
||||
int write(int fileno, /* File number */
|
||||
char *buf, /* The address of destination buffer */
|
||||
int count) /* The number of chacter to write */
|
||||
#endif
|
||||
{
|
||||
long i; /* A variable for counter */
|
||||
unsigned char c; /* An output character */
|
||||
|
||||
/* Checking the mode of file , output each character */
|
||||
/* Checking the attribute for Write-Only, Read-Only or Read-Write */
|
||||
if(flmod[fileno]&O_WRONLY || flmod[fileno]&O_RDWR)
|
||||
{
|
||||
if( fileno == STDIN ) return -1; /* Standard Input */
|
||||
else if( (fileno == STDOUT) || (fileno == STDERR) )
|
||||
/* Standard Error/output */
|
||||
{
|
||||
for( i = count; i > 0; --i )
|
||||
{
|
||||
c = *buf++;
|
||||
charput(c);
|
||||
}
|
||||
return count; /*Return the number of written characters */
|
||||
}
|
||||
else return -1; /* Incorrect file number */
|
||||
}
|
||||
else return -1; /* An error */
|
||||
}
|
||||
|
||||
#if defined( __RX )
|
||||
long read( long fileno, unsigned char *buf, long count )
|
||||
#else
|
||||
int read( int fileno, char *buf, unsigned int count )
|
||||
#endif
|
||||
{
|
||||
long i;
|
||||
|
||||
/* Checking the file mode with the file number, each character is input and stored the buffer */
|
||||
|
||||
if((flmod[fileno]&_MOPENR) || (flmod[fileno]&O_RDWR)){
|
||||
for(i = count; i > 0; i--){
|
||||
*buf = charget();
|
||||
if(*buf==CR){ /* Replace the new line character */
|
||||
*buf = LF;
|
||||
}
|
||||
buf++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( __RX )
|
||||
long lseek( long fileno, long offset, long base )
|
||||
#else
|
||||
long lseek( int fileno, long offset, int base )
|
||||
#endif
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : mcu_info.h
|
||||
* Device(s) : RX
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Information about the MCU on this board.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 28.11.2011 1.00 First Release
|
||||
* : 13.03.2012 1.10 System clock speeds are now calculated from macros in r_bsp_config.h.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef _MCU_INFO
|
||||
#define _MCU_INFO
|
||||
|
||||
/* MCU that is used. */
|
||||
#define MCU_RX63N (1)
|
||||
|
||||
/* Package. */
|
||||
#define PACKAGE_LQFP176 (1)
|
||||
|
||||
/* Memory size of your MCU. */
|
||||
#define ROM_SIZE_BYTES (1048576)
|
||||
#define RAM_SIZE_BYTES (131072)
|
||||
#define DF_SIZE_BYTES (32768)
|
||||
|
||||
/* System clock speed in Hz. */
|
||||
#define ICLK_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / ICK_DIV)
|
||||
/* Peripheral Module Clock A speed in Hz. Used for ETHERC and EDMAC. */
|
||||
#define PCLKA_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKA_DIV)
|
||||
/* Peripheral Module Clock B speed in Hz. */
|
||||
#define PCLKB_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKB_DIV)
|
||||
/* External bus clock speed in Hz. */
|
||||
#define BCLK_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / BCK_DIV)
|
||||
/* FlashIF clock speed in Hz. */
|
||||
#define FCLK_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / FCK_DIV)
|
||||
/* USB clock speed in Hz. */
|
||||
#define UCLK_HZ (((XTAL_HZ/PLL_DIV) * PLL_MUL) / UCK_DIV)
|
||||
|
||||
#endif /* _MCU_INFO */
|
||||
|
@ -0,0 +1,54 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_bsp.h
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Has the header files that should be included for this platform.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 13.01.2012 1.00 First Release
|
||||
* : 13.03.2012 1.10 Added locking.h and r_bsp_config.h #includes. Removed sbrk.h since heap size is not
|
||||
* defined in r_bsp_config.h.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef PLATFORM_BOARD_RSKRX63N
|
||||
#define PLATFORM_BOARD_RSKRX63N
|
||||
|
||||
/* Make sure that no other platforms have already been defined. Do not touch this! */
|
||||
#ifdef PLATFORM_DEFINED
|
||||
#error "Error - Multiple platforms defined in platform.h!"
|
||||
#else
|
||||
#define PLATFORM_DEFINED
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
INCLUDE APPROPRIATE MCU AND BOARD FILES
|
||||
***********************************************************************************************************************/
|
||||
#include "r_bsp_config.h"
|
||||
#include ".\mcu\rx63n\iodefine.h"
|
||||
#include ".\board\rskrx63n\rskrx63n.h"
|
||||
#include ".\board\rskrx63n\mcu_info.h"
|
||||
#include ".\board\rskrx63n\hwsetup.h"
|
||||
/*#include ".\board\rskrx63n\lcd.h" Not currently used. */
|
||||
/* #include ".\board\rskrx63n\locking.h" Not currently used. */
|
||||
|
||||
#endif /* PLATFORM_BOARD_RSKRX63N */
|
||||
|
||||
|
@ -0,0 +1,149 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_bsp_config_reference.c
|
||||
* Device(s) : RX63x
|
||||
* Description : The file r_bsp_config.h is used to configure your BSP. r_bsp_config.h should be included
|
||||
* somewhere in your package so that the r_bsp code has access to it. This file (r_bsp_config_reference.h)
|
||||
* is just a reference file that the user can use to make their own r_bsp_config.h file.
|
||||
************************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 13.03.2012 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
#ifndef R_BSP_CONFIG_REF_HEADER_FILE
|
||||
#define R_BSP_CONFIG_REF_HEADER_FILE
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Configuration Options
|
||||
***********************************************************************************************************************/
|
||||
/* The 'BSP_DECLARE_STACK' macro is checked so that the stack is only declared in one place (resetprg.c). Every time a
|
||||
'#pragma stacksize' is encountered, the stack size is increased. This prevents multiplication of stack size. */
|
||||
#if defined(BSP_DECLARE_STACK)
|
||||
/* User Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize su=0x1000
|
||||
/* Interrupt Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize si=0x400
|
||||
#endif
|
||||
|
||||
/* Heap size in bytes. */
|
||||
#define HEAP_BYTES (0x400)
|
||||
|
||||
/* After reset MCU will operate in Supervisor mode. To switch to User mode, set this macro to '1'. For more information
|
||||
on the differences between these 2 modes see the CPU >> Processor Mode section of your MCU's hardware manual.
|
||||
0 = Stay in Supervisor mode.
|
||||
1 = Switch to User mode.
|
||||
*/
|
||||
#define RUN_IN_USER_MODE (0)
|
||||
|
||||
/* To get into User Boot Mode the user must control some pins on the MCU and also set some values in ROM. These values
|
||||
in ROM are described in the Option-Setting Memory section of the hardware manual. This macro sets these values so
|
||||
that User Boot Mode can be used. The user is still responsible for setting the MCU pins appropriately.
|
||||
0 = Single-Chip or USB Boot Mode
|
||||
1 = User Boot Mode
|
||||
*/
|
||||
#define USER_BOOT_ENABLE (0)
|
||||
|
||||
/* Set your desired ID code. NOTE, leave at the default (all 0xFF's) if you do not wish to use an ID code. If you set
|
||||
this value and program it into the MCU then you will need to remember the ID code because the debugger will ask for
|
||||
it when trying to connect. Note that the E1/E20 will ignore the ID code when programming the MCU during debugging.
|
||||
If you set this value and then forget it then you can clear the ID code by connecting up in serial boot mode using
|
||||
FDT. The ID Code is 16 bytes long. The macro below define the ID Code in 4-byte sections. */
|
||||
/* Lowest 4-byte section, address 0xFFFFFFA0. From MSB to LSB: Control Code, ID code 1, ID code 2, ID code 3. */
|
||||
#define ID_CODE_LONG_1 (0xFFFFFFFF)
|
||||
/* 2nd ID Code section, address 0xFFFFFFA4. From MSB to LSB: ID code 4, ID code 5, ID code 6, ID code 7. */
|
||||
#define ID_CODE_LONG_2 (0xFFFFFFFF)
|
||||
/* 3rd ID Code section, address 0xFFFFFFA8. From MSB to LSB: ID code 8, ID code 9, ID code 10, ID code 11. */
|
||||
#define ID_CODE_LONG_3 (0xFFFFFFFF)
|
||||
/* 4th ID Code section, address 0xFFFFFFAC. From MSB to LSB: ID code 12, ID code 13, ID code 14, ID code 15. */
|
||||
#define ID_CODE_LONG_4 (0xFFFFFFFF)
|
||||
|
||||
/* This macro lets other modules no if a RTOS is being used.
|
||||
0 = RTOS is not used.
|
||||
1 = RTOS is used.
|
||||
*/
|
||||
#define RTOS_USED (0)
|
||||
|
||||
/* Clock source select (CKSEL).
|
||||
0 = Low Speed On-Chip Oscillator (LOCO)
|
||||
1 = High Speed On-Chip Oscillator (HOCO)
|
||||
2 = Main Clock Oscillator
|
||||
3 = Sub-Clock Oscillator
|
||||
4 = PLL Circuit
|
||||
*/
|
||||
#define CLOCK_SOURCE (4)
|
||||
|
||||
/* Clock configuration options.
|
||||
The input clock frequency is specified and then the system clocks are set by specifying the multipliers used. The
|
||||
multiplier settings are used to set the clock registers in resetprg.c. If a 12MHz clock is used and the
|
||||
ICLK is 96MHz, PCLKA is 48MHz, PCLKB is 48MHz, FCLK is 48MHz, USB Clock is 48MHz, and BCLK is 12MHz then the
|
||||
settings would be:
|
||||
|
||||
XTAL_HZ = 12000000
|
||||
PLL_DIV = 1 (no division)
|
||||
PLL_MUL = 16 (12MHz x 16 = 192MHz)
|
||||
ICK_DIV = 2 : System Clock (ICLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / ICK_DIV) = 96MHz
|
||||
PCKA_DIV = 4 : Peripheral Clock A (PCLKA) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKA_DIV) = 48MHz
|
||||
PCKB_DIV = 4 : Peripheral Clock B (PCLKB) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKB_DIV) = 48MHz
|
||||
FCK_DIV = 4 : Flash IF Clock (FCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / FCK_DIV) = 48MHz
|
||||
BCK_DIV = 8 : External Bus Clock (BCK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / BCK_DIV) = 24MHz
|
||||
UCK_DIV = 4 : USB Clock (UCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / UCK_DIV) = 48MHz
|
||||
*/
|
||||
/* XTAL - Input clock frequency in Hz */
|
||||
#define XTAL_HZ (12000000)
|
||||
/* PLL Input Frequency Divider Select (PLIDIV).
|
||||
Available divisors = /1 (no division), /2, /4
|
||||
*/
|
||||
#define PLL_DIV (1)
|
||||
/* PLL Frequency Multiplication Factor Select (STC).
|
||||
Available multipliers = x8, x10, x12, x16, x20, x24, x25, x50
|
||||
*/
|
||||
#define PLL_MUL (16)
|
||||
/* System Clock Divider (ICK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define ICK_DIV (2)
|
||||
/* Peripheral Module Clock A Divider (PCKA).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKA_DIV (4)
|
||||
/* Peripheral Module Clock B Divider (PCKB).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKB_DIV (4)
|
||||
/* External Bus Clock Divider (BCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define BCK_DIV (8)
|
||||
/* Flash IF Clock Divider (FCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define FCK_DIV (4)
|
||||
/* IEBUS Clock Divider Select.
|
||||
Available divisors = /1 (no division), /2, /4, /6, /8, /16, /32, /64
|
||||
*/
|
||||
#define IEBCK_DIV (8)
|
||||
/* USB Clock Divider Select.
|
||||
Available divisors = /3, /4
|
||||
*/
|
||||
#define UCK_DIV (4)
|
||||
|
||||
#endif /* R_BSP_CONFIG_REF_HEADER_FILE */
|
||||
|
||||
|
||||
|
@ -0,0 +1,409 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : resetprg.c
|
||||
* Device(s) : RX63x
|
||||
* Description : Defines post-reset routines that are used to configure the MCU prior to the main program starting.
|
||||
* This is were the program counter starts on power-up or reset.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
* : 13.03.2012 1.10 Stack sizes are now defined in r_bsp_config.h. Because of this the #include for
|
||||
* stacksct.h was removed. Settings for SCKCR are now set in r_bsp_config.h and used here
|
||||
* to setup clocks based on user settings.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Defines machine level functions used in this file */
|
||||
#include <machine.h>
|
||||
/* Defines MCU configuration functions used in this file */
|
||||
#include <_h_c_lib.h>
|
||||
/* Defines standard variable types used in this file */
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* This macro is here so that the stack will be declared here. This is used to prevent multiplication of stack size. */
|
||||
#define BSP_DECLARE_STACK
|
||||
/* Define the target platform */
|
||||
#include "platform.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
#define PSW_init (0x00030000)
|
||||
#define FPSW_init (0x00000100)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Pre-processor Directives
|
||||
***********************************************************************************************************************/
|
||||
/* Declare the contents of the function 'Change_PSW_PM_to_UserMode' as
|
||||
assembler to the compiler */
|
||||
#pragma inline_asm Change_PSW_PM_to_UserMode
|
||||
|
||||
/* Set this as the entry point from a power-on reset */
|
||||
#pragma entry PowerON_Reset_PC
|
||||
|
||||
/***********************************************************************************************************************
|
||||
External function Prototypes
|
||||
***********************************************************************************************************************/
|
||||
/* Functions to setup I/O library */
|
||||
extern void _INIT_IOLIB(void);
|
||||
extern void _CLOSEALL(void);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Private global variables and functions
|
||||
***********************************************************************************************************************/
|
||||
/* Power-on reset function declaration */
|
||||
void PowerON_Reset_PC(void);
|
||||
|
||||
#if RUN_IN_USER_MODE==1
|
||||
#if __RENESAS_VERSION__ < 0x01010000
|
||||
/* MCU usermode switcher function declaration */
|
||||
static void Change_PSW_PM_to_UserMode(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Main program function delcaration */
|
||||
void main(void);
|
||||
static void operating_frequency_set(void);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: PowerON_Reset_PC
|
||||
* Description : This function is the MCU's entry point from a power-on reset.
|
||||
* The following steps are taken in the startup code:
|
||||
* 1. The User Stack Pointer (USP) and Interrupt Stack Pointer (ISP) are both set immediately after entry
|
||||
* to this function. The USP and ISP stack sizes are set in the file stacksct.h.
|
||||
* Default sizes are USP=4K and ISP=1K.
|
||||
* 2. The interrupt vector base register is set to point to the beginning of the relocatable interrupt
|
||||
* vector table.
|
||||
* 3. The MCU is setup for floating point operations by setting the initial value of the Floating Point
|
||||
* Status Word (FPSW).
|
||||
* 4. The MCU operating frequency is set by configuring the Clock Generation Circuit (CGC) in
|
||||
* operating_frequency_set.
|
||||
* 5. Calls are made to functions to setup the C runtime environment which involves initializing all
|
||||
* initialed data, zeroing all uninitialized variables, and configuring STDIO if used
|
||||
* (calls to _INITSCT and _INIT_IOLIB).
|
||||
* 6. Board-specific hardware setup, including configuring I/O pins on the MCU, in hardware_setup.
|
||||
* 7. Global interrupts are enabled by setting the I bit in the Program Status Word (PSW), and the stack
|
||||
* is switched from the ISP to the USP. The initial Interrupt Priority Level is set to zero, enabling
|
||||
* any interrupts with a priority greater than zero to be serviced.
|
||||
* 8. The processor is optionally switched to user mode. To run in user mode, set the macro
|
||||
* RUN_IN_USER_MODE above to a 1.
|
||||
* 9. The bus error interrupt is enabled to catch any accesses to invalid or reserved areas of memory.
|
||||
*
|
||||
* Once this initialization is complete, the user's main() function is called. It should not return.
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void PowerON_Reset_PC(void)
|
||||
{
|
||||
/* Stack pointers are setup prior to calling this function - see comments above */
|
||||
|
||||
/* Initialise the MCU processor word */
|
||||
#if __RENESAS_VERSION__ >= 0x01010000
|
||||
set_intb((void *)__sectop("C$VECT"));
|
||||
#else
|
||||
set_intb((unsigned long)__sectop("C$VECT"));
|
||||
#endif
|
||||
|
||||
/* Initialize FPSW for floating-point operations */
|
||||
#ifdef __ROZ
|
||||
#define _ROUND 0x00000001 /* Let FPSW RMbits=01 (round to zero) */
|
||||
#else
|
||||
#define _ROUND 0x00000000 /* Let FPSW RMbits=00 (round to nearest) */
|
||||
#endif
|
||||
#ifdef __DOFF
|
||||
#define _DENOM 0x00000100 /* Let FPSW DNbit=1 (denormal as zero) */
|
||||
#else
|
||||
#define _DENOM 0x00000000 /* Let FPSW DNbit=0 (denormal as is) */
|
||||
#endif
|
||||
set_fpsw(FPSW_init | _ROUND | _DENOM);
|
||||
|
||||
/* Switch to high-speed operation */
|
||||
operating_frequency_set();
|
||||
|
||||
/* Initialize C runtime environment */
|
||||
_INITSCT();
|
||||
|
||||
/* Comment this out if not using I/O lib
|
||||
_INIT_IOLIB(); */
|
||||
|
||||
/* Configure the MCU and YRDK hardware */
|
||||
hardware_setup();
|
||||
|
||||
/* Change the MCU's usermode from supervisor to user */
|
||||
nop();
|
||||
set_psw(PSW_init);
|
||||
#if RUN_IN_USER_MODE==1
|
||||
/* Use chg_pmusr() intrinsic if possible. */
|
||||
#if __RENESAS_VERSION__ >= 0x01010000
|
||||
chg_pmusr() ;
|
||||
#else
|
||||
Change_PSW_PM_to_UserMode();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable the bus error interrupt to catch accesses to illegal/reserved areas of memory */
|
||||
/* The ISR for this interrupt can be found in vecttbl.c in the function "bus_error_isr" */
|
||||
/* Clear any pending interrupts */
|
||||
IR(BSC,BUSERR) = 0;
|
||||
/* Make this the highest priority interrupt (adjust as necessary for your application */
|
||||
IPR(BSC,BUSERR) = 0x0F;
|
||||
/* Enable the interrupt in the ICU*/
|
||||
IEN(BSC,BUSERR) = 1;
|
||||
/* Enable illegal address interrupt in the BSC */
|
||||
BSC.BEREN.BIT.IGAEN = 1;
|
||||
|
||||
/* Call the main program function (should not return) */
|
||||
main();
|
||||
|
||||
/* Comment this out if not using I/O lib - cleans up open files */
|
||||
_CLOSEALL();
|
||||
|
||||
while(1)
|
||||
{
|
||||
/* Infinite loop. Put a breakpoint here if you want to catch an exit of main(). */
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: operating_frequency_set
|
||||
* Description : Configures the clock settings for each of the device clocks
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
void operating_frequency_set(void)
|
||||
{
|
||||
/* Used for constructing value to write to SCKCR register. */
|
||||
uint32_t temp_clock = 0;
|
||||
|
||||
/*
|
||||
Clock Description Frequency
|
||||
----------------------------------------
|
||||
Input Clock Frequency............ 12 MHz
|
||||
PLL frequency (x16).............. 192 MHz
|
||||
Internal Clock Frequency......... 96 MHz
|
||||
Peripheral Clock Frequency....... 48 MHz
|
||||
USB Clock Frequency.............. 48 MHz
|
||||
External Bus Clock Frequency..... 24 MHz */
|
||||
|
||||
volatile unsigned int i;
|
||||
|
||||
/* Protect off. */
|
||||
SYSTEM.PRCR.WORD = 0xA50B;
|
||||
|
||||
/* Uncomment if not using sub-clock */
|
||||
//SYSTEM.SOSCCR.BYTE = 0x01; /* stop sub-clock */
|
||||
SYSTEM.SOSCCR.BYTE = 0x00; /* Enable sub-clock for RTC */
|
||||
|
||||
/* Wait 131,072 cycles * 12 MHz = 10.9 ms */
|
||||
SYSTEM.MOSCWTCR.BYTE = 0x0D;
|
||||
|
||||
/* PLL wait is 4,194,304 cycles (default) * 192 MHz (12 MHz * 16) = 20.1 ms*/
|
||||
SYSTEM.PLLWTCR.BYTE = 0x0F;
|
||||
|
||||
/* Set PLL Input Divisor. */
|
||||
SYSTEM.PLLCR.BIT.PLIDIV = PLL_DIV >> 1;
|
||||
|
||||
/* Set PLL Multiplier. */
|
||||
SYSTEM.PLLCR.BIT.STC = PLL_MUL - 1;
|
||||
|
||||
/* EXTAL ON */
|
||||
SYSTEM.MOSCCR.BYTE = 0x00;
|
||||
|
||||
/* PLL ON */
|
||||
SYSTEM.PLLCR2.BYTE = 0x00;
|
||||
|
||||
for(i = 0;i< 0x168;i++)
|
||||
{
|
||||
/* Wait over 12ms */
|
||||
nop() ;
|
||||
}
|
||||
|
||||
/* Figure out setting for FCK bits. */
|
||||
#if FCK_DIV == 1
|
||||
/* Do nothing since FCK bits should be 0. */
|
||||
#elif FCK_DIV == 2
|
||||
temp_clock |= 0x10000000;
|
||||
#elif FCK_DIV == 4
|
||||
temp_clock |= 0x20000000;
|
||||
#elif FCK_DIV == 8
|
||||
temp_clock |= 0x30000000;
|
||||
#elif FCK_DIV == 16
|
||||
temp_clock |= 0x40000000;
|
||||
#elif FCK_DIV == 32
|
||||
temp_clock |= 0x50000000;
|
||||
#elif FCK_DIV == 64
|
||||
temp_clock |= 0x60000000;
|
||||
#else
|
||||
#error "Error! Invalid setting for FCK_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Figure out setting for ICK bits. */
|
||||
#if ICK_DIV == 1
|
||||
/* Do nothing since ICK bits should be 0. */
|
||||
#elif ICK_DIV == 2
|
||||
temp_clock |= 0x01000000;
|
||||
#elif ICK_DIV == 4
|
||||
temp_clock |= 0x02000000;
|
||||
#elif ICK_DIV == 8
|
||||
temp_clock |= 0x03000000;
|
||||
#elif ICK_DIV == 16
|
||||
temp_clock |= 0x04000000;
|
||||
#elif ICK_DIV == 32
|
||||
temp_clock |= 0x05000000;
|
||||
#elif ICK_DIV == 64
|
||||
temp_clock |= 0x06000000;
|
||||
#else
|
||||
#error "Error! Invalid setting for ICK_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* SDCLK Pin Output and BCLK Pin Output are disabled by default. */
|
||||
temp_clock |= 0x00C00000;
|
||||
|
||||
/* Figure out setting for BCK bits. */
|
||||
#if BCK_DIV == 1
|
||||
/* Do nothing since BCK bits should be 0. */
|
||||
#elif BCK_DIV == 2
|
||||
temp_clock |= 0x00010000;
|
||||
#elif BCK_DIV == 4
|
||||
temp_clock |= 0x00020000;
|
||||
#elif BCK_DIV == 8
|
||||
temp_clock |= 0x00030000;
|
||||
#elif BCK_DIV == 16
|
||||
temp_clock |= 0x00040000;
|
||||
#elif BCK_DIV == 32
|
||||
temp_clock |= 0x00050000;
|
||||
#elif BCK_DIV == 64
|
||||
temp_clock |= 0x00060000;
|
||||
#else
|
||||
#error "Error! Invalid setting for BCK_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Figure out setting for PCKA bits. */
|
||||
#if PCKA_DIV == 1
|
||||
/* Do nothing since PCKA bits should be 0. */
|
||||
#elif PCKA_DIV == 2
|
||||
temp_clock |= 0x00001000;
|
||||
#elif PCKA_DIV == 4
|
||||
temp_clock |= 0x00002000;
|
||||
#elif PCKA_DIV == 8
|
||||
temp_clock |= 0x00003000;
|
||||
#elif PCKA_DIV == 16
|
||||
temp_clock |= 0x00004000;
|
||||
#elif PCKA_DIV == 32
|
||||
temp_clock |= 0x00005000;
|
||||
#elif PCKA_DIV == 64
|
||||
temp_clock |= 0x00006000;
|
||||
#else
|
||||
#error "Error! Invalid setting for PCKA_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Figure out setting for PCKB bits. */
|
||||
#if PCKB_DIV == 1
|
||||
/* Do nothing since PCKB bits should be 0. */
|
||||
#elif PCKB_DIV == 2
|
||||
temp_clock |= 0x00000100;
|
||||
#elif PCKB_DIV == 4
|
||||
temp_clock |= 0x00000200;
|
||||
#elif PCKB_DIV == 8
|
||||
temp_clock |= 0x00000300;
|
||||
#elif PCKB_DIV == 16
|
||||
temp_clock |= 0x00000400;
|
||||
#elif PCKB_DIV == 32
|
||||
temp_clock |= 0x00000500;
|
||||
#elif PCKB_DIV == 64
|
||||
temp_clock |= 0x00000600;
|
||||
#else
|
||||
#error "Error! Invalid setting for PCKB_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Bottom byte of SCKCR register must be set to 0x11 */
|
||||
temp_clock |= 0x00000011;
|
||||
|
||||
/* Set SCKCR register. */
|
||||
SYSTEM.SCKCR.LONG = temp_clock;
|
||||
|
||||
/* Re-init temp_clock to use to set SCKCR2. */
|
||||
temp_clock = 0;
|
||||
|
||||
/* Figure out setting for IEBCK bits. */
|
||||
#if IEBCK_DIV == 2
|
||||
temp_clock |= 0x00000001;
|
||||
#elif IEBCK_DIV == 4
|
||||
temp_clock |= 0x00000002;
|
||||
#elif IEBCK_DIV == 6
|
||||
temp_clock |= 0x0000000C;
|
||||
#elif IEBCK_DIV == 8
|
||||
temp_clock |= 0x00000003;
|
||||
#elif IEBCK_DIV == 16
|
||||
temp_clock |= 0x00000004;
|
||||
#elif IEBCK_DIV == 32
|
||||
temp_clock |= 0x00000005;
|
||||
#elif IEBCK_DIV == 64
|
||||
temp_clock |= 0x00000006;
|
||||
#else
|
||||
#error "Error! Invalid setting for IEBCK_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Figure out setting for UCK bits. */
|
||||
#if UCK_DIV == 3
|
||||
temp_clock |= 0x00000020;
|
||||
#elif UCK_DIV == 4
|
||||
temp_clock |= 0x00000030;
|
||||
#else
|
||||
#error "Error! Invalid setting for UCK_DIV in r_bsp_config.h"
|
||||
#endif
|
||||
|
||||
/* Set SCKCR2 register. */
|
||||
SYSTEM.SCKCR2.WORD = (uint16_t)temp_clock;
|
||||
|
||||
/* Choose clock source. Default for r_bsp_config.h is PLL. */
|
||||
SYSTEM.SCKCR3.WORD = ((uint16_t)CLOCK_SOURCE) << 8;
|
||||
|
||||
/* Protect on. */
|
||||
SYSTEM.PRCR.WORD = 0xA500;
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: Change_PSW_PM_to_UserMode
|
||||
* Description : Assembler function, used to change the MCU's usermode from supervisor to user.
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
#if RUN_IN_USER_MODE==1
|
||||
#if __RENESAS_VERSION__ < 0x01010000
|
||||
static void Change_PSW_PM_to_UserMode(void)
|
||||
{
|
||||
MVFC PSW,R1
|
||||
OR #00100000h,R1
|
||||
PUSH.L R1
|
||||
MVFC PC,R1
|
||||
ADD #10,R1
|
||||
PUSH.L R1
|
||||
RTE
|
||||
NOP
|
||||
NOP
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,65 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : rskrx63n.h
|
||||
* H/W Platform : RSK+RX63N
|
||||
* Description : Board specific definitions for the RSKRX630.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 28.11.2011 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef RSKRX63N_H
|
||||
#define RSKRX63N_H
|
||||
|
||||
/* Local defines */
|
||||
#define LED_ON (0)
|
||||
#define LED_OFF (1)
|
||||
#define SET_BIT_HIGH (1)
|
||||
#define SET_BIT_LOW (0)
|
||||
#define SET_BYTE_HIGH (0xFF)
|
||||
#define SET_BYTE_LOW (0x00)
|
||||
|
||||
/* Switches */
|
||||
#define SW_ACTIVE 0
|
||||
#define SW1 PORT3.PIDR.BIT.B2
|
||||
#define SW2 PORT0.PIDR.BIT.B0
|
||||
#define SW3 PORT0.PIDR.BIT.B7
|
||||
#define SW1_PDR PORT3.PDR.BIT.B2
|
||||
#define SW2_PDR PORT0.PDR.BIT.B0
|
||||
#define SW3_PDR PORT0.PDR.BIT.B7
|
||||
#define SW1_PMR PORT3.PMR.BIT.B2
|
||||
#define SW2_PMR PORT0.PMR.BIT.B0
|
||||
#define SW3_PMR PORT0.PMR.BIT.B7
|
||||
|
||||
/* LEDs */
|
||||
#define LED0 PORT0.PODR.BIT.B3
|
||||
#define LED1 PORT0.PODR.BIT.B5
|
||||
#define LED2 PORT1.PODR.BIT.B0
|
||||
#define LED3 PORT1.PODR.BIT.B1
|
||||
#define LED0_PDR PORT0.PDR.BIT.B3
|
||||
#define LED1_PDR PORT0.PDR.BIT.B5
|
||||
#define LED2_PDR PORT1.PDR.BIT.B0
|
||||
#define LED3_PDR PORT1.PDR.BIT.B1
|
||||
|
||||
/* Slave select. */
|
||||
#define FLASH_CS PORT3.PDR.BIT.B1 // SSLB0
|
||||
|
||||
#endif /* RSKRX63N_H */
|
@ -0,0 +1,96 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : sbrk.c
|
||||
* Device(s) : RX
|
||||
* Description : Configures the MCU heap memory. The size of the heap is defined by the macro HEAPSIZE below.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
* : 12.03.2012 1.10 Heap size is now defined in r_bsp_config.h, not sbrk.h.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
/* Provides standard definitions used in this file */
|
||||
#include <stddef.h>
|
||||
/* Defines standard input/output functions used in this file */
|
||||
#include <stdio.h>
|
||||
/* Defines standard variable types used in this file */
|
||||
#include <stdint.h>
|
||||
/* Used for getting HEAP_BYTES macro. */
|
||||
#include "platform.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Macro definitions
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Function Prototypes
|
||||
***********************************************************************************************************************/
|
||||
/* Memory allocation function prototype declaration */
|
||||
int8_t *sbrk(size_t size);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Global Variables
|
||||
***********************************************************************************************************************/
|
||||
//const size_t _sbrk_size= /* Specifies the minimum unit of */
|
||||
/* the defined heap area */
|
||||
extern int8_t *_s1ptr;
|
||||
|
||||
union HEAP_TYPE
|
||||
{
|
||||
int32_t dummy; /* Dummy for 4-byte boundary */
|
||||
int8_t heap[HEAP_BYTES]; /* Declaration of the area managed by sbrk*/
|
||||
};
|
||||
/* Declare memory heap area */
|
||||
static union HEAP_TYPE heap_area;
|
||||
/* End address allocated by sbrk */
|
||||
static int8_t *brk=(int8_t *)&heap_area;
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: sbrk
|
||||
* Description : This function configures MCU memory area allocation.
|
||||
* Arguments : size -
|
||||
* assigned area size
|
||||
* Return value : Start address of allocated area (pass)
|
||||
* -1 (failure)
|
||||
***********************************************************************************************************************/
|
||||
int8_t *sbrk(size_t size)
|
||||
{
|
||||
int8_t *p;
|
||||
|
||||
if (brk+size > heap_area.heap+HEAP_BYTES)
|
||||
{
|
||||
/* Empty area size */
|
||||
p = (int8_t *)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Area assignment */
|
||||
p = brk;
|
||||
|
||||
/* End address update */
|
||||
brk += size;
|
||||
}
|
||||
|
||||
/* Return result */
|
||||
return p;
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : vecttbl.c
|
||||
* Device(s) : RX
|
||||
* Description : Definition of the fixed vector table
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 26.10.2011 1.00 First Release
|
||||
* : 17.02.2012 1.10 Made function names compliant with CS v4.0
|
||||
* : 13.03.2012 1.20 ID Code is now specified in r_bsp_config.h. It is still used here in Fixed_Vectors[].
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
***********************************************************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include <machine.h>
|
||||
#include "platform.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: PowerON_Reset_PC
|
||||
* Description : The reset vector points to this function. Code execution starts in this function after reset.
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
extern void PowerON_Reset_PC(void);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: excep_supervisor_inst_isr
|
||||
* Description : Supervisor Instruction Violation ISR
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (excep_supervisor_inst_isr)
|
||||
void excep_supervisor_inst_isr(void)
|
||||
{
|
||||
/* Add your own code here to handle this exception */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: excep_undefined_inst_isr
|
||||
* Description : Undefined instruction exception ISR
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (excep_undefined_inst_isr)
|
||||
void excep_undefined_inst_isr(void)
|
||||
{
|
||||
/* Add your own code here to handle this exception */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: excep_floating_point_isr
|
||||
* Description : Floating point exception ISR
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (excep_floating_point_isr)
|
||||
void excep_floating_point_isr(void)
|
||||
{
|
||||
/* Add your own code here to handle this exception */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: non_maskable_isr
|
||||
* Description : Non-maskable interrupt ISR
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (non_maskable_isr)
|
||||
void non_maskable_isr(void)
|
||||
{
|
||||
/* Add your own code here to handle this exception */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: undefined_interrupt_source_isr
|
||||
* Description : All undefined interrupt vectors point to this function.
|
||||
* Set a breakpoint in this function to determine which source is creating unwanted interrupts.
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (undefined_interrupt_source_isr)
|
||||
void undefined_interrupt_source_isr(void)
|
||||
{
|
||||
/* Add your own code here to handle this exception */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Function name: bus_error_isr
|
||||
* Description : By default, this demo code enables the Bus Error Interrupt. This interrupt will fire if the user tries
|
||||
* to access code or data from one of the reserved areas in the memory map, including the areas covered
|
||||
* by disabled chip selects. A nop() statement is included here as a convenient place to set a breakpoint
|
||||
* during debugging and development, and further handling should be added by the user for their
|
||||
* application.
|
||||
* Arguments : none
|
||||
* Return value : none
|
||||
***********************************************************************************************************************/
|
||||
#pragma interrupt (bus_error_isr(vect=VECT(BSC,BUSERR)))
|
||||
void bus_error_isr (void)
|
||||
{
|
||||
/*
|
||||
To find the address that was accessed when the bus error occured, read the register BSC.BERSR2.WORD. The upper
|
||||
13 bits of this register contain the upper 13-bits of the offending address (in 512K byte units)
|
||||
*/
|
||||
|
||||
/* Add your own code here to handle this interrupt */
|
||||
nop();
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* The following array fills in the fixed vector table and the code
|
||||
* protecction ID bytes.
|
||||
***********************************************************************************************************************/
|
||||
#pragma section C FIXEDVECT
|
||||
|
||||
void* const Fixed_Vectors[] = {
|
||||
|
||||
/* 0xffffff90 through 0xffffff9f: Reserved area - must be all 0xFF */
|
||||
(void *)0xFFFFFFFF, /* 0xffffff90 - Reserved */
|
||||
(void *)0xFFFFFFFF, /* 0xffffff94 - Reserved */
|
||||
(void *)0xFFFFFFFF, /* 0xffffff98 - Reserved */
|
||||
|
||||
/* The 32-bit area immediately below (0xffffff9c through 0xffffff9f) is a special area that allows the ROM to be
|
||||
protected from reading or writing by a parallel programmer. Please refer to the HW manual for appropriate settings.
|
||||
The default (all 0xff) places no restrictions and therefore allows reads and writes by a parallel programmer. */
|
||||
(void *)0xFFFFFFFF, /* 0xffffff9C - ROM Code Protection */
|
||||
|
||||
/* The memory are immediately below (0xffffffa0 through 0xffffffaf) is a special area that allows the on-chip firmware
|
||||
to be protected. See the section "ID Code Protection" in the HW manual for details on how to enable protection.
|
||||
Setting the four long words below to non-0xFF values will enable protection. Do this only after carefully review
|
||||
the HW manual */
|
||||
|
||||
/* 0xffffffA0 through 0xffffffaf: ID Code Protection. The ID code is specified using macros in r_bsp_config.h. */
|
||||
(void *) ID_CODE_LONG_1, /* 0xffffffA0 - Control code and ID code */
|
||||
(void *) ID_CODE_LONG_2, /* 0xffffffA4 - ID code (cont.) */
|
||||
(void *) ID_CODE_LONG_3, /* 0xffffffA8 - ID code (cont.) */
|
||||
(void *) ID_CODE_LONG_4, /* 0xffffffAC - ID code (cont.) */
|
||||
|
||||
/* 0xffffffB0 through 0xffffffcf: Reserved area */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffB0 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffB4 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffB8 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffBC - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffC0 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffC4 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffC8 - Reserved */
|
||||
(void *) 0xFFFFFFFF, /* 0xffffffCC - Reserved */
|
||||
|
||||
/* Fixed vector table */
|
||||
(void *) excep_supervisor_inst_isr, /* 0xffffffd0 Exception(Supervisor Instruction) */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xffffffd4 Reserved */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xffffffd8 Reserved */
|
||||
(void *) excep_undefined_inst_isr, /* 0xffffffdc Exception(Undefined Instruction) */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xffffffe0 Reserved */
|
||||
(void *) excep_floating_point_isr, /* 0xffffffe4 Exception(Floating Point) */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xffffffe8 Reserved */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xffffffec Reserved */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xfffffff0 Reserved */
|
||||
(void *) undefined_interrupt_source_isr, /* 0xfffffff4 Reserved */
|
||||
(void *) non_maskable_isr, /* 0xfffffff8 NMI */
|
||||
(void *) PowerON_Reset_PC /* 0xfffffffc RESET */
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : platform.h
|
||||
* Version : 1.20
|
||||
* Description : The user chooses which MCU and board they are developing for in this file. If the board you are using
|
||||
* is not listed below, please add your own or use the default 'User Board'.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 30.11.2011 1.00 First Release
|
||||
* : 13.01.2012 1.10 Moved from having platform defined using macro defintion, to having platform defined
|
||||
* by choosing an include path. This makes this file simpler and cleans up the issue
|
||||
* where HEW shows all header files for all platforms under 'Dependencies'.
|
||||
* : 14.02.2012 1.20 Added RX210 BSP.
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#ifndef _PLATFORM_H_
|
||||
#define _PLATFORM_H_
|
||||
|
||||
/***********************************************************************************************************************
|
||||
DEFINE YOUR SYSTEM - UNCOMMENT THE INCLUDE PATH FOR THE PLATFORM YOU ARE USING.
|
||||
***********************************************************************************************************************/
|
||||
/* RSKRX610 */
|
||||
//#include "./board/rskrx610/r_bsp.h"
|
||||
|
||||
/* RSKRX62N */
|
||||
//#include "./board/rskrx62n/r_bsp.h"
|
||||
|
||||
/* RSKRX62T */
|
||||
//#include "./board/rskrx62t/r_bsp.h"
|
||||
|
||||
/* RDKRX62N */
|
||||
//#include "./board/rdkrx62n/r_bsp.h"
|
||||
|
||||
/* RSKRX630 */
|
||||
//#include "./board/rskrx630/r_bsp.h"
|
||||
|
||||
/* RSKRX63N */
|
||||
#include "./board/rskrx63n/r_bsp.h"
|
||||
|
||||
/* RDKRX63N */
|
||||
//#include "./board/rdkrx63n/r_bsp.h"
|
||||
|
||||
/* RSKRX210 */
|
||||
//#include "./board/rskrx210/r_bsp.h"
|
||||
|
||||
/* User Board - Define your own board here. */
|
||||
//#include "./board/user/r_bsp.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
MAKE SURE AT LEAST ONE PLATFORM WAS DEFINED - DO NOT EDIT BELOW THIS POINT
|
||||
***********************************************************************************************************************/
|
||||
#ifndef PLATFORM_DEFINED
|
||||
#error "Error - No platform defined in platform.h!"
|
||||
#endif
|
||||
|
||||
#endif /* _PLATFORM_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :lowsrc.h */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Header file of I/O Stream file */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
/*Number of I/O Stream*/
|
||||
#define IOSTREAM 20
|
@ -1,107 +0,0 @@
|
||||
|
||||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
* Please refer to http://www.renesas.com/disclaimer
|
||||
******************************************************************************
|
||||
Copyright (C) 2011. Renesas Electronics Corp., All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* File Name : rsksh7216.h
|
||||
* Version : 1.00
|
||||
* Description : RSK RX63N board specific settings
|
||||
******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 12.09.2011 1.00 First Release
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef RSKRX63N_H
|
||||
#define RSKRX63N_H
|
||||
|
||||
/******************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Typedef definitions
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Macro definitions
|
||||
******************************************************************************/
|
||||
|
||||
/* System Clock Settings */
|
||||
|
||||
/* DETAIL THIS LATER !!!! */
|
||||
|
||||
#define XTAL_FREQUENCY (12000000L)
|
||||
#define PLL_MUL (16)
|
||||
#define PLL_INPUT_FREQ_DIV (1)
|
||||
#define ICLK_DIV (2)
|
||||
#define PCLK_DIV (4)
|
||||
#define BCLK_DIV (4)
|
||||
#define PLL_FREQUENCY (XTAL_FREQUENCY * (PLL_MUL / PLL_INPUT_FREQ_DIV))
|
||||
#define ICLK_FREQUENCY (PLL_FREQUENCY / ICLK_DIV)
|
||||
#define PCLK_FREQUENCY (PLL_FREQUENCY / PCLK_DIV)
|
||||
#define BCLK_FREQUENCY (PLL_FREQUENCY / BCLK_DIV)
|
||||
|
||||
#define CMT0_CLK_SELECT (512)
|
||||
|
||||
/* General Values */
|
||||
#define LED_ON (0)
|
||||
#define LED_OFF (1)
|
||||
#define SET_BIT_HIGH (1)
|
||||
#define SET_BIT_LOW (0)
|
||||
#define SET_BYTE_HIGH (0xFF)
|
||||
#define SET_BYTE_LOW (0x00)
|
||||
|
||||
/* Define switches to be polled if not available as interrupts */
|
||||
#define SW_ACTIVE FALSE
|
||||
#define SW1 PORT0.DR.BIT.B0
|
||||
#define SW2 PORT0.DR.BIT.B1
|
||||
#define SW3 PORT0.DR.BIT.B7
|
||||
#define SW1_DDR PORT0.DDR.BIT.B0
|
||||
#define SW2_DDR PORT0.DDR.BIT.B1
|
||||
#define SW3_DDR PORT0.DDR.BIT.B7
|
||||
#define SW1_ICR PORT0.ICR.BIT.B0
|
||||
#define SW2_ICR PORT0.ICR.BIT.B1
|
||||
#define SW3_ICR PORT0.ICR.BIT.B7
|
||||
|
||||
/* LEDs */
|
||||
#define LED0 PORT0.PODR.BIT.B3
|
||||
#define LED1 PORT0.PODR.BIT.B5
|
||||
#define LED2 PORT1.PODR.BIT.B0
|
||||
#define LED3 PORT1.PODR.BIT.B1
|
||||
//#define LED4 PORT6.DR.BIT.B0
|
||||
//#define LED5 PORT7.DR.BIT.B3
|
||||
#define LED0_PDR PORT0.PDR.BIT.B3
|
||||
#define LED1_PDR PORT0.PDR.BIT.B5
|
||||
#define LED2_PDR PORT1.PDR.BIT.B0
|
||||
#define LED3_PDR PORT1.PDR.BIT.B1
|
||||
//#define LED4_DDR PORT6.DDR.BIT.B0
|
||||
//#define LED5_DDR PORT7.DDR.BIT.B3
|
||||
|
||||
/* 2x8 segment LCD */
|
||||
#if 0
|
||||
#define INCLUDE_LCD 1
|
||||
#define LCD_RS PORTJ.PODR.BIT.B1
|
||||
#define LCD_EN PORTJ.PODR.BIT.B3
|
||||
#define LCD_DATA PORTH.PODR.BYTE
|
||||
|
||||
#define LCD_RS_DDR PORTJ.PDR.BIT.B1
|
||||
#define LCD_EN_DDR PORTJ.PDR.BIT.B3
|
||||
#define LCD_DATA_DDR PORTH.PDR.BYTE
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Variable Externs
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Functions Prototypes
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* RSKRX63N_H */
|
||||
#endif
|
||||
|
@ -1,13 +0,0 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :stacksct.h */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Setting of Stack area */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
#pragma stacksize su=0x300
|
||||
#pragma stacksize si=0x100
|
@ -1,41 +0,0 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :typedefine.h */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Aliases of Integer Type */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Device : RX
|
||||
*
|
||||
* File Name : typedefine.h
|
||||
*
|
||||
* Abstract : Aliases of Integer Type.
|
||||
*
|
||||
* History : 1.00 (2009-08-07)
|
||||
*
|
||||
* NOTE : THIS IS A TYPICAL EXAMPLE.
|
||||
*
|
||||
* Copyright(c) 2009 Renesas Technology Corp.
|
||||
* And Renesas Solutions Corp.,All Rights Reserved.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
typedef signed char _SBYTE;
|
||||
typedef unsigned char _UBYTE;
|
||||
typedef signed short _SWORD;
|
||||
typedef unsigned short _UWORD;
|
||||
typedef signed int _SINT;
|
||||
typedef unsigned int _UINT;
|
||||
typedef signed long _SDWORD;
|
||||
typedef unsigned long _UDWORD;
|
||||
typedef signed long long _SQWORD;
|
||||
typedef unsigned long long _UQWORD;
|
@ -1,60 +0,0 @@
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :vect.h */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Definition of Vector */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Device : RX/RX600
|
||||
*
|
||||
* File Name : vect.h
|
||||
*
|
||||
* Abstract : Definition of Vector.
|
||||
*
|
||||
* History : 1.00 (2009-08-07)
|
||||
*
|
||||
* NOTE : THIS IS A TYPICAL EXAMPLE.
|
||||
*
|
||||
* Copyright(c) 2009 Renesas Technology Corp.
|
||||
* And Renesas Solutions Corp.,All Rights Reserved.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
// Exception(Supervisor Instruction)
|
||||
#pragma interrupt (Excep_SuperVisorInst)
|
||||
void Excep_SuperVisorInst(void);
|
||||
|
||||
// Exception(Undefined Instruction)
|
||||
#pragma interrupt (Excep_UndefinedInst)
|
||||
void Excep_UndefinedInst(void);
|
||||
|
||||
// Exception(Floating Point)
|
||||
#pragma interrupt (Excep_FloatingPoint)
|
||||
void Excep_FloatingPoint(void);
|
||||
|
||||
// NMI
|
||||
#pragma interrupt (NonMaskableInterrupt)
|
||||
void NonMaskableInterrupt(void);
|
||||
|
||||
// Dummy
|
||||
#pragma interrupt (Dummy)
|
||||
void Dummy(void);
|
||||
|
||||
// BRK
|
||||
#pragma interrupt (Excep_BRK(vect=0))
|
||||
void Excep_BRK(void);
|
||||
|
||||
//;<<VECTOR DATA START (POWER ON RESET)>>
|
||||
//;Power On Reset PC
|
||||
extern void PowerON_Reset_PC(void);
|
||||
//;<<VECTOR DATA END (POWER ON RESET)>>
|
||||
|
@ -0,0 +1,149 @@
|
||||
/***********************************************************************************************************************
|
||||
* DISCLAIMER
|
||||
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
|
||||
* other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
|
||||
* applicable laws, including copyright laws.
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
|
||||
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
|
||||
* SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
|
||||
* SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
|
||||
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
|
||||
* following link:
|
||||
* http://www.renesas.com/disclaimer
|
||||
*
|
||||
* Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.
|
||||
***********************************************************************************************************************/
|
||||
/***********************************************************************************************************************
|
||||
* File Name : r_bsp_config_reference.c
|
||||
* Device(s) : RX63x
|
||||
* Description : The file r_bsp_config.h is used to configure your BSP. r_bsp_config.h should be included
|
||||
* somewhere in your package so that the r_bsp code has access to it. This file (r_bsp_config_reference.h)
|
||||
* is just a reference file that the user can use to make their own r_bsp_config.h file.
|
||||
************************************************************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 13.03.2012 1.00 First Release
|
||||
***********************************************************************************************************************/
|
||||
#ifndef R_BSP_CONFIG_REF_HEADER_FILE
|
||||
#define R_BSP_CONFIG_REF_HEADER_FILE
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Configuration Options
|
||||
***********************************************************************************************************************/
|
||||
/* The 'BSP_DECLARE_STACK' macro is checked so that the stack is only declared in one place (resetprg.c). Every time a
|
||||
'#pragma stacksize' is encountered, the stack size is increased. This prevents multiplication of stack size. */
|
||||
#if defined(BSP_DECLARE_STACK)
|
||||
/* User Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize su=0x1000
|
||||
/* Interrupt Stack size in bytes. The Renesas RX toolchain sets the stack size using the #pragma stacksize directive. */
|
||||
#pragma stacksize si=0x400
|
||||
#endif
|
||||
|
||||
/* Heap size in bytes. */
|
||||
#define HEAP_BYTES (0x4)
|
||||
|
||||
/* After reset MCU will operate in Supervisor mode. To switch to User mode, set this macro to '1'. For more information
|
||||
on the differences between these 2 modes see the CPU >> Processor Mode section of your MCU's hardware manual.
|
||||
0 = Stay in Supervisor mode.
|
||||
1 = Switch to User mode.
|
||||
*/
|
||||
#define RUN_IN_USER_MODE (0)
|
||||
|
||||
/* To get into User Boot Mode the user must control some pins on the MCU and also set some values in ROM. These values
|
||||
in ROM are described in the Option-Setting Memory section of the hardware manual. This macro sets these values so
|
||||
that User Boot Mode can be used. The user is still responsible for setting the MCU pins appropriately.
|
||||
0 = Single-Chip or USB Boot Mode
|
||||
1 = User Boot Mode
|
||||
*/
|
||||
#define USER_BOOT_ENABLE (0)
|
||||
|
||||
/* Set your desired ID code. NOTE, leave at the default (all 0xFF's) if you do not wish to use an ID code. If you set
|
||||
this value and program it into the MCU then you will need to remember the ID code because the debugger will ask for
|
||||
it when trying to connect. Note that the E1/E20 will ignore the ID code when programming the MCU during debugging.
|
||||
If you set this value and then forget it then you can clear the ID code by connecting up in serial boot mode using
|
||||
FDT. The ID Code is 16 bytes long. The macro below define the ID Code in 4-byte sections. */
|
||||
/* Lowest 4-byte section, address 0xFFFFFFA0. From MSB to LSB: Control Code, ID code 1, ID code 2, ID code 3. */
|
||||
#define ID_CODE_LONG_1 (0xFFFFFFFF)
|
||||
/* 2nd ID Code section, address 0xFFFFFFA4. From MSB to LSB: ID code 4, ID code 5, ID code 6, ID code 7. */
|
||||
#define ID_CODE_LONG_2 (0xFFFFFFFF)
|
||||
/* 3rd ID Code section, address 0xFFFFFFA8. From MSB to LSB: ID code 8, ID code 9, ID code 10, ID code 11. */
|
||||
#define ID_CODE_LONG_3 (0xFFFFFFFF)
|
||||
/* 4th ID Code section, address 0xFFFFFFAC. From MSB to LSB: ID code 12, ID code 13, ID code 14, ID code 15. */
|
||||
#define ID_CODE_LONG_4 (0xFFFFFFFF)
|
||||
|
||||
/* This macro lets other modules no if a RTOS is being used.
|
||||
0 = RTOS is not used.
|
||||
1 = RTOS is used.
|
||||
*/
|
||||
#define RTOS_USED (0)
|
||||
|
||||
/* Clock source select (CKSEL).
|
||||
0 = Low Speed On-Chip Oscillator (LOCO)
|
||||
1 = High Speed On-Chip Oscillator (HOCO)
|
||||
2 = Main Clock Oscillator
|
||||
3 = Sub-Clock Oscillator
|
||||
4 = PLL Circuit
|
||||
*/
|
||||
#define CLOCK_SOURCE (4)
|
||||
|
||||
/* Clock configuration options.
|
||||
The input clock frequency is specified and then the system clocks are set by specifying the multipliers used. The
|
||||
multiplier settings are used to set the clock registers in resetprg.c. If a 12MHz clock is used and the
|
||||
ICLK is 96MHz, PCLKA is 48MHz, PCLKB is 48MHz, FCLK is 48MHz, USB Clock is 48MHz, and BCLK is 12MHz then the
|
||||
settings would be:
|
||||
|
||||
XTAL_HZ = 12000000
|
||||
PLL_DIV = 1 (no division)
|
||||
PLL_MUL = 16 (12MHz x 16 = 192MHz)
|
||||
ICK_DIV = 2 : System Clock (ICLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / ICK_DIV) = 96MHz
|
||||
PCKA_DIV = 4 : Peripheral Clock A (PCLKA) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKA_DIV) = 48MHz
|
||||
PCKB_DIV = 4 : Peripheral Clock B (PCLKB) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / PCKB_DIV) = 48MHz
|
||||
FCK_DIV = 4 : Flash IF Clock (FCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / FCK_DIV) = 48MHz
|
||||
BCK_DIV = 8 : External Bus Clock (BCK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / BCK_DIV) = 24MHz
|
||||
UCK_DIV = 4 : USB Clock (UCLK) = (((XTAL_HZ/PLL_DIV) * PLL_MUL) / UCK_DIV) = 48MHz
|
||||
*/
|
||||
/* XTAL - Input clock frequency in Hz */
|
||||
#define XTAL_HZ (12000000)
|
||||
/* PLL Input Frequency Divider Select (PLIDIV).
|
||||
Available divisors = /1 (no division), /2, /4
|
||||
*/
|
||||
#define PLL_DIV (1)
|
||||
/* PLL Frequency Multiplication Factor Select (STC).
|
||||
Available multipliers = x8, x10, x12, x16, x20, x24, x25, x50
|
||||
*/
|
||||
#define PLL_MUL (16)
|
||||
/* System Clock Divider (ICK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define ICK_DIV (2)
|
||||
/* Peripheral Module Clock A Divider (PCKA).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKA_DIV (4)
|
||||
/* Peripheral Module Clock B Divider (PCKB).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define PCKB_DIV (4)
|
||||
/* External Bus Clock Divider (BCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define BCK_DIV (8)
|
||||
/* Flash IF Clock Divider (FCK).
|
||||
Available divisors = /1 (no division), /2, /4, /8, /16, /32, /64
|
||||
*/
|
||||
#define FCK_DIV (4)
|
||||
/* IEBUS Clock Divider Select.
|
||||
Available divisors = /1 (no division), /2, /4, /6, /8, /16, /32, /64
|
||||
*/
|
||||
#define IEBCK_DIV (8)
|
||||
/* USB Clock Divider Select.
|
||||
Available divisors = /3, /4
|
||||
*/
|
||||
#define UCK_DIV (4)
|
||||
|
||||
#endif /* R_BSP_CONFIG_REF_HEADER_FILE */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue