configs/pnev5180b: Minimal support for NXP Semiconductors' PN5180 NFC Frontend Development Kit. This board is based on the NXP LPC1769 MCU. At the moment there is just support for a minimal nsh configuration via UART0.

This commit is contained in:
Michael Jung 2019-06-17 15:57:42 -06:00 committed by Gregory Nutt
parent 4d78132c46
commit ace7ead09f
20 changed files with 1597 additions and 1 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
<p>Last Updated: June 10, 2019</p>
<p>Last Updated: June 17, 2019</p>
</td>
</tr>
</table>
@ -254,6 +254,8 @@ nuttx/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/pic32mx7mmb/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- pic32mz-starterkit/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/pic32mz-starterkit/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- pnev5180b/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/pnev5180b/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- qemu-i486/
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/qemu-i486/README.txt" target="_blank"><b><i>README.txt</i></b></a>
| |- sabre-6quad/

View File

@ -1927,6 +1927,8 @@ nuttx/
| | `- README.txt
| |- pic32mz-starterkit/
| | `- README.txt
| |- pnev5180b/
| | `- README.txt
| |- qemu-i486/
| | `- README.txt
| |- sabre-6quad/

View File

@ -1304,6 +1304,14 @@ config ARCH_BOARD_PHOTON
(https://www.particle.io). This board features the STM32F205RGY6
MCU from STMicro.
config ARCH_BOARD_PNEV5180B
bool "NXP PNEV5180B NFC Frontend Development Kit"
depends on ARCH_CHIP_LPC1769
select ARCH_HAVE_LEDS
---help---
NXP Semiconductors' PN5180 NFC Frontend Development Kit. This board is
based on the NXP LPC1769 MCU.
config ARCH_BOARD_STM32_BUTTERFLY2
bool "Kamami STM32Butterfly2 development board"
depends on ARCH_CHIP_STM32F107VC
@ -1957,6 +1965,7 @@ config ARCH_BOARD
default "shenzhou" if ARCH_BOARD_SHENZHOU
default "skp16c26" if ARCH_BOARD_SKP16C26
default "photon" if ARCH_BOARD_PHOTON
default "pnev5180b" if ARCH_BOARD_PNEV5180B
default "stm32butterfly2" if ARCH_BOARD_STM32_BUTTERFLY2
default "stm32_tiny" if ARCH_BOARD_STM32_TINY
default "stm32f051-discovery" if ARCH_BOARD_STM32F051_DISCOVERY
@ -2412,6 +2421,9 @@ endif
if ARCH_BOARD_PHOTON
source "configs/photon/Kconfig"
endif
if ARCH_BOARD_PNEV5180B
source "configs/pnev5180b/Kconfig"
endif
if ARCH_BOARD_STM32_BUTTERFLY2
source "configs/stm32butterfly2/Kconfig"
endif

View File

@ -607,6 +607,10 @@ configs/pic32mz-starterkit
See www.microchip.com for further information.
configs/pnev5180b
NXP Semiconductors' PN5180 NFC Frontend Development Kit. This board is
based on the NXP LPC1769 MCU.
configs/qemu-i486
Port of NuttX to QEMU in i486 mode. This port will also run on real i486
hardwared (Google the Bifferboard).

View File

@ -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_PNEV5180B
endif

View File

@ -0,0 +1,100 @@
README
^^^^^^
README for NuttX port to NXP's PNEV5180B, which is a development board
containing a NXP-LPC1769 MCU and a PN5180 NFC Frontend.
Contents
^^^^^^^^
NXP's PNEV5180B Board
Configurations
NXP's PNEV5180B Board
^^^^^^^^^^^^^^^^^^^^^
Pin Description On Board Connector
-------------------------------- ---------------- -------------
P0.2/TXD0/AD0.7 TX J201
P0.3/RXD0/AD0.6 RX
P0.22/RTS1/TD1 LD200 ORANGE LED
P0.15/TXD1/SCK0/SCK PN5180-SCK
P0.16/RXD1/SSEL0/SSEL PN5180-SSEL PN5180
P0.17/CTS1/MISO0/MISO PN5180-MISO
P0.18/DCD1/M0SI0/MOSI PN5180-MOSI
P0.19/DSR1/SDA1 EEPROM (Not Assembled)
P0.20/DTR1/SCL1 EEPROM
P0.21/RI1/RD1 PN5180-AUX2 PN5180
P0.29/USB_D+ USB-D+ USB
P0.30/USB_D- USB-D-
P2.0/PWM1.1/TXD1 LD201 RED LED
P2.5/PWM1.6/DTR1/TRACEDATA0 PN5180-nPN_RST
P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
P2.11/nEINT1/I2STX_CLK PN5180-BUSY PN5180
P2.12/nEINT2/I2STX_WS PN5180-IRQ
P3.25/MAT0.0/PWM1.2 LD203 GREEN LED
P3.26/STCLK/MAT0.1/PWM1.3 LD202 BLUE LED
NXP's PNEV5180B Board
^^^^^^^^^^^^^^^^^^^^^
UART
----
Board LPC1769
Signal Pin
----------------- -----------------
TX P0.2 TXD0
RX P0.3 RXD0
USB
---
Board LPC1769
Signal Pin
----------------- -----------------
USB_CONNECT P2.9 USB_CONNECT
USB_DM P0.29 USB_D-
USB_DP P0.30 USB_D+
PN5180
------
Board LPC1769
Signal Pin
----------------- -----------------
PN5180_SCK P0.15 SCK
PN5180_SSEL P0.16 SSEL
PN5180_MISO P0.17 MISO
PN5180_MOSI P0.18 MOSI
PN5180_AUX2 P0.21 GPIO I
PN5180_nPN_RST P2.5 GPIO O
PN5180_BUSY P2.11 GPIO I
PN5180_IRQ P2.12 GPIO I
Configurations
^^^^^^^^^^^^^^
Each PNEV5180B configuration is maintained in a sub-directory and can be
selected as follow:
cd tools
./configure.sh pnev5180b/<subdir>
cd -
Where <subdir> is one of the following:
nsh:
Configures the NuttShell (nsh) located at apps/examples/nsh. The
Configuration enables the serial NSH interface.
NOTES:
1. This configuration uses the mconf-based configuration tool. To
change this 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.

View File

@ -0,0 +1,237 @@
/****************************************************************************
* configs/pnev5180b/include/board.h
* include/arch/board/board.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* Based on configs/zkit-arm-1769/include/board.h
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
* Author: BabuSubashChandar <code@zilogic.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.
*
*****************************************************************************/
#ifndef __CONFIGS_PNEV5180B_INCLUDE_BOARD_H
#define __CONFIGS_PNEV5180B_INCLUDE_BOARD_H
/*****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_GPIOIRQ)
# include <nuttx/irq.h>
#endif
/*****************************************************************************
* Pre-processor Definitions
*****************************************************************************/
/* Clocking ******************************************************************/
/* NOTE: The following definitions require lpc17_syscon.h. It is not
* included here because the including C file may not have that file in its
* include path.
*/
#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency */
#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
/* This is the clock setup we configure for:
*
* SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for
* source
* PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20,
* pre-divider=1
* CCLCK = 480MHz / 4 = 120MHz -> CCLK divider = 4
*/
#define LPC17_CCLK 120000000 /* 120Mhz */
/* Select the main oscillator as the frequency source. SYSCLK is then the
* frequency of the main oscillator.
*/
#undef CONFIG_LPC17_MAINOSC
#define CONFIG_LPC17_MAINOSC 1
#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
/* Select the main oscillator and CCLK divider. The output of the divider is
* CCLK. The input to the divider (PLLCLK) will be determined by the PLL
* output.
*/
#define BOARD_CCLKCFG_DIVIDER 4
#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
*
* Source clock: Main oscillator
* PLL0 Multiplier value (M): 20
* PLL0 Pre-divider value (N): 1
*
* PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
*/
#undef CONFIG_LPC17_PLL0
#define CONFIG_LPC17_PLL0 1
#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
#define BOARD_PLL0CFG_MSEL 20
#define BOARD_PLL0CFG_NSEL 1
#define BOARD_PLL0CFG_VALUE \
(((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
/* PLL1 -- Not used. */
#undef CONFIG_LPC17_PLL1
#define BOARD_PLL1CFG_MSEL 36
#define BOARD_PLL1CFG_NSEL 1
#define BOARD_PLL1CFG_VALUE \
(((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
/* USB divider. This divider is used when PLL1 is not enabled to get the
* USB clock from PLL0:
*
* USBCLK = PLL0CLK / 10 = 48MHz
*/
#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
/* FLASH Configuration */
#undef CONFIG_LP17_FLASH
#define CONFIG_LP17_FLASH 1
#define BOARD_FLASHCFG_VALUE 0x0000403a
/* LED definitions ***********************************************************/
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LEDs on the
* PNEV5180B board. The following definitions describe how NuttX controls the
* LEDs:
*/
/* LD201 LD200 LD202 LD203 */
/* RED ORANGE BLUE GREEN */
#define LED_STARTED 0 /* ON ON ON ON */
#define LED_HEAPALLOCATE 1 /* OFF OFF OFF ON */
#define LED_IRQSENABLED 2 /* OFF OFF ON OFF */
#define LED_STACKCREATED 3 /* OFF OFF OFF OFF */
#define LED_INIRQ 4 /* OFF OFF OFF ON (momentary) */
#define LED_SIGNAL 5 /* OFF OFF ON OFF (momentary) */
#define LED_ASSERTION 6 /* OFF ON OFF OFF (momentary) */
#define LED_PANIC 7 /* ON OFF OFF OFF (1Hz flashing) */
/* Alternate pin selections **************************************************/
/* Pin Description On Board Connector
* -------------------------------- ---------------- -------------
* P0.2/TXD0/AD0.7 TX J201
* P0.3/RXD0/AD0.6 RX
* P0.22/RTS1/TD1 LD200 ORANGE LED
* P0.15/TXD1/SCK0/SCK PN5180-SCK
* P0.16/RXD1/SSEL0/SSEL PN5180-SSEL PN5180
* P0.17/CTS1/MISO0/MISO PN5180-MISO
* P0.18/DCD1/M0SI0/MOSI PN5180-MOSI
* P0.19/DSR1/SDA1 EEPROM (Not Assembled)
* P0.20/DTR1/SCL1 EEPROM
* P0.21/RI1/RD1 PN5180-AUX2 PN5180
* P0.29/USB_D+ USB-D+ USB
* P0.30/USB_D- USB-D-
* P2.0/PWM1.1/TXD1 LD201 RED LED
* P2.5/PWM1.6/DTR1/TRACEDATA0 PN5180-nPN_RST
* P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
* P2.11/nEINT1/I2STX_CLK PN5180-BUSY PN5180
* P2.12/nEINT2/I2STX_WS PN5180-IRQ
* P3.25/MAT0.0/PWM1.2 LD203 GREEN LED
* P3.26/STCLK/MAT0.1/PWM1.3 LD202 BLUE LED
*/
/*****************************************************************************
* Public Types
*****************************************************************************/
#ifndef __ASSEMBLY__
/*****************************************************************************
* Public Data
*****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/*****************************************************************************
* Public Function Prototypes
*****************************************************************************/
/*****************************************************************************
* Name: lpc17_boardinitialize
*
* Description:
* All LPC17xx architectures must provide the following entry point. This
* entry point is called early in the intitialization -- after all memory
* has been configured and mapped but before any devices have been
* initialized.
*
*****************************************************************************/
void lpc17_boardinitialize(void);
/*****************************************************************************
* Name: lpc17_led
*
* Description:
* Once the system has booted, these functions can be used to control LED 1
*
*****************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void lpc17_led(int lednum, int state);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_PNEV5180_INCLUDE_BOARD_H */

View File

@ -0,0 +1,20 @@
#
# 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="arm"
CONFIG_ARCH_BOARD="pnev5180b"
CONFIG_ARCH_BOARD_PNEV5180B=y
CONFIG_ARCH_CHIP_LPC1769=y
CONFIG_ARCH_CHIP_LPC17XX=y
CONFIG_BOARD_LOOPSPERMSEC=11992
CONFIG_LPC17_UART0=y
CONFIG_MM_REGIONS=2
CONFIG_RAM_SIZE=32768
CONFIG_RAM_START=0x10000000
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"

View File

@ -0,0 +1,128 @@
############################################################################
# configs/pnev5180b/scripts/Make.defs
#
# Copyright (C) 2019 Gregory Nutt. All rights reserved.
# Author: Michael Jung <mijung@gmx.net>
#
# Based on configs/zkit-arm-1769/scripts/Make.defs
#
# Copyright (C) 2013 Zilogic Systems. All rights reserved.
# Author: BabuSubashChandar <code@zilogic.com>
# Manikandan <code@zilogic.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.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
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/flash.ld}"
NXFLATLDSCRIPT = -T "${shell cygpath -w $(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld}"
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/flash.ld
NXFLATLDSCRIPT = -T"$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld"
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
MKNXFLAT = mknxflat
LDNXFLAT = ldnxflat
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
# enable precise stack overflow tracking
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) $(INSTRUMENTATIONDEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) $(INSTRUMENTATIONDEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) $(NXFLATLDSCRIPT) -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
ASMEXT = .S
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-nuttx-elf-)
ifneq ($(CROSSDEV),arm-nuttx-eabi-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
HOSTLDFLAGS =

View File

@ -0,0 +1,115 @@
/*****************************************************************************
* configs/pnev5180b/scripts/flash.ld
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* Based on configs/zkit-arm-1769/scripts/flash.ld
*
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
* Author: BabuSubashChandar <code@zilogic.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.
*
*****************************************************************************/
/* The LPC1769 has 512Kb of FLASH beginning at address 0x0000:0000 and
* 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
* 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
* 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
* into the 32Kb CPU SRAM address range.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.ARM.extab : {
*(.ARM.extab*)
} >sram
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
__exidx_end = ABSOLUTE(.);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* 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) }
}

2
configs/pnev5180b/src/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.depend
/Make.dep

View File

@ -0,0 +1,65 @@
##############################################################################
# configs/pnev5180b/src/Makefile
#
# Copyright (C) 2019 Gregory Nutt. All rights reserved.
# Author: Michael Jung <mijung@gmx.net>
#
# 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
ASRCS =
CSRCS = lpc17_boot.c lpc17_bringup.c
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += lpc17_leds.c
endif
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += lpc17_appinit.c
endif
ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
CSRCS += lpc17_composite.c
endif
ifeq ($(CONFIG_LPC17_SPI),y)
CSRCS += lpc17_spi.c
endif
ifeq ($(CONFIG_ELF),y)
CSRCS += lpc17_symtab.c
endif
ifeq ($(CONFIG_NXFLAT),y)
CSRCS += lpc17_symtab.c
endif
include $(TOPDIR)/configs/Board.mk

View File

@ -0,0 +1,94 @@
/*****************************************************************************
* config/pnev5180b/src/lpc17_appinit.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* 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 <nuttx/config.h>
#include <nuttx/board.h>
#include "pnev5180b.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef OK
# define OK 0
#endif
/*****************************************************************************
* 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.
*
* 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 cold 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)
{
#ifdef CONFIG_BOARD_LATE_INITIALIZE
/* Board initialization already performed by board_late_initialize() */
return OK;
#else
/* Perform board-specific initialization */
return pnev5180b_bringup();
#endif
}

View File

@ -0,0 +1,96 @@
/*****************************************************************************
* configs/pnev5180b/src/lpc17_boot.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* 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 <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "pnev5180b.h"
/*****************************************************************************
* Public Functions
*****************************************************************************/
/*****************************************************************************
* Name: lpc17_boardinitialize
*
* Description:
* All LPC17xx architectures must provide the following entry point. This
* entry point is called early in the initialization -- after all memory
* has been configured and mapped but before any devices have been
* initialized.
*
*****************************************************************************/
void lpc17_boardinitialize(void)
{
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
pnev5180b_autoled_initialize();
#endif
}
/****************************************************************************
* Name: board_late_initialize
*
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize() will be
* called immediately after up_initialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
/* Perform board-specific initialization */
(void)pnev5180b_bringup();
}
#endif

View File

@ -0,0 +1,148 @@
/*****************************************************************************
* configs/pnev5180b/src/lpc17_composite.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* Configure and register CDC-ACM and CDC-ECM
*
* 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 <nuttx/config.h>
#include <syslog.h>
#include <stddef.h>
#include <nuttx/usb/cdcacm.h>
#include <nuttx/usb/cdcecm.h>
#include <nuttx/usb/composite.h>
#if defined(CONFIG_BOARDCTL_USBDEVCTRL) && defined(CONFIG_USBDEV_COMPOSITE)
/*****************************************************************************
* Public Functions
*****************************************************************************/
/*****************************************************************************
* Name: board_composite_initialize
*
* Description:
* Perform architecture specific initialization of a composite USB device.
*
*****************************************************************************/
int board_composite_initialize(int port)
{
syslog(LOG_INFO, "board_composite_initialize(port: %d)\n", port);
return OK;
}
/*****************************************************************************
* Name: board_composite_connect
*
* Description:
* Connect the USB composite device on the specified USB device port using
* the specified configuration. The interpretation of the configid is
* board specific.
*
* Input Parameters:
* port - The USB device port.
* configid - The USB composite configuration
*
* Returned Value:
* A non-NULL handle value is returned on success. NULL is returned on
* any failure.
*
*****************************************************************************/
FAR void *board_composite_connect(int port, int configid)
{
struct composite_devdesc_s dev[2];
int ifnobase = 0;
int strbase = COMPOSITE_NSTRIDS;
syslog(LOG_INFO, "board_composite_connect(port: %d, configid: %d)\n",
port, configid);
/* Configure the CDC/ACM device */
/* Ask the cdcacm driver to fill in the constants we didn't
* know here.
*/
cdcacm_get_composite_devdesc(&dev[0]);
/* Overwrite and correct some values... */
/* The callback functions for the CDC/ACM class */
dev[0].classobject = cdcacm_classobject;
dev[0].uninitialize = cdcacm_uninitialize;
/* Interfaces */
dev[0].devinfo.ifnobase = ifnobase; /* Offset to Interface-IDs */
dev[0].minor = 0; /* The minor interface number */
/* Strings */
dev[0].devinfo.strbase = strbase; /* Offset to String Numbers */
/* Endpoints */
dev[0].devinfo.epno[CDCACM_EP_INTIN_IDX] = 1;
dev[0].devinfo.epno[CDCACM_EP_BULKIN_IDX] = 5;
dev[0].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = 2;
/* Count up the base numbers */
ifnobase += dev[0].devinfo.ninterfaces;
strbase += dev[0].devinfo.nstrings;
/* Configure the CDC/ECM device */
cdcecm_get_composite_devdesc(&dev[1]);
dev[1].devinfo.ifnobase = ifnobase; /* Offset to Interface-IDs */
dev[1].devinfo.strbase = strbase; /* Offset to String Numbers */
dev[1].minor = 0; /* The minor interface number */
dev[1].devinfo.epno[CDCECM_EP_INTIN_IDX] = 4;
dev[1].devinfo.epno[CDCECM_EP_BULKIN_IDX] = 11;
dev[1].devinfo.epno[CDCECM_EP_BULKOUT_IDX] = 8;
return composite_initialize(2, dev);
}
#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */

View File

@ -0,0 +1,157 @@
/****************************************************************************
* configs/pnev5180b/src/lpc17_leds.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* 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 <nuttx/config.h>
#include <stdbool.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "lpc17_gpio.h"
#include "pnev5180b.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
void pnev5180b_autoled_initialize(void)
{
/* Configure all LED GPIO lines */
lpc17_configgpio(PNEV5180B_LED_RED);
lpc17_configgpio(PNEV5180B_LED_ORANGE);
lpc17_configgpio(PNEV5180B_LED_BLUE);
lpc17_configgpio(PNEV5180B_LED_GREEN);
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
switch (led)
{
case LED_STARTED:
lpc17_gpiowrite(PNEV5180B_LED_RED, true);
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, true);
lpc17_gpiowrite(PNEV5180B_LED_BLUE, true);
lpc17_gpiowrite(PNEV5180B_LED_GREEN, true);
break;
case LED_HEAPALLOCATE:
lpc17_gpiowrite(PNEV5180B_LED_RED, false);
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, false);
lpc17_gpiowrite(PNEV5180B_LED_BLUE, false);
lpc17_gpiowrite(PNEV5180B_LED_GREEN, true);
break;
case LED_IRQSENABLED:
lpc17_gpiowrite(PNEV5180B_LED_RED, false);
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, false);
lpc17_gpiowrite(PNEV5180B_LED_BLUE, true);
lpc17_gpiowrite(PNEV5180B_LED_GREEN, false);
break;
case LED_STACKCREATED:
lpc17_gpiowrite(PNEV5180B_LED_RED, false);
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, false);
lpc17_gpiowrite(PNEV5180B_LED_BLUE, false);
lpc17_gpiowrite(PNEV5180B_LED_GREEN, false);
break;
case LED_INIRQ:
lpc17_gpiowrite(PNEV5180B_LED_GREEN, true);
break;
case LED_SIGNAL:
lpc17_gpiowrite(PNEV5180B_LED_BLUE, true);
break;
case LED_ASSERTION:
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, true);
break;
case LED_PANIC:
lpc17_gpiowrite(PNEV5180B_LED_RED, true);
break;
default:
DEBUGPANIC();
}
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
switch (led)
{
case LED_INIRQ:
lpc17_gpiowrite(PNEV5180B_LED_GREEN, false);
break;
case LED_SIGNAL:
lpc17_gpiowrite(PNEV5180B_LED_BLUE, false);
break;
case LED_ASSERTION:
lpc17_gpiowrite(PNEV5180B_LED_ORANGE, false);
break;
case LED_PANIC:
lpc17_gpiowrite(PNEV5180B_LED_RED, false);
break;
default:
DEBUGPANIC();
}
}
#endif /* CONFIG_ARCH_LEDS */

