forked from xuos/xiuos
modify nuttx bug of lack of files
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_SKP16C26
|
||||
endif
|
||||
@@ -0,0 +1,110 @@
|
||||
boards/renesas/m16c/skp16c26/README.txt
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
1. The buildroot package can be used to build an M16C toolchain. The toolchain
|
||||
buildroot can be downloaded from buildroot in the NuttX GIT. Insructions
|
||||
for building the toolchain are provided below.
|
||||
|
||||
However, the target cannot be built because the GNU m16c-nuttx-elf-ld link fails with
|
||||
the following message:
|
||||
|
||||
m32c-nuttx-elf-ld: BFD (GNU Binutils) 2.19 assertion fail /home/Owner/projects/nuttx/buildroot/toolchain_build_m32c/binutils-2.19/bfd/elf32-m32c.c:482
|
||||
|
||||
Where the reference line is:
|
||||
|
||||
/* If the symbol is out of range for a 16-bit address,
|
||||
we must have allocated a plt entry. */
|
||||
BFD_ASSERT (*plt_offset != (bfd_vma) -1);
|
||||
|
||||
No workaround is known at this time. This is a show stopper for M16C.
|
||||
|
||||
2. A supported version of the M16C toolchain is available here:
|
||||
|
||||
http://www.kpitgnutools.com/index.php
|
||||
|
||||
This download is free but requires registration. Unfortunately, this v0901 of
|
||||
this toolchain shows the same behavior:
|
||||
|
||||
c:\Hew3\Tools\KPIT Cummins\GNUM16CM32C-ELF\v0901\m32c-elf\bin\m32c-elf-ld.exe: BFD (GNU Binutils) 2.19-GNUM16CM32C_v0901 assertion fail /home/kpit/fsfsrc/binutils-2.19/bfd/elf32-m32c.c:482
|
||||
|
||||
It is possible that this error messasge my be telling me -- a very roundabout way --
|
||||
that I have exceeded the FLASH region, but I think that unlikely (it is difficult
|
||||
to know if the link does not complete gracefully).
|
||||
|
||||
BUILDING THE R8C/M16C/M32C GNU TOOLCHAIN USING BUILDROOT
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
NOTE: See the toolchain issues above -- you may not want to waste your time.
|
||||
|
||||
1. CD to the correct directory.
|
||||
|
||||
Change to the directory just above the NuttX installation. If <nuttx-dir> is
|
||||
where NuttX is installed, then cd to <nuttx-dir>/..
|
||||
|
||||
2. Get and Install the buildroot Module
|
||||
|
||||
a. Using a release tarball:
|
||||
|
||||
cd <nuttx-dir>/..
|
||||
Download the appropriate buildroot package.
|
||||
unpack the buildroot package
|
||||
rename the directory to buildroot
|
||||
|
||||
b. Using GIT
|
||||
|
||||
Check out the buildroot module. GIT checkout instructions:
|
||||
|
||||
git clone hhttps://patacongo@bitbucket.org/nuttx/buildroot.git buildroot
|
||||
|
||||
Make the archive directory:
|
||||
|
||||
mkdir archive
|
||||
|
||||
The <nuttx-dir>/../buildroot is where the toolchain is built;
|
||||
The <nuttx-dir>/../archive directory is where toolchain sources will be downloaded.
|
||||
|
||||
3. Make sure that NuttX is configured
|
||||
|
||||
cd <nuttx-dir>
|
||||
tools/configure.sh <nuttx-configuration>
|
||||
|
||||
4. Configure and Make the buildroot
|
||||
|
||||
cd <buildroot-dir>
|
||||
cp boards/m32c-defconfig-4.2.4 .config
|
||||
make oldconfig
|
||||
make
|
||||
|
||||
This will download the large source packages for the toolchain and build the toolchain.
|
||||
The resulting binaries will be under buildroot/build_m32c. There will also be a
|
||||
large build directory called toolchain_build_m32c; this directory can be removed once
|
||||
the build completes successfully.
|
||||
|
||||
Cygwin GCC BUILD NOTES
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
On Cygwin, the buildroot 'make' command will fail with an error like:
|
||||
|
||||
"...
|
||||
build/genchecksum cc1-dummy > cc1-checksum.c
|
||||
opening cc1-dummy: No such file or directory
|
||||
..."
|
||||
|
||||
This is caused because on Cygwin, host executables will be generated with the extension .exe
|
||||
and, apparently, the make variable "exeext" is set incorrectly. A work around after the
|
||||
above occurs is:
|
||||
|
||||
cd toolchain_build_m32c/gcc-4.2.4-initial/gcc # Go to the directory where error occurred
|
||||
mv cc1-dummy.exe cc1-dummy # Rename the executable without .exe
|
||||
rm cc1-checksum.c # Get rid of the bad generated file
|
||||
|
||||
Then resume the buildroot make:
|
||||
|
||||
cd - # Back to the buildroot make directory
|
||||
make # Restart the build
|
||||
|
||||
GCC is built twice. First a initial, "bootstrap" GCC is produced in
|
||||
toolchain_build_m32c/gcc-4.2.4-initial, then the final GCC is produced in
|
||||
toolchain_build_m32c/gcc-4.2.4-final. The above error will occur twice: Once for
|
||||
the initial GCC build (see above) and once for the final GCC build. For the final GCC
|
||||
build, the workaround is the same except that the directory will be
|
||||
toolchain_build_m32c/gcc-4.2.4-final/gcc.
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DISABLE_POSIX_TIMERS is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="skp16c26"
|
||||
CONFIG_ARCH_BOARD_SKP16C26=y
|
||||
CONFIG_ARCH_CHIP="m16c"
|
||||
CONFIG_ARCH_CHIP_M30262F8=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=128
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16945
|
||||
CONFIG_CONSOLE_SYSLOG=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_ENDIAN_BIG=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=256
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=256
|
||||
CONFIG_PTHREAD_STACK_MIN=64
|
||||
CONFIG_RAM_SIZE=2048
|
||||
CONFIG_RAM_START=0x00400
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SLCD=y
|
||||
CONFIG_SLCD_CONSOLE=y
|
||||
CONFIG_START_DAY=20
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_YEAR=2009
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TLS_NELEM=0
|
||||
CONFIG_USERMAIN_STACKSIZE=256
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
@@ -0,0 +1,120 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* User configuration checks ************************************************/
|
||||
|
||||
/* According to SKP16C26 documentation, "SIO/UART1 pins are used for
|
||||
* communication between the SKP16C26 board kernel and KD30 Debugger through
|
||||
* the ICD. Do not connect these pins to any other circuit, as UART1 cannot
|
||||
* be used in the user program.
|
||||
* For details, please see ICD (RTA-FoUSB-MON) User Manual on Target M16C
|
||||
* ROM Monitor Resources or related ICD application notes."
|
||||
*
|
||||
* However, the schematic appears to show that SIO/UART2 is actual
|
||||
* connection.
|
||||
* To be safe, we will error out on either selection:
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_M16C_UART1) || defined(CONFIG_M16C_UART2)
|
||||
# error "UART1/2 should not be used on SKP16C26"
|
||||
#endif
|
||||
|
||||
/* Hardware defintitions ****************************************************/
|
||||
|
||||
/* Xin Freq */
|
||||
|
||||
#define M16C_XIN_FREQ 20000000 /* 20MHz */
|
||||
|
||||
/* Interrupt Priority Levels ************************************************/
|
||||
|
||||
/* IPL settings */
|
||||
|
||||
#define M16C_DEFAULT_IPL 0 /* Default M16C Interrupt priority level */
|
||||
#undef M16C_INTERRUPT_IPL /* Default interrupt IPL to enabled nested interrupts */
|
||||
|
||||
/* Define any of the following to specify interrupt priorities. A default
|
||||
* value of 5 will be used for any unspecified values
|
||||
*/
|
||||
|
||||
#undef M16C_INT3_PRIO /* INT3 interrupt priority */
|
||||
#undef M16C_INT5_PRIO /* INT5 interrupt priority */
|
||||
#undef M16C_INT4_PRIO /* INT4 interrupt priority */
|
||||
#undef M16C_BCN_PRIO /* Bus collision detection interrupt priority */
|
||||
#undef M16C_DM0_PRIO /* DMA0 interrupt priority */
|
||||
#undef M16C_DM1_PRIO /* DMA1 interrupt priority */
|
||||
#undef M16C_KUP_PRIO /* Key input interrupt priority */
|
||||
#undef M16C_AD_PRIO /* A-D conversion interrupt priority */
|
||||
#undef M16C_S2T_PRIO /* UART2 transmit interrupt priority */
|
||||
#undef M16C_S2R_PRIO /* UART2 receive interrupt priority */
|
||||
#undef M16C_S0T_PRIO /* UART0 transmit interrupt priority */
|
||||
#undef M16C_S0R_PRIO /* UART0 receive interrupt priority */
|
||||
#undef M16C_S1T_PRIO /* UART1 transmit interrupt priority */
|
||||
#undef M16C_S1R_PRIO /* UART1 receive interrupt priority */
|
||||
#define M16C_TA0_PRIO 5 /* Timer A0 interrupt priority */
|
||||
#undef M16C_TA1_PRIO /* Timer A1 interrupt priority */
|
||||
#undef M16C_TA2_PRIO /* Timer A2 interrupt priority */
|
||||
#undef M16C_TA3_PRIO /* Timer A3 interrupt priority */
|
||||
#undef M16C_TA4_PRIO /* Timer A4 interrupt priority */
|
||||
#undef M16C_TB0_PRIO /* Timer B0 interrupt priority */
|
||||
#undef M16C_TB1_PRIO /* Timer B1 interrupt priority */
|
||||
#undef M16C_TB2_PRIO /* Timer B2 interrupt priority */
|
||||
#undef M16C_INT0_PRIO /* INT0 interrupt priority */
|
||||
#undef M16C_INT1_PRIO /* INT1 interrupt priority */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* GREEN YELLOW RED */
|
||||
#define LED_STARTED 0 /* OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 1 /* ON OFF OFF */
|
||||
#define LED_IRQSENABLED 2 /* OFF ON OFF */
|
||||
#define LED_STACKCREATED 3 /* ON ON OFF */
|
||||
#define LED_INIRQ 4 /* ON OFF ON */
|
||||
#define LED_SIGNAL 5 /* OFF ON ON */
|
||||
#define LED_ASSERTION 6 /* ON ON ON */
|
||||
#define LED_PANIC 7 /* NC** NC** ON* */
|
||||
|
||||
/* *=FLASHING **=if INIRQ, SIGNAL, or ASSERTION will be flashing */
|
||||
|
||||
/* BUTTON definitions *******************************************************/
|
||||
|
||||
#define SW1_PRESSED 0x01 /* Bit 0: 1=SW1 pressed */
|
||||
#define SW2_PRESSED 0x02 /* Bit 1: 1=SW2 pressed */
|
||||
#define SW3_PRESSED 0x04 /* Bit 2: 1=SW3 pressed */
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_M32262F8_SKP16C26_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,54 @@
|
||||
############################################################################
|
||||
# boards/renesas/m16c/skp16c26/scripts/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
CROSSDEV = m32c-nuttx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -mcpu=m16c -fno-builtin
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)skp16c26.ld
|
||||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
@@ -0,0 +1,124 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/scripts/skp16c26.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
OUTPUT_ARCH(m32c)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
/* "Far" flash memory begins at address 0xf0000 for the M20262F8 part and
|
||||
* ends at address 0xfffff (all parts). The program entry point is
|
||||
* the first address in flash
|
||||
*/
|
||||
|
||||
. = 0xf0000;
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got) /* Global offset table */
|
||||
_etext = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
_enronly = ABSOLUTE(.); /* End of read-only values */
|
||||
/* .ndata will be relocated */
|
||||
/* from this address */
|
||||
|
||||
/* The "variable" vector table will be fixed at the following address */
|
||||
|
||||
. = 0xffd00;
|
||||
.varvect : {
|
||||
_svarvect = ABSOLUTE(.);
|
||||
*(.varvect)
|
||||
_evarvect = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* Followed by the special page/fixed vector table. */
|
||||
|
||||
. = 0xffe00;
|
||||
.specpg : {
|
||||
_sspecpg = ABSOLUTE(.);
|
||||
*(.specpg)
|
||||
_especpg = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
. = 0xfffdc;
|
||||
.fixvect : {
|
||||
_sfixvect = ABSOLUTE(.);
|
||||
*(.fixvect)
|
||||
_efixvect = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* Internal "near" RAM begins at address 0x00400 (all parts) and ends at
|
||||
* address 0x00bff (M20262F6 and M20262F8 parts). With the RAM
|
||||
* region, used is .data followed by .bss. The remainder of RAM
|
||||
* carved up by the start-up code into stacks and heaps.
|
||||
*/
|
||||
|
||||
. = 0x00400;
|
||||
|
||||
.ndata : {
|
||||
_sndata = ABSOLUTE(.);
|
||||
*(.data)
|
||||
CONSTRUCTORS
|
||||
_endata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.nbss : { /* BSS */
|
||||
_snbss = ABSOLUTE(.);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
_enbss = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* "Far" RAM begins at 0x10000. The SKP16C26 has no far RAM */
|
||||
|
||||
. = 0x10000;
|
||||
|
||||
.fdata : {
|
||||
_sfdata = ABSOLUTE(.);
|
||||
*(.fdata)
|
||||
CONSTRUCTORS
|
||||
_efdata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.fbss : { /* BSS */
|
||||
_sfbss = ABSOLUTE(.);
|
||||
*(.fbss)
|
||||
*(COMMON)
|
||||
_efbss = ABSOLUTE(.);
|
||||
}
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
############################################################################
|
||||
# boards/renesas/m16c/skp16c26/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = m16c_leds.c m16c_buttons.c m16c_lcd.c m16c_lcdconsole.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_buttons.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SKP62C26 has 3 buttons control by bits 1, 2, and 3 in port 8. */
|
||||
|
||||
#define SW1_BIT (1 << 3) /* Bit 3, port 8 */
|
||||
#define SW2_BIT (1 << 2) /* Bit 2, port 8 */
|
||||
#define SW3_BIT (1 << 1) /* Bit 1, port 8 */
|
||||
|
||||
#define SW_PRESSED(p,b) (((p) & (b)) == 0)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
regval = getreg8(M16C_PD8);
|
||||
regval |= (SW1_BIT | SW2_BIT | SW3_BIT);
|
||||
putreg8(regval, M16C_PD8);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t swset = 0;
|
||||
uint8_t regval = getreg8(M16C_P8);
|
||||
|
||||
if (SW_PRESSED(regval, SW1_BIT))
|
||||
{
|
||||
swset |= SW1_PRESSED;
|
||||
}
|
||||
|
||||
if (SW_PRESSED(regval, SW2_BIT))
|
||||
{
|
||||
swset |= SW2_PRESSED;
|
||||
}
|
||||
|
||||
if (SW_PRESSED(regval, SW3_BIT))
|
||||
{
|
||||
swset |= SW3_PRESSED;
|
||||
}
|
||||
|
||||
return swset;
|
||||
}
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
@@ -0,0 +1,268 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_lcd.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef CONFIG_SLCD
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* LCD dimensions ***********************************************************/
|
||||
|
||||
#define LCD_NLINES 2 /* Two lines */
|
||||
#define LCD_NCHARS 8 /* Eight characters per line */
|
||||
|
||||
/* LCD commands *************************************************************/
|
||||
|
||||
#define LCD_CLEAR 0x01 /* Clear LCD display and home cursor */
|
||||
#define CURSOR_MODE_DEC 0x04 /* Cursor auto decrement after R/W */
|
||||
#define CURSOR_MODE_INC 0x06 /* Cursor auto increment after R/W */
|
||||
#define LCD_CURSOR_ON 0x0e /* Display ON with Cursor */
|
||||
#define LCD_CURSOR_OFF 0x0c /* Display ON with Cursor off */
|
||||
#define LCD_CURSOR_BLINK 0x0d /* Display on with blinking cursor */
|
||||
#define LCD_CURSOR_LEFT 0x10 /* Move Cursor Left One Position */
|
||||
#define LCD_CURSOR_RIGHT 0x14 /* Move Cursor Right One Position */
|
||||
#define FUNCTION_SET 0x28 /* Setup, 4 bits,2 lines, 5X7 */
|
||||
#define LCD_CGRAM 0x40 /* Map characters to CG RAM */
|
||||
#define LCD_POS_L1(p) (0x80 | p) /* Move cursor to line 1, character p+1 */
|
||||
#define LCD_POS_L2(p) (0xc0 | p) /* Move cursor to line 2, character p+1 */
|
||||
#define LCD_HOME_L1 0x80 /* Move cursor to line 1 */
|
||||
#define LCD_HOME_L2 0xc0 /* Move cursor to line 2 */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint8_t g_nchars; /* Number of characters in lines 2 */
|
||||
static uint8_t g_line[LCD_NCHARS]; /* The content of lines 2 */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcddelay
|
||||
****************************************************************************/
|
||||
|
||||
static void up_lcddelay(uint16_t count)
|
||||
{
|
||||
uint32_t counter = (uint16_t)count << 8;
|
||||
while (counter--)
|
||||
{
|
||||
asm("\tnop\n\tnop\n\tnop\n" : :); /* 3 NOPs */
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_setrs
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_setrs(bool data)
|
||||
{
|
||||
/* Set/clear bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
if (data)
|
||||
{
|
||||
regval |= (1 << 0); /* High = data */
|
||||
}
|
||||
else
|
||||
{
|
||||
regval &= ~(1 << 0); /* Low = control */
|
||||
}
|
||||
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_seten
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_seten(void)
|
||||
{
|
||||
/* Set bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
regval |= (1 << 1);
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_clren
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_clren(void)
|
||||
{
|
||||
/* Clear bit 1 of port 6 */
|
||||
|
||||
register uint8_t regval = getreg8(M16C_P6);
|
||||
regval &= ~(1 << 1);
|
||||
putreg8(regval, M16C_P6);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_enpluse
|
||||
****************************************************************************/
|
||||
|
||||
static inline void up_enpulse(bool data)
|
||||
{
|
||||
up_seten(); /* EN enable chip (HIGH) */
|
||||
up_lcddelay(0); /* Short delay */
|
||||
up_clren(); /* Latch data by setting EN low */
|
||||
up_lcddelay(0); /* Short delay for data writes */
|
||||
if (!data) up_lcddelay(0); /* Longer delay for control writes */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdwrite
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdwrite(bool data, uint8_t ch)
|
||||
{
|
||||
up_setrs(data); /* Set RS appropriately */
|
||||
|
||||
/* Write upper nibble first. Only the lower 4 bits of P9 are valid.
|
||||
* The upper four bits are reserved and must be zero.
|
||||
*/
|
||||
|
||||
putreg8(ch >> 4, M16C_P9);
|
||||
up_enpulse(data);
|
||||
|
||||
/* Write lower nibble second */
|
||||
|
||||
putreg8(ch & 0x0f, M16C_P9);
|
||||
up_enpulse(data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_scroll
|
||||
****************************************************************************/
|
||||
|
||||
static void up_scroll(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Clear the display and position the cursor at the beginning of line 1 */
|
||||
|
||||
up_lcdwrite(false, LCD_CLEAR);
|
||||
up_lcdwrite(false, LCD_HOME_L1);
|
||||
|
||||
/* Copy line 2 to line 1 */
|
||||
|
||||
for (i = 0; i < g_nchars; i++)
|
||||
{
|
||||
up_lcdwrite(true, g_line[i]);
|
||||
}
|
||||
|
||||
/* Position the cursor at the beginning of line 2 */
|
||||
|
||||
up_lcdwrite(false, LCD_HOME_L2);
|
||||
g_nchars = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdinit(void)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
/* Enable writing to PD9 by selecting bit 2 in the protection register */
|
||||
|
||||
regval = getreg8(M16C_PRCR);
|
||||
regval |= (1 << 2);
|
||||
putreg8(regval, M16C_PRCR);
|
||||
|
||||
/* We can't read PD9, so we can't OR the values in */
|
||||
|
||||
putreg8(0x0f, M16C_PD9);
|
||||
|
||||
/* Set EN (port 6 bit 1) and Set RS (port 6 bit 0) as outputs */
|
||||
|
||||
regval = getreg8(M16C_P6);
|
||||
regval |= (1 << 1) | (1 << 0);
|
||||
putreg8(regval, M16C_P6);
|
||||
|
||||
regval = getreg8(M16C_PD6);
|
||||
regval |= (1 << 1) | (1 << 0);
|
||||
putreg8(regval, M16C_PD6);
|
||||
|
||||
/* Set EN low */
|
||||
|
||||
up_clren();
|
||||
|
||||
/* Write the reset sequence */
|
||||
|
||||
up_lcdwrite(false, 0x33);
|
||||
up_lcddelay(20);
|
||||
up_lcdwrite(false, 0x32);
|
||||
up_lcddelay(20);
|
||||
up_lcdwrite(false, FUNCTION_SET); /* reset sequence */
|
||||
up_lcdwrite(false, FUNCTION_SET);
|
||||
up_lcdwrite(false, LCD_CURSOR_OFF);
|
||||
up_lcdwrite(false, LCD_CLEAR);
|
||||
up_lcdwrite(false, LCD_HOME_L1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lcdputc
|
||||
****************************************************************************/
|
||||
|
||||
void up_lcdputc(char ch)
|
||||
{
|
||||
/* Check for new line */
|
||||
|
||||
if (ch == '\n')
|
||||
{
|
||||
up_scroll();
|
||||
}
|
||||
|
||||
/* Should we wrap to truncate at the end of line??? Let's truncate.
|
||||
* In either case, let's ignore all other non-printable characters.
|
||||
*/
|
||||
|
||||
else if (g_nchars < LCD_NCHARS && isprint(ch))
|
||||
{
|
||||
up_lcdwrite(true, ch);
|
||||
g_line[g_nchars] = ch;
|
||||
g_nchars++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SLCD */
|
||||
@@ -0,0 +1,125 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_lcdconsole.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "skp16c26.h"
|
||||
|
||||
/* Only use the LCD as a console if there are is no serial console */
|
||||
|
||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART0)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART1)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_M16C_UART2)
|
||||
# define HAVE_SERIALCONSOLE 1
|
||||
#else
|
||||
# undef HAVE_SERIALCONSOLE
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SERIALCONSOLE) && defined(CONFIG_SLCD) && \
|
||||
defined(CONFIG_SLCD_CONSOLE)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_earlyconsoleinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level UART initialization early in debug so that the
|
||||
* serial console will be available during bootup.
|
||||
* This must be called before up_consoleinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
|
||||
void up_earlyconsoleinit(void)
|
||||
{
|
||||
/* There is probably a problem if we are here */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_consoleinit
|
||||
*
|
||||
* Description:
|
||||
* Register serial console and serial ports. This assumes that
|
||||
* up_earlyconsoleinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if USE_SERIALDRIVER
|
||||
# warning "You probably need to define CONFIG_ARCH_LOWCONSOLE"
|
||||
void up_consoleinit(void)
|
||||
{
|
||||
/* There is probably a problem if we are here */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lowputc
|
||||
*
|
||||
* Description:
|
||||
* Output one character on the console
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_lowputc(char ch)
|
||||
{
|
||||
up_lcdputc(ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_putc
|
||||
*
|
||||
* Description:
|
||||
* Output one character on the console
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
up_lcdputc(ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_SERIALCONSOLE && CONFIG_SLCD && CONFIG_SLCD_CONSOLE */
|
||||
@@ -0,0 +1,241 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/m16c_leds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SKP62C26 has 3 LEDs control by bits
|
||||
* 0 and 2 in port 7 and bit 0 in port 8.
|
||||
*/
|
||||
|
||||
#define GREEN_LED (1 << 2) /* Bit 2, port 7 */
|
||||
#define YELLOW_LED (1 << 4) /* Bit 4, port 7 */
|
||||
#define RED_LED (1 << 0) /* Bit 0, port 8 */
|
||||
|
||||
#define GREEN_LED_ON 0
|
||||
#define GREEN_LED_OFF GREEN_LED
|
||||
#define GREEN_LED_MASK GREEN_LED
|
||||
#define GREEN_LED_PORT M16C_P7
|
||||
|
||||
#define YELLOW_LED_ON 0
|
||||
#define YELLOW_LED_OFF YELLOW_LED
|
||||
#define YELLOW_LED_MASK YELLOW_LED
|
||||
#define YELLOW_LED_PORT M16C_P7
|
||||
|
||||
#define GREENYELLOW_LED_MASK (GREEN_LED_MASK|YELLOW_LED_MASK)
|
||||
#define GREENYELLOW_LED_PORT M16C_P7
|
||||
#define GREENYELLOW_DIR_PORT M16C_PD7
|
||||
|
||||
#define RED_LED_ON 0
|
||||
#define RED_LED_OFF RED_LED
|
||||
#define RED_LED_MASK RED_LED
|
||||
#define RED_LED_PORT M16C_P8
|
||||
#define RED_DIR_PORT M16C_PD8
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint8_t g_ledstate[7] =
|
||||
{
|
||||
(GREEN_LED_OFF | YELLOW_LED_OFF | RED_LED_OFF), /* LED_STARTED */
|
||||
(GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_OFF), /* LED_HEAPALLOCATE */
|
||||
(GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_OFF), /* LED_IRQSENABLED */
|
||||
(GREEN_LED_ON | YELLOW_LED_ON | RED_LED_OFF), /* LED_STACKCREATED */
|
||||
(GREEN_LED_ON | YELLOW_LED_OFF | RED_LED_ON), /* LED_INIRQ */
|
||||
(GREEN_LED_OFF | YELLOW_LED_ON | RED_LED_ON), /* LED_SIGNAL */
|
||||
(GREEN_LED_ON | YELLOW_LED_ON | RED_LED_ON) /* LED_ASSERTION */
|
||||
};
|
||||
|
||||
static uint8_t g_prevled[3];
|
||||
static uint8_t g_nestlevel;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: m16c_setleds
|
||||
****************************************************************************/
|
||||
|
||||
static void m16c_setleds(uint8_t gybits, uint8_t rbit)
|
||||
{
|
||||
uint8_t regval;
|
||||
|
||||
regval = getreg8(GREENYELLOW_LED_PORT);
|
||||
regval &= ~GREENYELLOW_LED_MASK;
|
||||
regval |= gybits;
|
||||
putreg8(regval, GREENYELLOW_LED_PORT);
|
||||
|
||||
regval = getreg8(RED_LED_PORT);
|
||||
regval &= ~RED_LED_MASK;
|
||||
regval |= rbit;
|
||||
putreg8(regval, RED_LED_PORT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
register uint8_t regval;
|
||||
|
||||
/* Make sure that the LEDs are in the OFF state */
|
||||
|
||||
regval = getreg8(GREENYELLOW_LED_PORT);
|
||||
regval |= (GREEN_LED_OFF | YELLOW_LED_OFF);
|
||||
putreg8(regval, GREENYELLOW_LED_PORT);
|
||||
|
||||
regval = getreg8(RED_LED_PORT);
|
||||
regval |= RED_LED_OFF;
|
||||
putreg8(regval, RED_LED_PORT);
|
||||
|
||||
/* Set the direction to output */
|
||||
|
||||
regval = getreg8(GREENYELLOW_DIR_PORT);
|
||||
regval |= (GREEN_LED | YELLOW_LED);
|
||||
putreg8(regval, GREENYELLOW_DIR_PORT);
|
||||
|
||||
regval = getreg8(RED_DIR_PORT);
|
||||
regval |= RED_LED;
|
||||
putreg8(regval, RED_DIR_PORT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
uint8_t ledset;
|
||||
|
||||
/* If this is the ASSERTION led, preserve the Y&G bits from the last
|
||||
* setting and set the RED LED on.
|
||||
*/
|
||||
|
||||
if (led == LED_ASSERTION)
|
||||
{
|
||||
ledset = g_ledstate[g_prevled[g_nestlevel]];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_ON);
|
||||
}
|
||||
else if (led < LED_ASSERTION)
|
||||
{
|
||||
/* Otherwise, just show the LEDs corresponding to this state */
|
||||
|
||||
ledset = g_ledstate[led];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
|
||||
|
||||
/* If this was a nested states (INIRQ, SIGNAL, or ASSERTION) then
|
||||
* stack up the previous value.
|
||||
*/
|
||||
|
||||
if (led > LED_STACKCREATED)
|
||||
{
|
||||
g_nestlevel++;
|
||||
}
|
||||
|
||||
g_prevled[g_nestlevel] = led;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
uint8_t ledset;
|
||||
|
||||
/* If this is the ASSERTION led then what we do depends on
|
||||
* the previous state
|
||||
*/
|
||||
|
||||
if (led == LED_ASSERTION)
|
||||
{
|
||||
/* If the previous state was one of the nested states
|
||||
* (INIRQ, SIGNAL, or ASSERTION),
|
||||
* then turn the green and yellow LEDs all off.
|
||||
* That way we can distinguish that case from the simple cases.
|
||||
*/
|
||||
|
||||
if (g_nestlevel > 0)
|
||||
{
|
||||
ledset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ledset = g_ledstate[g_prevled[0]];
|
||||
}
|
||||
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, RED_LED_OFF);
|
||||
}
|
||||
else if (led > 0 && led < LED_ASSERTION)
|
||||
{
|
||||
/* If this was one of the nested states,
|
||||
* then we want to back to the LED setting
|
||||
* before entering that nested statel.
|
||||
*/
|
||||
|
||||
if (g_nestlevel > 0)
|
||||
{
|
||||
g_nestlevel--;
|
||||
led = g_prevled[g_nestlevel];
|
||||
}
|
||||
else if (led > LED_STACKCREATED)
|
||||
{
|
||||
/* This shouldn't happen */
|
||||
|
||||
led--;
|
||||
}
|
||||
|
||||
ledset = g_ledstate[led];
|
||||
m16c_setleds(ledset & GREENYELLOW_LED_MASK, ledset & RED_LED_MASK);
|
||||
g_prevled[g_nestlevel] = led;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/m16c/skp16c26/src/skp16c26.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H
|
||||
#define __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_M32262F8_SKP16C26_SRC_SKP16C26_H */
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_RX65N_GRROSE
|
||||
endif
|
||||
@@ -0,0 +1,419 @@
|
||||
README
|
||||
======
|
||||
|
||||
This README file discusses the port of NuttX to “GR-ROSE” board produced by Gadget Renesas.This board features the RX65N (R5F565NEHDFP 100pin QFP)
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
- Board Features
|
||||
- Status/Open Issues
|
||||
- Serial Console
|
||||
- LEDs
|
||||
- Networking
|
||||
- Contents
|
||||
- RTC
|
||||
- USB Device
|
||||
- RSPI
|
||||
- RIIC
|
||||
- DTC
|
||||
- USB Host
|
||||
- USB Host Hub
|
||||
- Debugging
|
||||
|
||||
Board Features
|
||||
==============
|
||||
- Micro controller - RX65N (R5F565NEHDFP 100pin QFP) RXv2 core [34 CoreMark/mA]
|
||||
- ROM/RAM - 2MB/640KB
|
||||
- Operating Frequency - 120MHz(12MHz 10 Multiplication)
|
||||
- RTC Clock - 32.768kHz
|
||||
- Sensors - Temperature(inside MCU)
|
||||
- ROS I/F - Ethernet, USB(rosserial)
|
||||
- Serial Servo I/F - TTL x 4, RS-485 x 1
|
||||
- Analog I/F - ADC(12bit) x 6, DAC x 1
|
||||
- Wireless - IEEE 802.11b/g/n
|
||||
- PMOD I/F - 1 (I2C, SPI, UART)
|
||||
- External power supply - USB VBUS or 4.5V~18V
|
||||
- Supply to external - 3.3V, 5V
|
||||
|
||||
See the RX65N GRROSE website for further information about this board:
|
||||
|
||||
- http://gadget.renesas.com/en/product/rose.html
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
RX65N GRROSE supports 12 serial ports (SCI0 - SCI12), however only 5 ports can be tested(SCI0, SCI1, SCI2,
|
||||
SCI5 & SCI6).
|
||||
|
||||
Please find the pin configurations for SCI0, SCI1, SCI2, SCI5 & SCI6
|
||||
|
||||
SCI0 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function
|
||||
-----------
|
||||
P21 RXD0
|
||||
P20 TXD0
|
||||
------------
|
||||
|
||||
SCI1 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function
|
||||
-----------
|
||||
P30 RXD1
|
||||
P26 TXD1
|
||||
------------
|
||||
|
||||
SCI2 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function
|
||||
-----------
|
||||
P12 RXD2
|
||||
P13 TXD2
|
||||
------------
|
||||
|
||||
SCI3 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function (connected to WiFi module)
|
||||
-----------
|
||||
P25 RXD3
|
||||
P23 TXD3
|
||||
------------
|
||||
|
||||
SCI5 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function
|
||||
-----------
|
||||
PC2 RXD5
|
||||
PC3 TXD5
|
||||
------------
|
||||
|
||||
SCI6 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function
|
||||
-----------
|
||||
P33 RXD6
|
||||
P32 TXD6
|
||||
------------
|
||||
|
||||
SCI8 Pin Configuration :
|
||||
|
||||
-----------
|
||||
RX65N GRROSE
|
||||
Function (Half duplication mode with RS485 driver)
|
||||
-----------
|
||||
PC6 RXD8
|
||||
PC7 TXD8
|
||||
PC5 Direction (L=TX, H=RX)
|
||||
|
||||
Serial Connection Configuration
|
||||
--------------------------
|
||||
1. GRROSE board needs to be connected to PC terminal, using USB to Serial Chip.
|
||||
2. Connect TX of USB to serial chip to RX of SCIX(0,1,2,5,6)
|
||||
3. Connect RX of USB to serial chip to TX of SCIX(0,1,2,5,6)
|
||||
4. Connect GND to GND pin.
|
||||
5. Configure Teraterm to 115200 baud.
|
||||
|
||||
LEDs
|
||||
====
|
||||
|
||||
The RX65N GRROSE board has 2 LED's, 1 Power LED(LED3) and 2 User LED's(LED1, LED2),which are enabled through software.
|
||||
|
||||
If enabled the LED is simply turned on when the board boots
|
||||
successfully, and is blinking on panic / assertion failed.
|
||||
|
||||
Networking
|
||||
==========
|
||||
|
||||
Ethernet Connections
|
||||
-----------
|
||||
|
||||
------ ---------
|
||||
RX65N
|
||||
GRROSE Ethernet
|
||||
Pin Function
|
||||
------ ---------
|
||||
PA4 ET0_MDC
|
||||
PA3 ET0_MDIO
|
||||
PB2 REF50CK0
|
||||
PB7 RMII0_CRS_DV
|
||||
PB1 RMII0_RXD0
|
||||
PB0 RMII0_RXD1
|
||||
PB3 RMII0_RX_ER
|
||||
PB5 RMII0_ETXD0
|
||||
PB6 RMII0_ETXD1
|
||||
PB4 RMII0_TXD_EN
|
||||
PA5 ET0_LINKSTA
|
||||
PA6_ET_RST ETHER reset
|
||||
------ ---------
|
||||
NuttX Configurations
|
||||
---------------
|
||||
The following configurations, need to be enabled for network.
|
||||
|
||||
CONFIG_RX65N_EMAC=y : Enable the EMAC Peripheral for RX65N
|
||||
CONFIG_RX65N_EMAC0=y : Enable the EMAC Peripheral for RX65N
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30 : Address of PHY status register on LAN8720A
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x18 : Needed for LAN8720A
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x08 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x14 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x04 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x1c : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_RMII=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=0 : LAN8720A PHY is at address 1
|
||||
|
||||
CONFIG_SCHED_WORKQUEUE=y : Work queue support is needed
|
||||
CONFIG_SCHED_HPWORK=y : High Priority Work queue support
|
||||
CONFIG_SCHED_LPWORK=y : Low Priority Work queue support
|
||||
|
||||
Using the network with NSH
|
||||
--------------------------
|
||||
The IP address is configured using DHCP, using the below mentioned configurations :
|
||||
|
||||
The IP address is configured using DHCP, using the below mentioned configurations :
|
||||
|
||||
CONFIG_NETUTILS_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NSH_DHCPC=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
|
||||
nsh> ifconfig
|
||||
eth0 HWaddr 00:e0:de:ad:be:ef at UP
|
||||
IPaddr:10.75.24.53 DRaddr:10.75.24.1 Mask:255.255.254.0
|
||||
|
||||
You can use ping to test for connectivity to the host (Careful,
|
||||
Window firewalls usually block ping-related ICMP traffic). On the
|
||||
target side, you can:
|
||||
|
||||
nsh> ping 10.75.24.250
|
||||
PING 10.75.24.250 56 bytes of data
|
||||
56 bytes from 10.75.24.250: icmp_seq=1 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=2 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=3 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=4 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=5 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=6 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=7 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=8 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=9 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=10 time=0 ms
|
||||
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
|
||||
|
||||
On the host side, you should also be able to ping the RX65N-GRROSE:
|
||||
|
||||
$ ping 10.75.24.53
|
||||
|
||||
Configure UDP blaster application as mentioned below :
|
||||
|
||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIP=0x0a4b1801 (10.75.24.1) ------> Gateway IP
|
||||
CONFIG_EXAMPLES_UDPBLASTER_NETMASK=0xfffffe00 (255.255.254.0) --------> Netmask
|
||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIP=0x0a4b189b (10.75.24.155) ---------> Target IP
|
||||
|
||||
RSPI
|
||||
-----------
|
||||
|
||||
For GRROSE board only channel 1 can be tested since RSPI channel1 pinout is only brought out as
|
||||
Pin number 2 and 3 in CN4 is used for MOSIB and MISOB respectively.
|
||||
|
||||
USB Host
|
||||
=============
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 1 & Pin 2
|
||||
J16 Short Pin 2 & Pin 3
|
||||
|
||||
USB Device
|
||||
=============
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 2 & Pin 3
|
||||
J16 Short Pin 1 & Pin 2
|
||||
|
||||
RTC
|
||||
==========
|
||||
|
||||
NuttX Configurations
|
||||
---------------
|
||||
The configurations listed in Renesas_RX65N_NuttX_RTC_Design.doc need to be enabled.
|
||||
|
||||
RTC Testing
|
||||
------------------
|
||||
The test cases mentioned in Renesas_RX65N_RTC_Test_Cases.xls are to be executed
|
||||
as part of RTC testing.
|
||||
|
||||
The following configurations are to be enabled as part of testing RTC examples.
|
||||
CONFIG_EXAMPLES_ALARM
|
||||
CONFIG_EXAMPLES_PERIODIC
|
||||
CONFIG_EXAMPLES_CARRY
|
||||
|
||||
USB Device Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Device
|
||||
|
||||
CONFIG_USBDEV
|
||||
CONFIG_CDCACM
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_STDIO_LINEBUFFER
|
||||
|
||||
USB Device Testing
|
||||
------------------------
|
||||
The following testing is executed as part of USB Device testing on RX65N target for GRROSE board
|
||||
|
||||
echo "This is a test for USB Device" > /dev/ttyACM0
|
||||
|
||||
xd 0 0x20000 > /dev/ttyACM0
|
||||
|
||||
The output of the commands mentioned above should be seen on the USB Device COM port on teraterm
|
||||
|
||||
RSPI Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for RSPI
|
||||
|
||||
CONFIG_SYSTEM_SPITOOL=y
|
||||
|
||||
RSPI Testing
|
||||
------------------------
|
||||
The following testing is executed as part of RSPI testing on RX65N target for GRROSE board
|
||||
|
||||
On GRROSE board only channel 1 can be tested since RSPI channel1 pinout is only brought out.
|
||||
|
||||
Following command can be used for testing RSPI communication to slave device.
|
||||
spi exch -b 0 -x 4 aabbccdd
|
||||
where b is bus number and x is Number of word to exchange.
|
||||
|
||||
RIIC Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for RIIC
|
||||
|
||||
CONFIG_SYSTEM_I2CTOOL=y
|
||||
|
||||
RIIC Testing
|
||||
------------------------
|
||||
|
||||
On GRROSE board, none of the RIIC channel pins are brought out in the board so not tested for communication.
|
||||
|
||||
DTC Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for DTC.
|
||||
|
||||
CONFIG_SYSTEM_SPITOOL=y
|
||||
|
||||
DTC Testing
|
||||
------------------------
|
||||
|
||||
DTC has been tested using RSPI driver.
|
||||
|
||||
USB Host Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Host Mode driver to
|
||||
support USB HID Keyboard class and MSC Class.
|
||||
|
||||
CONFIG_USBHOST=y
|
||||
CONFIG_USBHOST_HIDKBD=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_EXAMPLES_HIDKBD=y
|
||||
|
||||
USB Host Driver Testing
|
||||
------------------------
|
||||
The Following Class Drivers were tested as mentioned below :
|
||||
|
||||
- USB HID Keyboard Class
|
||||
On the NuttX Console "hidkbd" application was executed
|
||||
|
||||
nsh> hidkbd
|
||||
The characters typed from the keyboard were executed correctly.
|
||||
|
||||
- USB MSC Class
|
||||
|
||||
The MSC device is enumerated as sda in /dev directory.
|
||||
|
||||
The block device is mounted using the command as mentioned below :
|
||||
|
||||
mount -t vfat /dev/sda /mnt
|
||||
|
||||
The MSC device is mounted in /dev directory
|
||||
|
||||
The copy command is executed to test the Read/Write functionality
|
||||
|
||||
cp /mnt/<file.txt> /mnt/file_copy.txt
|
||||
|
||||
USB Host Hub Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Host Mode driver to
|
||||
support USB HID Keyboard class and MSC Class.
|
||||
|
||||
CONFIG_RX65N_USBHOST=y
|
||||
CONFIG_USBHOST_HUB=y
|
||||
CONFIG_USBHOST_ASYNCH=y
|
||||
CONFIG_USBHOST=y
|
||||
CONFIG_USBHOST_HIDKBD=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_EXAMPLES_HIDKBD=y
|
||||
|
||||
USB Host Hub Driver Testing
|
||||
------------------------
|
||||
The Following Class Drivers were tested as mentioned below :
|
||||
|
||||
- USB HID Keyboard Class
|
||||
On the NuttX Console "hidkbd" application was executed
|
||||
|
||||
nsh> hidkbd
|
||||
The characters typed from the keyboard were executed correctly.
|
||||
|
||||
- USB MSC Class
|
||||
The MSC device is enumerated as sda in /dev directory.
|
||||
|
||||
The block device is mounted using the command as mentioned below :
|
||||
|
||||
mount -t vfat /dev/sda /mnt
|
||||
|
||||
The MSC device is mounted in /dev directory
|
||||
|
||||
The copy command is executed to test the Read/Write functionality
|
||||
|
||||
cp /mnt/<file.txt> /mnt/file_copy.txt
|
||||
|
||||
Debugging
|
||||
==========
|
||||
|
||||
1. NuttX needs to be compiled in Cygwin.
|
||||
|
||||
The following Configuration needs to be set, in order to do source level debugging.
|
||||
|
||||
CONFIG_DEBUG_SYMBOLS = y (Set this option, using menuconfig only, DO NOT Enable this as default configuration).
|
||||
|
||||
2. Download & Install Renesas e2studio IDE.
|
||||
3. Load the project(NuttX built on Cygwin) as Makefile project with existing code
|
||||
4. Right click on the project, and select Debug Configurations.
|
||||
5. The binary(NuttX) needs to be loaded using E1/E2 Emulator.
|
||||
6. Select the Device name as R5F565NE and Emulator as E1/E2(whichever is being used)
|
||||
7. Select Connection type as FINE.
|
||||
8. Load and run the binary.
|
||||
|
||||
Flashing NuttX
|
||||
===============
|
||||
Alternatively, NuttX binary can be flashed using Renesas flash programmer tool without using e2 studio/Cygwin
|
||||
|
||||
Below are the steps mentioned to flash NuttX binary using Renesas flash programmer tool(RFP).
|
||||
|
||||
1.In order to flash using Renesas flash programmer tool, nuttx.mot file should be generated.
|
||||
2. Add the following lines in tools/Makefile.unix file :
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: nuttx.mot"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) $(BIN) -O srec -I elf32-rx-be-ns nuttx.mot
|
||||
endif
|
||||
3. Add CONFIG_MOTOROLA_SREC=y in defconfig file or choose make menucofig->Build Setup-> Binary Output Format->
|
||||
Select Motorola SREC format.
|
||||
4. Download Renesas flash programmer tool from https://www.renesas.com/in/en/products/software-tools/tools/programmer/renesas-flash-programmer-programming-gui.html#downloads
|
||||
5. Refer to the user manual document, for steps to flash NuttX binary using RFP tool.
|
||||
@@ -0,0 +1,79 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_IPv4 is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-grrose"
|
||||
CONFIG_ARCH_BOARD_RX65N_GRROSE=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFP=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_NET=y
|
||||
CONFIG_EXAMPLES_SERIALBLASTER=y
|
||||
CONFIG_EXAMPLES_SERIALRX=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRINTSTR=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRIORITY=75
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_STATISTICS=y
|
||||
CONFIG_NETINIT_IPv6NETMASK_8=0xff80
|
||||
CONFIG_NETINIT_THREAD=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ICMPv6=y
|
||||
CONFIG_NET_ICMPv6_NEIGHBOR=y
|
||||
CONFIG_NET_ICMPv6_SOCKET=y
|
||||
CONFIG_NET_IPv6=y
|
||||
CONFIG_NET_MLD=y
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_SOLINGER=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCPBACKLOG=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=655360
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_EMAC0=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=0
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x18
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x08
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x14
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x04
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x1c
|
||||
CONFIG_RX65N_EMAC0_RMII=y
|
||||
CONFIG_RX65N_SCI0=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCI1_SERIAL_CONSOLE=y
|
||||
CONFIG_SCI5_BAUD=921600
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PRIORITY=50
|
||||
CONFIG_SYSTEM_PING6=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-grrose"
|
||||
CONFIG_ARCH_BOARD_RX65N_GRROSE=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFP=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_EXAMPLES_SERIALBLASTER=y
|
||||
CONFIG_EXAMPLES_SERIALRX=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRINTSTR=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRIORITY=75
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDB_DNSSERVER_NOADDR=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_STATISTICS=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NETUTILS_TFTPC=y
|
||||
CONFIG_NETUTILS_WEBCLIENT=y
|
||||
CONFIG_NET_ARP_SEND=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCPBACKLOG=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC=y
|
||||
CONFIG_RTC_ALARM=y
|
||||
CONFIG_RTC_DRIVER=y
|
||||
CONFIG_RTC_HIRES=y
|
||||
CONFIG_RX65N_EMAC0=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=0
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x18
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x08
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x14
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x04
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x1c
|
||||
CONFIG_RX65N_EMAC0_RMII=y
|
||||
CONFIG_RX65N_SCI0=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCI1_SERIAL_CONSOLE=y
|
||||
CONFIG_SCI5_BAUD=921600
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PRIORITY=50
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-grrose"
|
||||
CONFIG_ARCH_BOARD_RX65N_GRROSE=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFP=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=655360
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_SCI0=y
|
||||
CONFIG_SCI1_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,89 @@
|
||||
README
|
||||
======
|
||||
|
||||
Overview
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS start-up script.
|
||||
This startup script is used by by the NSH when it starts provided that
|
||||
CONFIG_NSH_ARCHROMFS=y. The script provides a ROMFS volume that will be
|
||||
mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-8.2
|
||||
nsh> ls -l /etc
|
||||
/etc:
|
||||
dr-xr-xr-x 0 .
|
||||
-r--r--r-- 20 group
|
||||
dr-xr-xr-x 0 init.d/
|
||||
-r--r--r-- 35 passwd
|
||||
/etc/init.d:
|
||||
dr-xr-xr-x 0 ..
|
||||
-r--r--r-- 110 rcS
|
||||
nsh>
|
||||
|
||||
/etc/init.d/rcS is the start-up script; /etc/passwd is a the password
|
||||
file. It supports a single user:
|
||||
|
||||
USERNAME: admin
|
||||
PASSWORD: Adminstrator
|
||||
|
||||
nsh> cat /etc/passwd
|
||||
admin:8Tv+Hbmr3pLddSjtzL0kwC:0:0:/
|
||||
|
||||
The encrypted passwords in the provided passwd file are only valid if the
|
||||
TEA key is set to: 012345678 9abcdef0 012345678 9abcdef0. Changes to either
|
||||
the key or the password word will require regeneration of the nsh_romfimg.h
|
||||
header file.
|
||||
|
||||
The format of the password file is:
|
||||
|
||||
user:x:uid:gid:home
|
||||
|
||||
Where:
|
||||
user: User name
|
||||
x: Encrypted password
|
||||
uid: User ID (0 for now)
|
||||
gid: Group ID (0 for now)
|
||||
home: Login directory (/ for now)
|
||||
|
||||
/etc/group is a group file. It is not currently used.
|
||||
|
||||
nsh> cat /etc/group
|
||||
root:*:0:root,admin
|
||||
|
||||
The format of the group file is:
|
||||
|
||||
group:x:gid:users
|
||||
|
||||
Where:
|
||||
group: The group name
|
||||
x: Group password
|
||||
gid: Group ID
|
||||
users: A comma separated list of members of the group
|
||||
|
||||
/etc/init.d/rcS should have the following contents :
|
||||
vi rcS
|
||||
echo "This is NuttX"
|
||||
|
||||
Updating the ROMFS File System
|
||||
------------------------------
|
||||
The content on the nsh_romfsimg.h header file is generated from a sample
|
||||
directory structure. That directory structure is contained in the etc/ directory and can be modified per the following steps:
|
||||
|
||||
|
||||
1. Change directory to etc/:
|
||||
|
||||
cd etc/
|
||||
|
||||
2. Make modifications as desired.
|
||||
|
||||
3. Create the new ROMFS image.
|
||||
|
||||
genromfs -f romfs_img -d etc -V SimEtcVol
|
||||
|
||||
4. Convert the ROMFS image to a C header file
|
||||
|
||||
xxd -i romfs_img >nsh_romfsimg.h
|
||||
|
||||
5. Edit nsh_romfsimg.h, mark both data definitions as 'const' so that
|
||||
that will be stored in FLASH.
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define RX_CLK_1MHz (1000UL * 1000UL)
|
||||
#define RX_FCLK ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_ICLK (120.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKA (120.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKB ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKC ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKD ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_BCK (120.0 * RX_CLK_1MHz)
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define RX_RESONATOR ( 12 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#else
|
||||
#error "Please definition RX_RESONATOR in board.h"
|
||||
#endif
|
||||
|
||||
/* LED definitions */
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
# define LED_ON (0)
|
||||
# define LED_OFF (1)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
# define LED_ON (1)
|
||||
# define LED_OFF (0)
|
||||
#else
|
||||
# error "No Selection for PORT definition in rx65n_port.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define LED0 (PORT7.PODR.BIT.B3)
|
||||
#define LED1 (PORTG.PODR.BIT.B7)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT7.ODR0.BIT.B6 = PORTG.ODR1.BIT.B6 = 0; \
|
||||
PORT7.DSCR.BIT.B3 = PORTG.DSCR.BIT.B7 = 1; \
|
||||
PORT7.DSCR2.BIT.B3 = PORTG.DSCR2.BIT.B7 = 0; \
|
||||
PORT7.PMR.BIT.B3 = PORTG.PMR.BIT.B7 = 0; \
|
||||
PORT7.PDR.BIT.B3 = PORTG.PDR.BIT.B7 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define LED0 (PORTA.PODR.BIT.BT0)
|
||||
#define LED1 (PORTA.PODR.BIT.B1)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORTA.ODR0.BIT.BT0 = PORTA.ODR0.BIT.B2 = 0; \
|
||||
PORTA.DSCR.BIT.BT0 = PORTA.DSCR.BIT.B1 = 1; \
|
||||
PORTA.DSCR2.BIT.BT0 = PORTA.DSCR2.BIT.B1 = 0; \
|
||||
PORTA.PMR.BIT.BT0 = PORTA.PMR.BIT.B1 = 0; \
|
||||
PORTA.PDR.BIT.BT0 = PORTA.PDR.BIT.B1 = 1; \
|
||||
}
|
||||
#else
|
||||
#error "LEDs are not defined."
|
||||
#endif
|
||||
|
||||
#define LED_STARTED 1 /* ON OFF NC NC */
|
||||
#define LED_HEAPALLOCATE 0 /* NC NC NC NC */
|
||||
#define LED_IRQSENABLED 0 /* NC NC NC NC */
|
||||
#define LED_STACKCREATED 2 /* ON ON NC NC */
|
||||
#define LED_INIRQ 0 /* NC NC NC NC */
|
||||
#define LED_SIGNAL 0 /* NC NC NC NC */
|
||||
#define LED_ASSERTION 0 /* NC NC NC NC */
|
||||
#define LED_PANIC 3 /* OFF ON NC NC (flashing 2Hz) */
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,326 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/include/rx65n_gpio.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_RX65N_GPIO_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_RX65N_GPIO_H
|
||||
|
||||
#if defined(CONFIG_ARCH_RX65N_GRROSE)
|
||||
#define PHY_STS_REG 0x1f
|
||||
#define PHY_STS_REG_AUTO_NEG (1 << 12)
|
||||
#define PHY_STS_READ_REG PHY_REG_STATUS
|
||||
#define PHY_STS_BIT_MASK (0x4)
|
||||
#define PHY_STS_SHIFT_COUNT (0x02)
|
||||
#else
|
||||
#define PHY_STS_REG 0x10
|
||||
#define PHY_STS_REG_LINK (1 << 0)
|
||||
#define PHY_STS_READ_REG PHY_STS_REG
|
||||
#define PHY_STS_BIT_MASK (0x1)
|
||||
#define PHY_STS_SHIFT_COUNT (0x0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_RX65N_GRROSE)
|
||||
#define PHY_SET_MODE_REG PHY_RMII_SET_MODE
|
||||
#else
|
||||
#define PHY_SET_MODE_REG PHY_MII_SET_MODE
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define RX65N_MAC_ADDRL 0x00509074
|
||||
#define RX65N_MAC_ADDRH 0x0000989c
|
||||
#else
|
||||
#define RX65N_MAC_ADDRL 0x00000000
|
||||
#define RX65N_MAC_ADDRH 0x00000000
|
||||
#endif
|
||||
|
||||
/* RSPI channel number */
|
||||
|
||||
#define RX65N_RSPI_CHANNEL0 0
|
||||
#define RX65N_RSPI_CHANNEL1 1
|
||||
#define RX65N_RSPI_CHANNEL2 2
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes SCI Ports of RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes LED Ports of RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void led_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Peripheral enabling
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB device port settings
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci0_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI0 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI0
|
||||
void sci0_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci1_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI1 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI1
|
||||
void sci1_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
void sci2_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci3_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI3 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI3
|
||||
void sci3_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci5_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI5 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI5
|
||||
void sci5_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci6_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI6 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI6
|
||||
void sci6_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci8_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI8 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI8
|
||||
void sci8_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rspi_pinconfig
|
||||
*
|
||||
* Description: RSPI pinconfiguration for channel
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple SPI interfaces)
|
||||
*
|
||||
* Description:
|
||||
*RSPI pin(SCK,MOSI and MISO) configuration
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
void rspi_pinconfig(int bus);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic0_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC0 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
void riic0_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic1_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC1 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
void riic1_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic2_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC2 Initialization RX65N GRROSE
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
void riic2_init_port(void);
|
||||
#endif
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_GRROSE_INCLUDE_RX65N_GPIO_H */
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
##############################################################################
|
||||
# boards/renesas/rx65n/rx65n-grrose/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld}"
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld
|
||||
endif
|
||||
|
||||
CROSSDEV = rx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E -P -x c
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
AS = $(CROSSDEV)as
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHCFLAGS = -std=c99 -fno-builtin
|
||||
ARCHCPUFLAGS = -mcpu=rx64m
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(ARCHWARNINGSXX)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
ASMEXT = .asm
|
||||
@@ -0,0 +1,176 @@
|
||||
MEMORY
|
||||
{
|
||||
/* RSK-RX65N-1MB */
|
||||
/*
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
ROM : ORIGIN = 0xFFF00000, LENGTH = 1048576
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
*/
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
RAMHI : ORIGIN = 0x800000, LENGTH = 393216
|
||||
ROM : ORIGIN = 0xFFE00000, LENGTH = 2097152
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.exvectors 0xFFFFFF80: AT(0xFFFFFF80)
|
||||
{
|
||||
_exvectors_start = .;
|
||||
KEEP(*(.exvectors))
|
||||
_exvectors_end = .;
|
||||
} > ROM
|
||||
.fvectors 0xFFFFFFFC: AT(0xFFFFFFFC)
|
||||
{
|
||||
KEEP(*(.fvectors))
|
||||
} > ROM
|
||||
/* RSK-RX65N-1MB */
|
||||
|
||||
/* .text 0xFFF00000: AT(0xFFF00000) */
|
||||
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
.text 0xFFE00000: AT(0xFFE00000)
|
||||
{
|
||||
*(.text)
|
||||
. = ALIGN(4);
|
||||
*(.text.*)
|
||||
. = ALIGN(4);
|
||||
*(P)
|
||||
etext = .;
|
||||
} > ROM
|
||||
.rvectors :
|
||||
{
|
||||
_rvectors_start = .;
|
||||
KEEP(*(.rvectors))
|
||||
_rvectors_end = .;
|
||||
} > ROM
|
||||
/*.exvectors :
|
||||
{
|
||||
_exvectors_start = .;
|
||||
KEEP(*(.exvectors))
|
||||
_exvectors_end = .;
|
||||
} > ROM */
|
||||
.init :
|
||||
{
|
||||
KEEP(*(.init))
|
||||
__preinit_array_start = .;
|
||||
KEEP(*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
__init_array_start = (. + 3) & ~ 3;
|
||||
KEEP(*(.init_array))
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
__init_array_end = .;
|
||||
__fini_array_start = .;
|
||||
KEEP(*(.fini_array))
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} > ROM
|
||||
.fini :
|
||||
{
|
||||
KEEP(*(.fini))
|
||||
} > ROM
|
||||
.got :
|
||||
{
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
} > ROM
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(C_1)
|
||||
*(C_2)
|
||||
*(C)
|
||||
_erodata = .;
|
||||
} > ROM
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
} > ROM
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
} > ROM
|
||||
.jcr :
|
||||
{
|
||||
*(.jcr)
|
||||
} > ROM
|
||||
.tors :
|
||||
{
|
||||
__CTOR_LIST__ = .;
|
||||
. = ALIGN(2);
|
||||
___ctors = .;
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
___dtors = .;
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
__DTOR_END__ = .;
|
||||
. = ALIGN(2);
|
||||
_mdata = .;
|
||||
} > ROM
|
||||
.ustack 0x400: AT(0x200)
|
||||
{
|
||||
_ustack = .;
|
||||
} > RAM
|
||||
.istack 0x200: AT(0x200)
|
||||
{
|
||||
_istack = .;
|
||||
} > RAM
|
||||
.data 0x404: AT(_mdata)
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(D)
|
||||
*(D_1)
|
||||
*(D_2)
|
||||
_edata = .;
|
||||
} > RAM
|
||||
.gcc_exc :
|
||||
{
|
||||
*(.gcc_exc)
|
||||
} > RAM
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.**)
|
||||
*(COMMON)
|
||||
*(B)
|
||||
*(B_1)
|
||||
*(B_2)
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
} >RAM
|
||||
.ofs1 0xFE7F5D40: AT(0xFE7F5D00)
|
||||
{
|
||||
KEEP(*(.ofs1))
|
||||
} > OFS
|
||||
.ofs2 0xFE7F5D48: AT(0xFE7F5D10)
|
||||
{
|
||||
KEEP(*(.ofs2))
|
||||
} > OFS
|
||||
.ofs3 0xFE7F5D50: AT(0xFE7F5D40)
|
||||
{
|
||||
KEEP(*(.ofs3))
|
||||
} > OFS
|
||||
.ofs4 0xFE7F5D10: AT(0xFE7F5D48)
|
||||
{
|
||||
KEEP(*(.ofs4))
|
||||
} > OFS
|
||||
.ofs5 0xFE7F5D10: AT(0xFE7F5D50)
|
||||
{
|
||||
KEEP(*(.ofs5))
|
||||
} > OFS
|
||||
.ofs6 0xFE7F5D10: AT(0xFE7F5D64)
|
||||
{
|
||||
KEEP(*(.ofs6))
|
||||
} > OFS
|
||||
.ofs7 0xFE7F5D10: AT(0xFE7F5D70)
|
||||
{
|
||||
KEEP(*(.ofs7))
|
||||
} > OFS
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
############################################################################
|
||||
# boards/renesas/rx65n/rx65n-grrose/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rx65n_appinit.c rx65n_bringup.c rx65n_sbram.c rx65n_gpio.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/src/rx65n_appinit.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include "rx65n_grrose.h"
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, &&
|
||||
* CONFIG_LIB_BOARDCTL=n :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value could be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
/* Did we already initialize via board_late_initialize()? */
|
||||
|
||||
#ifndef CONFIG_BOARD_LATE_INITIALIZE
|
||||
return rx65n_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
@@ -0,0 +1,540 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/src/rx65n_bringup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kthread.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
||||
#include "rx65n_usbhost.h"
|
||||
#include "rx65n_grrose.h"
|
||||
#include <rx65n_definitions.h>
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
# include <nuttx/timers/rtc.h>
|
||||
# include "rx65n_rtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# include <nuttx/usb/cdcacm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DTC_DRIVER
|
||||
# include "rx65n_dtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RSPI_DRIVER
|
||||
# include <nuttx/spi/spi_transfer.h>
|
||||
# include "rx65n_rspi.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
# include <nuttx/i2c/i2c_master.h>
|
||||
# include "rx65n_riic.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define NSH_HAVE_USBHOST 1
|
||||
|
||||
/* USB Host */
|
||||
|
||||
#ifndef CONFIG_USBHOST
|
||||
# undef NSH_HAVE_USBHOST
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
# ifndef CONFIG_USBHOST_DEFPRIO
|
||||
# define CONFIG_USBHOST_DEFPRIO 100
|
||||
# endif
|
||||
# ifndef CONFIG_USBHOST_STACKSIZE
|
||||
# ifdef CONFIG_USBHOST_HUB
|
||||
# define CONFIG_USBHOST_STACKSIZE 1536
|
||||
# else
|
||||
# define CONFIG_USBHOST_STACKSIZE 1024
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_waiter
|
||||
*
|
||||
* Description:
|
||||
* Wait for USB devices to be connected.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_waiter(int argc, char *argv[])
|
||||
{
|
||||
struct usbhost_hubport_s *hport;
|
||||
|
||||
syslog(LOG_INFO, "nsh_waiter: Running\n");
|
||||
for (; ; )
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
|
||||
syslog(LOG_INFO, "nsh_waiter: %s\n",
|
||||
hport->connected ? "Host:connected" : "Host:disconnected");
|
||||
|
||||
/* Did we just become connected? */
|
||||
|
||||
if (hport->connected && hport->port == 0)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
(void)CONN_ENUMERATE(g_usbconn, hport);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the compiler from complaining */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_usbhostinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SPI-based microSD.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_usbhostinitialize(void)
|
||||
{
|
||||
int pid;
|
||||
int ret;
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about:
|
||||
*/
|
||||
|
||||
syslog(LOG_INFO, "Register class drivers\n");
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
/* Initialize USB hub class support */
|
||||
|
||||
ret = usbhost_hub_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
/* Register the USB host Mass Storage Class */
|
||||
|
||||
ret = usbhost_msc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDCACM
|
||||
/* Register the CDC/ACM serial class */
|
||||
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the KBD class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDKBD
|
||||
/* Register the HID KBD class */
|
||||
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
g_usbconn = rx65n_usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
syslog(LOG_INFO, "Start nsh_waiter\n");
|
||||
|
||||
pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
|
||||
CONFIG_USBHOST_STACKSIZE,
|
||||
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
||||
syslog(LOG_INFO, "USBHost: Created pid = %d\n", pid);
|
||||
return pid < 0 ? -ENOEXEC : OK;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
#else
|
||||
# define nsh_usbhostinitialize() (OK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_rspi_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the RSPI driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
static void rx65n_rspi_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
struct spi_dev_s *rspi0;
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
struct spi_dev_s *rspi1;
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
struct spi_dev_s *rspi2;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
rspi0 = rx65n_rspibus_initialize(0);
|
||||
if (!rspi0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 0\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 0\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
rspi1 = rx65n_rspibus_initialize(1);
|
||||
if (!rspi1)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 1\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi1, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 1\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
rspi2 = rx65n_rspibus_initialize(2);
|
||||
if (!rspi2)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 2\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi2, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 2\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtc_driver_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the RTC driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
static int rtc_driver_initialize(void)
|
||||
{
|
||||
FAR struct rtc_lowerhalf_s *lower;
|
||||
int ret;
|
||||
|
||||
/* Instantiate the rx65n lower-half RTC driver */
|
||||
|
||||
lower = rx65n_rtc_lowerhalf();
|
||||
if (lower == NULL)
|
||||
{
|
||||
serr("ERROR: Failed to instantiate the RTC lower-half driver\n");
|
||||
ret = -ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bind the lower half driver and register the combined RTC driver
|
||||
* as /dev/rtc0
|
||||
*/
|
||||
|
||||
ret = rtc_initialize(0, lower);
|
||||
if (ret < 0)
|
||||
{
|
||||
serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Name: rx65n_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_bringup(void)
|
||||
{
|
||||
#if defined (HAVE_RTC_DRIVER) || defined (CONFIG_FS_PROCFS)
|
||||
int ret;
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
ret = rtc_driver_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: rtc_driver_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d\n", ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
/* Initialize battery-backed RAM */
|
||||
|
||||
(void)rx65n_sbram_int();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DTC_DRIVER
|
||||
/* Initialize DTC */
|
||||
|
||||
(void)rx65n_dtc_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USBHOST)
|
||||
ret = nsh_usbhostinitialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
(void)rx65n_rspi_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CDCACM) && !defined(CONFIG_CDCACM_CONSOLE)
|
||||
/* Initialize CDCACM */
|
||||
|
||||
syslog(LOG_INFO, "Initialize CDCACM device\n");
|
||||
|
||||
ret = cdcacm_initialize(0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: cdcacm_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_CDCACM & !CONFIG_CDCACM_CONSOLE */
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
FAR struct i2c_master_s *i2c;
|
||||
|
||||
/* Get the I2C lower half instance */
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
i2cerr("Port is initialized for RIIC0. SCI2 cannot be used\n");
|
||||
#endif
|
||||
riic0_init_port();
|
||||
i2c = rx65n_i2cbus_initialize(0);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
i2cerr("ERROR: Initialization of RIIC Channel 0 failed: %d\n", ret);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Register the I2C character driver */
|
||||
|
||||
ret = i2c_register(i2c, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
i2cerr("ERROR: Failed to register RIIC device: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
i2cerr("RIIC1 setting is not supported on GR-ROSE Board\n");
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
i2cerr("RIIC2 setting is not supported on GR-ROSE Board\n");
|
||||
i2cerr("It is used for USB port and cannot be configured\n");
|
||||
#endif
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
#if defined (CONFIG_ARCH_HAVE_LEDS) && (CONFIG_ARCH_LEDS)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_on(int led)
|
||||
{
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_off(int led)
|
||||
{
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,544 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/src/rx65n_gpio.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "rx65n_macrodriver.h"
|
||||
#include "rx65n_port.h"
|
||||
#include "arch/board/board.h"
|
||||
#include "arch/board/rx65n_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* LED Port Initialization for RX65N GRROSE Board
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
void led_port_create(void)
|
||||
{
|
||||
/* LED Port initialization of RX65N GRROSE */
|
||||
|
||||
LED_PORTINIT(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* SCI Port Initialization for RX65N GRROSE Board
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void)
|
||||
{
|
||||
/* SCI Port initialization for RX65N-GRROSE */
|
||||
|
||||
/* SCI0(UART) direction */
|
||||
|
||||
PORT2.PODR.BIT.B2 = 0; PORT2.PMR.BIT.B2 = 0; PORT2.PDR.BIT.B2 = 1;
|
||||
|
||||
/* SCI2(UART) direction */
|
||||
|
||||
PORT1.PODR.BIT.B4 = 0; PORT1.PMR.BIT.B4 = 0; PORT1.PDR.BIT.B4 = 1;
|
||||
|
||||
/* SCI5(UART) direction */
|
||||
|
||||
PORTC.PODR.BIT.B4 = 0; PORTC.PMR.BIT.B4 = 0; PORTC.PDR.BIT.B4 = 1;
|
||||
|
||||
/* SCI6(UART) direction */
|
||||
|
||||
PORT3.PODR.BIT.B4 = 0; PORT3.PMR.BIT.B4 = 0; PORT3.PDR.BIT.B4 = 1;
|
||||
|
||||
/* SCI8(RS485) direction */
|
||||
|
||||
PORTC.PODR.BIT.B5 = 0; PORTC.PMR.BIT.B5 = 0; PORTC.PDR.BIT.B5 = 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Pheriperal enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void)
|
||||
{
|
||||
/* Set ET0_MDC(PA4_ET_MDC) pin */
|
||||
|
||||
MPC.PA4PFS.BYTE = 0x11u;
|
||||
PORTA.PMR.BIT.B4 = 1u;
|
||||
|
||||
/* Set ET0_MDIO(PA3_ET_MDIO) pin */
|
||||
|
||||
MPC.PA3PFS.BYTE = 0x11u;
|
||||
PORTA.PMR.BIT.B3 = 1u;
|
||||
|
||||
/* Set REF50CK0 (PB2_ET_CLK) pin */
|
||||
|
||||
MPC.PB2PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set RMII0_CRS_DV(PB7_ET_CRS) pin */
|
||||
|
||||
MPC.PB7PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B7 = 1u;
|
||||
|
||||
/* Set RMII0_RXD0(PB1_ET_RXD0) pin */
|
||||
|
||||
MPC.PB1PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set RMII0_RXD1(PB0_ET_RXD1) pin */
|
||||
|
||||
MPC.PB0PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.BT0 = 1u;
|
||||
|
||||
/* Set RMII0_RX_ER(PB3_ET_RXER) pin */
|
||||
|
||||
MPC.PB3PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B3 = 1u;
|
||||
|
||||
/* Set RMII0_ETXD0(PB5_ET_TXD0) pin */
|
||||
|
||||
MPC.PB5PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B5 = 1u;
|
||||
|
||||
/* Set RMII0_ETXD1(PB6_ET_TXD1) pin */
|
||||
|
||||
MPC.PB6PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set RMII0_TXD_EN(PB4_ET_TXEN) pin */
|
||||
|
||||
MPC.PB4PFS.BYTE = 0x12u;
|
||||
PORTB.PMR.BIT.B4 = 1u;
|
||||
|
||||
/* Set RXD2 pin */
|
||||
|
||||
MPC.P52PFS.BYTE = 0x0au;
|
||||
PORT5.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD2 pin */
|
||||
|
||||
PORT5.PODR.BYTE |= 0x01u;
|
||||
MPC.P50PFS.BYTE = 0x0au;
|
||||
PORT5.PDR.BYTE |= 0x01u;
|
||||
|
||||
/* Set ET0_LINKSTA(PA5_ET_LINK) pin */
|
||||
|
||||
MPC.PA5PFS.BYTE = 0x11u;
|
||||
PORTA.PMR.BIT.B5 = 1u;
|
||||
|
||||
/* Set ETHER reset(PA6_ET_RST) pin */
|
||||
|
||||
MPC.PA6PFS.BYTE = 0x12u;
|
||||
PORTA.PMR.BIT.B6 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Device enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void)
|
||||
{
|
||||
/* Set USB0_VBUS pin */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x11;
|
||||
PORT1.PMR.BIT.B6 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usb_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Enabling for RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_USBHOST)
|
||||
void r_usb_port_enable(void)
|
||||
{
|
||||
/* Set VBUS pin for USB */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x11u;
|
||||
|
||||
/* PORT1.PMR.BYTE |= 0x40; */
|
||||
|
||||
PORT1.PMR.BIT.B6 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci0_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI0 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI0
|
||||
inline void sci0_init_port(void)
|
||||
{
|
||||
/* Set RXD0 pin (P21) */
|
||||
|
||||
MPC.P21PFS.BYTE = 0x0au;
|
||||
PORT2.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set TXD0 pin (P20) */
|
||||
|
||||
PORT2.PODR.BIT.BT0 = 1u;
|
||||
MPC.P20PFS.BYTE = 0x0au;
|
||||
PORT2.PDR.BIT.BT0 = 1u;
|
||||
PORT2.PMR.BIT.BT0 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci1_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI1 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI1
|
||||
inline void sci1_init_port(void)
|
||||
{
|
||||
/* Set RXD1 pin (P30) */
|
||||
|
||||
MPC.P30PFS.BYTE = 0x0au;
|
||||
PORT3.PMR.BIT.BT0 = 1u;
|
||||
|
||||
/* Set TXD1 pin (P26) */
|
||||
|
||||
PORT2.PODR.BIT.B6 = 1u;
|
||||
MPC.P26PFS.BYTE = 0x0au;
|
||||
PORT2.PDR.BIT.B6 = 1u;
|
||||
PORT2.PMR.BIT.B6 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
inline void sci2_init_port(void)
|
||||
{
|
||||
/* Set RXD2 pin (P12) */
|
||||
|
||||
MPC.P12PFS.BYTE = 0x0au;
|
||||
PORT1.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD2 pin (P13) */
|
||||
|
||||
PORT1.PODR.BIT.B3 = 1u;
|
||||
MPC.P13PFS.BYTE = 0x0au;
|
||||
PORT1.PDR.BIT.B3 = 1u;
|
||||
PORT1.PMR.BIT.B3 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci3_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI3 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI3
|
||||
inline void sci3_init_port(void)
|
||||
{
|
||||
/* Set RXD3 pin (PXX)
|
||||
* MPC.PXXPFS.BYTE = 0x0au;
|
||||
* PORTX.PMR.BIT.BX = 1u;
|
||||
* Set TXD3 pin (PXX)
|
||||
* PORTX.PODR.BIT.BX = 1u;
|
||||
* MPC.PXXPFS.BYTE = 0x0au;
|
||||
* PORTX.PDR.BIT.BX = 1u;
|
||||
* PORTX.PMR.BIT.BX = 1u;
|
||||
*/
|
||||
|
||||
/* Set RXD2 pin (P25) */
|
||||
|
||||
MPC.P25PFS.BYTE = 0x0au;
|
||||
PORT2.PMR.BIT.B5 = 1u;
|
||||
|
||||
/* Set TXD2 pin (P23) */
|
||||
|
||||
PORT2.PODR.BIT.B3 = 1u;
|
||||
MPC.P23PFS.BYTE = 0x0au;
|
||||
PORT2.PDR.BIT.B3 = 1u;
|
||||
PORT2.PMR.BIT.B3 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci5_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI5 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI5
|
||||
inline void sci5_init_port(void)
|
||||
{
|
||||
/* Set RXD3 pin (PC2) */
|
||||
|
||||
MPC.PC2PFS.BYTE = 0x0au;
|
||||
PORTC.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD3 pin (PC3) */
|
||||
|
||||
PORTC.PODR.BIT.B3 = 1u;
|
||||
MPC.PC3PFS.BYTE = 0x0au;
|
||||
PORTC.PDR.BIT.B3 = 1u;
|
||||
PORTC.PMR.BIT.B3 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci6_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI6 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI6
|
||||
inline void sci6_init_port(void)
|
||||
{
|
||||
/* Set RXD6 pin (P33) */
|
||||
|
||||
MPC.P33PFS.BYTE = 0x0au;
|
||||
PORT3.PMR.BIT.B3 = 1u;
|
||||
|
||||
/* Set TXD6 pin (P32) */
|
||||
|
||||
PORT3.PODR.BIT.B2 = 1u;
|
||||
MPC.P32PFS.BYTE = 0x0au;
|
||||
PORT3.PDR.BIT.B2 = 1u;
|
||||
PORT3.PMR.BIT.B2 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci8_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI8 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI8
|
||||
inline void sci8_init_port(void)
|
||||
{
|
||||
/* Set RXD8 pin (PC6) */
|
||||
|
||||
MPC.PC6PFS.BYTE = 0x0au;
|
||||
PORTC.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set TXD8 pin (PC7) */
|
||||
|
||||
PORTC.PODR.BIT.B7 = 1u;
|
||||
MPC.PC7PFS.BYTE = 0x0au;
|
||||
PORTC.PDR.BIT.B7 = 1u;
|
||||
PORTC.PMR.BIT.B7 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rspi_pinconfig
|
||||
*
|
||||
* Description: RSPI pinconfiguration for channel
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple SPI interfaces)
|
||||
*
|
||||
* Description:
|
||||
*RSPI pin(SCK,MOSI and MISO) configuration
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
void rspi_pinconfig(int bus)
|
||||
{
|
||||
/* Set RSPI signal ports to peripheral mode */
|
||||
|
||||
switch (bus)
|
||||
{
|
||||
case RX65N_RSPI_CHANNEL0:
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
|
||||
/* Configure RSPCKA */
|
||||
|
||||
MPC.PC5PFS.BYTE = 0x0d;
|
||||
PORTC.PMR.BIT.B5 = 1;
|
||||
|
||||
/* Configure MOSIA */
|
||||
|
||||
MPC.PC6PFS.BYTE = 0x0d; /* This config will block SCI8 function */
|
||||
PORTC.PMR.BIT.B6 = 1;
|
||||
|
||||
/* Configure MISOA */
|
||||
|
||||
MPC.PC7PFS.BYTE = 0x0d; /* This config will block SCI8 function */
|
||||
PORTC.PMR.BIT.B7 = 1;
|
||||
|
||||
/* Configure SSLA0 */
|
||||
|
||||
MPC.PC4PFS.BYTE = 0x0d;
|
||||
PORTC.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RX65N_RSPI_CHANNEL1:
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
|
||||
/* Configure RSPCKB */
|
||||
|
||||
MPC.PE5PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B5 = 1;
|
||||
|
||||
/* Configure MOSIB */
|
||||
|
||||
MPC.PE6PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B6 = 1;
|
||||
|
||||
/* Configure MISOB */
|
||||
|
||||
MPC.PE7PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B7 = 1;
|
||||
|
||||
/* Configure SSLB0 */
|
||||
|
||||
MPC.PE4PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RX65N_RSPI_CHANNEL2:
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
|
||||
/* Configure RSPCKC */
|
||||
|
||||
MPC.PD3PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B3 = 1;
|
||||
|
||||
/* Configure MOSIC */
|
||||
|
||||
MPC.PD1PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B1 = 1;
|
||||
|
||||
/* Configure MISOC */
|
||||
|
||||
MPC.PD2PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B2 = 1;
|
||||
|
||||
/* Configure SSLC0 */
|
||||
|
||||
MPC.PD4PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic0_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC0 Initialization RX65N GRROSE
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
inline void riic0_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P12) */
|
||||
|
||||
MPC.P12PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P13) */
|
||||
|
||||
MPC.P13PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B3 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic1_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC1 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
inline void riic1_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P21) */
|
||||
|
||||
MPC.P21PFS.BYTE = 0x0fu;
|
||||
PORT2.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P20) */
|
||||
|
||||
MPC.P20PFS.BYTE = 0x0fu;
|
||||
PORT2.PMR.BIT.BT0 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic2_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC2 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
inline void riic2_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P16) */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P17) */
|
||||
|
||||
MPC.P17PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B7 = 1u;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BOARD_RX65N_GRROSE */
|
||||
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/src/rx65n_grrose.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H
|
||||
#define __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_sbsram_int
|
||||
*
|
||||
* Description:
|
||||
* Initialize SBRAM Driver
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
int rx65n_sbram_int(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H */
|
||||
@@ -0,0 +1,482 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include "up_internal.h"
|
||||
#include "rx65n_sbram.h"
|
||||
#include "rx65n_grrose.h"
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define FREEZE_STR(s) #s
|
||||
#define STRINGIFY(s) FREEZE_STR(s)
|
||||
#define HARDFAULT_FILENO 3
|
||||
#define HARDFAULT_PATH SBRAM_PATH""STRINGIFY(HARDFAULT_FILENO)
|
||||
#define HARDFAULT_REBOOT_ FILENO 0
|
||||
#define HARDFAULT_REBOOT_PATH SBRAM_PATH""STRINGIFY(HARDFAULT_REBOOT_FILENO)
|
||||
|
||||
#define SBRAM_SIZE_FN0 (sizeof(int))
|
||||
#define SBRAM_SIZE_FN1 384
|
||||
#define SBRAM_SIZE_FN2 384
|
||||
#define SBRAM_SIZE_FN3 - 1
|
||||
|
||||
/* The following guides in the amount of the user and interrupt stack
|
||||
* data we can save. The amount of storage left will dictate the actual
|
||||
* number of entries of the user stack data saved. If it is too big
|
||||
* It will be truncated by the call to rx65n_sbram_savepanic
|
||||
*/
|
||||
|
||||
#define SBRAM_HEADER_SIZE 20 /* This is an assumption */
|
||||
#define SBRAM_USED ((4*SBRAM_HEADER_SIZE)+ \
|
||||
(SBRAM_SIZE_FN0+SBRAM_SIZE_FN1+ \
|
||||
SBRAM_SIZE_FN2))
|
||||
#define SBRAM_REAMINING (RX65N_SBRAM_SIZE-SBRAM_USED)
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK <= 3
|
||||
# define SBRAM_NUMBER_STACKS 1
|
||||
#else
|
||||
# define SBRAM_NUMBER_STACKS 2
|
||||
#endif
|
||||
#define SBRAM_FIXED_ELEMENTS_SIZE (sizeof(info_t))
|
||||
#define SBRAM_LEFTOVER (SBRAM_REAMINING-\
|
||||
SBRAM_FIXED_ELEMENTS_SIZE)
|
||||
|
||||
#define CONFIG_ISTACK_SIZE (SBRAM_LEFTOVER/SBRAM_NUMBER_STACKS/ \
|
||||
sizeof(stack_word_t))
|
||||
#define CONFIG_USTACK_SIZE (SBRAM_LEFTOVER/SBRAM_NUMBER_STACKS/ \
|
||||
sizeof(stack_word_t))
|
||||
|
||||
/* The path to the Battery Backed up SRAM */
|
||||
|
||||
#define SBRAM_PATH "/fs/sbr"
|
||||
|
||||
/* The sizes of the files to create (-1) use rest of SBRAM memory */
|
||||
|
||||
#define SBRAM_FILE_SIZES \
|
||||
{ \
|
||||
SBRAM_SIZE_FN0, \
|
||||
SBRAM_SIZE_FN1, \
|
||||
SBRAM_SIZE_FN2, \
|
||||
SBRAM_SIZE_FN3, \
|
||||
0 \
|
||||
}
|
||||
|
||||
#define ARRAYSIZE(a) (sizeof((a))/sizeof(a[0]))
|
||||
|
||||
/* For Assert keep this much of the file name */
|
||||
|
||||
#define MAX_FILE_PATH_LENGTH 40
|
||||
|
||||
#define HEADER_TIME_FMT "%Y-%m-%d-%H:%M:%S"
|
||||
#define HEADER_TIME_FMT_NUM (2+ 0+ 0+ 0+ 0+ 0)
|
||||
#define HEADER_TIME_FMT_LEN (((ARRAYSIZE(HEADER_TIME_FMT)-1) + \
|
||||
HEADER_TIME_FMT_NUM))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Used for stack frame storage */
|
||||
|
||||
typedef uint32_t stack_word_t;
|
||||
|
||||
/* Stack related data */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sp;
|
||||
uint32_t top;
|
||||
uint32_t size;
|
||||
} _stack_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_stack_t user;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
_stack_t interrupt;
|
||||
#endif
|
||||
} stack_t;
|
||||
|
||||
/* Not Used for reference only */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sp;
|
||||
uint32_t acc0lo;
|
||||
uint32_t acc0hi;
|
||||
uint32_t acc0gu;
|
||||
uint32_t acc1lo;
|
||||
uint32_t acc1hi;
|
||||
uint32_t acc1gu;
|
||||
uint32_t fpsw;
|
||||
uint32_t r1;
|
||||
uint32_t r2;
|
||||
uint32_t r3;
|
||||
uint32_t r4;
|
||||
uint32_t r5;
|
||||
uint32_t r6;
|
||||
uint32_t r7;
|
||||
uint32_t r8;
|
||||
uint32_t r9;
|
||||
uint32_t r10;
|
||||
uint32_t r11;
|
||||
uint32_t r12;
|
||||
uint32_t r13;
|
||||
uint32_t r14;
|
||||
uint32_t r15;
|
||||
uint32_t pc;
|
||||
uint32_t psw;
|
||||
} proc_regs_t;
|
||||
|
||||
/* Flags to identify what is in the dump */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REGS_PRESENT = 0x01,
|
||||
USERSTACK_PRESENT = 0x02,
|
||||
INTSTACK_PRESENT = 0x04,
|
||||
INVALID_USERSTACK_PTR = 0x20,
|
||||
INVALID_INTSTACK_PTR = 0x40,
|
||||
} fault_flags_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fault_flags_t flags; /* What is in the dump */
|
||||
uintptr_t current_regs; /* Used to validate the dump */
|
||||
int lineno; /* __LINE__ to up_assert */
|
||||
int pid; /* Process ID */
|
||||
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
|
||||
stack_t stacks; /* Stack info */
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
|
||||
* terminator) */
|
||||
#endif
|
||||
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
|
||||
* __FILE__ to up_assert */
|
||||
} info_t;
|
||||
|
||||
struct fullcontext
|
||||
{
|
||||
info_t info; /* The info */
|
||||
|
||||
/* The amount of stack data is compile time
|
||||
* sized backed on what is left after the
|
||||
* other standby ram files are defined
|
||||
* the order is such that only the
|
||||
* ustack should be truncated
|
||||
*/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
stack_word_t istack[CONFIG_USTACK_SIZE];
|
||||
#endif
|
||||
stack_word_t ustack[CONFIG_ISTACK_SIZE];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint8_t g_sdata[RX65N_SBRAM_SIZE];
|
||||
extern int istack;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hardfault_get_desc
|
||||
****************************************************************************/
|
||||
|
||||
static int hardfault_get_desc(struct sbramd_s *desc)
|
||||
{
|
||||
FAR struct file filestruct;
|
||||
int ret;
|
||||
|
||||
ret = file_open(&filestruct, HARDFAULT_PATH, O_RDONLY);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to open Fault Log file [%s] "
|
||||
"(%d)\n", HARDFAULT_PATH, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = file_ioctl(&filestruct, RX65N_SBRAM_GETDESC_IOCTL,
|
||||
(unsigned long)((uintptr_t)desc));
|
||||
(void)file_close(&filestruct);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to get Fault Log descriptor "
|
||||
"(%d)\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: copy_reverse
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
*dest++ = *src--;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_sbram_int
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_sbram_int(void)
|
||||
{
|
||||
int filesizes[CONFIG_RX65N_SBRAM_FILES + 1] = SBRAM_FILE_SIZES;
|
||||
char buf[HEADER_TIME_FMT_LEN + 1];
|
||||
struct sbramd_s desc;
|
||||
int rv;
|
||||
int state;
|
||||
struct tm tt;
|
||||
time_t time_sec;
|
||||
|
||||
/* Using Standby RAM */
|
||||
|
||||
rx65n_sbraminitialize(SBRAM_PATH, filesizes);
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
/* Panic Logging in Battery Backed Up Files */
|
||||
|
||||
/* Do we have an hard fault in SBRAM? */
|
||||
|
||||
rv = hardfault_get_desc(&desc);
|
||||
if (rv >= OK)
|
||||
{
|
||||
syslog(LOG_EMERG, "There is a hard fault logged.\n");
|
||||
state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1;
|
||||
|
||||
syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x "
|
||||
"state:%d\n", (unsigned int)desc.fileno, (unsigned int) desc.len,
|
||||
(unsigned int)desc.flags, state);
|
||||
|
||||
if (state == OK)
|
||||
{
|
||||
time_sec = desc.lastwrite.tv_sec + (desc.lastwrite.tv_nsec / 1e9);
|
||||
gmtime_r(&time_sec, &tt);
|
||||
strftime(buf, HEADER_TIME_FMT_LEN , HEADER_TIME_FMT , &tt);
|
||||
|
||||
syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf);
|
||||
}
|
||||
|
||||
rv = nx_unlink(HARDFAULT_PATH);
|
||||
if (rv < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file"
|
||||
" [%s] (%d)\n", HARDFAULT_PATH, rv);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_crashdump
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
FAR const char *filename, int lineno)
|
||||
{
|
||||
struct fullcontext *pdump ;
|
||||
pdump = (struct fullcontext *)&g_sdata;
|
||||
FAR struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
rtcb = (FAR struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset((uint8_t *)pdump, 0, sizeof(struct fullcontext));
|
||||
|
||||
/* Save Info */
|
||||
|
||||
pdump->info.lineno = lineno;
|
||||
|
||||
if (filename)
|
||||
{
|
||||
int offset = 0;
|
||||
unsigned int len = strlen((char *)filename) + 1;
|
||||
|
||||
if (len > sizeof(pdump->info.filename))
|
||||
{
|
||||
offset = len - sizeof(pdump->info.filename);
|
||||
}
|
||||
|
||||
strncpy((char *)pdump->info.filename, (char *)&filename[offset],
|
||||
sizeof(pdump->info.filename));
|
||||
}
|
||||
|
||||
/* Save the value of the pointer for current_regs as debugging info.
|
||||
* It should be NULL in case of an ASSERT and will aid in cross
|
||||
* checking the validity of system memory at the time of the
|
||||
* fault.
|
||||
*/
|
||||
|
||||
pdump->info.current_regs = (uintptr_t) g_current_regs;
|
||||
|
||||
/* Save Context */
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
strncpy(pdump->info.name, rtcb->name, CONFIG_TASK_NAME_SIZE);
|
||||
#endif
|
||||
|
||||
pdump->info.pid = rtcb->pid;
|
||||
|
||||
/* If current_regs is not NULL then we are in an interrupt context
|
||||
* and the user context is in current_regs else we are running in
|
||||
* the users context
|
||||
*/
|
||||
|
||||
if (g_current_regs)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs,
|
||||
sizeof(pdump->info.regs));
|
||||
pdump->info.stacks.user.sp = pdump->info.regs[REG_SP];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* users context */
|
||||
|
||||
pdump->info.flags |= USERSTACK_PRESENT;
|
||||
pdump->info.stacks.user.sp = currentsp;
|
||||
}
|
||||
|
||||
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
|
||||
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
pdump->info.stacks.interrupt.top = (uint32_t)&istack;
|
||||
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK);
|
||||
|
||||
/* If In interrupt Context save the interrupt stack data centered
|
||||
* about the interrupt stack pointer
|
||||
*/
|
||||
|
||||
if ((pdump->info.flags & INTSTACK_PRESENT) != 0)
|
||||
{
|
||||
stack_word_t *ps = (stack_word_t *) pdump->info.stacks.interrupt.sp;
|
||||
copy_reverse((stack_word_t *)pdump->istack,
|
||||
&ps[ARRAYSIZE(pdump->istack) / 2],
|
||||
ARRAYSIZE(pdump->istack));
|
||||
}
|
||||
|
||||
/* Is it Invalid? */
|
||||
|
||||
if (!(pdump->info.stacks.interrupt.sp <= pdump->info.stacks.interrupt.top
|
||||
&& pdump->info.stacks.interrupt.sp >
|
||||
pdump->info.stacks.interrupt.top -
|
||||
pdump->info.stacks.interrupt.size))
|
||||
{
|
||||
pdump->info.flags |= INVALID_INTSTACK_PTR;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* If In interrupt context or User save the user stack data centered
|
||||
* about the user stack pointer
|
||||
*/
|
||||
|
||||
if ((pdump->info.flags & USERSTACK_PRESENT) != 0)
|
||||
{
|
||||
stack_word_t *ps = (stack_word_t *) pdump->info.stacks.user.sp;
|
||||
copy_reverse((stack_word_t *)pdump->ustack,
|
||||
&ps[ARRAYSIZE(pdump->ustack) / 2],
|
||||
ARRAYSIZE(pdump->ustack));
|
||||
}
|
||||
|
||||
/* Is it Invalid? */
|
||||
|
||||
if (!(pdump->info.stacks.user.sp <= pdump->info.stacks.user.top &&
|
||||
pdump->info.stacks.user.sp > pdump->info.stacks.user.top -
|
||||
pdump->info.stacks.user.size))
|
||||
{
|
||||
pdump->info.flags |= INVALID_USERSTACK_PTR;
|
||||
}
|
||||
|
||||
rv = rx65n_sbram_savepanic(HARDFAULT_FILENO, (uint8_t *)pdump,
|
||||
sizeof(struct fullcontext));
|
||||
|
||||
/* Test if memory got wiped because of using _sdata */
|
||||
|
||||
if (rv == -ENXIO)
|
||||
{
|
||||
char *dead = "Memory wiped - dump not saved!";
|
||||
|
||||
while (*dead)
|
||||
{
|
||||
up_lowputc(*dead++);
|
||||
}
|
||||
}
|
||||
else if (rv == -ENOSPC)
|
||||
{
|
||||
/* hard fault again */
|
||||
|
||||
up_lowputc('!');
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
#endif /* CONFIG_RX65N_SBRAM */
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_RX65N_RSK1MB
|
||||
endif
|
||||
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-rsk1mb"
|
||||
CONFIG_ARCH_BOARD_RX65N_RSK1MB=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEDDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_ETH0_PHY_KSZ8081=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDB_DNSSERVER_NOADDR=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_STATISTICS=y
|
||||
CONFIG_NETUTILS_TFTPC=y
|
||||
CONFIG_NETUTILS_WEBCLIENT=y
|
||||
CONFIG_NET_ARP_SEND=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCPBACKLOG=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=655360
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_EMAC0=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x6
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x2
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x5
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x1
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x7
|
||||
CONFIG_RX65N_SCI2=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCI2_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-rsk1mb"
|
||||
CONFIG_ARCH_BOARD_RX65N_RSK1MB=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEDDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_SCI2=y
|
||||
CONFIG_SCI2_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,131 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk1mb/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_RSKLMB_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_RSKLMB_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking */
|
||||
|
||||
#define RX_CLK_1MHz (1000UL * 1000UL)
|
||||
#define RX_FCLK ( 60 * RX_CLK_1MHz)
|
||||
#define RX_ICLK (120 * RX_CLK_1MHz)
|
||||
#define RX_PCLKA (120 * RX_CLK_1MHz)
|
||||
#define RX_PCLKB ( 60 * RX_CLK_1MHz)
|
||||
#define RX_PCLKC ( 60 * RX_CLK_1MHz)
|
||||
#define RX_PCLKD ( 60 * RX_CLK_1MHz)
|
||||
#define RX_BCK (120 * RX_CLK_1MHz)
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define RX_RESONATOR ( 12 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#else
|
||||
#error "Please definition RX_RESONATOR in board.h"
|
||||
#endif
|
||||
|
||||
/* LED definitions */
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define LED0 (PORT7.PODR.BIT.B3)
|
||||
#define LED1 (PORTG.PODR.BIT.B7)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT7.ODR0.BIT.B6 = PORTG.ODR1.BIT.B6 = 0; \
|
||||
PORT7.DSCR.BIT.B3 = PORTG.DSCR.BIT.B7 = 1; \
|
||||
PORT7.DSCR2.BIT.B3 = PORTG.DSCR2.BIT.B7 = 0; \
|
||||
PORT7.PMR.BIT.B3 = PORTG.PMR.BIT.B7 = 0; \
|
||||
PORT7.PDR.BIT.B3 = PORTG.PDR.BIT.B7 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define LED0 (PORTA.PODR.BIT.BT0)
|
||||
#define LED1 (PORTA.PODR.BIT.B1)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORTA.ODR0.BIT.BT0 = PORTA.ODR0.BIT.B2 = 0; \
|
||||
PORTA.DSCR.BIT.BT0 = PORTA.DSCR.BIT.B1 = 1; \
|
||||
PORTA.DSCR2.BIT.BT0 = PORTA.DSCR2.BIT.B1 = 0; \
|
||||
PORTA.PMR.BIT.BT0 = PORTA.PMR.BIT.B1 = 0; \
|
||||
PORTA.PDR.BIT.BT0 = PORTA.PDR.BIT.B1 = 1; \
|
||||
}
|
||||
#else
|
||||
#error "LEDs are not defined."
|
||||
#endif
|
||||
|
||||
#define LED_STARTED 1 /* ON OFF NC NC */
|
||||
#define LED_HEAPALLOCATE 0 /* NC NC NC NC */
|
||||
#define LED_IRQSENABLED 0 /* NC NC NC NC */
|
||||
#define LED_STACKCREATED 2 /* ON ON NC NC */
|
||||
#define LED_INIRQ 0 /* NC NC NC NC */
|
||||
#define LED_SIGNAL 0 /* NC NC NC NC */
|
||||
#define LED_ASSERTION 0 /* NC NC NC NC */
|
||||
#define LED_PANIC 3 /* OFF ON NC NC (flashing 2Hz) */
|
||||
|
||||
/* Button definitions */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_RSKLMB_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk1mb/include/rx65n_gpio.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_RSK1MB_INCLUDE_RX65N_GPIO_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_RSK1MB_INCLUDE_RX65N_GPIO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes SCI Ports of RX65N RSK1MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes LED Ports of RX65N RSK1MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void led_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Peripheral enabling
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N RSK1MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
void sci2_init_port(void);
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_RSK1MB_INCLUDE_RX65N_GPIO_H */
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
##############################################################################
|
||||
# boards/renesas/rx65n/rx65n-rsk1mb/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld}"
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld
|
||||
endif
|
||||
|
||||
CROSSDEV = rx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E -P -x c
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
AS = $(CROSSDEV)as
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHCFLAGS = -std=c99 -fno-builtin
|
||||
ARCHCPUFLAGS = -mcpu=rx64m
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(ARCHWARNINGSXX)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
ASMEXT = .asm
|
||||
@@ -0,0 +1,167 @@
|
||||
MEMORY
|
||||
{
|
||||
/* RSK-RX65N-1MB */
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
ROM : ORIGIN = 0xFFF00000, LENGTH = 1048576
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
/*
|
||||
RAM : ORIGIN = 0x0, LENGTH = 655360
|
||||
ROM : ORIGIN = 0xFFE00000, LENGTH = 2097152
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
*/
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.exvectors 0xFFFFFF80: AT(0xFFFFFF80)
|
||||
{
|
||||
KEEP(*(.exvectors))
|
||||
} > ROM
|
||||
.fvectors 0xFFFFFFFC: AT(0xFFFFFFFC)
|
||||
{
|
||||
KEEP(*(.fvectors))
|
||||
} > ROM
|
||||
/* RSK-RX65N-1MB */
|
||||
.text 0xFFF00000: AT(0xFFF00000)
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
/*
|
||||
.text 0xFFE00000: AT(0xFFE00000)
|
||||
*/
|
||||
{
|
||||
*(.text)
|
||||
. = ALIGN(4);
|
||||
*(.text.*)
|
||||
. = ALIGN(4);
|
||||
*(P)
|
||||
etext = .;
|
||||
} > ROM
|
||||
.rvectors :
|
||||
{
|
||||
_rvectors_start = .;
|
||||
KEEP(*(.rvectors))
|
||||
_rvectors_end = .;
|
||||
} > ROM
|
||||
.init :
|
||||
{
|
||||
KEEP(*(.init))
|
||||
__preinit_array_start = .;
|
||||
KEEP(*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
__init_array_start = (. + 3) & ~ 3;
|
||||
KEEP(*(.init_array))
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
__init_array_end = .;
|
||||
__fini_array_start = .;
|
||||
KEEP(*(.fini_array))
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} > ROM
|
||||
.fini :
|
||||
{
|
||||
KEEP(*(.fini))
|
||||
} > ROM
|
||||
.got :
|
||||
{
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
} > ROM
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(C_1)
|
||||
*(C_2)
|
||||
*(C)
|
||||
_erodata = .;
|
||||
} > ROM
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
} > ROM
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
} > ROM
|
||||
.jcr :
|
||||
{
|
||||
*(.jcr)
|
||||
} > ROM
|
||||
.tors :
|
||||
{
|
||||
__CTOR_LIST__ = .;
|
||||
. = ALIGN(2);
|
||||
___ctors = .;
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
___dtors = .;
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
__DTOR_END__ = .;
|
||||
. = ALIGN(2);
|
||||
_mdata = .;
|
||||
} > ROM
|
||||
.ustack 0x400: AT(0x200)
|
||||
{
|
||||
_ustack = .;
|
||||
} > RAM
|
||||
.istack 0x200: AT(0x200)
|
||||
{
|
||||
_istack = .;
|
||||
} > RAM
|
||||
.data 0x404: AT(_mdata)
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(D)
|
||||
*(D_1)
|
||||
*(D_2)
|
||||
_edata = .;
|
||||
} > RAM
|
||||
.gcc_exc :
|
||||
{
|
||||
*(.gcc_exc)
|
||||
} > RAM
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.**)
|
||||
*(COMMON)
|
||||
*(B)
|
||||
*(B_1)
|
||||
*(B_2)
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
} > RAM
|
||||
.ofs1 0xFE7F5D40: AT(0xFE7F5D00)
|
||||
{
|
||||
KEEP(*(.ofs1))
|
||||
} > OFS
|
||||
.ofs2 0xFE7F5D48: AT(0xFE7F5D10)
|
||||
{
|
||||
KEEP(*(.ofs2))
|
||||
} > OFS
|
||||
.ofs3 0xFE7F5D50: AT(0xFE7F5D40)
|
||||
{
|
||||
KEEP(*(.ofs3))
|
||||
} > OFS
|
||||
.ofs4 0xFE7F5D10: AT(0xFE7F5D48)
|
||||
{
|
||||
KEEP(*(.ofs4))
|
||||
} > OFS
|
||||
.ofs5 0xFE7F5D10: AT(0xFE7F5D50)
|
||||
{
|
||||
KEEP(*(.ofs5))
|
||||
} > OFS
|
||||
.ofs6 0xFE7F5D10: AT(0xFE7F5D64)
|
||||
{
|
||||
KEEP(*(.ofs6))
|
||||
} > OFS
|
||||
.ofs7 0xFE7F5D10: AT(0xFE7F5D70)
|
||||
{
|
||||
KEEP(*(.ofs7))
|
||||
} > OFS
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
############################################################################
|
||||
# boards/renesas/rx65n/rx65n-rsk1mb/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rx65n_main.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk1mb/src/rx65n_gpio.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "rx65n_macrodriver.h"
|
||||
#include "rx65n_port.h"
|
||||
#include "arch/board/board.h"
|
||||
#include "arch/board/rx65n_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* Port Initialization for RX65N RSK1MB Board
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB)
|
||||
void led_port_create(void)
|
||||
{
|
||||
/* LED Port initialization of RX65N RSK1MB */
|
||||
|
||||
/* LED_PORTINIT(0); */
|
||||
|
||||
PORT0.PODR.BYTE = _04_PM2_OUTPUT_1 | _08_PM3_OUTPUT_1 | _20_PM5_OUTPUT_1;
|
||||
PORT0.DSCR.BYTE = _00_PM2_HIDRV_OFF;
|
||||
PORT0.DSCR2.BYTE = _00_PM2_HISPEED_OFF;
|
||||
PORT0.PMR.BYTE = 0x00u;
|
||||
PORT0.PDR.BYTE = _04_PM2_MODE_OUTPUT | _08_PM3_MODE_OUTPUT |
|
||||
_20_PM5_MODE_OUTPUT | _50_PDR0_DEFAULT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* SCI Port Initialization for RX65N RSK2MB Board
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void)
|
||||
{
|
||||
/* SCI Port initialization for RX65N-RSK1MB */
|
||||
|
||||
PORT5.PODR.BYTE = _40_PM6_OUTPUT_1;
|
||||
PORT5.DSCR.BYTE = _20_PM5_HIDRV_ON | _00_PM6_HIDRV_OFF;
|
||||
PORT5.DSCR2.BYTE = _00_PM5_HISPEED_OFF | _00_PM6_HISPEED_OFF;
|
||||
PORT5.PMR.BYTE = 0x00u;
|
||||
PORT5.PDR.BYTE = _20_PM5_MODE_OUTPUT | _40_PM6_MODE_OUTPUT |
|
||||
_80_PDR5_DEFAULT;
|
||||
|
||||
/* General Purpose I/O Port initialization for RX65N-RSK1MB */
|
||||
|
||||
PORT7.PODR.BYTE = _08_PM3_OUTPUT_1;
|
||||
PORT9.PODR.BYTE = _08_PM3_OUTPUT_1;
|
||||
PORTJ.PODR.BYTE = _20_PM5_OUTPUT_1;
|
||||
PORT7.DSCR2.BYTE = _00_PM3_HISPEED_OFF;
|
||||
PORT9.DSCR.BYTE = _00_PM3_HIDRV_OFF;
|
||||
PORT9.DSCR2.BYTE = _00_PM3_HISPEED_OFF;
|
||||
PORT7.PMR.BYTE = 0x00u;
|
||||
PORT7.PDR.BYTE = _08_PM3_MODE_OUTPUT;
|
||||
PORT9.PMR.BYTE = 0x00u;
|
||||
PORT9.PDR.BYTE = _08_PM3_MODE_OUTPUT | _F0_PDR9_DEFAULT;
|
||||
PORTJ.PMR.BYTE = 0x00u;
|
||||
PORTJ.PDR.BYTE = _20_PM5_MODE_OUTPUT | _D7_PDRJ_DEFAULT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Peripheral enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N RSK1MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
inline void sci2_init_port(void)
|
||||
{
|
||||
/* Set RXD2 pin (P52) */
|
||||
|
||||
MPC.P52PFS.BYTE = 0x0au;
|
||||
PORT5.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD2 pin (P50) */
|
||||
|
||||
PORT5.PODR.BIT.BT0 = 1u;
|
||||
MPC.P50PFS.BYTE = 0x0au;
|
||||
PORT5.PDR.BIT.BT0 = 1u;
|
||||
PORT5.PMR.BIT.BT0 = 1u;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BOARD_RX65N_RSK1MB*/
|
||||
@@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk1mb/src/rx65n_main.c
|
||||
*
|
||||
* Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Anjana <anjana@tataelxsi.co.in>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "rx65n_macrodriver.h"
|
||||
#include "arch/board/board.h"
|
||||
#include "rx65n_definitions.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_on(int led)
|
||||
{
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_off(int led)
|
||||
{
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_RX65N_RSK2MB
|
||||
endif
|
||||
@@ -0,0 +1,392 @@
|
||||
README
|
||||
======
|
||||
|
||||
This README file discusses the port of NuttX to the RX65N RSK2MB board. This board features the RX65N (R5F565NEHDFC 176pin)
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
- Board Features
|
||||
- Status/Open Issues
|
||||
- Serial Console
|
||||
- LEDs
|
||||
- Networking
|
||||
- RTC
|
||||
- USB Device
|
||||
- RSPI
|
||||
- RIIC
|
||||
- DTC
|
||||
- USB Host
|
||||
- USB Host Hub
|
||||
- Debugging
|
||||
|
||||
Board Features
|
||||
==============
|
||||
- Mounted devices: RX65N (R5F565NEDDFC: No Encrypt Function, Code Flash 2MB, Pin Count 176-pin),
|
||||
or RX65N (R5F565NEHDFC: Supported Encrypt Function, Code Flash 2MB, Pin Count 176-pin)
|
||||
- Mounts TFT Display. Graphic LCD controller can be evaluated
|
||||
- 1 channel Ethernet can be evaluated
|
||||
- RX65N builds in Trusted Secure IP. AES encryption function and robust key management can be evaluated (*)
|
||||
- Mounts SD slot. If an optional Wireless LAN expansion board package for RSK (RTK0ZZZZZZP00000BR#WS) is used,
|
||||
Wireless LAN can evaluated
|
||||
- 1 channel USB Function and 1 channel USB Host can be evaluated
|
||||
- In addition, CAN, RSPI, QSPI, etc. can be evaluated
|
||||
|
||||
|
||||
See the RX65N RSK2MB website for further information about this board:
|
||||
|
||||
- https://www.renesas.com/br/en/products/software-tools/boards-and-kits/starter-kits/renesas-starter-kitplus-for-rx65n-2mb.html
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
RX65N RSK2MB supports 12 serial ports (SCI0 - SCI12), however only 1 port can be tested(SCI8, which is the serial console). Only SCI8 port can be tested which is connected to USB Serial port.
|
||||
|
||||
Serial ports SCI1, SCI2, SCI9-SCI12, cannot be tested because they are multiplexed to other Rx65N controller interfaces.
|
||||
|
||||
Following SCI ports are configured w.r.t RX65N pin configuration
|
||||
SCI1 Pin Configuration :
|
||||
-----------
|
||||
RX65N RSK2MB
|
||||
Function
|
||||
-----------
|
||||
PF2 RXD1
|
||||
PF1 TXD1
|
||||
------------
|
||||
|
||||
SCI2 Pin Configuration :
|
||||
-----------
|
||||
RX65N RSK2MB
|
||||
Function
|
||||
-----------
|
||||
P52 RXD2
|
||||
P50 TXD2
|
||||
------------
|
||||
SCI8 Pin Configuration :
|
||||
-----------
|
||||
RX65N RSK2MB
|
||||
Function
|
||||
-----------
|
||||
PJ1 RXD8
|
||||
PJ2 TXD8
|
||||
------------
|
||||
|
||||
Serial Connection Configuration
|
||||
-------------------------------
|
||||
1. RSK2MB board needs to be connected to PC, using USB cable(One end of which is connected to PC, other end
|
||||
connected to USB serial port on H/W board).
|
||||
2. RSK USB Serial Driver needs to be downloaded on PC side.
|
||||
3. Configure Teraterm to 115200 baud.
|
||||
|
||||
LEDs
|
||||
====
|
||||
|
||||
The RX65N RSK2MB board has 2 Power LED's(PowerLED5 LED_G, PowerLED3 LED_G) and 4 user LED's (LED_G, LED_O, LED_R, LED_R).
|
||||
|
||||
If enabled 4 User LED's are simply turned on when the board boots
|
||||
successfully, and is blinking on panic / assertion failed.
|
||||
|
||||
Networking
|
||||
==========
|
||||
|
||||
Ethernet Connections
|
||||
--------------------
|
||||
|
||||
------ ---------
|
||||
RX65N
|
||||
RSK2MB Ethernet
|
||||
Pin Function
|
||||
------ ---------
|
||||
PC4 ET0_TX_CLK
|
||||
P76 ET0_RX_CLK
|
||||
P80 ET0_TX_EN
|
||||
PC6 ET0_ETXD3
|
||||
PC5 ET0_ETXD2
|
||||
P82 ET0_ETXD1
|
||||
P81 ET0_ETXD0
|
||||
PC3 ET0_TX_ER
|
||||
PC2 ET0_RX_DV
|
||||
PC0 ET0_ERXD3
|
||||
PC1 ET0_ERXD2
|
||||
P74 ET0_ERXD1
|
||||
P75 ET0_ERXD0
|
||||
P77 ET0_RX_ER
|
||||
P83 ET0_CRS
|
||||
PC7 ET0_COL
|
||||
P72 ET0_MDC
|
||||
P71 ET0_MDIO
|
||||
P54 ET0_LINKSTA
|
||||
------ ---------
|
||||
|
||||
USB Device
|
||||
-----------
|
||||
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 2 & Pin 3
|
||||
J16 Short Pin 1 & Pin 2
|
||||
|
||||
NuttX Configurations
|
||||
--------------------
|
||||
The following configurations, need to be enabled for network.
|
||||
|
||||
CONFIG_RX65N_EMAC=y : Enable the EMAC Peripheral for RX65N
|
||||
CONFIG_RX65N_EMAC0=y : Enable the EMAC Peripheral for RX65N
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30 : Address of PHY status register
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x18 : Needed for PHY CHIP
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x08 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x14 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x04 : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x1c : " " " " " "
|
||||
CONFIG_RX65N_EMAC0_RMII=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=0 : PHY is at address 1
|
||||
|
||||
CONFIG_SCHED_WORKQUEUE=y : Work queue support is needed
|
||||
CONFIG_SCHED_HPWORK=y : High Priority Work queue support
|
||||
CONFIG_SCHED_LPWORK=y : Low Priority Work queue support
|
||||
|
||||
Using the network with NSH
|
||||
--------------------------
|
||||
The IP address is configured using DHCP, using the below mentioned configurations :
|
||||
|
||||
CONFIG_NETUTILS_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NSH_DHCPC=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
|
||||
nsh> ifconfig
|
||||
eth0 HWaddr 00:e0:de:ad:be:ef at UP
|
||||
IPaddr:10.75.24.53 DRaddr:10.75.24.1 Mask:255.255.254.0
|
||||
|
||||
You can use ping to test for connectivity to the host (Careful,
|
||||
Window firewalls usually block ping-related ICMP traffic). On the
|
||||
target side, you can:
|
||||
|
||||
nsh> ping 10.75.24.250
|
||||
PING 10.75.24.250 56 bytes of data
|
||||
56 bytes from 10.75.24.250: icmp_seq=1 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=2 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=3 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=4 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=5 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=6 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=7 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=8 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=9 time=0 ms
|
||||
56 bytes from 10.75.24.250: icmp_seq=10 time=0 ms
|
||||
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
|
||||
|
||||
On the host side, you should also be able to ping the RX65N-RSK2MB:
|
||||
|
||||
$ ping 10.75.24.53
|
||||
|
||||
Configure UDP blaster application as mentioned below :
|
||||
|
||||
CONFIG_EXAMPLES_UDPBLASTER_HOSTIP=0x0a4b1801 (10.75.24.1) ------> Gateway IP
|
||||
CONFIG_EXAMPLES_UDPBLASTER_NETMASK=0xfffffe00 (255.255.254.0) --------> Netmask
|
||||
CONFIG_EXAMPLES_UDPBLASTER_TARGETIP=0x0a4b189b (10.75.24.155) ---------> Target IP
|
||||
|
||||
RSPI
|
||||
-----------
|
||||
|
||||
For RX65N RSK2MB board, Following pin is configured for all channels in JA3.
|
||||
Channel0: Pin number 7 and 8 in JA3 is used for MOSIA and MISOA respectively
|
||||
Channel1: Pin number 35 and 36 in JA3 is used for MOSIB and MISOB respectively
|
||||
Channel2: Pin number 18 and 19 in JA3 is used for MOSIC and MISOC respectively
|
||||
and for enabling these pin need to select DSW-SEL0 by making off SW4-4
|
||||
|
||||
USB Host
|
||||
=============
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 1 & Pin 2
|
||||
J16 Short Pin 2 & Pin 3
|
||||
|
||||
USB Device
|
||||
=============
|
||||
For the RX65N RSK2MB board, to be used as USB Device, the following Jumper settings need to be done
|
||||
|
||||
J7 Short Pin 2 & Pin 3
|
||||
J16 Short Pin 1 & Pin 2
|
||||
|
||||
RTC
|
||||
==========
|
||||
|
||||
NuttX Configurations
|
||||
---------------
|
||||
The configurations listed in Renesas_RX65N_NuttX_RTC_Design.doc need to be enabled.
|
||||
|
||||
RTC Testing
|
||||
------------------
|
||||
The test cases mentioned in Renesas_RX65N_RTC_Test_Cases.xls are to be executed
|
||||
as part of RTC testing.
|
||||
|
||||
The following configurations are to be enabled as part of testing RTC examples.
|
||||
CONFIG_EXAMPLES_ALARM
|
||||
CONFIG_EXAMPLES_PERIODIC
|
||||
CONFIG_EXAMPLES_CARRY
|
||||
|
||||
USB Device Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Device
|
||||
|
||||
CONFIG_USBDEV
|
||||
CONFIG_CDCACM
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_STDIO_LINEBUFFER
|
||||
|
||||
USB Device Testing
|
||||
------------------------
|
||||
The following testing is executed as part of USB Device testing on RX65N target for GRROSE board
|
||||
|
||||
echo "This is a test for USB Device" > /dev/ttyACM0
|
||||
|
||||
xd 0 0x20000 > /dev/ttyACM0
|
||||
|
||||
The output of the commands mentioned above should be seen on the USB Device COM port on teraterm
|
||||
|
||||
RSPI Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for RSPI
|
||||
|
||||
CONFIG_SYSTEM_SPITOOL=y
|
||||
|
||||
RSPI Testing
|
||||
------------------------
|
||||
The following testing is executed as part of RSPI testing on RX65N target for RSK2MB board
|
||||
|
||||
On RSK2MB board, all three channels 0, 1 and 2 has been brought out and tested.
|
||||
|
||||
Following command can be used for testing RSPI communication to slave device.
|
||||
spi exch -b 0 -x 4 aabbccdd
|
||||
where b is bus number and x is Number of word to exchange.
|
||||
|
||||
RIIC Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for RIIC.
|
||||
|
||||
CONFIG_SYSTEM_I2CTOOL=y
|
||||
|
||||
RIIC Testing
|
||||
------------------------
|
||||
The following testing is executed as part of RIIC testing on RX65N target for RSK2MB board
|
||||
|
||||
On RSK2MB board only channel 0 can be tested.
|
||||
|
||||
Following command can be used for testing RIIC communication with slave device.
|
||||
i2c set -b 0 -a 53 -r 0 10
|
||||
where b is bus number, a is the slave address, r is the register address and 10 is the value to be written.
|
||||
|
||||
DTC Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for DTC.
|
||||
|
||||
CONFIG_SYSTEM_SPITOOL=y
|
||||
|
||||
DTC Testing
|
||||
------------------------
|
||||
|
||||
DTC has been tested using RSPI driver.
|
||||
|
||||
USB Host Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Host Mode driver to
|
||||
support USB HID Keyboard class and MSC Class.
|
||||
|
||||
CONFIG_USBHOST=y
|
||||
CONFIG_USBHOST_HIDKBD=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_EXAMPLES_HIDKBD=y
|
||||
|
||||
USB Host Driver Testing
|
||||
------------------------
|
||||
The Following Class Drivers were tested as mentioned below :
|
||||
|
||||
- USB HID Keyboard Class
|
||||
On the NuttX Console "hidkbd" application was executed
|
||||
|
||||
nsh> hidkbd
|
||||
The characters typed from the keyboard were executed correctly.
|
||||
|
||||
- USB MSC Class
|
||||
|
||||
The MSC device is enumerated as sda in /dev directory.
|
||||
|
||||
The block device is mounted using the command as mentioned below :
|
||||
|
||||
mount -t vfat /dev/sda /mnt
|
||||
|
||||
The MSC device is mounted in /dev directory
|
||||
|
||||
The copy command is executed to test the Read/Write functionality
|
||||
|
||||
cp /mnt/<file.txt> /mnt/file_copy.txt
|
||||
|
||||
USB Host Hub Configurations
|
||||
--------------------------
|
||||
The following configurations need to be enabled for USB Host Mode driver to
|
||||
support USB HID Keyboard class and MSC Class.
|
||||
|
||||
CONFIG_RX65N_USBHOST=y
|
||||
CONFIG_USBHOST_HUB=y
|
||||
CONFIG_USBHOST_ASYNCH=y
|
||||
CONFIG_USBHOST=y
|
||||
CONFIG_USBHOST_HIDKBD=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_EXAMPLES_HIDKBD=y
|
||||
|
||||
USB Host Hub Driver Testing
|
||||
------------------------
|
||||
The Following Class Drivers were tested as mentioned below :
|
||||
|
||||
- USB HID Keyboard Class
|
||||
On the NuttX Console "hidkbd" application was executed
|
||||
|
||||
nsh> hidkbd
|
||||
The characters typed from the keyboard were executed correctly.
|
||||
|
||||
- USB MSC Class
|
||||
The MSC device is enumerated as sda in /dev directory.
|
||||
|
||||
The block device is mounted using the command as mentioned below :
|
||||
|
||||
mount -t vfat /dev/sda /mnt
|
||||
|
||||
The MSC device is mounted in /dev directory
|
||||
|
||||
The copy command is executed to test the Read/Write functionality
|
||||
|
||||
cp /mnt/<file.txt> /mnt/file_copy.txt
|
||||
|
||||
Debugging
|
||||
==========
|
||||
1. NuttX needs to be compiled in Cygwin environment on Windows.
|
||||
|
||||
The following Configuration needs to be set, in order to do source level debugging.
|
||||
|
||||
CONFIG_DEBUG_SYMBOLS = y (Set this option, using menuconfig only, DO NOT Enable this as default configuration).
|
||||
|
||||
2. Download & Install Renesas e2studio IDE
|
||||
3. Load the project(NuttX built on Cygwin) as Makefile project with existing code
|
||||
4. Right click on the project, and select Debug Configurations
|
||||
5. The binary(NuttX) needs to be loaded using E1/E2 Emulator
|
||||
6. Select the Device name as R5F565NE and Emulator as E1/E2(whichever is being used)
|
||||
7. Select Connection type as JTAG
|
||||
8. Load and run the binary
|
||||
|
||||
Flashing NuttX
|
||||
===============
|
||||
Alternatively, NuttX binary can be flashed using Renesas flash programmer tool without using e2 studio/Cygwin
|
||||
|
||||
Below are the steps mentioned to flash NuttX binary using Renesas flash programmer tool(RFP).
|
||||
|
||||
1.In order to flash using Renesas flash programmer tool, nuttx.mot file should be generated.
|
||||
2. Add the following lines in tools/Makefile.unix file :
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: nuttx.mot"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) $(BIN) -O srec -I elf32-rx-be-ns nuttx.mot
|
||||
endif
|
||||
3. Add CONFIG_MOTOROLA_SREC=y in defconfig file or choose make menucofig->Build Setup-> Binary Output Format->
|
||||
Select Motorola SREC format.
|
||||
4. Download Renesas flash programmer tool from https://www.renesas.com/in/en/products/software-tools/tools/programmer/renesas-flash-programmer-programming-gui.html#downloads
|
||||
5. Refer to the user manual document, for steps to flash NuttX binary using RFP tool.
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NET_IPv4 is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-rsk2mb"
|
||||
CONFIG_ARCH_BOARD_RX65N_RSK2MB=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_NET=y
|
||||
CONFIG_EXAMPLES_SERIALBLASTER=y
|
||||
CONFIG_EXAMPLES_SERIALRX=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRINTSTR=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRIORITY=75
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_STATISTICS=y
|
||||
CONFIG_NETINIT_IPv6NETMASK_8=0xff80
|
||||
CONFIG_NETINIT_THREAD=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ICMPv6=y
|
||||
CONFIG_NET_ICMPv6_NEIGHBOR=y
|
||||
CONFIG_NET_ICMPv6_SOCKET=y
|
||||
CONFIG_NET_IPv6=y
|
||||
CONFIG_NET_MLD=y
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_SOLINGER=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCPBACKLOG=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_EMAC0=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x4
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x0
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x6
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x2
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x6
|
||||
CONFIG_RX65N_SCI2=y
|
||||
CONFIG_RX65N_SCI8=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCI8_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PRIORITY=50
|
||||
CONFIG_SYSTEM_PING6=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-rsk2mb"
|
||||
CONFIG_ARCH_BOARD_RX65N_RSK2MB=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_EXAMPLES_SERIALBLASTER=y
|
||||
CONFIG_EXAMPLES_SERIALRX=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRINTSTR=y
|
||||
CONFIG_EXAMPLES_SERIALRX_PRIORITY=75
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDB_DNSSERVER_NOADDR=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_STATISTICS=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPC=y
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NETUTILS_TFTPC=y
|
||||
CONFIG_NETUTILS_WEBCLIENT=y
|
||||
CONFIG_NET_ARP_SEND=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCPBACKLOG=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC=y
|
||||
CONFIG_RTC_ALARM=y
|
||||
CONFIG_RTC_DRIVER=y
|
||||
CONFIG_RTC_HIRES=y
|
||||
CONFIG_RX65N_EMAC0=y
|
||||
CONFIG_RX65N_EMAC0_PHYADDR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR=30
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100FD=0x4
|
||||
CONFIG_RX65N_EMAC0_PHYSR_100HD=0x0
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10FD=0x6
|
||||
CONFIG_RX65N_EMAC0_PHYSR_10HD=0x2
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTCONFIG=y
|
||||
CONFIG_RX65N_EMAC0_PHYSR_ALTMODE=0x6
|
||||
CONFIG_RX65N_SCI8=y
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCI8_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PRIORITY=50
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n-rsk2mb"
|
||||
CONFIG_ARCH_BOARD_RX65N_RSK2MB=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEHDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15001
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_SCI8=y
|
||||
CONFIG_SCI8_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,85 @@
|
||||
README
|
||||
======
|
||||
|
||||
Overview
|
||||
--------
|
||||
This directory contains logic to support a custom ROMFS start-up script.
|
||||
This startup script is used by by the NSH when it starts provided that
|
||||
CONFIG_NSH_ARCHROMFS=y. The script provides a ROMFS volume that will be
|
||||
mounted at /etc and will look like this at run-time:
|
||||
|
||||
NuttShell (NSH) NuttX-8.2
|
||||
nsh> ls -l /etc
|
||||
/etc:
|
||||
dr-xr-xr-x 0 .
|
||||
-r--r--r-- 20 group
|
||||
dr-xr-xr-x 0 init.d/
|
||||
-r--r--r-- 35 passwd
|
||||
/etc/init.d:
|
||||
dr-xr-xr-x 0 ..
|
||||
-r--r--r-- 110 rcS
|
||||
nsh>
|
||||
|
||||
/etc/init.d/rcS is the start-up script; /etc/passwd is a the password
|
||||
file. It supports a single user:
|
||||
|
||||
USERNAME: admin
|
||||
PASSWORD: Adminstrator
|
||||
|
||||
nsh> cat /etc/passwd
|
||||
admin:8Tv+Hbmr3pLddSjtzL0kwC:0:0:/
|
||||
|
||||
The encrypted passwords in the provided passwd file are only valid if the
|
||||
TEA key is set to: 012345678 9abcdef0 012345678 9abcdef0. Changes to either
|
||||
the key or the password word will require regeneration of the nsh_romfimg.h
|
||||
header file.
|
||||
|
||||
The format of the password file is:
|
||||
|
||||
user:x:uid:gid:home
|
||||
|
||||
Where:
|
||||
user: User name
|
||||
x: Encrypted password
|
||||
uid: User ID (0 for now)
|
||||
gid: Group ID (0 for now)
|
||||
home: Login directory (/ for now)
|
||||
|
||||
/etc/group is a group file. It is not currently used.
|
||||
|
||||
nsh> cat /etc/group
|
||||
root:*:0:root,admin
|
||||
|
||||
The format of the group file is:
|
||||
|
||||
group:x:gid:users
|
||||
|
||||
Where:
|
||||
group: The group name
|
||||
x: Group password
|
||||
gid: Group ID
|
||||
users: A comma separated list of members of the group
|
||||
|
||||
Updating the ROMFS File System
|
||||
------------------------------
|
||||
The content on the nsh_romfsimg.h header file is generated from a sample
|
||||
directory structure. That directory structure is contained in the etc/ directory and can be modified per the following steps:
|
||||
|
||||
|
||||
1. Change directory to etc/:
|
||||
|
||||
cd etc/
|
||||
|
||||
2. Make modifications as desired.
|
||||
|
||||
3. Create the new ROMFS image.
|
||||
|
||||
genromfs -f romfs_img -d etc -V SimEtcVol
|
||||
|
||||
4. Convert the ROMFS image to a C header file
|
||||
|
||||
xxd -i romfs_img >nsh_romfsimg.h
|
||||
|
||||
5. Edit nsh_romfsimg.h, mark both data definitions as 'const' so that
|
||||
that will be stored in FLASH.
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define RX_CLK_1MHz (1000UL * 1000UL)
|
||||
#define RX_FCLK ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_ICLK (120.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKA (120.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKB ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKC ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_PCLKD ( 60.0 * RX_CLK_1MHz)
|
||||
#define RX_BCK (120.0 * RX_CLK_1MHz)
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define RX_RESONATOR ( 12 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#else
|
||||
#error "Please definition RX_RESONATOR in board.h"
|
||||
#endif
|
||||
|
||||
/* LED definitions */
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
# define LED_ON (0)
|
||||
# define LED_OFF (1)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
# define LED_ON (1)
|
||||
# define LED_OFF (0)
|
||||
#else
|
||||
# error "No Selection for PORT definition in rx65n_port.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define LED0 (PORT7.PODR.BIT.B3)
|
||||
#define LED1 (PORTG.PODR.BIT.B7)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT7.ODR0.BIT.B6 = PORTG.ODR1.BIT.B6 = 0; \
|
||||
PORT7.DSCR.BIT.B3 = PORTG.DSCR.BIT.B7 = 1; \
|
||||
PORT7.DSCR2.BIT.B3 = PORTG.DSCR2.BIT.B7 = 0; \
|
||||
PORT7.PMR.BIT.B3 = PORTG.PMR.BIT.B7 = 0; \
|
||||
PORT7.PDR.BIT.B3 = PORTG.PDR.BIT.B7 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define LED0 (PORTA.PODR.BIT.BT0)
|
||||
#define LED1 (PORTA.PODR.BIT.B1)
|
||||
#define LED_PORTINIT(X) \
|
||||
{ \
|
||||
LED0 = LED1 = (X); \
|
||||
PORTA.ODR0.BIT.BT0 = PORTA.ODR0.BIT.B2 = 0; \
|
||||
PORTA.DSCR.BIT.BT0 = PORTA.DSCR.BIT.B1 = 1; \
|
||||
PORTA.DSCR2.BIT.BT0 = PORTA.DSCR2.BIT.B1 = 0; \
|
||||
PORTA.PMR.BIT.BT0 = PORTA.PMR.BIT.B1 = 0; \
|
||||
PORTA.PDR.BIT.BT0 = PORTA.PDR.BIT.B1 = 1; \
|
||||
}
|
||||
#else
|
||||
#error "LEDs are not defined."
|
||||
#endif
|
||||
|
||||
#define LED_STARTED 1 /* ON OFF NC NC */
|
||||
#define LED_HEAPALLOCATE 0 /* NC NC NC NC */
|
||||
#define LED_IRQSENABLED 0 /* NC NC NC NC */
|
||||
#define LED_STACKCREATED 2 /* ON ON NC NC */
|
||||
#define LED_INIRQ 0 /* NC NC NC NC */
|
||||
#define LED_SIGNAL 0 /* NC NC NC NC */
|
||||
#define LED_ASSERTION 0 /* NC NC NC NC */
|
||||
#define LED_PANIC 3 /* OFF ON NC NC (flashing 2Hz) */
|
||||
|
||||
/* Button definitions */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,261 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/include/rx65n_gpio.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_RX65N_GPIO_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_RX65N_GPIO_H
|
||||
|
||||
#if defined(CONFIG_ARCH_RX65N_RSK2MB)
|
||||
#define PHY_STS_REG 0x10
|
||||
#define PHY_STS_REG_LINK (1 << 0)
|
||||
#define PHY_STS_READ_REG PHY_STS_REG
|
||||
#define PHY_STS_BIT_MASK (0x1)
|
||||
#define PHY_STS_SHIFT_COUNT (0x0)
|
||||
#else
|
||||
#define PHY_STS_REG 0x1f
|
||||
#define PHY_STS_REG_AUTO_NEG (1 << 12)
|
||||
#define PHY_STS_READ_REG PHY_REG_STATUS
|
||||
#define PHY_STS_BIT_MASK (0x4)
|
||||
#define PHY_STS_SHIFT_COUNT (0x02)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define PHY_SET_MODE_REG PHY_MII_SET_MODE
|
||||
#else
|
||||
#define PHY_SET_MODE_REG PHY_RMII_SET_MODE
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define RX65N_MAC_ADDRL 0x00509074
|
||||
#define RX65N_MAC_ADDRH 0x0000949c
|
||||
#else
|
||||
#define RX65N_MAC_ADDRL 0x00000000
|
||||
#define RX65N_MAC_ADDRH 0x00000000
|
||||
#endif
|
||||
|
||||
/* RSPI channel number */
|
||||
|
||||
#define RX65N_RSPI_CHANNEL0 0
|
||||
#define RX65N_RSPI_CHANNEL1 1
|
||||
#define RX65N_RSPI_CHANNEL2 2
|
||||
|
||||
/* DSW_SEL0 hardware setting in RSK2MB baord accordingly change this macro */
|
||||
|
||||
#define DSW_SEL0_ON 0 /* 1 means ON and 0 means OFF*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes SCI Ports of RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* Initializes LED Ports of RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void led_port_create(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Pheriperal enabling
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB device port settings
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci1_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI1 Initialization RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI1
|
||||
void sci1_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
void sci2_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci8_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI8 Initialization RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI8
|
||||
void sci8_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci12_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI12 Initialization RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI12
|
||||
void sci12_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rspi_pinconfig
|
||||
*
|
||||
* Description: RSPI pinconfiguration for channel
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple SPI interfaces)
|
||||
*
|
||||
* Description:
|
||||
*RSPI pin(SCK,MOSI and MISO) configuration
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
void rspi_pinconfig(int bus);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic0_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC0 Initialization RX65N RSK2MB
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
void riic0_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic1_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC1 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
void riic1_init_port(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic2_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC2 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
void riic2_init_port(void);
|
||||
#endif
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_RSK2MB_INCLUDE_RX65N_GPIO_H */
|
||||
@@ -0,0 +1,92 @@
|
||||
##############################################################################
|
||||
# boards/renesas/rx65n/rx65n-rsk2mb/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld}"
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld
|
||||
endif
|
||||
|
||||
CROSSDEV = rx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E -P -x c
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
AS = $(CROSSDEV)as
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHCFLAGS = -std=c99 -fno-builtin
|
||||
ARCHCPUFLAGS = -mcpu=rx64m
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(ARCHWARNINGSXX)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
ASMEXT = .asm
|
||||
@@ -0,0 +1,168 @@
|
||||
MEMORY
|
||||
{
|
||||
/* RSK-RX65N-1MB */
|
||||
/*
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
ROM : ORIGIN = 0xFFF00000, LENGTH = 1048576
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
*/
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
RAMHI : ORIGIN = 0x800000, LENGTH = 393216
|
||||
ROM : ORIGIN = 0xFFE00000, LENGTH = 2097152
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.exvectors 0xFFFFFF80: AT(0xFFFFFF80)
|
||||
{
|
||||
KEEP(*(.exvectors))
|
||||
} > ROM
|
||||
.fvectors 0xFFFFFFFC: AT(0xFFFFFFFC)
|
||||
{
|
||||
KEEP(*(.fvectors))
|
||||
} > ROM
|
||||
/* RSK-RX65N-1MB */
|
||||
/*
|
||||
.text 0xFFF00000: AT(0xFFF00000)
|
||||
*/
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
.text 0xFFE00000: AT(0xFFE00000)
|
||||
{
|
||||
*(.text)
|
||||
. = ALIGN(4);
|
||||
*(.text.*)
|
||||
. = ALIGN(4);
|
||||
*(P)
|
||||
etext = .;
|
||||
} > ROM
|
||||
.rvectors :
|
||||
{
|
||||
_rvectors_start = .;
|
||||
KEEP(*(.rvectors))
|
||||
_rvectors_end = .;
|
||||
} > ROM
|
||||
.init :
|
||||
{
|
||||
KEEP(*(.init))
|
||||
__preinit_array_start = .;
|
||||
KEEP(*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
__init_array_start = (. + 3) & ~ 3;
|
||||
KEEP(*(.init_array))
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
__init_array_end = .;
|
||||
__fini_array_start = .;
|
||||
KEEP(*(.fini_array))
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} > ROM
|
||||
.fini :
|
||||
{
|
||||
KEEP(*(.fini))
|
||||
} > ROM
|
||||
.got :
|
||||
{
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
} > ROM
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(C_1)
|
||||
*(C_2)
|
||||
*(C)
|
||||
_erodata = .;
|
||||
} > ROM
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
} > ROM
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
} > ROM
|
||||
.jcr :
|
||||
{
|
||||
*(.jcr)
|
||||
} > ROM
|
||||
.tors :
|
||||
{
|
||||
__CTOR_LIST__ = .;
|
||||
. = ALIGN(2);
|
||||
___ctors = .;
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
___dtors = .;
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
__DTOR_END__ = .;
|
||||
. = ALIGN(2);
|
||||
_mdata = .;
|
||||
} > ROM
|
||||
.ustack 0x400: AT(0x200)
|
||||
{
|
||||
_ustack = .;
|
||||
} > RAM
|
||||
.istack 0x200: AT(0x200)
|
||||
{
|
||||
_istack = .;
|
||||
} > RAM
|
||||
.data 0x404: AT(_mdata)
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(D)
|
||||
*(D_1)
|
||||
*(D_2)
|
||||
_edata = .;
|
||||
} > RAM
|
||||
.gcc_exc :
|
||||
{
|
||||
*(.gcc_exc)
|
||||
} > RAM
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.**)
|
||||
*(COMMON)
|
||||
*(B)
|
||||
*(B_1)
|
||||
*(B_2)
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
} > RAM
|
||||
.ofs1 0xFE7F5D40: AT(0xFE7F5D00)
|
||||
{
|
||||
KEEP(*(.ofs1))
|
||||
} > OFS
|
||||
.ofs2 0xFE7F5D48: AT(0xFE7F5D10)
|
||||
{
|
||||
KEEP(*(.ofs2))
|
||||
} > OFS
|
||||
.ofs3 0xFE7F5D50: AT(0xFE7F5D40)
|
||||
{
|
||||
KEEP(*(.ofs3))
|
||||
} > OFS
|
||||
.ofs4 0xFE7F5D10: AT(0xFE7F5D48)
|
||||
{
|
||||
KEEP(*(.ofs4))
|
||||
} > OFS
|
||||
.ofs5 0xFE7F5D10: AT(0xFE7F5D50)
|
||||
{
|
||||
KEEP(*(.ofs5))
|
||||
} > OFS
|
||||
.ofs6 0xFE7F5D10: AT(0xFE7F5D64)
|
||||
{
|
||||
KEEP(*(.ofs6))
|
||||
} > OFS
|
||||
.ofs7 0xFE7F5D10: AT(0xFE7F5D70)
|
||||
{
|
||||
KEEP(*(.ofs7))
|
||||
} > OFS
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
############################################################################
|
||||
# boards/renesas/rx65n/rx65n-rsk2mb/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rx65n_appinit.c rx65n_bringup.c rx65n_sbram.c rx65n_gpio.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_appinit.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include "rx65n_rsk2mb.h"
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, &&
|
||||
* CONFIG_LIB_BOARDCTL=n :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value could be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
/* Did we already initialize via board_late_initialize()? */
|
||||
|
||||
#ifndef CONFIG_BOARD_LATE_INITIALIZE
|
||||
return rx65n_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
@@ -0,0 +1,547 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_bringup.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
||||
#include "rx65n_usbhost.h"
|
||||
#include "rx65n_rsk2mb.h"
|
||||
#include <rx65n_definitions.h>
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
# include <nuttx/timers/rtc.h>
|
||||
# include "rx65n_rtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# include <nuttx/usb/cdcacm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DTC_DRIVER
|
||||
# include "rx65n_dtc.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RSPI_DRIVER
|
||||
# include <nuttx/spi/spi_transfer.h>
|
||||
# include "rx65n_rspi.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
# include <nuttx/i2c/i2c_master.h>
|
||||
# include "rx65n_riic.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define NSH_HAVE_USBHOST 1
|
||||
|
||||
/* USB Host */
|
||||
|
||||
#ifndef CONFIG_USBHOST
|
||||
# undef NSH_HAVE_USBHOST
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
# ifndef CONFIG_USBHOST_DEFPRIO
|
||||
# define CONFIG_USBHOST_DEFPRIO 100
|
||||
# endif
|
||||
# ifndef CONFIG_USBHOST_STACKSIZE
|
||||
# ifdef CONFIG_USBHOST_HUB
|
||||
# define CONFIG_USBHOST_STACKSIZE 1536
|
||||
# else
|
||||
# define CONFIG_USBHOST_STACKSIZE 1024
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_waiter
|
||||
*
|
||||
* Description:
|
||||
* Wait for USB devices to be connected.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_waiter(int argc, char *argv[])
|
||||
{
|
||||
struct usbhost_hubport_s *hport;
|
||||
|
||||
syslog(LOG_INFO, "nsh_waiter: Running\n");
|
||||
for (; ; )
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
|
||||
|
||||
/* Did we just become connected? */
|
||||
|
||||
if (hport->connected && hport->port == 0)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
(void)CONN_ENUMERATE(g_usbconn, hport);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the compiler from complaining */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_usbhostinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SPI-based microSD.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_usbhostinitialize(void)
|
||||
{
|
||||
int pid;
|
||||
int ret;
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about:
|
||||
*/
|
||||
|
||||
syslog(LOG_INFO, "Register class drivers\n");
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
/* Register the USB host Mass Storage Class */
|
||||
|
||||
printf ("USB Host MSC\n");
|
||||
ret = usbhost_msc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDCACM
|
||||
/* Register the CDC/ACM serial class */
|
||||
|
||||
printf ("USB Host CDCACM \n");
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the KBD class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HIDKBD
|
||||
/* Register the HID KBD class */
|
||||
|
||||
ret = usbhost_kbdinit();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
/* Initialize USB hub class support */
|
||||
|
||||
ret = usbhost_hub_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
g_usbconn = rx65n_usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
syslog(LOG_INFO, "Start nsh_waiter\n");
|
||||
|
||||
pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
|
||||
CONFIG_USBHOST_STACKSIZE,
|
||||
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
||||
syslog(LOG_INFO, "USBHost: Created pid = %d\n", pid);
|
||||
return pid < 0 ? -ENOEXEC : OK;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
#else
|
||||
# define nsh_usbhostinitialize() (OK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_rspi_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the RSPI driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
static void rx65n_rspi_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
struct spi_dev_s *rspi0;
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
struct spi_dev_s *rspi1;
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
struct spi_dev_s *rspi2;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
rspi0 = rx65n_rspibus_initialize(0);
|
||||
if (!rspi0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 0\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 0\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
rspi1 = rx65n_rspibus_initialize(1);
|
||||
if (!rspi1)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 1\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi1, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 1\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
rspi2 = rx65n_rspibus_initialize(2);
|
||||
if (!rspi2)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to initialize SPI port 2\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_DRIVER
|
||||
ret = spi_register(rspi2, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
spierr("ERROR: [boot] FAILED to register driver for channel 2\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rtc_driver_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the RTC driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
static int rtc_driver_initialize(void)
|
||||
{
|
||||
FAR struct rtc_lowerhalf_s *lower;
|
||||
int ret;
|
||||
|
||||
/* Instantiate the rx65n lower-half RTC driver */
|
||||
|
||||
lower = rx65n_rtc_lowerhalf();
|
||||
if (lower == NULL)
|
||||
{
|
||||
serr("ERROR: Failed to instantiate the RTC lower-half driver\n");
|
||||
ret = -ENOMEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bind the lower half driver and register the combined RTC driver
|
||||
* as /dev/rtc0
|
||||
*/
|
||||
|
||||
ret = rtc_initialize(0, lower);
|
||||
if (ret < 0)
|
||||
{
|
||||
serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Name: rx65n_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_bringup(void)
|
||||
{
|
||||
#if defined (HAVE_RTC_DRIVER) || defined (CONFIG_FS_PROCFS)
|
||||
int ret;
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
ret = rtc_driver_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: rtc_driver_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d\n", ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
/* Initialize standby RAM */
|
||||
|
||||
(void)rx65n_sbram_int();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DTC_DRIVER
|
||||
/* Initialize DTC */
|
||||
|
||||
(void)rx65n_dtc_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
(void)rx65n_rspi_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USBHOST)
|
||||
ret = nsh_usbhostinitialize();
|
||||
printf ("USB Initialization done!!! with return value = %d\n", ret);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CDCACM) && !defined(CONFIG_CDCACM_CONSOLE)
|
||||
/* Initialize CDCACM */
|
||||
|
||||
syslog(LOG_INFO, "Initialize CDCACM device\n");
|
||||
|
||||
ret = cdcacm_initialize(0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: cdcacm_initialize failed: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_CDCACM & !CONFIG_CDCACM_CONSOLE */
|
||||
|
||||
#ifdef HAVE_RIIC_DRIVER
|
||||
FAR struct i2c_master_s *i2c;
|
||||
|
||||
/* Get the I2C lower half instance */
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
i2c = rx65n_i2cbus_initialize(0);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
i2cerr("ERROR: Initialization of RIIC Channel 0 failed: %d\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Register the I2C character driver */
|
||||
|
||||
ret = i2c_register(i2c, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
i2cerr("ERROR: Failed to register RIIC device: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
i2c = rx65n_i2cbus_initialize(1);
|
||||
if (i2c == NULL)
|
||||
{
|
||||
i2cerr("ERROR: Initialization of RIIC Channel 1 failed: %d\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Register the I2C character driver */
|
||||
|
||||
ret = i2c_register(i2c, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
i2cerr("ERROR: Failed to register RIIC device: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
i2cerr("RIIC2 setting is not supported on RSK-2MB Board\n");
|
||||
i2cerr("It is used for USB port and cannot be configured\n");
|
||||
#endif
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
#if defined (CONFIG_ARCH_HAVE_LEDS) && (CONFIG_ARCH_LEDS)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_on(int led)
|
||||
{
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_off(int led)
|
||||
{
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,557 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_gpio.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "rx65n_macrodriver.h"
|
||||
#include "rx65n_port.h"
|
||||
#include "arch/board/board.h"
|
||||
#include "arch/board/rx65n_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_port_create
|
||||
*
|
||||
* Description:
|
||||
* LED Port Initialization for RX65N RSK2MB Board
|
||||
****************************************************************************/
|
||||
|
||||
#if defined (CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
void led_port_create(void)
|
||||
{
|
||||
/* LED Port initialization of RX65N RSK2MB */
|
||||
|
||||
/* LED_PORTINIT(0); */
|
||||
|
||||
PORT7.PODR.BYTE = _08_PM3_OUTPUT_1;
|
||||
PORT7.DSCR2.BYTE = _00_PM3_HISPEED_OFF;
|
||||
PORT7.PMR.BYTE = 0x00u;
|
||||
PORT7.PDR.BYTE = _08_PM3_MODE_OUTPUT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci_port_create
|
||||
*
|
||||
* Description:
|
||||
* SCI Port Initialization for RX65N RSK2MB Board
|
||||
****************************************************************************/
|
||||
|
||||
void sci_port_create(void)
|
||||
{
|
||||
/* SCI Port initialization for RX65N-RSK2MB */
|
||||
|
||||
PORT5.PODR.BYTE = _40_PM6_OUTPUT_1;
|
||||
PORTJ.PODR.BYTE = _20_PM5_OUTPUT_1;
|
||||
PORT5.DSCR.BYTE = _20_PM5_HIDRV_ON | _00_PM6_HIDRV_OFF;
|
||||
PORT5.DSCR2.BYTE = _00_PM5_HISPEED_OFF | _00_PM6_HISPEED_OFF;
|
||||
PORT5.PMR.BYTE = 0x00u;
|
||||
PORT5.PDR.BYTE = _20_PM5_MODE_OUTPUT | _40_PM6_MODE_OUTPUT |
|
||||
_80_PDR5_DEFAULT;
|
||||
PORTJ.PMR.BYTE = 0x00u;
|
||||
PORTJ.PDR.BYTE = _20_PM5_MODE_OUTPUT | _D7_PDRJ_DEFAULT;
|
||||
|
||||
/* General Purpose I/O Port initialization for RX65N-RSK2MB */
|
||||
|
||||
PORT0.PODR.BYTE = _04_PM2_OUTPUT_1 | _08_PM3_OUTPUT_1 | _20_PM5_OUTPUT_1;
|
||||
PORT9.PODR.BYTE = _08_PM3_OUTPUT_1;
|
||||
PORT0.DSCR.BYTE = _00_PM2_HIDRV_OFF;
|
||||
PORT0.DSCR2.BYTE = _00_PM2_HISPEED_OFF;
|
||||
PORT9.DSCR.BYTE = _00_PM3_HIDRV_OFF;
|
||||
PORT9.DSCR2.BYTE = _00_PM3_HISPEED_OFF;
|
||||
PORT0.PMR.BYTE = 0x00u;
|
||||
PORT0.PDR.BYTE = _04_PM2_MODE_OUTPUT | _08_PM3_MODE_OUTPUT |
|
||||
_20_PM5_MODE_OUTPUT | _50_PDR0_DEFAULT;
|
||||
PORT9.PMR.BYTE = 0x00u;
|
||||
PORT9.PDR.BYTE = _08_PM3_MODE_OUTPUT | _F0_PDR9_DEFAULT;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_ether_pheriperal_enable
|
||||
*
|
||||
* Description:
|
||||
* Ethernet Pheriperal enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_EMAC0
|
||||
void r_ether_pheriperal_enable(void)
|
||||
{
|
||||
/* Set ET0_TX_CLK pin */
|
||||
|
||||
MPC.PC4PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B4 = 1u;
|
||||
|
||||
/* Set ET0_RX_CLK pin */
|
||||
|
||||
MPC.P76PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set ET0_TX_EN pin */
|
||||
|
||||
MPC.P80PFS.BYTE = 0x11u;
|
||||
PORT8.PMR.BIT.BT0 = 1u;
|
||||
|
||||
/* Set ET0_ETXD3 pin */
|
||||
|
||||
MPC.PC6PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set ET0_ETXD2 pin */
|
||||
|
||||
MPC.PC5PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B5 = 1u;
|
||||
|
||||
/* Set ET0_ETXD1 pin */
|
||||
|
||||
MPC.P82PFS.BYTE = 0x11u;
|
||||
PORT8.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set ET0_ETXD0 pin */
|
||||
|
||||
MPC.P81PFS.BYTE = 0x11u;
|
||||
PORT8.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set ET0_TX_ER pin */
|
||||
|
||||
MPC.PC3PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B3 = 1u;
|
||||
|
||||
/* Set ET0_RX_DV pin */
|
||||
|
||||
MPC.PC2PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set ET0_ERXD3 pin */
|
||||
|
||||
MPC.PC0PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.BT0 = 1u;
|
||||
|
||||
/* Set ET0_ERXD2 pin */
|
||||
|
||||
MPC.PC1PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set ET0_ERXD1 pin */
|
||||
|
||||
MPC.P74PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B4 = 1u;
|
||||
|
||||
/* Set ET0_ERXD0 pin */
|
||||
|
||||
MPC.P75PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B5 = 1u;
|
||||
|
||||
/* Set ET0_RX_ER pin */
|
||||
|
||||
MPC.P77PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B7 = 1u;
|
||||
|
||||
/* Set ET0_CRS pin */
|
||||
|
||||
MPC.P83PFS.BYTE = 0x11u;
|
||||
PORT8.PMR.BIT.B3 = 1u;
|
||||
|
||||
/* Set ET0_COL pin */
|
||||
|
||||
MPC.PC7PFS.BYTE = 0x11u;
|
||||
PORTC.PMR.BIT.B7 = 1u;
|
||||
|
||||
/* Set ET0_MDC pin */
|
||||
|
||||
MPC.P72PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set ET0_MDIO pin */
|
||||
|
||||
MPC.P71PFS.BYTE = 0x11u;
|
||||
PORT7.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set ET0_LINKSTA pin */
|
||||
|
||||
MPC.P54PFS.BYTE = 0x11u;
|
||||
PORT5.PMR.BIT.B4 = 1u;
|
||||
|
||||
/* Set ET0_LINKSTA pin */
|
||||
|
||||
MPC.P34PFS.BYTE = 0x11u;
|
||||
PORT3.PMR.BIT.B4 = 1u;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Name: r_usbdev_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Device enabling
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
void r_usbdev_port_enable(void)
|
||||
{
|
||||
/* Set USB0_VBUS pin */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x11;
|
||||
PORT1.PMR.BIT.B6 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: r_usb_port_enable
|
||||
*
|
||||
* Description:
|
||||
* USB Enabling for RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#if defined(CONFIG_USBHOST)
|
||||
void r_usb_port_enable(void)
|
||||
{
|
||||
/* Set VBUS pin for USB */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x12u;
|
||||
|
||||
/* PORT1.PMR.BYTE |= 0x40; */
|
||||
|
||||
PORT1.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* set USB0_OVRCURA pin */
|
||||
|
||||
MPC.P14PFS.BYTE = 0x12u;
|
||||
PORT1.PMR.BIT.B4 = 1u;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci1_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI1 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI1
|
||||
inline void sci1_init_port(void)
|
||||
{
|
||||
/* Set RXD1 pin (PF2) */
|
||||
|
||||
MPC.PF2PFS.BYTE = 0x0au;
|
||||
PORTF.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD1 pin (PF1) */
|
||||
|
||||
PORTF.PODR.BIT.B1 = 1u;
|
||||
MPC.PF1PFS.BYTE = 0x0au;
|
||||
PORTF.PDR.BIT.B1 = 1u;
|
||||
PORTF.PMR.BIT.B1 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci2_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI2 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI2
|
||||
inline void sci2_init_port(void)
|
||||
{
|
||||
/* Set RXD2 pin (P52) */
|
||||
|
||||
MPC.P52PFS.BYTE = 0x0au;
|
||||
PORT5.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set TXD2 pin (P50) */
|
||||
|
||||
PORT5.PODR.BIT.BT0 = 1u;
|
||||
MPC.P50PFS.BYTE = 0x0au;
|
||||
PORT5.PDR.BIT.BT0 = 1u;
|
||||
PORT5.PMR.BIT.BT0 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci8_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI8 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI8
|
||||
inline void sci8_init_port(void)
|
||||
{
|
||||
/* Set RXD8 pin (PJ1) */
|
||||
|
||||
MPC.PJ1PFS.BYTE = 0x0au;
|
||||
PORTJ.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set TXD8 pin (PJ2) */
|
||||
|
||||
PORTJ.PODR.BIT.B2 = 1u;
|
||||
MPC.PJ2PFS.BYTE = 0x0au;
|
||||
PORTJ.PDR.BIT.B2 = 1u;
|
||||
PORTJ.PMR.BIT.B2 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sci12_init_port
|
||||
*
|
||||
* Description:
|
||||
* SCI12 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_SCI12
|
||||
inline void sci12_init_port(void)
|
||||
{
|
||||
/* Set RXD12 pin */
|
||||
|
||||
MPC.PE2PFS.BYTE = 0x0cu;
|
||||
PORTE.PMR.BYTE |= 0x04u;
|
||||
|
||||
/* Set TXD12 pin */
|
||||
|
||||
PORTE.PODR.BYTE |= 0x02u;
|
||||
MPC.PE1PFS.BYTE = 0x0cu;
|
||||
PORTE.PDR.BYTE |= 0x02u;
|
||||
|
||||
/* Set RXD12 pin (PXX)
|
||||
* MPC.PXXPFS.BYTE = 0x0au;
|
||||
* PORTX.PMR.BIT.BX = 1u;
|
||||
* Set TXD12 pin (PXX)
|
||||
* PORTX.PODR.BIT.BX = 1u;
|
||||
* MPC.PXXPFS.BYTE = 0x0au;
|
||||
* PORTX.PDR.BIT.BX = 1u;
|
||||
* PORTX.PMR.BIT.BX = 1u;
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rspi_pinconfig
|
||||
*
|
||||
* Description: RSPI pinconfiguration for channel
|
||||
*
|
||||
* Input Parameters:
|
||||
* Port number (for hardware that has multiple SPI interfaces)
|
||||
*
|
||||
* Description:
|
||||
*RSPI pin(SCK,MOSI and MISO) configuration
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RSPI
|
||||
void rspi_pinconfig(int bus)
|
||||
{
|
||||
/* Set RSPI signal ports to peripheral mode */
|
||||
|
||||
switch (bus)
|
||||
{
|
||||
case RX65N_RSPI_CHANNEL0:
|
||||
#ifdef CONFIG_RX65N_RSPI0
|
||||
|
||||
/* Configure RSPCKA */
|
||||
|
||||
MPC.PA5PFS.BYTE = 0x0d;
|
||||
PORTA.PMR.BIT.B5 = 1;
|
||||
|
||||
/* Configure MOSIA */
|
||||
|
||||
MPC.PA6PFS.BYTE = 0x0d;
|
||||
PORTA.PMR.BIT.B6 = 1;
|
||||
|
||||
/* Configure MISOA */
|
||||
|
||||
MPC.PA7PFS.BYTE = 0x0d;
|
||||
PORTA.PMR.BIT.B7 = 1;
|
||||
|
||||
/* Configure SSLA0 */
|
||||
|
||||
MPC.PA4PFS.BYTE = 0x0d;
|
||||
PORTC.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RX65N_RSPI_CHANNEL1:
|
||||
#ifdef CONFIG_RX65N_RSPI1
|
||||
|
||||
/* Configure RSPCKB */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P27PFS.BYTE = 0x0d;
|
||||
PORT2.PMR.BIT.B7 = 1;
|
||||
#else
|
||||
MPC.PE5PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B5 = 1;
|
||||
#endif
|
||||
|
||||
/* Configure MOSIB */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P26PFS.BYTE = 0x0d;
|
||||
PORT2.PMR.BIT.B6 = 1;
|
||||
#else
|
||||
MPC.PE6PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B6 = 1;
|
||||
#endif
|
||||
|
||||
/* Configure MISOB */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P30PFS.BYTE = 0x0d;
|
||||
PORT3.PMR.BIT.BT0 = 1;
|
||||
#else
|
||||
MPC.PE7PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B7 = 1;
|
||||
#endif
|
||||
|
||||
/* Configure SSLB0 */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P57PFS.BYTE = 0x0d;
|
||||
PORT5.PMR.BIT.B7 = 1;
|
||||
#else
|
||||
MPC.PE4PFS.BYTE = 0x0d;
|
||||
PORTE.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RX65N_RSPI_CHANNEL2:
|
||||
#ifdef CONFIG_RX65N_RSPI2
|
||||
|
||||
/* Configure RSPCKC */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P56PFS.BYTE = 0x0d;
|
||||
PORT5.PMR.BIT.B6 = 1;
|
||||
#else
|
||||
MPC.PD3PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B3 = 1;
|
||||
#endif
|
||||
/* Configure MOSIC */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P54PFS.BYTE = 0x0d;
|
||||
PORT5.PMR.BIT.B4 = 1;
|
||||
#else
|
||||
MPC.PD1PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B1 = 1;
|
||||
#endif
|
||||
|
||||
/* Configure MISOC */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P55PFS.BYTE = 0x0d;
|
||||
PORT5.PMR.BIT.B5 = 1;
|
||||
#else
|
||||
MPC.PD2PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B2 = 1;
|
||||
#endif
|
||||
|
||||
/* Configure SSLC0 */
|
||||
|
||||
#if DSW_SEL0_ON
|
||||
MPC.P57PFS.BYTE = 0x0d;
|
||||
PORT5.PMR.BIT.B7 = 1;
|
||||
#else
|
||||
MPC.PD4PFS.BYTE = 0x0d;
|
||||
PORTD.PMR.BIT.B4 = 1;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic0_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC0 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC0
|
||||
inline void riic0_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P12) */
|
||||
|
||||
MPC.P12PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B2 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P13) */
|
||||
|
||||
MPC.P13PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B3 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic1_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC1 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC1
|
||||
inline void riic1_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P21) */
|
||||
|
||||
MPC.P21PFS.BYTE = 0x0fu;
|
||||
PORT2.PMR.BIT.B1 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P20) */
|
||||
|
||||
MPC.P20PFS.BYTE = 0x0fu;
|
||||
PORT2.PMR.BIT.BT0 = 1u;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: riic2_init_port
|
||||
*
|
||||
* Description:
|
||||
* RIIC2 Initialization RX65N RSK2MB
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RX65N_RIIC2
|
||||
inline void riic2_init_port(void)
|
||||
{
|
||||
/* Set SCL0 pin (P16) */
|
||||
|
||||
MPC.P16PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B6 = 1u;
|
||||
|
||||
/* Set SDA0 pin (P17) */
|
||||
|
||||
MPC.P17PFS.BYTE = 0x0fu;
|
||||
PORT1.PMR.BIT.B7 = 1u;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BOARD_RX65N_RSK2MB */
|
||||
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_rsk2mb.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H
|
||||
#define __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_sbsram_int
|
||||
*
|
||||
* Description:
|
||||
* Initialize SBRAM Driver
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
int rx65n_sbram_int(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RENESAS_RX65N_GRROSE_SRC_RX65N_GRROSE_H */
|
||||
@@ -0,0 +1,479 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include "up_internal.h"
|
||||
#include "rx65n_sbram.h"
|
||||
#include "rx65n_rsk2mb.h"
|
||||
#ifdef CONFIG_RX65N_SBRAM
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define FREEZE_STR(s) #s
|
||||
#define STRINGIFY(s) FREEZE_STR(s)
|
||||
#define HARDFAULT_FILENO 3
|
||||
#define HARDFAULT_PATH SBRAM_PATH""STRINGIFY(HARDFAULT_FILENO)
|
||||
#define HARDFAULT_REBOOT_ FILENO 0
|
||||
#define HARDFAULT_REBOOT_PATH SBRAM_PATH""STRINGIFY(HARDFAULT_REBOOT_FILENO)
|
||||
|
||||
#define SBRAM_SIZE_FN0 (sizeof(int))
|
||||
#define SBRAM_SIZE_FN1 384
|
||||
#define SBRAM_SIZE_FN2 384
|
||||
#define SBRAM_SIZE_FN3 - 1
|
||||
|
||||
/* The following guides in the amount of the user and interrupt stack
|
||||
* data we can save. The amount of storage left will dictate the actual
|
||||
* number of entries of the user stack data saved. If it is too big
|
||||
* It will be truncated by the call to rx65n_sbram_savepanic
|
||||
*/
|
||||
|
||||
#define SBRAM_HEADER_SIZE 20 /* This is an assumption */
|
||||
#define SBRAM_USED ((4*SBRAM_HEADER_SIZE)+ \
|
||||
(SBRAM_SIZE_FN0+SBRAM_SIZE_FN1+ \
|
||||
SBRAM_SIZE_FN2))
|
||||
#define SBRAM_REAMINING (RX65N_SBRAM_SIZE-SBRAM_USED)
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK <= 3
|
||||
# define SBRAM_NUMBER_STACKS 1
|
||||
#else
|
||||
# define SBRAM_NUMBER_STACKS 2
|
||||
#endif
|
||||
#define SBRAM_FIXED_ELEMENTS_SIZE (sizeof(info_t))
|
||||
#define SBRAM_LEFTOVER (SBRAM_REAMINING-\
|
||||
SBRAM_FIXED_ELEMENTS_SIZE)
|
||||
|
||||
#define CONFIG_ISTACK_SIZE (SBRAM_LEFTOVER/SBRAM_NUMBER_STACKS/ \
|
||||
sizeof(stack_word_t))
|
||||
#define CONFIG_USTACK_SIZE (SBRAM_LEFTOVER/SBRAM_NUMBER_STACKS/ \
|
||||
sizeof(stack_word_t))
|
||||
|
||||
/* The path to the Standby RAM */
|
||||
|
||||
#define SBRAM_PATH "/fs/sbr"
|
||||
|
||||
/* The sizes of the files to create (-1) use rest of SBRAM memory */
|
||||
|
||||
#define SBRAM_FILE_SIZES \
|
||||
{ \
|
||||
SBRAM_SIZE_FN0, \
|
||||
SBRAM_SIZE_FN1, \
|
||||
SBRAM_SIZE_FN2, \
|
||||
SBRAM_SIZE_FN3, \
|
||||
0 \
|
||||
}
|
||||
|
||||
#define ARRAYSIZE(a) (sizeof((a))/sizeof(a[0]))
|
||||
|
||||
/* For Assert keep this much of the file name */
|
||||
|
||||
#define MAX_FILE_PATH_LENGTH 40
|
||||
|
||||
#define HEADER_TIME_FMT "%Y-%m-%d-%H:%M:%S"
|
||||
#define HEADER_TIME_FMT_NUM (2+ 0+ 0+ 0+ 0+ 0)
|
||||
#define HEADER_TIME_FMT_LEN (((ARRAYSIZE(HEADER_TIME_FMT)-1) + \
|
||||
HEADER_TIME_FMT_NUM))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Used for stack frame storage */
|
||||
|
||||
typedef uint32_t stack_word_t;
|
||||
|
||||
/* Stack related data */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sp;
|
||||
uint32_t top;
|
||||
uint32_t size;
|
||||
} _stack_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
_stack_t user;
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
_stack_t interrupt;
|
||||
#endif
|
||||
} stack_t;
|
||||
|
||||
/* Not Used for reference only */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sp;
|
||||
uint32_t acc0lo;
|
||||
uint32_t acc0hi;
|
||||
uint32_t acc0gu;
|
||||
uint32_t acc1lo;
|
||||
uint32_t acc1hi;
|
||||
uint32_t acc1gu;
|
||||
uint32_t fpsw;
|
||||
uint32_t r1;
|
||||
uint32_t r2;
|
||||
uint32_t r3;
|
||||
uint32_t r4;
|
||||
uint32_t r5;
|
||||
uint32_t r6;
|
||||
uint32_t r7;
|
||||
uint32_t r8;
|
||||
uint32_t r9;
|
||||
uint32_t r10;
|
||||
uint32_t r11;
|
||||
uint32_t r12;
|
||||
uint32_t r13;
|
||||
uint32_t r14;
|
||||
uint32_t r15;
|
||||
uint32_t pc;
|
||||
uint32_t psw;
|
||||
} proc_regs_t;
|
||||
|
||||
/* Flags to identify what is in the dump */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REGS_PRESENT = 0x01,
|
||||
USERSTACK_PRESENT = 0x02,
|
||||
INTSTACK_PRESENT = 0x04,
|
||||
INVALID_USERSTACK_PTR = 0x20,
|
||||
INVALID_INTSTACK_PTR = 0x40,
|
||||
} fault_flags_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fault_flags_t flags; /* What is in the dump */
|
||||
uintptr_t current_regs; /* Used to validate the dump */
|
||||
int lineno; /* __LINE__ to up_assert */
|
||||
int pid; /* Process ID */
|
||||
uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */
|
||||
stack_t stacks; /* Stack info */
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL
|
||||
* terminator) */
|
||||
#endif
|
||||
char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in
|
||||
* __FILE__ to up_assert */
|
||||
} info_t;
|
||||
|
||||
struct fullcontext
|
||||
{
|
||||
info_t info; /* The info */
|
||||
|
||||
/* The amount of stack data is compile time sized backed on what is left
|
||||
* after the other standby ram files are defined the order is such that
|
||||
* only the ustack should be truncated
|
||||
*/
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
stack_word_t istack[CONFIG_USTACK_SIZE];
|
||||
#endif
|
||||
stack_word_t ustack[CONFIG_ISTACK_SIZE];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uint8_t g_sdata[RX65N_SBRAM_SIZE];
|
||||
extern int istack;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hardfault_get_desc
|
||||
****************************************************************************/
|
||||
|
||||
static int hardfault_get_desc(struct sbramd_s *desc)
|
||||
{
|
||||
FAR struct file filestruct;
|
||||
int ret;
|
||||
|
||||
ret = file_open(&filestruct, HARDFAULT_PATH, O_RDONLY);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to open Fault Log file [%s] "
|
||||
"(%d)\n", HARDFAULT_PATH, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = file_ioctl(&filestruct, RX65N_SBRAM_GETDESC_IOCTL,
|
||||
(unsigned long)((uintptr_t)desc));
|
||||
(void)file_close(&filestruct);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to get Fault Log descriptor "
|
||||
"(%d)\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: copy_reverse
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
*dest++ = *src--;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: rx65n_sbram_int
|
||||
****************************************************************************/
|
||||
|
||||
int rx65n_sbram_int(void)
|
||||
{
|
||||
int filesizes[CONFIG_RX65N_SBRAM_FILES + 1] = SBRAM_FILE_SIZES;
|
||||
char buf[HEADER_TIME_FMT_LEN + 1];
|
||||
struct sbramd_s desc;
|
||||
int rv;
|
||||
int state;
|
||||
struct tm tt;
|
||||
time_t time_sec;
|
||||
|
||||
/* Using Standby RAM */
|
||||
|
||||
rx65n_sbraminitialize(SBRAM_PATH, filesizes);
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
/* Panic Logging in Standby RAM Files */
|
||||
|
||||
/* Do we have an hard fault in SBRAM? */
|
||||
|
||||
rv = hardfault_get_desc(&desc);
|
||||
if (rv >= OK)
|
||||
{
|
||||
syslog(LOG_EMERG, "There is a hard fault logged.\n");
|
||||
state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1;
|
||||
|
||||
syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x "
|
||||
"state:%d\n", (unsigned int)desc.fileno, (unsigned int) desc.len,
|
||||
(unsigned int)desc.flags, state);
|
||||
|
||||
if (state == OK)
|
||||
{
|
||||
time_sec = desc.lastwrite.tv_sec + (desc.lastwrite.tv_nsec / 1e9);
|
||||
gmtime_r(&time_sec, &tt);
|
||||
strftime(buf, HEADER_TIME_FMT_LEN , HEADER_TIME_FMT , &tt);
|
||||
|
||||
syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf);
|
||||
}
|
||||
|
||||
rv = nx_unlink(HARDFAULT_PATH);
|
||||
if (rv < 0)
|
||||
{
|
||||
syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file"
|
||||
" [%s] (%d)\n", HARDFAULT_PATH, rv);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_crashdump
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_RX65N_SAVE_CRASHDUMP)
|
||||
void board_crashdump(uintptr_t currentsp, FAR void *tcb,
|
||||
FAR const char *filename, int lineno)
|
||||
{
|
||||
struct fullcontext *pdump ;
|
||||
pdump = (struct fullcontext *)&g_sdata;
|
||||
FAR struct tcb_s *rtcb;
|
||||
int rv;
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
rtcb = (FAR struct tcb_s *)tcb;
|
||||
|
||||
/* Zero out everything */
|
||||
|
||||
memset((uint8_t *)pdump, 0, sizeof(struct fullcontext));
|
||||
|
||||
/* Save Info */
|
||||
|
||||
pdump->info.lineno = lineno;
|
||||
|
||||
if (filename)
|
||||
{
|
||||
int offset = 0;
|
||||
unsigned int len = strlen((char *)filename) + 1;
|
||||
|
||||
if (len > sizeof(pdump->info.filename))
|
||||
{
|
||||
offset = len - sizeof(pdump->info.filename);
|
||||
}
|
||||
|
||||
strncpy((char *)pdump->info.filename, (char *)&filename[offset],
|
||||
sizeof(pdump->info.filename));
|
||||
}
|
||||
|
||||
/* Save the value of the pointer for current_regs as debugging info.
|
||||
* It should be NULL in case of an ASSERT and will aid in cross
|
||||
* checking the validity of system memory at the time of the
|
||||
* fault.
|
||||
*/
|
||||
|
||||
pdump->info.current_regs = (uintptr_t) g_current_regs;
|
||||
|
||||
/* Save Context */
|
||||
|
||||
#if CONFIG_TASK_NAME_SIZE > 0
|
||||
strncpy(pdump->info.name, rtcb->name, CONFIG_TASK_NAME_SIZE);
|
||||
#endif
|
||||
|
||||
pdump->info.pid = rtcb->pid;
|
||||
|
||||
/* If current_regs is not NULL then we are in an interrupt context
|
||||
* and the user context is in current_regs else we are running in
|
||||
* the users context
|
||||
*/
|
||||
|
||||
if (g_current_regs)
|
||||
{
|
||||
pdump->info.stacks.interrupt.sp = currentsp;
|
||||
pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \
|
||||
INTSTACK_PRESENT);
|
||||
memcpy((uint8_t *)pdump->info.regs, (void *)g_current_regs,
|
||||
sizeof(pdump->info.regs));
|
||||
pdump->info.stacks.user.sp = pdump->info.regs[REG_SP];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* users context */
|
||||
|
||||
pdump->info.flags |= USERSTACK_PRESENT;
|
||||
pdump->info.stacks.user.sp = currentsp;
|
||||
}
|
||||
|
||||
pdump->info.stacks.user.top = (uint32_t) rtcb->adj_stack_ptr;
|
||||
pdump->info.stacks.user.size = (uint32_t) rtcb->adj_stack_size;
|
||||
|
||||
#if CONFIG_ARCH_INTERRUPTSTACK > 3
|
||||
/* Get the limits on the interrupt stack memory */
|
||||
|
||||
pdump->info.stacks.interrupt.top = (uint32_t)&istack;
|
||||
pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK);
|
||||
|
||||
/* If In interrupt Context save the interrupt stack data centered
|
||||
* about the interrupt stack pointer
|
||||
*/
|
||||
|
||||
if ((pdump->info.flags & INTSTACK_PRESENT) != 0)
|
||||
{
|
||||
stack_word_t *ps = (stack_word_t *) pdump->info.stacks.interrupt.sp;
|
||||
copy_reverse((stack_word_t *)pdump->istack,
|
||||
&ps[ARRAYSIZE(pdump->istack) / 2],
|
||||
ARRAYSIZE(pdump->istack));
|
||||
}
|
||||
|
||||
/* Is it Invalid? */
|
||||
|
||||
if (!(pdump->info.stacks.interrupt.sp <= pdump->info.stacks.interrupt.top
|
||||
&& pdump->info.stacks.interrupt.sp > pdump->info.stacks.interrupt.top -
|
||||
pdump->info.stacks.interrupt.size))
|
||||
{
|
||||
pdump->info.flags |= INVALID_INTSTACK_PTR;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* If In interrupt context or User save the user stack data centered
|
||||
* about the user stack pointer
|
||||
*/
|
||||
|
||||
if ((pdump->info.flags & USERSTACK_PRESENT) != 0)
|
||||
{
|
||||
stack_word_t *ps = (stack_word_t *) pdump->info.stacks.user.sp;
|
||||
copy_reverse((stack_word_t *)pdump->ustack,
|
||||
&ps[ARRAYSIZE(pdump->ustack) / 2],
|
||||
ARRAYSIZE(pdump->ustack));
|
||||
}
|
||||
|
||||
/* Is it Invalid? */
|
||||
|
||||
if (!(pdump->info.stacks.user.sp <= pdump->info.stacks.user.top &&
|
||||
pdump->info.stacks.user.sp > pdump->info.stacks.user.top -
|
||||
pdump->info.stacks.user.size))
|
||||
{
|
||||
pdump->info.flags |= INVALID_USERSTACK_PTR;
|
||||
}
|
||||
|
||||
rv = rx65n_sbram_savepanic(HARDFAULT_FILENO, (uint8_t *)pdump,
|
||||
sizeof(struct fullcontext));
|
||||
|
||||
/* Test if memory got wiped because of using _sdata */
|
||||
|
||||
if (rv == -ENXIO)
|
||||
{
|
||||
char *dead = "Memory wiped - dump not saved!";
|
||||
|
||||
while (*dead)
|
||||
{
|
||||
up_lowputc(*dead++);
|
||||
}
|
||||
}
|
||||
else if (rv == -ENOSPC)
|
||||
{
|
||||
/* hard fault again */
|
||||
|
||||
up_lowputc('!');
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_RX65N_SAVE_CRASHDUMP */
|
||||
|
||||
#endif /* CONFIG_RX65N_SBRAM */
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_RX65N
|
||||
endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="rx65n"
|
||||
CONFIG_ARCH_BOARD_RX65N=y
|
||||
CONFIG_ARCH_CHIP="rx65n"
|
||||
CONFIG_ARCH_CHIP_R5F565NEDDFC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1024
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=262144
|
||||
CONFIG_RAM_START=0x00000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RX65N_SCI2=y
|
||||
CONFIG_SCI2_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,150 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n/include/board.h
|
||||
*
|
||||
* Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Anjana <anjana@tataelxsi.co.in>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_RX65N_RX65N_INCLUDE_BOARD_H
|
||||
#define __BOARDS_RENESAS_RX65N_RX65N_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define RX_CLK_1MHz (1000UL * 1000UL)
|
||||
#define RX_FCLK ( 60 * RX_CLK_1MHz)
|
||||
#define RX_ICLK (120 * RX_CLK_1MHz)
|
||||
#define RX_PCLKA (120 * RX_CLK_1MHz)
|
||||
#define RX_PCLKB ( 60 * RX_CLK_1MHz)
|
||||
#define RX_PCLKC ( 60 * RX_CLK_1MHz)
|
||||
#define RX_PCLKD ( 60 * RX_CLK_1MHz)
|
||||
#define RX_BCK (120 * RX_CLK_1MHz)
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB) || defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define RX_RESONATOR ( 12 * RX_CLK_1MHz)
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define RX_RESONATOR ( 24 * RX_CLK_1MHz)
|
||||
#else
|
||||
#error "Please definition RX_RESONATOR in board.h"
|
||||
#endif
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_BOARD_RX65N_RSK1MB)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_RSK2MB)
|
||||
#define LED0 (PORT7.PODR.BIT.B3)
|
||||
#define LED1 (PORTG.PODR.BIT.B7)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT7.ODR0.BIT.B6 = PORTG.ODR1.BIT.B6 = 0; \
|
||||
PORT7.DSCR.BIT.B3 = PORTG.DSCR.BIT.B7 = 1; \
|
||||
PORT7.DSCR2.BIT.B3 = PORTG.DSCR2.BIT.B7 = 0; \
|
||||
PORT7.PMR.BIT.B3 = PORTG.PMR.BIT.B7 = 0; \
|
||||
PORT7.PDR.BIT.B3 = PORTG.PDR.BIT.B7 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N)
|
||||
#define LED0 (PORT0.PODR.BIT.B3)
|
||||
#define LED1 (PORT0.PODR.BIT.B5)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORT0.ODR0.BIT.B6 = PORT0.ODR1.BIT.B2 = 0; \
|
||||
PORT0.DSCR.BIT.B3 = PORT0.DSCR.BIT.B5 = 1; \
|
||||
PORT0.PMR.BIT.B3 = PORT0.PMR.BIT.B5 = 0; \
|
||||
PORT0.PDR.BIT.B3 = PORT0.PDR.BIT.B5 = 1; \
|
||||
}
|
||||
#elif defined(CONFIG_ARCH_BOARD_RX65N_GRROSE)
|
||||
#define LED0 (PORTA.PODR.BIT.BT0)
|
||||
#define LED1 (PORTA.PODR.BIT.B1)
|
||||
#define LED_PORTINIT(X) { LED0 = LED1 = (X); \
|
||||
PORTA.ODR0.BIT.BT0 = PORTA.ODR0.BIT.B2 = 0; \
|
||||
PORTA.DSCR.BIT.BT0 = PORTA.DSCR.BIT.B1 = 1; \
|
||||
PORTA.DSCR2.BIT.BT0 = PORTA.DSCR2.BIT.B1 = 0; \
|
||||
PORTA.PMR.BIT.BT0 = PORTA.PMR.BIT.B1 = 0; \
|
||||
PORTA.PDR.BIT.BT0 = PORTA.PDR.BIT.B1 = 1; \
|
||||
}
|
||||
#else
|
||||
#error "LEDs are not defined."
|
||||
#endif
|
||||
|
||||
#define LED_STARTED 1 /* ON OFF NC NC */
|
||||
#define LED_HEAPALLOCATE 0 /* NC NC NC NC */
|
||||
#define LED_IRQSENABLED 0 /* NC NC NC NC */
|
||||
#define LED_STACKCREATED 2 /* ON ON NC NC */
|
||||
#define LED_INIRQ 0 /* NC NC NC NC */
|
||||
#define LED_SIGNAL 0 /* NC NC NC NC */
|
||||
#define LED_ASSERTION 0 /* NC NC NC NC */
|
||||
#define LED_PANIC 3 /* OFF ON NC NC (flashing 2Hz) */
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_RX65N_RX65N_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,92 @@
|
||||
##############################################################################
|
||||
# boards/renesas/rx65n/rx65n/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld}"
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)linker_script.ld
|
||||
endif
|
||||
|
||||
CROSSDEV = rx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E -P -x c
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
AS = $(CROSSDEV)as
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHCFLAGS = -std=c99 -fno-builtin
|
||||
ARCHCPUFLAGS = -mcpu=rx64m
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) $(ARCHWARNINGSXX)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
LDMODULEFLAGS = -r -e module_initialize
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
|
||||
else
|
||||
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
ASMEXT = .asm
|
||||
@@ -0,0 +1,176 @@
|
||||
MEMORY
|
||||
{
|
||||
/* RSK-RX65N-1MB */
|
||||
/*
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
ROM : ORIGIN = 0xFFF00000, LENGTH = 1048576
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
*/
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
RAM : ORIGIN = 0x0, LENGTH = 262144
|
||||
RAMHI : ORIGIN = 0x800000, LENGTH = 393216
|
||||
ROM : ORIGIN = 0xFFE00000, LENGTH = 2097152
|
||||
OFS : ORIGIN = 0xFE7F5D00, LENGTH = 256
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.exvectors 0xFFFFFF80: AT(0xFFFFFF80)
|
||||
{
|
||||
_exvectors_start = .;
|
||||
KEEP(*(.exvectors))
|
||||
_exvectors_end = .;
|
||||
} > ROM
|
||||
.fvectors 0xFFFFFFFC: AT(0xFFFFFFFC)
|
||||
{
|
||||
KEEP(*(.fvectors))
|
||||
} > ROM
|
||||
/* RSK-RX65N-1MB */
|
||||
|
||||
.text 0xFFF00000: AT(0xFFF00000)
|
||||
|
||||
/* RSK-RX65N-2MB | GR-ROSE */
|
||||
/*.text 0xFFE00000: AT(0xFFE00000) */
|
||||
{
|
||||
*(.text)
|
||||
. = ALIGN(4);
|
||||
*(.text.*)
|
||||
. = ALIGN(4);
|
||||
*(P)
|
||||
etext = .;
|
||||
} > ROM
|
||||
.rvectors :
|
||||
{
|
||||
_rvectors_start = .;
|
||||
KEEP(*(.rvectors))
|
||||
_rvectors_end = .;
|
||||
} > ROM
|
||||
/*.exvectors :
|
||||
{
|
||||
_exvectors_start = .;
|
||||
KEEP(*(.exvectors))
|
||||
_exvectors_end = .;
|
||||
} > ROM */
|
||||
.init :
|
||||
{
|
||||
KEEP(*(.init))
|
||||
__preinit_array_start = .;
|
||||
KEEP(*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
__init_array_start = (. + 3) & ~ 3;
|
||||
KEEP(*(.init_array))
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
__init_array_end = .;
|
||||
__fini_array_start = .;
|
||||
KEEP(*(.fini_array))
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
} > ROM
|
||||
.fini :
|
||||
{
|
||||
KEEP(*(.fini))
|
||||
} > ROM
|
||||
.got :
|
||||
{
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
} > ROM
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(C_1)
|
||||
*(C_2)
|
||||
*(C)
|
||||
_erodata = .;
|
||||
} > ROM
|
||||
.eh_frame_hdr :
|
||||
{
|
||||
*(.eh_frame_hdr)
|
||||
} > ROM
|
||||
.eh_frame :
|
||||
{
|
||||
*(.eh_frame)
|
||||
} > ROM
|
||||
.jcr :
|
||||
{
|
||||
*(.jcr)
|
||||
} > ROM
|
||||
.tors :
|
||||
{
|
||||
__CTOR_LIST__ = .;
|
||||
. = ALIGN(2);
|
||||
___ctors = .;
|
||||
*(.ctors)
|
||||
___ctors_end = .;
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
___dtors = .;
|
||||
*(.dtors)
|
||||
___dtors_end = .;
|
||||
__DTOR_END__ = .;
|
||||
. = ALIGN(2);
|
||||
_mdata = .;
|
||||
} > ROM
|
||||
.ustack 0x400: AT(0x200)
|
||||
{
|
||||
_ustack = .;
|
||||
} > RAM
|
||||
.istack 0x200: AT(0x200)
|
||||
{
|
||||
_istack = .;
|
||||
} > RAM
|
||||
.data 0x404: AT(_mdata)
|
||||
{
|
||||
_data = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(D)
|
||||
*(D_1)
|
||||
*(D_2)
|
||||
_edata = .;
|
||||
} > RAM
|
||||
.gcc_exc :
|
||||
{
|
||||
*(.gcc_exc)
|
||||
} > RAM
|
||||
.bss :
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
*(.bss.**)
|
||||
*(COMMON)
|
||||
*(B)
|
||||
*(B_1)
|
||||
*(B_2)
|
||||
_ebss = .;
|
||||
_end = .;
|
||||
} >RAM
|
||||
.ofs1 0xFE7F5D40: AT(0xFE7F5D00)
|
||||
{
|
||||
KEEP(*(.ofs1))
|
||||
} > OFS
|
||||
.ofs2 0xFE7F5D48: AT(0xFE7F5D10)
|
||||
{
|
||||
KEEP(*(.ofs2))
|
||||
} > OFS
|
||||
.ofs3 0xFE7F5D50: AT(0xFE7F5D40)
|
||||
{
|
||||
KEEP(*(.ofs3))
|
||||
} > OFS
|
||||
.ofs4 0xFE7F5D10: AT(0xFE7F5D48)
|
||||
{
|
||||
KEEP(*(.ofs4))
|
||||
} > OFS
|
||||
.ofs5 0xFE7F5D10: AT(0xFE7F5D50)
|
||||
{
|
||||
KEEP(*(.ofs5))
|
||||
} > OFS
|
||||
.ofs6 0xFE7F5D10: AT(0xFE7F5D64)
|
||||
{
|
||||
KEEP(*(.ofs6))
|
||||
} > OFS
|
||||
.ofs7 0xFE7F5D10: AT(0xFE7F5D70)
|
||||
{
|
||||
KEEP(*(.ofs7))
|
||||
} > OFS
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
############################################################################
|
||||
# boards/renesas/rx65n/rx65n/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Anjana <anjana@tataelxsi.co.in>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = rx65n_main.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/rx65n/rx65n/src/rx65n_main.c
|
||||
*
|
||||
* Copyright (C) 2008-2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Anjana <anjana@tataelxsi.co.in>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "rx65n_macrodriver.h"
|
||||
#include "arch/board/board.h"
|
||||
#include "rx65n_definitions.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_on(int led)
|
||||
{
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
*
|
||||
* Description:
|
||||
* Turns on LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
LED0 = LED_ON;
|
||||
LED1 = LED_ON;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled1_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled1_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled2_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled2_off(int led)
|
||||
{
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
*
|
||||
* Description:
|
||||
* Turns off LED 0 & LED 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
LED0 = LED_OFF;
|
||||
LED1 = LED_OFF;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_TWR_K60N512
|
||||
endif
|
||||
@@ -0,0 +1,151 @@
|
||||
Status
|
||||
^^^^^^
|
||||
|
||||
*** UNSTABLE ***
|
||||
The port is basically complete and many examples run correctly. However, there
|
||||
are remaining instabilities that make the port un-usable. The nature of these
|
||||
is not understood; the behavior is that certain SH-1 instructions stop working
|
||||
as advertised. This could be a silicon problem, some pipeline issue that is not
|
||||
handled properly by the gcc 3.4.5 toolchain (which has very limited SH-1 support
|
||||
to begin with), or perhaps with the CMON debugger. At any rate, I have exhausted
|
||||
all of the energy that I am willing to put into this cool old processor for the
|
||||
time being.
|
||||
|
||||
Toolchain
|
||||
^^^^^^^^^
|
||||
|
||||
A GNU GCC-based toolchain is assumed. The PATH environment variable should
|
||||
be modified to point to the correct path to the SH toolchain (if
|
||||
different from the default).
|
||||
|
||||
If you have no SH toolchain, one can be downloaded from the NuttX
|
||||
Bitbucket download site (https://bitbucket.org/nuttx/buildroot/downloads/).
|
||||
|
||||
1. You must have already configured NuttX in <some-dir>nuttx.
|
||||
|
||||
tools/configure.sh us7032evb1:<sub-dir>
|
||||
|
||||
2. Download the latest buildroot package into <some-dir>
|
||||
|
||||
3. unpack
|
||||
|
||||
4. cd <some-dir>/buildroot
|
||||
|
||||
5. cp boards/sh-defconfig .config
|
||||
|
||||
6. make oldconfig
|
||||
|
||||
7. make
|
||||
|
||||
8. Make sure that the PATH variable includes the path to the newly built
|
||||
binaries.
|
||||
|
||||
shterm
|
||||
^^^^^^
|
||||
|
||||
The USB7032EVB1 supports CMON in PROM. CMON requires special
|
||||
serial interactions in order to upload and download program files.
|
||||
Therefore, a standard terminal emulation program (such as minicom)
|
||||
cannot be used.
|
||||
|
||||
The shterm subdirectory contains a small terminal emulation
|
||||
program that supports these special interactions for file transfers.
|
||||
|
||||
Configurations
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Common Configuration Notes
|
||||
--------------------------
|
||||
|
||||
1. Each SH-1 configuration is maintained in a sub-directory and
|
||||
can be selected as follow:
|
||||
|
||||
tools/configure.sh us7032evb1:<subdir>
|
||||
|
||||
Where <subdir> is one of the configuration sub-directories described in
|
||||
the following paragraph.
|
||||
|
||||
2. These configurations use the mconf-based configuration tool. To
|
||||
change a configurations using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
3. By default, all configurations assume that you are building under
|
||||
Linux (should work under Windows with Cygwin as well). This is
|
||||
is easily reconfigured:
|
||||
|
||||
CONFIG_HOST_LINUX=y
|
||||
|
||||
Configuration Sub-Directories
|
||||
-----------------------------
|
||||
|
||||
ostest
|
||||
|
||||
This configuration directory, performs a simple OS test using
|
||||
examples/ostest.
|
||||
|
||||
nsh
|
||||
|
||||
Configures the NuttShell (nsh) located at examples/nsh. The
|
||||
Configuration enables only the serial NSH interfaces.
|
||||
|
||||
NOTE: At present, the NSH example does not run. See the "Status"
|
||||
discussion above for a full explanation.
|
||||
|
||||
Configuration Options
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In additional to the common configuration options listed in the
|
||||
file boards/README.txt, there are other configuration options
|
||||
specific to the SH-1
|
||||
|
||||
Architecture selection
|
||||
|
||||
CONFIG_ARCH - identifies the arch subdirectory and, hence, the
|
||||
processor architecture. This should be renesas (for arch/renesas)
|
||||
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory.
|
||||
This should be sh1 (for arch/renesas/src/sh1 and arch/renesas/include/sh1)
|
||||
CONFIG_ARCH_SH1 and CONFIG_ARCH_CHIP_SH7032 - for use in C code. These
|
||||
identify the particular chip or SoC that the architecture is
|
||||
implemented in.
|
||||
CONFIG_ARCH_BOARD - identifies the boards/ subdirectory and, hence,
|
||||
the board that supports the particular chip or SoC. This
|
||||
should be us7032evb1 for (boards/renesas/sh1/us7032evb1).
|
||||
CONFIG_ARCH_BOARD_US7032EVB1 - for use in C code
|
||||
CONFIG_ENDIAN_BIG - the SH-1 usually runs big-endian
|
||||
CONFIG_ARCH_NOINTC - define if the architecture does not
|
||||
support an interrupt controller or otherwise cannot support
|
||||
APIs like up_enable_irq() and up_disable_irq(). Should be
|
||||
defined.
|
||||
CONFIG_BOARD_LOOPSPERMSEC - for delay loops
|
||||
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to SH1_LCEVB1
|
||||
CONFIG_RAM_SIZE - Describes the internal DRAM.
|
||||
CONFIG_RAM_START - The start address of internal DRAM
|
||||
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||
stack. If defined, this symbol is the size of the interrupt
|
||||
stack in bytes. If not defined, the user task stacks will be
|
||||
used during interrupt handling.
|
||||
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||
|
||||
CONFIG_SH1_DMAC0, CONFIG_SH1_DMAC1, CONFIG_SH1_DMAC2, CONFIG_SH1_DMAC3,
|
||||
CONFIG_SH1_ITU1, CONFIG_SH1_ITU2, CONFIG_SH1_ITU3, CONFIG_SH1_ITU4,
|
||||
CONFIG_SH1_SCI0, CONFIG_SH1_SCI1, CONFIG_SH1_PCU, CONFIG_SH1_AD,
|
||||
CONFIG_SH1_WDT, CONFIG_SH1_CMI - Each unused chip block should b
|
||||
disabled to save space
|
||||
|
||||
SH1 specific device driver settings
|
||||
|
||||
CONFIG_SCIn_SERIAL_CONSOLE - selects the SCIn for the
|
||||
console and ttys0 (default is the UART0).
|
||||
CONFIG_SCIn_RXBUFSIZE - Characters are buffered as received.
|
||||
This specific the size of the receive buffer
|
||||
CONFIG_SCIn_TXBUFSIZE - Characters are buffered before
|
||||
being sent. This specific the size of the transmit buffer
|
||||
CONFIG_SCIn_BAUD - The configure BAUD of the UART. Must be
|
||||
CONFIG_SCIn_BITS - The number of bits. Must be either 7 or 8.
|
||||
CONFIG_SCIn_PARTIY - 0=no parity, 1=odd parity, 2=even parity, 3=mark 1, 4=space 0
|
||||
CONFIG_SCIn_2STOP - Two stop bits
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="us7032evb1"
|
||||
CONFIG_ARCH_BOARD_US7032EVB1=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="sh1"
|
||||
CONFIG_ARCH_CHIP_SH7032=y
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=572
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_DISABLE_PTHREAD=y
|
||||
CONFIG_ENDIAN_BIG=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=57344
|
||||
CONFIG_RAM_START=0x0a002000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_SCI1_BAUD=9600
|
||||
CONFIG_SCI1_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SH1_SCI1=y
|
||||
CONFIG_START_DAY=10
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2008
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
CONFIG_ARCH="renesas"
|
||||
CONFIG_ARCH_BOARD="us7032evb1"
|
||||
CONFIG_ARCH_BOARD_US7032EVB1=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="sh1"
|
||||
CONFIG_ARCH_CHIP_SH7032=y
|
||||
CONFIG_ARCH_RENESAS=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=572
|
||||
CONFIG_CONSOLE_SYSLOG=y
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_DISABLE_PTHREAD=y
|
||||
CONFIG_ENDIAN_BIG=y
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1024
|
||||
CONFIG_RAM_SIZE=57344
|
||||
CONFIG_RAM_START=0x0a002000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_SCI1_BAUD=9600
|
||||
CONFIG_SCI1_SERIAL_CONSOLE=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SH1_SCI1=y
|
||||
CONFIG_START_DAY=10
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2008
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3
|
||||
CONFIG_TESTING_OSTEST_STACKSIZE=4096
|
||||
CONFIG_USERMAIN_STACKSIZE=1024
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/sh1/us7032evb1/configs/ostest/ld.script
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
OUTPUT_ARCH(sh)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
/* The us7032evb1 has CMON in PROM beginning at address 0x00000000 and
|
||||
* either 64Kb or 256Kb of SRAM beginning at 0x0a000000. Neither the
|
||||
* PROM nor the first 8Kb of SRAM are available to the devoleper as these
|
||||
* are used by CMON. The next 1Kb of SRAM is dedicated to relocated
|
||||
* interrupt vectors.
|
||||
*/
|
||||
|
||||
. = 0x0a002000;
|
||||
.text : {
|
||||
_svect = ABSOLUTE(.);
|
||||
*(.vects); /* Relocated interrupt vectors */
|
||||
_evect = ABSOLUTE(.);
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.reset) /* Reset/IRQ code */
|
||||
*(.text) /* Code */
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata) /* Read-only data */
|
||||
*(.rodata.str1.4)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got) /* Global offset table */
|
||||
_etext = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.data : ALIGN(4) {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data) /* Modifiable data */
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.bss : ALIGN(4) { /* BSS */
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/sh1/us7032evb1/include/board.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RENESAS_SH7032_US7032EVB1_BOARD_H
|
||||
#define __BOARDS_RENESAS_SH7032_US7032EVB1_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#include "chip.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define SH1_CLOCK 20000000 /* 20 MHz */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
|
||||
* port B, pin 15 (selectable via JP8).
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0
|
||||
#define LED_HEAPALLOCATE 1
|
||||
#define LED_IRQSENABLED 1
|
||||
#define LED_STACKCREATED 1
|
||||
#define LED_INIRQ 0
|
||||
#define LED_SIGNAL 0
|
||||
#define LED_ASSERTION 0
|
||||
#define LED_PANIC 1
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BOARDS_RENESAS_SH7032_US7032EVB1_BOARD_H */
|
||||
@@ -0,0 +1,54 @@
|
||||
##############################################################################
|
||||
# boards/renesas/sh1/us7032evb1/scripts/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
include $(TOPDIR)/.config
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -m1 -fno-builtin
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)sdram.ld
|
||||
|
||||
CROSSDEV = sh-nuttx-elf-
|
||||
CC = $(CROSSDEV)gcc
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
CFLAGS := $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/sh1/us7032evb1/scripts/sram.ld
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
OUTPUT_ARCH(sh)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
/* The us7032evb1 has CMON in PROM beginning at address 0x00000000 and
|
||||
* either 64Kb or 256Kb of SRAM beginning at 0x0a000000. Neither the
|
||||
* PROM nor the first 8Kb of SRAM are available to the devoleper as these
|
||||
* are used by CMON. The next 1Kb of SRAM is dedicated to relocated
|
||||
* interrupt vectors.
|
||||
*/
|
||||
|
||||
. = 0x0a002000;
|
||||
.text : {
|
||||
_svect = ABSOLUTE(.);
|
||||
*(.vects); /* Relocated interrupt vectors */
|
||||
_evect = ABSOLUTE(.);
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.reset) /* Reset/IRQ code */
|
||||
*(.text) /* Code */
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata) /* Read-only data */
|
||||
*(.rodata.str1.4)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got) /* Global offset table */
|
||||
_etext = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data) /* Modifiable data */
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.bss : { /* BSS */
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
}
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
############################################################################
|
||||
# boards/renesas/sh1/us7032evb1/shterm/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
SRC = shterm.c
|
||||
BIN = shterm
|
||||
|
||||
all: ..$(DELIM)bin$(DELIM)$(BIN)$(EXEEXT)
|
||||
|
||||
$(BIN)$(EXEEXT): $(SRC)
|
||||
$(HOSTCC) $(HOSTCFLAGS) $^ -o $@
|
||||
|
||||
..$(DELIM)bin$(DELIM)$(BIN)$(EXEEXT): $(BIN)$(EXEEXT)
|
||||
install -m 0755 $^ $@
|
||||
|
||||
clean:
|
||||
$(call DELFILE, $(BIN)$(EXEEXT))
|
||||
$(call DELFILE..$(DELIM)bin$(DELIM)$(BIN)$(EXEEXT))
|
||||
$(call CLEAN)
|
||||
@@ -0,0 +1,814 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/sh1/us7032evb1/shterm/shterm.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Size of the circular buffer used for interrupt I/O */
|
||||
|
||||
#define MAX_FILEPATH 255
|
||||
|
||||
#define ENQ 5
|
||||
#define ACK 6
|
||||
|
||||
#define DEFAULT_BAUD 9600
|
||||
|
||||
#define _err(format, ...) if (debug > 0) printconsole(format, ##__VA_ARGS__)
|
||||
#define _info(format, ...) if (debug > 1) printconsole(format, ##__VA_ARGS__)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void sendfile(int fdtarg, char *filename, int verify);
|
||||
static void receivefile(int fdtarg, char *filename);
|
||||
static void getfilename(int fd, char *name);
|
||||
static int readbyte(int fd, char *ch);
|
||||
static void writebyte(int fd, char byte);
|
||||
static void close_tty(void);
|
||||
static void interrupt(int signo);
|
||||
static void show_usage(const char *progname, int exitcode);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static int debug = 0;
|
||||
static int g_fd = -1;
|
||||
static int g_fdnb = -1;
|
||||
static FILE *g_logstream = NULL;
|
||||
static const char g_dfttydev[] = "/dev/ttyS0";
|
||||
static const char *g_ttydev = g_dfttydev;
|
||||
static const char *g_logfile = 0;
|
||||
static int g_baud = DEFAULT_BAUD;
|
||||
static struct termios g_termios;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: putconsole
|
||||
****************************************************************************/
|
||||
|
||||
static void putconsole(char ch)
|
||||
{
|
||||
if (g_logstream)
|
||||
{
|
||||
putc(ch, g_logstream);
|
||||
}
|
||||
|
||||
putchar(ch);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: flushconsole
|
||||
****************************************************************************/
|
||||
|
||||
static void flushconsole(void)
|
||||
{
|
||||
if (g_logstream)
|
||||
{
|
||||
fflush(g_logstream);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: printconsole
|
||||
****************************************************************************/
|
||||
|
||||
static void printconsole(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
if (g_logstream)
|
||||
{
|
||||
vfprintf(g_logstream, fmt, ap);
|
||||
}
|
||||
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sendfile
|
||||
****************************************************************************/
|
||||
|
||||
static void sendfile(int fdtarg, char *filename, int verify)
|
||||
{
|
||||
char chin;
|
||||
char chout;
|
||||
int fdin;
|
||||
int nbytes;
|
||||
int ndots;
|
||||
int ret;
|
||||
|
||||
/* Source the source file */
|
||||
|
||||
fdin = open(filename, O_RDONLY);
|
||||
if (fdin < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to open '%s' for reading\n", filename);
|
||||
writebyte(fdin, '>');
|
||||
return;
|
||||
}
|
||||
|
||||
if (verify)
|
||||
{
|
||||
printconsole("Verifying file '%s':\n", filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
printconsole("Loading file '%s':\n", filename);
|
||||
}
|
||||
|
||||
flushconsole();
|
||||
|
||||
/* This loop processes each byte from the source file */
|
||||
|
||||
nbytes = 0;
|
||||
ndots = 0;
|
||||
|
||||
while ((ret = readbyte(fdin, &chout)) == 1)
|
||||
{
|
||||
/* If verbose debug is OFF, then output dots at a low rate */
|
||||
|
||||
if (debug < 2)
|
||||
{
|
||||
if (++nbytes > 64)
|
||||
{
|
||||
nbytes = 0;
|
||||
putconsole('.');
|
||||
|
||||
if (++ndots > 72)
|
||||
{
|
||||
putconsole('\n');
|
||||
ndots = 0;
|
||||
}
|
||||
|
||||
flushconsole();
|
||||
}
|
||||
}
|
||||
|
||||
/* If verbose debug is ON, dump everything */
|
||||
|
||||
else if (chout == 'S')
|
||||
{
|
||||
printconsole("\n[%c", chout);
|
||||
}
|
||||
else if (isprint(chout))
|
||||
{
|
||||
printconsole("[%c", chout);
|
||||
}
|
||||
else
|
||||
{
|
||||
printconsole("[.");
|
||||
}
|
||||
|
||||
/* Send the byte to the target */
|
||||
|
||||
writebyte(fdtarg, chout);
|
||||
|
||||
/* Get the response from the target. Loop until the target responds by
|
||||
* either echoing the byte sent or by sending '>'
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
ret = readbyte(fdtarg, &chin);
|
||||
|
||||
/* If verbose debug is ON, echo the response from the target */
|
||||
|
||||
if (ret == 1 && debug >= 2)
|
||||
{
|
||||
if (chin != chout)
|
||||
{
|
||||
if (isprint(chin))
|
||||
{
|
||||
putconsole(chin);
|
||||
}
|
||||
else
|
||||
{
|
||||
putconsole('.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
putconsole(']');
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the target is asking to terminate the transfer */
|
||||
|
||||
if (ret == 1 && chin == '>')
|
||||
{
|
||||
close(fdin);
|
||||
writebyte(fdtarg, ACK);
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (ret == 1 && chin != chout);
|
||||
}
|
||||
|
||||
writebyte(fdtarg, '>');
|
||||
do
|
||||
{
|
||||
ret = readbyte(fdtarg, &chin);
|
||||
}
|
||||
while (ret == 1 && chin != ENQ);
|
||||
|
||||
close(fdin);
|
||||
writebyte(fdtarg, ACK);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: receivefile
|
||||
****************************************************************************/
|
||||
|
||||
static void receivefile(int fdtarg, char *filename)
|
||||
{
|
||||
char ch;
|
||||
int fdout;
|
||||
int nbytes;
|
||||
int ndots;
|
||||
int ret;
|
||||
|
||||
fdout = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fdout < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to open '%s' for writing\n", filename);
|
||||
writebyte(fdtarg, '>');
|
||||
return;
|
||||
}
|
||||
|
||||
printconsole("Receiving file '%s':\n", filename);
|
||||
flushconsole();
|
||||
writebyte(fdtarg, '+');
|
||||
|
||||
/* Synchronize */
|
||||
|
||||
do
|
||||
{
|
||||
ret = readbyte(fdtarg, &ch);
|
||||
}
|
||||
while (ret == 1 && ch != 'S' && ch != 'Q');
|
||||
|
||||
nbytes = 0;
|
||||
ndots = 0;
|
||||
|
||||
/* Receive the file */
|
||||
|
||||
while (ret == 1)
|
||||
{
|
||||
/* Check for end-of-file */
|
||||
|
||||
if (ch == '>')
|
||||
{
|
||||
close(fdout);
|
||||
return;
|
||||
}
|
||||
|
||||
writebyte(fdout, ch);
|
||||
|
||||
if (++nbytes > 256)
|
||||
{
|
||||
nbytes = 0;
|
||||
putconsole('.');
|
||||
if (++ndots > 72)
|
||||
{
|
||||
putconsole('\n');
|
||||
ndots = 0;
|
||||
}
|
||||
|
||||
flushconsole();
|
||||
}
|
||||
|
||||
ret = readbyte(fdtarg, &ch);
|
||||
if (ch == '\r')
|
||||
{
|
||||
writebyte(fdtarg, '+');
|
||||
}
|
||||
}
|
||||
|
||||
close(fdout);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: getfilename
|
||||
****************************************************************************/
|
||||
|
||||
static void getfilename(int fd, char *name)
|
||||
{
|
||||
char ch;
|
||||
int ret;
|
||||
|
||||
/* Skip over spaces */
|
||||
|
||||
do
|
||||
{
|
||||
ret = readbyte(fd, &ch);
|
||||
}
|
||||
while (ch == ' ' && ret == 1);
|
||||
|
||||
/* Concatenate the filename */
|
||||
|
||||
while (ret == 1 && ch > ' ')
|
||||
{
|
||||
*name++ = ch;
|
||||
ret = readbyte(fd, &ch);
|
||||
}
|
||||
|
||||
*name++ = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: readbyte
|
||||
****************************************************************************/
|
||||
|
||||
static int readbyte(int fd, char *ch)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Read characters from the console, and echo them to the target tty */
|
||||
|
||||
ret = read(fd, ch, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
printconsole("ERROR: Failed to read from fd=%d: %s\n", fd,
|
||||
strerror(errno));
|
||||
close_tty();
|
||||
exit(12);
|
||||
}
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
else if (ret > 1)
|
||||
{
|
||||
printconsole("ERROR: Unexpected number of bytes read(%d) from fd=%d\n",
|
||||
ret, fd);
|
||||
close_tty();
|
||||
exit(13);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: writebyte
|
||||
****************************************************************************/
|
||||
|
||||
static void writebyte(int fd, char byte)
|
||||
{
|
||||
int ret = write(fd, &byte, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to write to fd=%d: %s\n", fd,
|
||||
strerror(errno));
|
||||
close_tty();
|
||||
exit(14);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: close_tty
|
||||
****************************************************************************/
|
||||
|
||||
static void close_tty(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (g_fdnb >= 0)
|
||||
{
|
||||
close(g_fdnb);
|
||||
}
|
||||
|
||||
if (g_fd >= 0)
|
||||
{
|
||||
ret = tcsetattr(g_fd, TCSANOW, &g_termios);
|
||||
if (ret < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to restore termios for %s: %s\n",
|
||||
g_ttydev, strerror(errno));
|
||||
}
|
||||
|
||||
close(g_fd);
|
||||
}
|
||||
|
||||
if (g_logstream)
|
||||
{
|
||||
fclose(g_logstream);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: interrupt
|
||||
****************************************************************************/
|
||||
|
||||
static void interrupt(int signo)
|
||||
{
|
||||
printconsole("Exit-ing...\n");
|
||||
close_tty();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: interrupt
|
||||
****************************************************************************/
|
||||
|
||||
static void show_usage(const char *progname, int exitcode)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"\nUSAGE: %s [-h] [-d] [-t <ttyname>] [-b <baud>] [-l <log-file>]\n",
|
||||
progname);
|
||||
fprintf(stderr, "\nWhere:\n");
|
||||
fprintf(stderr, "\t-h: Prints this message then exit.\n");
|
||||
fprintf(stderr, "\t-d: Enable debug output (twice for verbose output).\n");
|
||||
fprintf(stderr, "\t-t <ttyname>: Use <ttyname> device instead of %s.\n",
|
||||
g_dfttydev);
|
||||
fprintf(stderr, "\t-b <baud>: Use <baud> instead of %d.\n", DEFAULT_BAUD);
|
||||
fprintf(stderr, "\t-l <log-file>: Echo console output in <log-file>.\n");
|
||||
exit(exitcode);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
struct termios tty;
|
||||
char filename[MAX_FILEPATH];
|
||||
char ch;
|
||||
int speed;
|
||||
int opt;
|
||||
int oflags;
|
||||
int ret;
|
||||
|
||||
while ((opt = getopt(argc, argv, ":dt:b:hl:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'd':
|
||||
debug++;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
g_ttydev = optarg;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
g_baud = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
show_usage(argv[0], 0);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
g_logfile = optarg;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
fprintf(stderr, "ERROR: Missing argument to option '%c'\n",
|
||||
optopt);
|
||||
show_usage(argv[0], 1);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
fprintf(stderr, "ERROR: Unrecognized option '%c'\n", optopt);
|
||||
show_usage(argv[0], 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unexpected arguments at end of line\n");
|
||||
show_usage(argv[0], 3);
|
||||
}
|
||||
|
||||
switch (g_baud)
|
||||
{
|
||||
case 0:
|
||||
speed = B0;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
speed = B50;
|
||||
break;
|
||||
|
||||
case 75:
|
||||
speed = B75;
|
||||
break;
|
||||
|
||||
case 110:
|
||||
speed = B110;
|
||||
break;
|
||||
|
||||
case 134:
|
||||
speed = B134;
|
||||
break;
|
||||
|
||||
case 150:
|
||||
speed = B150;
|
||||
break;
|
||||
|
||||
case 200:
|
||||
speed = B200;
|
||||
break;
|
||||
|
||||
case 300:
|
||||
speed = B300;
|
||||
break;
|
||||
|
||||
case 600:
|
||||
speed = B600;
|
||||
break;
|
||||
|
||||
case 1200:
|
||||
speed = B1200;
|
||||
break;
|
||||
|
||||
case 1800:
|
||||
speed = B1800;
|
||||
break;
|
||||
|
||||
case 2400:
|
||||
speed = B2400;
|
||||
break;
|
||||
|
||||
case 4800:
|
||||
speed = B4800;
|
||||
break;
|
||||
|
||||
case 9600:
|
||||
speed = B9600;
|
||||
break;
|
||||
|
||||
case 19200:
|
||||
speed = B19200;
|
||||
break;
|
||||
|
||||
case 38400:
|
||||
speed = B38400;
|
||||
break;
|
||||
|
||||
case 57600:
|
||||
speed = B57600;
|
||||
break;
|
||||
|
||||
case 115200:
|
||||
speed = B115200;
|
||||
break;
|
||||
|
||||
case 230400:
|
||||
speed = B230400;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "ERROR: Unsupported BAUD=%d\n", g_baud);
|
||||
show_usage(argv[0], 4);
|
||||
}
|
||||
|
||||
/* Was a log file specified? */
|
||||
|
||||
if (g_logfile)
|
||||
{
|
||||
g_logstream = fopen(g_logfile, "w");
|
||||
if (!g_logstream)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to open '%s' for writing\n",
|
||||
g_logfile);
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the host stdin to O_NONBLOCK */
|
||||
|
||||
oflags = fcntl(0, F_GETFL, 0);
|
||||
if (oflags == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
|
||||
return 6;
|
||||
}
|
||||
|
||||
ret = fcntl(0, F_SETFL, oflags | O_NONBLOCK);
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
|
||||
return 7;
|
||||
}
|
||||
|
||||
/* Open the selected serial port (blocking) */
|
||||
|
||||
g_fd = open(g_ttydev, O_RDWR);
|
||||
if (g_fd < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to open %s: %s\n",
|
||||
g_ttydev, strerror(errno));
|
||||
return 8;
|
||||
}
|
||||
|
||||
/* Configure the serial port in at the selected baud in 8-bit, no-parity,
|
||||
* raw mode and turn off echo, etc.
|
||||
*/
|
||||
|
||||
ret = tcgetattr(g_fd, &g_termios);
|
||||
if (ret < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to get termios for %s: %s\n", g_ttydev,
|
||||
strerror(errno));
|
||||
close(g_fd);
|
||||
return 9;
|
||||
}
|
||||
|
||||
memcpy(&tty, &g_termios, sizeof(struct termios));
|
||||
tty.c_iflag &=
|
||||
~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
|
||||
tty.c_oflag &= ~OPOST;
|
||||
tty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
|
||||
tty.c_cflag &= ~(CSIZE | PARENB);
|
||||
tty.c_cflag |= CS8;
|
||||
|
||||
cfsetispeed(&tty, speed);
|
||||
cfsetospeed(&tty, speed);
|
||||
|
||||
ret = tcsetattr(g_fd, TCSANOW, &tty);
|
||||
if (ret < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to set termios for %s: %s\n", g_ttydev,
|
||||
strerror(errno));
|
||||
close(g_fd);
|
||||
return 10;
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Open the selected serial port (non-blocking) */
|
||||
|
||||
g_fdnb = open(g_ttydev, O_RDONLY | O_NONBLOCK);
|
||||
if (g_fdnb < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to open %s: %s\n",
|
||||
g_ttydev, strerror(errno));
|
||||
return 11;
|
||||
}
|
||||
#else
|
||||
/* Create a non-blocking copy of the configure tty descriptor */
|
||||
|
||||
g_fdnb = dup(g_fd);
|
||||
if (g_fdnb < 0)
|
||||
{
|
||||
printconsole("ERROR: Failed to dup %s fd=%d: %s\n", g_ttydev, g_fd,
|
||||
strerror(errno));
|
||||
close_tty();
|
||||
return 12;
|
||||
}
|
||||
|
||||
oflags = fcntl(g_fdnb, F_GETFL, 0);
|
||||
if (oflags == -1)
|
||||
{
|
||||
fprintf(stderr, "ERROR: fnctl(F_GETFL) failed: %s\n", strerror(errno));
|
||||
close_tty();
|
||||
return 13;
|
||||
}
|
||||
|
||||
ret = fcntl(g_fdnb, F_SETFL, oflags | O_NONBLOCK);
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: fnctl(F_SETFL) failed: %s\n", strerror(errno));
|
||||
close_tty();
|
||||
return 14;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Catch attempts to control-C out of the program so that we can restore
|
||||
* the TTY settings.
|
||||
*/
|
||||
|
||||
signal(SIGINT, interrupt);
|
||||
|
||||
/* Loopo until control-C */
|
||||
|
||||
for (; ; )
|
||||
{
|
||||
/* Read characters from the console, and echo them to the target tty */
|
||||
|
||||
ret = readbyte(0, &ch);
|
||||
if (ret == 0)
|
||||
{
|
||||
printconsole("End-of-file: exitting\n");
|
||||
close_tty();
|
||||
return 0;
|
||||
}
|
||||
else if (ret == 1)
|
||||
{
|
||||
writebyte(g_fd, ch);
|
||||
}
|
||||
|
||||
/* Read characters from target TTY and echo them on the console */
|
||||
|
||||
ret = readbyte(g_fdnb, &ch);
|
||||
if (ret == 0)
|
||||
{
|
||||
printconsole(
|
||||
"ERROR: Unexpected number of bytes read(%d) from %s\n",
|
||||
ret, g_ttydev);
|
||||
close_tty();
|
||||
return 15;
|
||||
}
|
||||
else if (ret == 1)
|
||||
{
|
||||
if (ch == ENQ)
|
||||
{
|
||||
char ch1;
|
||||
char ch2;
|
||||
|
||||
writebyte(g_fd, '*');
|
||||
ret = readbyte(g_fd, &ch1);
|
||||
if (ret != 1)
|
||||
{
|
||||
printconsole
|
||||
("ERROR: Unexpected number of bytes read(%d) from %s\n",
|
||||
ret, g_ttydev);
|
||||
close_tty();
|
||||
return 15;
|
||||
}
|
||||
|
||||
ret = readbyte(g_fd, &ch2);
|
||||
if (ret != 1)
|
||||
{
|
||||
printconsole
|
||||
("ERROR: Unexpected number of bytes read(%d) from %s\n",
|
||||
ret, g_ttydev);
|
||||
close_tty();
|
||||
return 16;
|
||||
}
|
||||
|
||||
getfilename(g_fd, filename);
|
||||
|
||||
if (ch1 == 'l' || ch1 == 'L')
|
||||
{
|
||||
sendfile(g_fd, filename, 0);
|
||||
}
|
||||
else if (ch1 == 'v' || ch1 == 'V')
|
||||
{
|
||||
sendfile(g_fd, filename, 1);
|
||||
}
|
||||
else if (ch1 == 's' || ch1 == 'S')
|
||||
{
|
||||
receivefile(g_fd, filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
putconsole(ch);
|
||||
flushconsole();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
############################################################################
|
||||
# boards/renesas/sh1/us7032evb1/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(TOPDIR)/Make.defs
|
||||
|
||||
CSRCS = sh1_leds.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* boards/renesas/sh1/us7032evb1/src/sh1_leds.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The SH1_LPEVB only a single LED controlled by either port A, pin 15, or
|
||||
* port B, pin 15 (selectable via JP8). In this file, we assume the portB
|
||||
* setup.
|
||||
*/
|
||||
|
||||
#define SH1_PBDR_LED 0x8000
|
||||
#define SH1_PBIOR_LED 0x8000
|
||||
#define SH1_PBCR2_LED 0xc000
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
uint16_t reg16;
|
||||
|
||||
/* Setup port B, pin 15 as an output */
|
||||
|
||||
reg16 = getreg16(SH1_PFC_PBIOR);
|
||||
reg16 |= SH1_PBIOR_LED;
|
||||
putreg16(reg16, SH1_PFC_PBIOR);
|
||||
|
||||
/* Setup port B, pin 15 as a normal I/O register */
|
||||
|
||||
reg16 = getreg16(SH1_PFC_PBCR1);
|
||||
reg16 &= ~SH1_PBCR2_LED;
|
||||
putreg16(reg16, SH1_PFC_PBCR1);
|
||||
|
||||
/* Turn the LED off */
|
||||
|
||||
reg16 = getreg16(SH1_PORTB_DR);
|
||||
reg16 &= ~SH1_PBDR_LED;
|
||||
putreg16(reg16, SH1_PORTB_DR);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
uint16_t reg16;
|
||||
|
||||
if (led)
|
||||
{
|
||||
/* Turn the LED on */
|
||||
|
||||
reg16 = getreg16(SH1_PORTB_DR);
|
||||
reg16 |= SH1_PBDR_LED;
|
||||
putreg16(reg16, SH1_PORTB_DR);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
uint16_t reg16;
|
||||
|
||||
if (led)
|
||||
{
|
||||
/* Turn the LED off */
|
||||
|
||||
reg16 = getreg16(SH1_PORTB_DR);
|
||||
reg16 &= ~SH1_PBDR_LED;
|
||||
putreg16(reg16, SH1_PORTB_DR);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
Reference in New Issue
Block a user