From a9be5eb6e78d8560d108beecf3f0461dd44acb04 Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Mon, 8 Jul 2019 12:38:21 +0000 Subject: [PATCH] Merged in alinjerpelea/nuttx (pull request #941) Mastertools: add spk binary format and entry point for mpy * tools: add spk binary format The .spk binary format is used on spresense and other boards based on the cxd56 arch. to enable this binary format please set in your config CONFIG_CXD56_BINARY=y Signed-off-by: Alin Jerpelea * configs: spresense: buils nuttx.spk images Enable nuttx.spk binary image that can be flashed on spresense board. Signed-off-by: Alin Jerpelea * configs: spresense: add entry point for mpy The entry point is needed for the downstream projects based on spresense. Signed-off-by: Alin Jerpelea Approved-by: Gregory Nutt --- Kconfig | 7 ++++ configs/spresense/lcd/defconfig | 1 + configs/spresense/mpy/defconfig | 1 + configs/spresense/nsh/defconfig | 1 + configs/spresense/rndis/defconfig | 1 + configs/spresense/src/Makefile | 1 + configs/spresense/src/cxd56_main.c | 56 ++++++++++++++++++++++++++++++ configs/spresense/usbmsc/defconfig | 1 + configs/spresense/usbnsh/defconfig | 1 + configs/spresense/wifi/defconfig | 1 + tools/.gitignore | 1 + tools/Makefile.unix | 12 +++++++ tools/Makefile.win | 12 +++++++ 13 files changed, 96 insertions(+) create mode 100644 configs/spresense/src/cxd56_main.c diff --git a/Kconfig b/Kconfig index c71394b1ac..77c73411dc 100644 --- a/Kconfig +++ b/Kconfig @@ -281,6 +281,13 @@ config RRLOAD_BINARY Create nuttx.rr in the rrload binary format used with BSPs from www.ridgerun.com using the tools/mkimage.sh script. +config CXD56_BINARY + bool "spk binary format" + default n + ---help--- + Create nuttx.spk binary format used on spresense board and boards + based on cxd56xx arch. + config INTELHEX_BINARY bool "Intel HEX binary format" default n diff --git a/configs/spresense/lcd/defconfig b/configs/spresense/lcd/defconfig index 200848042a..085629160a 100644 --- a/configs/spresense/lcd/defconfig +++ b/configs/spresense/lcd/defconfig @@ -26,6 +26,7 @@ CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS=y CONFIG_COMPOSITE_PRODUCTID=0x0bc2 CONFIG_COMPOSITE_VENDORID=0x054c CONFIG_COMPOSITE_VENDORSTR="Sony" +CONFIG_CXD56_BINARY=y CONFIG_CXD56_DMAC_SPI4_RX=y CONFIG_CXD56_DMAC_SPI4_TX=y CONFIG_CXD56_I2C0=y diff --git a/configs/spresense/mpy/defconfig b/configs/spresense/mpy/defconfig index 74dc689357..3b43d45356 100644 --- a/configs/spresense/mpy/defconfig +++ b/configs/spresense/mpy/defconfig @@ -19,6 +19,7 @@ CONFIG_BOARD_LOOPSPERMSEC=5434 CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y +CONFIG_CXD56_BINARY=y CONFIG_CXD56_ADC=y CONFIG_CXD56_CISIF=y CONFIG_CXD56_HPADC0=y diff --git a/configs/spresense/nsh/defconfig b/configs/spresense/nsh/defconfig index f3264bf4cf..00d1a5fa3d 100644 --- a/configs/spresense/nsh/defconfig +++ b/configs/spresense/nsh/defconfig @@ -17,6 +17,7 @@ CONFIG_BOARD_LOOPSPERMSEC=5434 CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y +CONFIG_CXD56_BINARY=y CONFIG_CXD56_I2C0=y CONFIG_CXD56_I2C=y CONFIG_CXD56_SPI4=y diff --git a/configs/spresense/rndis/defconfig b/configs/spresense/rndis/defconfig index 2ebedc4174..0d30d53328 100644 --- a/configs/spresense/rndis/defconfig +++ b/configs/spresense/rndis/defconfig @@ -21,6 +21,7 @@ CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y CONFIG_CODECS_HASH_MD5=y +CONFIG_CXD56_BINARY=y CONFIG_CXD56_SDIO=y CONFIG_CXD56_USBDEV=y CONFIG_DEBUG_FULLOPT=y diff --git a/configs/spresense/src/Makefile b/configs/spresense/src/Makefile index a602db996a..55ea240f8f 100644 --- a/configs/spresense/src/Makefile +++ b/configs/spresense/src/Makefile @@ -39,6 +39,7 @@ DEPPATH = --dep-path . ASRCS = CSRCS = +CSRCS += cxd56_main.c CSRCS += cxd56_boot.c CSRCS += cxd56_clock.c CSRCS += cxd56_bringup.c diff --git a/configs/spresense/src/cxd56_main.c b/configs/spresense/src/cxd56_main.c new file mode 100644 index 0000000000..0424e1edc9 --- /dev/null +++ b/configs/spresense/src/cxd56_main.c @@ -0,0 +1,56 @@ +/**************************************************************************** + * bsp/board/spresense/src/spresense_main.c + * + * Copyright 2018 Sony Semiconductor Solutions Corporation + * + * 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 of Sony Semiconductor Solutions Corporation 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 +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/* This function is provided outside exported SDK, therefore here is defined + * as weak symbol to avoid link error. + */ + +int nsh_main(int argc, char *argv[]); + +int weak_function spresense_main(int argc, char *argv[]) +{ + return nsh_main(argc, argv); +} diff --git a/configs/spresense/usbmsc/defconfig b/configs/spresense/usbmsc/defconfig index 0cfeff733b..0d97b6c680 100644 --- a/configs/spresense/usbmsc/defconfig +++ b/configs/spresense/usbmsc/defconfig @@ -26,6 +26,7 @@ CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS=y CONFIG_COMPOSITE_PRODUCTID=0x0bc2 CONFIG_COMPOSITE_VENDORID=0x054c CONFIG_COMPOSITE_VENDORSTR="Sony" +CONFIG_CXD56_BINARY=y CONFIG_CXD56_I2C0=y CONFIG_CXD56_I2C=y CONFIG_CXD56_SDIO=y diff --git a/configs/spresense/usbnsh/defconfig b/configs/spresense/usbnsh/defconfig index ef9926e703..ddb4b5ac21 100644 --- a/configs/spresense/usbnsh/defconfig +++ b/configs/spresense/usbnsh/defconfig @@ -19,6 +19,7 @@ CONFIG_BOARD_LOOPSPERMSEC=5434 CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y +CONFIG_CXD56_BINARY=y CONFIG_CXD56_I2C0=y CONFIG_CXD56_I2C=y CONFIG_CXD56_SDIO=y diff --git a/configs/spresense/wifi/defconfig b/configs/spresense/wifi/defconfig index 07e4caf782..b3bfef0baa 100644 --- a/configs/spresense/wifi/defconfig +++ b/configs/spresense/wifi/defconfig @@ -20,6 +20,7 @@ CONFIG_BOOT_RUNFROMISRAM=y CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y CONFIG_CODECS_HASH_MD5=y +CONFIG_CXD56_BINARY=y CONFIG_CXD56_DMAC_SPI5_RX=y CONFIG_CXD56_DMAC_SPI5_TX=y CONFIG_CXD56_SDIO=y diff --git a/tools/.gitignore b/tools/.gitignore index 5c7facb0db..a72cda1cfa 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -20,3 +20,4 @@ /*.dSYM /.k2h-body.dat /.k2h-apndx.dat +/cxd56 \ No newline at end of file diff --git a/tools/Makefile.unix b/tools/Makefile.unix index 32442dae22..eb889627e9 100644 --- a/tools/Makefile.unix +++ b/tools/Makefile.unix @@ -442,6 +442,18 @@ ifeq ($(CONFIG_RAW_BINARY),y) @echo "CP: $(NUTTXNAME).bin" $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(NUTTXNAME).bin endif +ifeq ($(CONFIG_CXD56_BINARY),y) + $(Q) if [ ! -f "tools/cxd56/mkspk" ] ; then \ + echo ""; \ + echo "Please run the following command to clone the needed tools"; \ + echo "git clone https://github.com/sonydevworld/cxd56/ tools/cxd56"; \ + echo ""; \ + echo "run make again to create the nuttx.spk image."; \ + else \ + echo "Generating: $(NUTTXNAME).spk"; \ + tools/cxd56/mkspk -c2 nuttx nuttx nuttx.spk; \ + fi +endif ifeq ($(CONFIG_UBOOT_UIMAGE),y) @echo "MKIMAGE: uImage" $(Q) mkimage -A $(CONFIG_ARCH) -O linux -C none -T kernel -a $(CONFIG_UIMAGE_LOAD_ADDRESS) \ diff --git a/tools/Makefile.win b/tools/Makefile.win index 155e096e10..d6a5bce57e 100644 --- a/tools/Makefile.win +++ b/tools/Makefile.win @@ -451,6 +451,18 @@ ifeq ($(CONFIG_RAW_BINARY),y) @echo "CP: $(NUTTXNAME).bin" $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(BIN) $(NUTTXNAME).bin endif +ifeq ($(CONFIG_CXD56_BINARY),y) + $(Q) if [ ! -f "tools/cxd56/mkspk.exe" ] ; then \ + echo ""; \ + echo "Please run the following command to clone the needed tools"; \ + echo "git clone https://github.com/sonydevworld/cxd56/ tools\cxd56"; \ + echo ""; \ + echo "run make again to create the nuttx.spk image."; \ + else \ + echo "Generating: $(NUTTXNAME).spk"; \ + tools\cxd56\mkspk.exe -c2 nuttx nuttx nuttx.spk; \ + fi +endif # $(BIN) #