mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Merged in masayuki2009/nuttx.nuttx/lc823450 (pull request #530)
Add IPL2 support for LC823450
* arch/arm/src/lc823450: Add IPL2 support
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* configs/lc823450-xgevk: Add IPL2 support
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
2a331b7f23
commit
56eac96d2f
@@ -7,6 +7,10 @@ comment "LC823450 Configuration Options"
|
||||
|
||||
menu "LC823450 Peripheral Support"
|
||||
|
||||
config LC823450_IPL2
|
||||
bool "IPL2"
|
||||
default n
|
||||
|
||||
config LC823450_UART0
|
||||
bool "UART0"
|
||||
select UART0_SERIALDRIVER
|
||||
@@ -125,6 +129,14 @@ config MTD_CONFIG_DEVPATH
|
||||
string "Device path for config"
|
||||
default "/dev/mtdblock0p2"
|
||||
|
||||
config MTD_RECOVERY_DEVPATH
|
||||
string "Device path for recovery"
|
||||
default "/dev/mtdblock0p3"
|
||||
|
||||
config MTD_KERNEL_DEVPATH
|
||||
string "Device path for kernel"
|
||||
default "/dev/mtdblock0p4"
|
||||
|
||||
config MTD_ETC_DEVPATH
|
||||
string "Device path for etc"
|
||||
default "/dev/mtdblock0p5"
|
||||
@@ -213,7 +225,7 @@ config LC823450_USBDEV_CUSTOM_HSDSEL_10
|
||||
endchoice
|
||||
|
||||
config LC823450_LSISTBY
|
||||
bool "LIS Standby"
|
||||
bool "LSI Standby"
|
||||
default n
|
||||
|
||||
config LC823450_MTM0_TICK
|
||||
@@ -229,4 +241,5 @@ config HRT_TIMER
|
||||
bool "High resolution timer"
|
||||
default n
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -137,8 +137,8 @@ ifeq ($(CONFIG_ADC),y)
|
||||
CHIP_CSRCS += lc823450_adc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IPL2),y)
|
||||
ifeq ($(CONFIG_SPIFLASH_BOOT),y)
|
||||
ifeq ($(CONFIG_LC823450_IPL2),y)
|
||||
ifeq ($(CONFIG_LC823450_SPIFLASH_BOOT),y)
|
||||
CHIP_CSRCS += lc823450_spif_ipl2.c
|
||||
else
|
||||
CHIP_CSRCS += lc823450_ipl2.c
|
||||
|
||||
@@ -141,7 +141,7 @@ void lc823450_clockconfig()
|
||||
val |= OSCCNT_SCKSEL_MAIN;
|
||||
putreg32(val, OSCCNT);
|
||||
|
||||
#ifdef CONFIG_IPL2
|
||||
#ifdef CONFIG_LC823450_IPL2
|
||||
/* set the common PLL values */
|
||||
/* XTAL / XT1OSC_CLK = 1MHz */
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
|
||||
leave_critical_section(irqs);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_IPL2
|
||||
#ifndef CONFIG_LC823450_IPL2
|
||||
i2cerr("ERROR: I2C timed out (dev=%xh)\n", msgs->addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -251,13 +251,13 @@ void __start(void)
|
||||
#else /* CONFIG_SPIFLASH_BOOT */
|
||||
/* vector offset */
|
||||
|
||||
#ifdef CONFIG_IPL2
|
||||
#ifdef CONFIG_LC823450_IPL2
|
||||
putreg32(0x02000e00, 0xe000ed08);
|
||||
putreg32(0x0, 0x40080008); /* XXX: remap disable */
|
||||
#else /* CONFIG_IPL2 */
|
||||
#else /* CONFIG_LC823450_IPL2 */
|
||||
putreg32(0x02040000, 0xe000ed08);
|
||||
#endif /* CONFIG_IPL2 */
|
||||
#endif /* CONFIG_SPIFLASH_BOOT */
|
||||
#endif /* CONFIG_LC823450_IPL2 */
|
||||
#endif /* CONFIG_LC823450_SPIFLASH_BOOT */
|
||||
|
||||
/* Mutex enable */
|
||||
|
||||
@@ -273,7 +273,7 @@ void __start(void)
|
||||
|
||||
/* IPL2 don't change mux */
|
||||
|
||||
#ifdef CONFIG_IPL2
|
||||
#ifdef CONFIG_LC823450_IPL2
|
||||
/* GPIO2F out High in IPL2 */
|
||||
|
||||
modifyreg32(MCLKCNTAPB, 0, MCLKCNTAPB_PORT2_CLKEN);
|
||||
@@ -286,9 +286,9 @@ void __start(void)
|
||||
|
||||
modifyreg32(PMDCNT5, 0, 3 << 14);
|
||||
#endif /* CONFIG_DEBUG */
|
||||
#else /* CONFIG_IPL2 */
|
||||
#else /* CONFIG_LC823450_IPL2 */
|
||||
up_init_default_mux();
|
||||
#endif /* CONFIG_IPL2 */
|
||||
#endif /* CONFIG_LC823450_IPL2 */
|
||||
|
||||
showprogress('B');
|
||||
|
||||
@@ -326,9 +326,9 @@ void __start(void)
|
||||
|
||||
showprogress('F');
|
||||
|
||||
#ifndef CONFIG_IPL2
|
||||
#ifndef CONFIG_LC823450_IPL2
|
||||
sinfo("icx_boot_reason = 0x%x\n", icx_boot_reason);
|
||||
#endif /* CONFIG_IPL2 */
|
||||
#endif /* CONFIG_LC823450_IPL2 */
|
||||
|
||||
#ifdef CONFIG_POWERBUTTON_LDOWN
|
||||
if (icx_boot_reason & ICX_BOOT_REASON_POWERBUTTON)
|
||||
|
||||
@@ -11,6 +11,14 @@ LC823450 related documents are available at
|
||||
|
||||
http://www.onsemi.com/PowerSolutions/supportDoc.do?type=AppNotes&rpn=LC823450
|
||||
|
||||
OpenOCD for NuttX thread and LC823450 support is available at
|
||||
|
||||
https://github.com/sony/openocd-nuttx/wiki
|
||||
|
||||
MakeIPL2 Tool for eMMC boot is available at
|
||||
|
||||
http://www.onsemi.com/PowerSolutions/supportDoc.do?type=software&rpn=LC823450
|
||||
|
||||
This port is intended to test LC823450 features including SMP.
|
||||
Supported peripherals:
|
||||
UART, TIMER, RTC, GPIO, DMA, I2C, SPI, LCD, eMMC, USB, WDT, ADC.
|
||||
@@ -18,7 +26,7 @@ UART, TIMER, RTC, GPIO, DMA, I2C, SPI, LCD, eMMC, USB, WDT, ADC.
|
||||
Settings
|
||||
^^^^^^^^
|
||||
|
||||
1. Currently only SRAM boot via ICE is supported.
|
||||
1. eMMC boot and SRAM boot via openocd are supported.
|
||||
2. If SWD connection is lost, please specify lower adaptor clock.
|
||||
3. Both CPUs are running at 160MHz.
|
||||
4. Internal SRAMs (seg0 to seg5) are used.
|
||||
@@ -35,6 +43,9 @@ output into the console because UART operates in FIFO mode.
|
||||
1. "nsh> smp" works but the result will be corrupted.
|
||||
2. "nsh> ostest" works but might cause a deadlock or assertion.
|
||||
|
||||
|
||||
|
||||
|
||||
Other Status
|
||||
^^^^^^^^^^^^
|
||||
|
||||
@@ -128,9 +139,56 @@ nsh> wdog
|
||||
NO ping elapsed=5500
|
||||
NO ping elapsed=6000
|
||||
|
||||
9. IPL2 and eMMC boot
|
||||
|
||||
IPL2 is the 2nd boot loader based on NuttX and can be built as follows.
|
||||
|
||||
$ make distclean
|
||||
$ ./tools/configure.sh lc823450-xgevk/ipl2
|
||||
$ make V=1
|
||||
$ MakeIPL2 ./nuttx.bin 0 2 0 0 0
|
||||
$ cp LC8234xx_17S_start_data.boot_bin /tmp/
|
||||
|
||||
To write the IPL2 (LC8234xx_17S_start_data.boot_bin),
|
||||
firstly build USB configuration image.
|
||||
|
||||
$ make distclean
|
||||
$ ./tools/configure.sh lc823450-xgevk/usb
|
||||
$ make V=1
|
||||
|
||||
Load the nuttx.bin with openocd + gdb
|
||||
|
||||
$ cd openocd-nuttx
|
||||
$ ./bootstrap
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo ./src/openocd -s ./tcl -f ./tcl/board/lc823450_xgevk.cfg -c init -c "reset halt"
|
||||
|
||||
$ arm-none-eabi-gdb
|
||||
(gdb) target extended-remote :3333
|
||||
(gdb) load ./nuttx
|
||||
(gdb) symbol-file ./nuttx
|
||||
(gdb) c
|
||||
|
||||
Start USB MSC to copy nuttx.bin and the IPL2 to the FAT32 partition (/dev/mtdblock0p10)
|
||||
then dd the files to the kernel partition (/dev/mtdblock0p4) and the IPL2 partition
|
||||
(/dev/mtdblock0p1) respectively.
|
||||
|
||||
nsh> mkfatfs -F 32 /dev/mtdblock0p10
|
||||
nsh> msconn
|
||||
|
||||
$ sudo cp ./nuttx.bin /media/usb0/
|
||||
$ sudo cp /tmp/LC8234xx_17S_start_data.boot_bin /media/usb0/
|
||||
$ sudo sync
|
||||
|
||||
nsh> msdis
|
||||
nsh> mount -t vfat /dev/mtdblock0p10 /mnt/sd0
|
||||
nsh> dd if=/mnt/sd0/nuttx.bin of=/dev/mtdblock0p4
|
||||
nsh> dd if=/mnt/sd0/LC8234xx_17S_start_data.boot_bin of=/dev/mtdblock0p1
|
||||
nsh> reboot
|
||||
|
||||
TODO
|
||||
^^^^
|
||||
|
||||
The following features will be supported.
|
||||
IPL2 (eMMC boot), Audio, etc.
|
||||
Audio, etc.
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="lc823450-xgevk"
|
||||
CONFIG_ARCH_BOARD_LC823450_XGEVK=y
|
||||
CONFIG_ARCH_CHIP_LC823450=y
|
||||
CONFIG_ARCH_FLOAT_H=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=12061
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_C99_BOOL8=y
|
||||
CONFIG_CODECS_HASH_MD5=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_ERROR=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_WARN=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FS_FATTIME=y
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LC823450_IPL2=y
|
||||
CONFIG_LC823450_MTD=y
|
||||
CONFIG_LC823450_SDIF_SDC=y
|
||||
CONFIG_LC823450_UART0=y
|
||||
CONFIG_LC823450_UART1=y
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MEMSET_OPTSPEED=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_NAME_MAX=765
|
||||
CONFIG_NETUTILS_CODECS=y
|
||||
CONFIG_NFILE_DESCRIPTORS=45
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=16
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=3072
|
||||
CONFIG_RAM_SIZE=1044480
|
||||
CONFIG_RAM_START=0x02001000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_RTC=y
|
||||
CONFIG_SCHED_ATEXIT=y
|
||||
CONFIG_SCHED_CHILD_STATUS=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_BUFFER=y
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_ONEXIT_MAX=32
|
||||
CONFIG_SCHED_ONEXIT=y
|
||||
CONFIG_SCHED_STARTHOOK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SENSORS=y
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_START_DAY=3
|
||||
CONFIG_START_MONTH=10
|
||||
CONFIG_START_YEAR=2013
|
||||
CONFIG_TASK_NAME_SIZE=24
|
||||
CONFIG_UART0_RXBUFSIZE=512
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_UART0_TXBUFSIZE=2048
|
||||
CONFIG_USBDEV_BUSPOWERED=y
|
||||
CONFIG_USBDEV_DUALSPEED=y
|
||||
CONFIG_USBDEV_MAXPOWER=500
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USER_ENTRYPOINT="ipl2_main"
|
||||
CONFIG_USERMAIN_STACKSIZE=3072
|
||||
@@ -37,6 +37,12 @@ include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_LC823450_IPL2),y)
|
||||
LDSCRIPT = ld-ipl2.script
|
||||
else
|
||||
LDSCRIPT = ld.script
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
@@ -44,13 +50,13 @@ ifeq ($(WINTOOL),y)
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/****************************************************************************
|
||||
* configs/lc823450-xgevk/scripts/ld-ipl2.script
|
||||
*
|
||||
* Copyright (C) 2017 Sony Corporation. All rights reserved.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
MEMORY
|
||||
{
|
||||
progmem (rx) : ORIGIN = 0x02000e00, LENGTH = 124K
|
||||
sram (rwx) : ORIGIN = 0x02100000, LENGTH = 256K
|
||||
ramlog (rwx) : ORIGIN = 0x020fe000, LENGTH = 8K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
KEEP(*(.vectors))
|
||||
*(.vectors)
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > progmem
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
KEEP(*(.init_array .init_array.*))
|
||||
_einit = ABSOLUTE(.);
|
||||
} > progmem
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > progmem
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > progmem
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
_eronly = ABSOLUTE(LOADADDR(.data));
|
||||
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > progmem
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.ramlog : {
|
||||
*(.ramlog)
|
||||
} > ramlog
|
||||
|
||||
/* 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) }
|
||||
}
|
||||
Reference in New Issue
Block a user