View File

@ -0,0 +1,114 @@
/****************************************************************************
* configs/pnev5180b/src/lpc17_spi.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Michael Jung <mijung@gmx.net>
*
* 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 <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "chip.h"
#include "lpc17_spi.h"
#include "lpc17_gpio.h"
#include "pnev5180b.h"
#if defined(CONFIG_LPC17_SPI)
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: pnev5180b_spidev_initialize
*
* Description:
* Called to configure SPI chip select and card detect GPIO pins for the
* NXP PNEV5180B NFC Frontend Development Kit.
*
****************************************************************************/
void weak_function pnev5180b_spidev_initialize(void)
{
}
/****************************************************************************
* Name: lpc17_spiselect and lpc17_spistatus
*
* Description:
* The external functions, lpc17_spiselect and lpc17_spistatus
* must be provided by board-specific logic. They are implementations of
* the select and status methods of the SPI interface defined by struct
* spi_ops_s (see include/nuttx/spi/spi.h). All other methods (including
* lpc17_spibus_initialize()) are provided by common LPC17xx logic. To
* use this common SPI logic on your board:
*
* 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip
* select
* pins.
* 2. Provide lpc17_spiselect and lpc17_spistatus functions
* in your board-specific logic. These functions will perform chip
* selection and status operations using GPIOs in the way your board is
* configured.
* 3. Add a calls to lpc17_spibus_initialize() in your low level
* application initialization logic
* 4. The handle returned by lpc17_spibus_initialize() may then be used
* to bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
****************************************************************************/
void lpc17_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n",
(int)devid, selected ? "assert" : "de-assert");
}
uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("devid: %d\n", (int)devid);
return 0;
}
#endif /* CONFIG_LPC17_SPI */

