mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-03 04:43:52 -04:00
Add FreeRTOS-Plus directory.
This commit is contained in:
parent
7bd5f21ad5
commit
f508a5f653
6798 changed files with 134949 additions and 19 deletions
|
@ -0,0 +1,66 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :dbsct.c */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Setting of B,R Section */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Device : RX
|
||||
*
|
||||
* File Name : dbsct.c
|
||||
*
|
||||
* Abstract : Setting of B,R Section.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include "typedefine.h"
|
||||
|
||||
#pragma unpack
|
||||
|
||||
#pragma section C C$DSEC
|
||||
extern const struct {
|
||||
_UBYTE *rom_s; /* Start address of the initialized data section in ROM */
|
||||
_UBYTE *rom_e; /* End address of the initialized data section in ROM */
|
||||
_UBYTE *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") }
|
||||
};
|
||||
#pragma section C C$BSEC
|
||||
extern const struct {
|
||||
_UBYTE *b_s; /* Start address of non-initialized data section */
|
||||
_UBYTE *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") }
|
||||
};
|
||||
|
||||
#pragma section
|
||||
|
||||
/*
|
||||
** CTBL prevents excessive output of L1100 messages when linking.
|
||||
** Even if CTBL is deleted, the operation of the program does not change.
|
||||
*/
|
||||
_UBYTE * const _CTBL[] = {
|
||||
__sectop("C_1"), __sectop("C_2"), __sectop("C"),
|
||||
__sectop("W_1"), __sectop("W_2"), __sectop("W")
|
||||
};
|
||||
|
||||
#pragma packoption
|
|
@ -0,0 +1,150 @@
|
|||
/******************************************************************************
|
||||
* DISCLAIMER
|
||||
|
||||
* This software is supplied by Renesas Technology Corp. and is only
|
||||
* intended for use with Renesas products. No other uses are authorized.
|
||||
|
||||
* This software is owned by Renesas Technology Corp. 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
|
||||
* TECHNOLOGY CORP. NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||
* FOR ANY REASON RELATED TO THE 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) 2008. Renesas Technology Corp., All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* File Name : hwsetup.c
|
||||
* Version : 1.00
|
||||
* Description : Power up hardware initializations
|
||||
******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 15.02.2010 1.00 First Release
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Includes <System Includes> , "Project Includes"
|
||||
******************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include "iodefine.h"
|
||||
#include "yrdkrx62ndef.h"
|
||||
// #include "lcd.h" Uncomment this if an LCD is present.
|
||||
|
||||
/******************************************************************************
|
||||
Typedef definitions
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Macro definitions
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Imported global variables and functions (from other files)
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Exported global variables and functions (to be accessed by other files)
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Private global variables and functions
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Function Name: HardwareSetup
|
||||
* Description : This function does initial setting for CPG port pins used in
|
||||
* : the Demo including the MII pins of the Ethernet PHY connection.
|
||||
* Arguments : none
|
||||
* Return Value : none
|
||||
******************************************************************************/
|
||||
void HardwareSetup(void)
|
||||
{
|
||||
uint32_t sckcr = 0;
|
||||
|
||||
/* Configure system clocks based on header */
|
||||
sckcr += (ICLK_MUL==8) ? (0ul << 24) : (ICLK_MUL==4) ? (1ul << 24) : (ICLK_MUL==2) ? (2ul << 24) : (3ul << 24);
|
||||
sckcr += (BCLK_MUL==8) ? (0ul << 16) : (BCLK_MUL==4) ? (1ul << 16) : (BCLK_MUL==2) ? (2ul << 16) : (3ul << 16);
|
||||
sckcr += (PCLK_MUL==8) ? (0ul << 8) : (PCLK_MUL==4) ? (1ul << 8) : (PCLK_MUL==2) ? (2ul << 8) : (3ul << 8);
|
||||
SYSTEM.SCKCR.LONG = sckcr;
|
||||
|
||||
/* Module standby clear - EtherC, EDMAC */
|
||||
SYSTEM.MSTPCRB.BIT.MSTPB15 = 0;
|
||||
|
||||
PORT0.DDR.BYTE = 0x00 ; // Port 0: inputs (IRQ's from ethernet & WiFi)
|
||||
PORT1.DDR.BYTE = 0x00 ; // Port 1: inputs (IIC and USB settings will override these later)
|
||||
PORT2.DDR.BYTE = 0x1A ; // Port 2: USB signals
|
||||
PORT3.DDR.BYTE = 0x04 ; // Port 3: JTAG (P30, P31, P34), CAN (P32=Tx, P33=Rx), NMI (P35)
|
||||
PORT4.DDR.BYTE = 0x00 ; // Port 4: Switches (P40-P42), AIN (P43-P47)
|
||||
PORT5.DDR.BYTE = 0x3B ; // Port 5: Audio (P55,P54), BCLK (P53), SCI (P52=Rx, P50=Tx), LCD-RS (P51)
|
||||
|
||||
PORTA.DR.BYTE = 0x00 ; // Port A outputs all LOW to start
|
||||
PORTA.DDR.BYTE = 0xFF ; // Port A: Expansion (PA0-PA2), Ether (PA3-PA5), Audio (PA6-PA7)
|
||||
|
||||
PORTB.DR.BYTE = 0x00 ;
|
||||
PORTB.DDR.BYTE = 0x70 ; // Port B: Ether
|
||||
|
||||
PORTC.DR.BYTE = 0xF7 ; // Port C: Chip selects, clock = high; IO reset = low (not reset, needed by Ether PHY)
|
||||
PORTC.DDR.BYTE = 0x7F ; // Port C: SPI (PC0-2, PC4-7), IO reset (PC3)
|
||||
|
||||
// Ethernet settings
|
||||
IOPORT.PFENET.BYTE = 0x82; // Enable Ether poins, RMII mode, enable LINKSTA
|
||||
PORTA.ICR.BIT.B5 = 1; // ET_LINKSTA
|
||||
PORTA.ICR.BIT.B3 = 1; // ET_MDIO
|
||||
PORTB.ICR.BIT.B0 = 1; // RMII_RXD1
|
||||
PORTB.ICR.BIT.B1 = 1; // RMII_RXD0
|
||||
PORTB.ICR.BIT.B2 = 1; // REF50CLK
|
||||
PORTB.ICR.BIT.B3 = 1; // RMII_RX_ER
|
||||
PORTB.ICR.BIT.B7 = 1; // RMII_CRS_DV
|
||||
|
||||
|
||||
/* Configure LEDs */
|
||||
LED4 = LED_OFF;
|
||||
LED5 = LED_OFF;
|
||||
LED6 = LED_OFF;
|
||||
LED7 = LED_OFF;
|
||||
LED8 = LED_OFF;
|
||||
LED9 = LED_OFF;
|
||||
LED10 = LED_OFF;
|
||||
LED11 = LED_OFF;
|
||||
LED12 = LED_OFF;
|
||||
LED13 = LED_OFF;
|
||||
LED14 = LED_OFF;
|
||||
LED15 = LED_OFF;
|
||||
|
||||
LED4_DDR = 1;
|
||||
LED5_DDR = 1;
|
||||
LED6_DDR = 1;
|
||||
LED7_DDR = 1;
|
||||
LED8_DDR = 1;
|
||||
LED9_DDR = 1;
|
||||
LED10_DDR = 1;
|
||||
LED11_DDR = 1;
|
||||
LED12_DDR = 1;
|
||||
LED13_DDR = 1;
|
||||
LED14_DDR = 1;
|
||||
LED15_DDR = 1;
|
||||
|
||||
/* Configure push button switches */
|
||||
SW1_DDR = 0;
|
||||
SW2_DDR = 0;
|
||||
SW3_DDR = 0;
|
||||
SW1_ICR = 1;
|
||||
SW2_ICR = 1;
|
||||
SW3_ICR = 1;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :intprg.c */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Interrupt Program */
|
||||
/* 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 : intprg.c
|
||||
*
|
||||
* Abstract : Interrupt Program.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include <machine.h>
|
||||
#include "vect.h"
|
||||
#pragma section IntPRG
|
||||
|
||||
// Exception(Supervisor Instruction)
|
||||
void Excep_SuperVisorInst(void){/* brk(); */}
|
||||
|
||||
// Exception(Undefined Instruction)
|
||||
void Excep_UndefinedInst(void){/* brk(); */}
|
||||
|
||||
// Exception(Floating Point)
|
||||
void Excep_FloatingPoint(void){/* brk(); */}
|
||||
|
||||
// NMI
|
||||
void NonMaskableInterrupt(void){/* brk(); */}
|
||||
|
||||
// Dummy
|
||||
void Dummy(void){/* brk(); */}
|
||||
|
||||
// BRK
|
||||
void Excep_BRK(void){ wait(); }
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
|
||||
; Comment out the orginal code
|
||||
.IF 0
|
||||
|
||||
;------------------------------------------------------------------------
|
||||
; |
|
||||
; FILE :lowlvl.src |
|
||||
; DATE :Wed, Jun 16, 2010 |
|
||||
; DESCRIPTION :Program of Low level |
|
||||
; CPU TYPE :Other |
|
||||
; |
|
||||
; This file is generated by Renesas Project Generator (Ver.4.50). |
|
||||
; NOTE:THIS IS A TYPICAL EXAMPLE. |
|
||||
; |
|
||||
;------------------------------------------------------------------------
|
||||
|
||||
|
||||
.GLB _charput
|
||||
.GLB _charget
|
||||
|
||||
SIM_IO .EQU 0h
|
||||
|
||||
.SECTION P,CODE
|
||||
;-----------------------------------------------------------------------
|
||||
; _charput:
|
||||
;-----------------------------------------------------------------------
|
||||
_charput:
|
||||
MOV.L #IO_BUF,R2
|
||||
MOV.B R1,[R2]
|
||||
MOV.L #1220000h,R1
|
||||
MOV.L #PARM,R3
|
||||
MOV.L R2,[R3]
|
||||
MOV.L R3,R2
|
||||
MOV.L #SIM_IO,R3
|
||||
JSR R3
|
||||
RTS
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
; _charget:
|
||||
;-----------------------------------------------------------------------
|
||||
_charget:
|
||||
MOV.L #1210000h,R1
|
||||
MOV.L #IO_BUF,R2
|
||||
MOV.L #PARM,R3
|
||||
MOV.L R2,[R3]
|
||||
MOV.L R3,R2
|
||||
MOV.L #SIM_IO,R3
|
||||
JSR R3
|
||||
MOV.L #IO_BUF,R2
|
||||
MOVU.B [R2],R1
|
||||
RTS
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
; I/O Buffer
|
||||
;-----------------------------------------------------------------------
|
||||
.SECTION B,DATA,ALIGN=4
|
||||
PARM: .BLKL 1
|
||||
.SECTION B_1,DATA
|
||||
IO_BUF: .BLKB 1
|
||||
; .END ; Commented out for conditional assembly
|
||||
|
||||
; Code below is for debug console
|
||||
.ELSE
|
||||
|
||||
;-----------------------------------------------------------------------
|
||||
;
|
||||
; 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
|
||||
.ENDIF
|
||||
|
||||
.END
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :lowsrc.c */
|
||||
/* DATE :Wed, Jun 16, 2010 */
|
||||
/* DESCRIPTION :Program of I/O Stream */
|
||||
/* CPU TYPE :Other */
|
||||
/* */
|
||||
/* This file is generated by Renesas Project Generator (Ver.4.50). */
|
||||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Device : RX
|
||||
*
|
||||
* File Name : lowsrc.c
|
||||
*
|
||||
* Abstract : Program of I/O Stream.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include "lowsrc.h"
|
||||
|
||||
/* 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,129 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :resetprg.c */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Reset Program */
|
||||
/* 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 : resetprg.c
|
||||
*
|
||||
* Abstract : Reset Program.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include <machine.h>
|
||||
#include <_h_c_lib.h>
|
||||
//#include <stddef.h> // Remove the comment when you use errno
|
||||
//#include <stdlib.h> // Remove the comment when you use rand()
|
||||
#include "typedefine.h"
|
||||
#include "stacksct.h"
|
||||
|
||||
#pragma inline_asm Change_PSW_PM_to_UserMode
|
||||
static void Change_PSW_PM_to_UserMode(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void PowerON_Reset_PC(void);
|
||||
void main(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus // Use SIM I/O
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void _INIT_IOLIB(void);
|
||||
extern void _CLOSEALL(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PSW_init 0x00010000
|
||||
#define FPSW_init 0x00000100
|
||||
|
||||
//extern void srand(_UINT); // Remove the comment when you use rand()
|
||||
//extern _SBYTE *_s1ptr; // Remove the comment when you use strtok()
|
||||
|
||||
//#ifdef __cplusplus // Use Hardware Setup
|
||||
//extern "C" {
|
||||
//#endif
|
||||
//extern void HardwareSetup(void);
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
||||
//#ifdef __cplusplus // Remove the comment when you use global class object
|
||||
//extern "C" { // Sections C$INIT and C$END will be generated
|
||||
//#endif
|
||||
//extern void _CALL_INIT(void);
|
||||
//extern void _CALL_END(void);
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
||||
#pragma section ResetPRG
|
||||
|
||||
#pragma entry PowerON_Reset_PC
|
||||
|
||||
void PowerON_Reset_PC(void)
|
||||
{
|
||||
set_intb((unsigned long)__sectop("C$VECT"));
|
||||
set_fpsw(FPSW_init);
|
||||
|
||||
_INITSCT();
|
||||
|
||||
// _INIT_IOLIB(); // Remove the comment when you use SIM I/O
|
||||
|
||||
// errno=0; // Remove the comment when you use errno
|
||||
// srand((_UINT)1); // Remove the comment when you use rand()
|
||||
// _s1ptr=NULL; // Remove the comment when you use strtok()
|
||||
|
||||
// HardwareSetup(); // Use Hardware Setup
|
||||
nop();
|
||||
|
||||
// _CALL_INIT(); // Remove the comment when you use global class object
|
||||
|
||||
set_psw(PSW_init); // Set Ubit & Ibit for PSW
|
||||
// Change_PSW_PM_to_UserMode(); // DO NOT CHANGE TO USER MODE IF USING FREERTOS!
|
||||
( void ) Change_PSW_PM_to_UserMode; // Just to avoid compiler warnings.
|
||||
|
||||
main();
|
||||
|
||||
// _CLOSEALL(); // Use SIM I/O
|
||||
|
||||
// _CALL_END(); // Remove the comment when you use global class object
|
||||
|
||||
brk();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#define HEAPSIZE 0x400
|
||||
signed char *sbrk( size_t size );
|
||||
union HEAP_TYPE
|
||||
{
|
||||
signed long dummy;
|
||||
signed char heap[HEAPSIZE];
|
||||
};
|
||||
static union HEAP_TYPE heap_area;
|
||||
|
||||
/* End address allocated by sbrk */
|
||||
static signed char *brk = ( signed char * ) &heap_area;
|
||||
signed char *sbrk( size_t size )
|
||||
{
|
||||
signed char *p;
|
||||
if( brk + size > heap_area.heap + HEAPSIZE )
|
||||
{
|
||||
p = ( signed char * ) - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = brk;
|
||||
brk += size;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* FILE :vecttbl.c */
|
||||
/* DATE :Wed, Aug 11, 2010 */
|
||||
/* DESCRIPTION :Initialize of Vector Table */
|
||||
/* 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 : vecttbl.c
|
||||
*
|
||||
* Abstract : Initialize of Vector Table.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include "vect.h"
|
||||
|
||||
#pragma section C FIXEDVECT
|
||||
|
||||
void* const Fixed_Vectors[] = {
|
||||
//;0xffffffd0 Exception(Supervisor Instruction)
|
||||
(void*) Excep_SuperVisorInst,
|
||||
//;0xffffffd4 Reserved
|
||||
Dummy,
|
||||
//;0xffffffd8 Reserved
|
||||
Dummy,
|
||||
//;0xffffffdc Exception(Undefined Instruction)
|
||||
(void*) Excep_UndefinedInst,
|
||||
//;0xffffffe0 Reserved
|
||||
Dummy,
|
||||
//;0xffffffe4 Exception(Floating Point)
|
||||
(void*) Excep_FloatingPoint,
|
||||
//;0xffffffe8 Reserved
|
||||
Dummy,
|
||||
//;0xffffffec Reserved
|
||||
Dummy,
|
||||
//;0xfffffff0 Reserved
|
||||
Dummy,
|
||||
//;0xfffffff4 Reserved
|
||||
Dummy,
|
||||
//;0xfffffff8 NMI
|
||||
(void*) NonMaskableInterrupt,
|
||||
//;0xfffffffc RESET
|
||||
//;<<VECTOR DATA START (POWER ON RESET)>>
|
||||
//;Power On Reset PC
|
||||
PowerON_Reset_PC
|
||||
//;<<VECTOR DATA END (POWER ON RESET)>>
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue