/********************************************************************************************************************** * 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) 2020 Renesas Electronics Corporation. All rights reserved. *********************************************************************************************************************/ /***********************************************************************/ /* */ /* FILE :Main.c or Main.cpp */ /* DATE :Tue, Oct 31, 2006 */ /* DESCRIPTION :Main Program */ /* CPU TYPE : */ /* */ /* NOTE:THIS IS A TYPICAL EXAMPLE. */ /* */ /***********************************************************************/ //#include "typedefine.h" #include "r_smc_entry.h" #ifdef __cplusplus //#include // Remove the comment when you use ios //_SINT ios_base::Init::init_cnt; // Remove the comment when you use ios #endif #define FACI (*(volatile unsigned char *)0x7e0000) #define FACI2 (*(volatile unsigned short *)0x7e0000) #pragma section P PRAMPRG void config_write(void) { unsigned char wdata[16]; int i; for(i=0; i<16; i++) wdata[i] = 0xff; wdata[3] = 0x1e; FLASH.FWEPROR.BYTE = 0x01; FLASH.FENTRYR.WORD = 0xAA80; FLASH.FSADDR.LONG = 0x00000040; FACI = 0x40; FACI = 0x08; for(i=0; i<8; i++) { while (FLASH.FSTATR.BIT.DBFULL != 0) { __nop(); } FACI2 = (unsigned short)wdata[i*2] | (((unsigned short)wdata[i*2+1]) << 8); } FACI = 0xD0; while (FLASH.FSTATR.BIT.FRDY != 1) { __nop(); } FLASH.FSADDR.LONG = 0x00000050; for(i=0; i<16; i++) wdata[i] = 0xff; wdata[0] = 0x45; FACI = 0x40; FACI = 0x08; for(i=0; i<8; i++) { while (FLASH.FSTATR.BIT.DBFULL != 0) { __nop(); } FACI2 = (unsigned short)wdata[i*2] | (((unsigned short)wdata[i*2+1]) << 8); } FACI = 0xD0; while (FLASH.FSTATR.BIT.FRDY != 1) { __nop(); } FLASH.FENTRYR.WORD = 0xAA00; FLASH.FWEPROR.BYTE = 0x02; while(1) { __nop(); } } #pragma section void main(void); #ifdef __cplusplus extern "C" { void abort(void); } #endif void main(void) { unsigned long ram_addr = 0x4000; unsigned long rom_addr = 0xfff04000; unsigned long size = 0x200; //CC-RXのリンカ設定でROMからRAMにマッピングする設定に「PRAMPRG=RRAMPRG」を追加 unsigned long i; for (i=0; i