View File

@ -0,0 +1,110 @@
/*****************************************************************************
* config/pnev5180b/src/lpc17_symtab.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* 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 <nuttx/compiler.h>
#include <nuttx/binfmt/symtab.h>
/*****************************************************************************
* Public Data
*****************************************************************************/
extern void *exit;
extern void *fflush;
extern void *fopen;
extern void *fprintf;
extern void *get_errno_ptr;
extern void *getpid;
extern void *kill;
extern void *memset;
extern void *printf;
extern void *pthread_attr_init;
extern void *pthread_create;
extern void *pthread_exit;
extern void *pthread_join;
extern void *pthread_mutex_init;
extern void *pthread_mutex_lock;
extern void *pthread_mutex_unlock;
extern void *puts;
extern void *sched_getstreams;
extern void *sem_destroy;
extern void *sem_init;
extern void *sem_post;
extern void *sem_wait;
extern void *sigaction;
extern void *sigemptyset;
extern void *sigqueue;
extern void *sleep;
extern void *strcmp;
extern void *task_create;
extern void *usleep;
const struct symtab_s lpc17_exports[] =
{
{"exit", &exit},
{"fflush", &fflush},
{"fopen", &fopen},
{"fprintf", &fprintf},
{"get_errno_ptr", &get_errno_ptr},
{"getpid", &getpid},
{"kill", &kill},
{"memset", &memset},
{"printf", &printf},
{"pthread_attr_init", &pthread_attr_init},
{"pthread_create", &pthread_create},
{"pthread_exit", &pthread_exit},
{"pthread_join", &pthread_join},
{"pthread_mutex_init", &pthread_mutex_init},
{"pthread_mutex_lock", &pthread_mutex_lock},
{"pthread_mutex_unlock", &pthread_mutex_unlock},
{"puts", &puts},
{"sched_getstreams", &sched_getstreams},
{"sem_destroy", &sem_destroy},
{"sem_init", &sem_init},
{"sem_post", &sem_post},
{"sem_wait", &sem_wait},
{"sigaction", &sigaction},
{"sigemptyset", &sigemptyset},
{"sigqueue", &sigqueue},
{"sleep", &sleep},
{"strcmp", &strcmp},
{"task_create", &task_create},
{"usleep", &usleep},
};
const int lpc17_nexports = sizeof(lpc17_exports) / sizeof(struct symtab_s);

View File

@ -0,0 +1,56 @@
/*****************************************************************************
* config/pnev5180b/src/lpc17_symtab.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Michael Jung <mijung@gmx.net>
*
* 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 __CONFIGS_PNEV5180B_SRC_LPC17_SYMTAB_H
#define __CONFIGS_PNEV5180B_SRC_LPC17_SYMTAB_H
/*****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/symtab.h>
#if defined(CONFIG_ELF) || defined(CONFIG_NXFLAT)
/*****************************************************************************
* Public Data
*****************************************************************************/
extern const struct symtab_s lpc17_exports[];
extern const int lpc17_nexports;
#endif
#endif /* __CONFIGS_PNEV5180B_SRC_LPC17_SYMTAB_H */

View File

@ -0,0 +1,127 @@
/****************************************************************************
* configs/pnev5180b/src/pnev5180b.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Michael Jung <mijung@gmx.net>
*
* 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 _CONFIGS_PNEV5180B_SRC_PNEV5180B_H
#define _CONFIGS_PNEV5180B_SRC_PNEV5180B_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* NXP PNEV5180B Pin Usage
****************************************************************************/
/* Pin Description On Board Connector
* -------------------------------- ---------------- -------------
* P0.2/TXD0/AD0.7 TX J201
* P0.3/RXD0/AD0.6 RX
* P0.22/RTS1/TD1 LD200 ORANGE LED
* P0.15/TXD1/SCK0/SCK PN5180-SCK
* P0.16/RXD1/SSEL0/SSEL PN5180-SSEL PN5180
* P0.17/CTS1/MISO0/MISO PN5180-MISO
* P0.18/DCD1/M0SI0/MOSI PN5180-MOSI
* P0.19/DSR1/SDA1 EEPROM (Not Assembled)
* P0.20/DTR1/SCL1 EEPROM
* P0.21/RI1/RD1 PN5180-AUX2 PN5180
* P0.29/USB_D+ USB-D+ USB
* P0.30/USB_D- USB-D-
* P2.0/PWM1.1/TXD1 LD201 RED LED
* P2.5/PWM1.6/DTR1/TRACEDATA0 PN5180-nPN_RST
* P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
* P2.11/nEINT1/I2STX_CLK PN5180-BUSY PN5180
* P2.12/nEINT2/I2STX_WS PN5180-IRQ
* P3.25/MAT0.0/PWM1.2 LD203 GREEN LED
* P3.26/STCLK/MAT0.1/PWM1.3 LD202 BLUE LED
*/
#define PNEV5180B_LED_BLUE (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT3 | GPIO_PIN26)
#define PNEV5180B_LED_GREEN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT3 | GPIO_PIN25)
#define PNEV5180B_LED_ORANGE (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN22)
#define PNEV5180B_LED_RED (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN0)
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: pnev5180b_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 pnev5180b_bringup(void);
/****************************************************************************
* Name: pnev5180b_autoled_initialize
*
* Description:
* Called early in power-up initialization to initialize the LED hardware.
*
****************************************************************************/
void pnev5180b_autoled_initialize(void);
/****************************************************************************
* Name: pnev5180b_spidev_initialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the NXP PNEV5180B
* board.
*
****************************************************************************/
void weak_function pnev5180b_spidev_initialize(void);
#endif /* __ASSEMBLY__ */
#endif /* _CONFIGS_PNEV5180B_SRC_PNEV5180B_H */