9
0
Fork 0

Converted all configurations to use the kconfig-frontends tools, cleaned up the directory structure and naming to match some of the more recent configurations, and added a segment LCD driver for the board. The initial checkin of the LCD driver is just a clone of configs/pcblogic-pic32mx/src/pic32mx_lcd1602 and it not yet expected to be functional.

This commit is contained in:
Gregory Nutt 2013-05-26 16:44:53 -06:00
parent 47ed1cf8c4
commit 168976579a
27 changed files with 3281 additions and 2269 deletions

View File

@ -4805,3 +4805,10 @@
from slcd_codec.h (2013-5-25)
* libc/misc/lib_slcdencode.c and lib_slcddecode.c: Several encoding
and decoding bug fixes (2013-5-26)
* configs/sure-pic32mx: Converted all configurations to use the
kconfig-frontends tools, cleaned up the directory structure and
naming to match some of the more recent configurations, and added
a segment LCD driver for the board. The initial checkin of the
LCD driver is just a clone of configs/pcblogic-pic32mx/src/pic32mx_lcd1602
and it not yet expected to be functional (2013-5-26).

View File

@ -499,7 +499,7 @@ config PIC32MX_UART1
config PIC32MX_UART2
bool "UART2"
default n
select ARCH_HAVE_UART1
select ARCH_HAVE_UART2
config PIC32MX_UART3
bool "UART3"

View File

@ -599,8 +599,7 @@ Configuration sub-directories
2. By default, this configuration uses an older Microchip C32 toolchain
for Windows (the newer ones seem to be incompatible) and builds under
Cygwin (or probably MSYS). That
can easily be reconfigured, of course.
Cygwin (or probably MSYS). That can easily be reconfigured, of course.
Build Setup:
CONFIG_HOST_WINDOWS=y : Builds under Windows
@ -634,8 +633,7 @@ Configuration sub-directories
3. By default, this configuration uses an older Microchip C32 toolchain
for Windows (the newer ones seem to be incompatible) and builds under
Cygwin (or probably MSYS). That
can easily be reconfigured, of course.
Cygwin (or probably MSYS). That can easily be reconfigured, of course.
Build Setup:
CONFIG_HOST_WINDOWS=y : Builds under Windows

View File

@ -4,4 +4,37 @@
#
if ARCH_BOARD_SUREPIC32MX
choice
prompt "Select Sure PIC32MX Board"
default ARCH_DBDP11215
config ARCH_DBDP11215
bool "DB_DP11215 PIC32 Storage Demo Board"
---help---
DB_DP11215 PIC32 Storage Demo Board
- PIC32MX44F512H
- SD card slot
- RS-2323 Interface
- USB (MINI-B)
- 2x16 LCD display
- Three tactile switches
- Four user LEDs
config ARCH_DBDP11212
bool "DB-DP11212 PIC32 General Purpose Demo Board"
---help---
DB-DP11212 PIC32 General Purpose Demo Board
- PIC32MX44F512H
- LM75A temperature sensor and temperature resistor (NTC-SMD thermistor)
- SPI FLASH: AT25DF041A
- USB (MINI-B)
- 2x16 LCD display
- 4 digit, 8 segment LED display
- Three tactile switches
- Four user LEDs
endchoice
endif

View File

@ -36,6 +36,7 @@ Contents
PIC32MX440F512H Pin Out
Toolchains
Loading NuttX with PICkit2
LCD1602
PIC32MX Configuration Options
Configurations
@ -391,6 +392,37 @@ Loading NuttX with PICkit2
# to the top-level build directory. It is the only
# required input to mkpichex.
LCD1602
=======
The on-board LCD is a 2x16 segment LCD and appears to be compatible with
the LCD1602 and is like an LCD1602 LCD here.
LCD pin mapping (see configs/pcblogic-pic32mx/README.txt)
--------------------- ---------- ----------------------------------
PIC32 Sure JP1 Sure Signal Description
PIN SIGNAL NAME PIN NAME(s)
--------------------- ---------- ----------------------------------
34 Vbus 1. +5V +5V VBUS device mode
To GND via capacitor
2. GND GND
49 RD1 3. Vo Transistor circuit driven by PWM2
44 PMA0/AN15/RB15 4. RS PMA0, Selects registers
53 PMRD/RD5 5. RW PMRD/PMWR, Selects read or write
45 PMPCS1/RD11 6. E Starts data read/write
60 PMD0/RE0 7. DB0 PMD0
61 PMD1/RE1 8. DB1 PMD1
62 PMD2/RE2 9. DB2 PMD2
63 PMD3/RE3 10. DB3 PMD3
64 PMD4/RE4 11. DB4 PMD4
1 PMD5/RE5 12. DB5 PMD5
2 PMD6/RE6 13. DB6 PMD6
3 PMD7/RE7 14. DB7 PMD7
15. A +5V_DUSB
46 INT0/RD0 16. K Transistor circuit driven by PWM1
--------------------- ---------- ----------------------------------
PIC32MX Configuration Options
=============================
@ -596,14 +628,28 @@ PIC32MX Configuration Options
Configurations
==============
Each PIC32MX configuration is maintained in a sub-directory and can be
selected as follow:
Each PIC32MX configuration is maintained in a sub-directory and can be
selected as follow:
cd tools
./configure.sh sure-pic32mx/<subdir>
cd -
. ./setenv.sh
Where <subdir> is one of the following sub-directories.
NOTE: These configurations use the mconf-based configuration tool. To
change any of these configurations using that tool, you should:
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
and misc/tools/
b. Execute 'make menuconfig' in nuttx/ in order to start the
reconfiguration process.
Configuration sub-directories
-----------------------------
Where <subdir> is one of the following:
ostest:
@ -613,6 +659,20 @@ Where <subdir> is one of the following:
This configuration directory, performs a simple OS test using
apps/examples/ostest.
Notes.
-----
1. By default, this configuration uses an older Microchip C32 toolchain
for Windows (the newer ones seem to be incompatible) and builds under
Cygwin (or probably MSYS). That
can easily be reconfigured, of course.
Build Setup:
CONFIG_HOST_WINDOWS=y : Builds under Windows
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
System Type:
CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y : Older C32 toolchain
nsh:
====
Description.
@ -620,54 +680,122 @@ Where <subdir> is one of the following:
Configures the NuttShell (nsh) located at apps/examples/nsh. The
Configuration enables only the serial NSH interface.
USB Configuations.
-----------------
Several USB device configurations can be enabled and included
as NSH built-in built in functions. All require the following
basic setup in your .config to enable USB device support:
Notes.
-----
1. By default, this configuration uses an older Microchip C32 toolchain
for Windows (the newer ones seem to be incompatible) and builds under
Cygwin (or probably MSYS). That can easily be reconfigured, of course.
Build Setup:
CONFIG_HOST_WINDOWS=y : Builds under Windows
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
System Type:
CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y : Older C32 toolchain
2. USB Configuations.
Several USB device configurations can be enabled and included
as NSH built-in built in functions. All require the following
basic setup in your .config to enable USB device support:
CONFIG_USBDEV=y : Enable basic USB device support
CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
Drivers:
CONFIG_USBDEV=y : Enable basic USB device support
examples/usbterm - This option can be enabled by uncommenting
the following line in the appconfig file:
System Type -> PIC32MX Peripheral Support:
CONFIG_PIC32MX_USBDEV=y : Enable PIC32 USB device support
CONFIGURED_APPS += examples/usbterm
examples/usbterm - This option can be enabled by uncommenting
the following line in the appconfig file:
And by enabling one of the USB serial devices:
Application Configuration->Examples:
CONFIG_EXAMPLES_USBTERM=y : Selects /apps/examples/usbterm
CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
And by enabling one of the USB serial devices:
examples/cdcacm - The examples/cdcacm program can be included as an
function by uncommenting the following line in the appconfig file:
Drivers->USB Device Driver Support
CONFIG_PL2303=y : Enable the Prolifics PL2303 emulation
CONFIG_CDCACM=y : or the CDC/ACM serial driver (not both)
examples/cdcacm - The examples/cdcacm program can be included as an
function by uncommenting the following line in the appconfig file:
CONFIGURED_APPS += examples/cdcacm
Application Configuration->Examples:
CONFIG_EXAMPLES_CDCACM=y : Select apps/examples/cdcacm
and defining the following in your .config file:
and defining the following in your .config file:
CONFIG_CDCACM=y : Enable the CDCACM device
Drivers->USB Device Driver Support
CONFIG_CDCACM=y : Enable the CDCACM device
examples/usbstorage - There are some hooks in the appconfig file
to enable the USB mass storage device. However, this device cannot
work until support for the SD card is also incorporated.
examples/usbstorage - There are some hooks in the appconfig file
to enable the USB mass storage class (MSC)device. However, this device
cannot work until support for the SD card is also incorporated.
SD Card Support.
----------------
Support for the on-board, SPI-based SD card is available but is
not yet functional (at least at the time of this writing). SD
card support can be enabled for testing by simply enabling SPI2
support in the configuration file:
Drivers->USB Device Driver Support
CONFIG_USBMSC=y : Enables the USB MSC class
-CONFIG_PIC32MX_SPI2=n
+CONFIG_PIC32MX_SPI2=y
Application Configuration->Examples:
CONFIG_EXAMPLES_USBSTORAGE=y : Enhables apps/examples/usbstorage
3. SD Card Support.
Support for the on-board, SPI-based SD card is available but is
not yet functional (at least at the time of this writing). SD
card support can be enabled for testing by simply enabling SPI2
support in the configuration file:
System Type -> PIC32MX Peripheral Support:
CONFIG_PIC32MX_SPI2=y : Enable SPI2
Drivers:
CONFIG_MMCSD=y : MMC/SD support
CONFIG_MMCSD_SPI=y : SPI-based MMC/SD support
File Systems:
CONFIG_FS_FAT=y : FAT file system
: Other FAT options
Debug output for testing the SD card can be enabled using:
-CONFIG_DEBUG_FS=n
-CONFIG_DEBUG_SPI=n
+CONFIG_DEBUG_FS=y
+CONFIG_DEBUG_SPI=y
Build Setup:
CONFIG_DEBUG=y : Enable debug features
CONFIG_DEBUG_VERBOSE=y : Enable verbose debug output
CONFIG_DEBUG_FS=y : Enable file system debug
CONFIG_DEBUG_SPI=y : Enable SPI debug
4. To enable LCD1602 support:
Device Drivers:
CONFIG_LCD=y : Enable LCD menus
CONFIG_LCD_LCD1602=y : Select LCD1602
Library Routines:
CONFIG_LIB_SLCDCODEC=y : Enable the SLCD CODEC
System Type -> PIC32MX Peripheral Support:
CONFIG_PIC32MX_PMP=y : Enable PMP support
To enable apps/examples/slcd to test the LCD:
Application Configuration:
CONFIG_NSH_ARCHINIT=y : Needed to initialize the SLCD
CONFIG_EXAMPLES_SLCD=y : Enable apps/examples/slcd use /dev/lcd1602
CONFIG_EXAMPLES_SLCD_DEVNAME="/dev/lcd1602"
To enable LCD debug output:
Build Setup:
CONFIG_DEBUG=y : Enable debug features
CONFIG_DEBUG_VERBOSE=y : Enable LCD debug
NOTES:
a. I do not have the LCD1602 working. I may just be getting lost in the
tangle of wires or perhaps there is something fundamentally wrong with
the code.
b. At this point in time, testing of the SLCD is very limited because
there is not much in apps/examples/slcd. Basically driver with a working
test setup and ready to be tested and debugged.
usbnsh:
=======
@ -681,29 +809,42 @@ Where <subdir> is one of the following:
"DB_DP11215 PIC32 Storage Demo Board" and has only be testing on that
board.
Comparison to nsh
-----------------
Below summarizes the key configuration differences between the 'nsh'
and the 'upnsh' configurations:
Notes.
-----
1. By default, this configuration uses an older Microchip C32 toolchain
for Windows (the newer ones seem to be incompatible) and builds under
Cygwin (or probably MSYS). That can easily be reconfigured, of course.
CONFIG_USBDEV=y : NuttX USB device support is enabled
CONFIG_PIC32MX_USBDEV=y : The PIC32MX USB device driver is built
CONFIG_UART1_SERIAL_CONSOLE=n : There is no serial console
CONFIG_UART2_SERIAL_CONSOLE=n :
CONFIG_CDCACM=y : The CDC/ACM serial device class is enabled
CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is the console
Build Setup:
CONFIG_HOST_WINDOWS=y : Builds under Windows
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
Using the Prolifics PL2303 Emulation
------------------------------------
You could also use the non-standard PL2303 serial device instead of
the standard CDC/ACM serial device by changing:
System Type:
CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y : Older C32 toolchain
CONFIG_CDCACM=y : Disable the CDC/ACM serial device class
CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is NOT the console
CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console
2. Comparison to nsh
Why would you want to use a non-standard USB serial driver? You might
to use the PL2303 driver with a Windows host because it should
automatically install the PL2303 driver (you might have to go through
some effort to get Windows to recognize the CDC/ACM device).
Below summarizes the key configuration differences between the 'nsh'
and the 'upnsh' configurations:
CONFIG_USBDEV=y : NuttX USB device support is enabled
CONFIG_PIC32MX_USBDEV=y : The PIC32MX USB device driver is built
CONFIG_UART1_SERIAL_CONSOLE=n : There is no serial console
CONFIG_UART2_SERIAL_CONSOLE=n :
CONFIG_CDCACM=y : The CDC/ACM serial device class is enabled
CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is the console
Using the Prolifics PL2303 Emulation
You could also use the non-standard PL2303 serial device instead of
the standard CDC/ACM serial device by changing:
CONFIG_CDCACM=n : Disable the CDC/ACM serial device class
CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console
CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled
CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console
Why would you want to use a non-standard USB serial driver? You might
to use the PL2303 driver with a Windows host because it should
automatically install the PL2303 driver (you might have to go through
some effort to get Windows to recognize the CDC/ACM device).

View File

@ -1,7 +1,7 @@
############################################################################
# configs/sure-pic32mx/nsh/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -44,13 +44,13 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.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)/nsh/ld.script}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
endif
CC = $(CROSSDEV)gcc

View File

@ -1,77 +0,0 @@
############################################################################
# configs/sure-pic32mx/nsh/appconfig
#
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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.
#
############################################################################
############################################################################
# Path to example in apps/examples containing the user_start entry point
############################################################################
CONFIGURED_APPS += examples/nsh
############################################################################
# The NSH application library
############################################################################
CONFIGURED_APPS += system/readline
CONFIGURED_APPS += nshlib
############################################################################
# USB device configurations
############################################################################
ifeq ($(CONFIG_PIC32MX_USBDEV),y)
# USB Mass Storage Class device configurations
ifeq ($(CONFIG_USBMSC),y)
# Uncomment to enable the examples/usbstorage built-in
# CONFIGURED_APPS += examples/usbstorage
endif
# USB CDC/ACM serial device configurations
ifeq ($(CONFIG_CDCACM),y)
# Uncomment to enable the examples/cdcacm built-in
# CONFIGURED_APPS += examples/cdcacm
# Uncomment the following to enable the examples/usbterm built-in
# CONFIGURED_APPS += examples/usbterm
endif
# Prolifics PL2303 emulation configurations
ifeq ($(CONFIG_PL2303),y)
# Uncomment the following to enable the examples/usbterm built-in
# CONFIGURED_APPS += examples/usbterm
endif
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
############################################################################
# configs/sure-pic32mx/ostest/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2011,2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -44,13 +44,13 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.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)/ostest/ld.script}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
endif
CC = $(CROSSDEV)gcc

View File

@ -1,39 +0,0 @@
############################################################################
# configs/sure-pic32mx/ostest/appconfig
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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.
#
############################################################################
# Path to example in apps/examples containing the user_start entry point
CONFIGURED_APPS += examples/ostest

File diff suppressed because it is too large Load Diff

View File

@ -1,317 +0,0 @@
/****************************************************************************
* configs/sure-pic32mx/ostest/ld.script
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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 Regions ***********************************************************/
MEMORY
{
/* The PIC32MX440F512H has 512Kb of program FLASH at physical address
* 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
*/
kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
/* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
* 0x1fc00000. The initial reset vector is in KSEG1, but all other
* accesses are in KSEG0.
*
* REGION PHYSICAL KSEG SIZE
* DESCRIPTION START ADDR (BYTES)
* ------------- ---------- ------ ----------------------
* Exceptions:*
* Reset 0x1fc00000 KSEG1 512 512
* TLB Refill 0x1fc00200 KSEG1 256 768
* Cache Error 0x1fc00300 KSEG1 128 896
* Others 0x1fc00380 KSEG1 128 1024 (1Kb)
* Interrupt 0x1fc00400 KSEG1 128 1152
* JTAG 0x1fc00480 KSEG1 16 1168
* Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
* Debug code 0x1fc02000 KSEG1 4096-16 12272
* DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
*
* Exceptions assume:
*
* STATUS: BEV=0/1 and EXL=0
* CAUSE: IV=1
* JTAG: ProbEn=0
* And multi-vector support disabled
*/
kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
/* The PIC32MX440F512H has 32Kb of data memory at physical address
* 0x00000000. Since the PIC32MX has no data cache, this memory is
* always accessed through KSEG1.
*
* When used with MPLAB, we need to set aside 512 bytes of memory
* for use by MPLAB.
*/
kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
}
OUTPUT_FORMAT("elf32-tradlittlemips")
OUTPUT_ARCH(pic32mx)
ENTRY(__start)
SECTIONS
{
/* Boot FLASH sections */
.reset :
{
KEEP (*(.reset))
} > kseg1_reset
/* Exception handlers. The following is assumed:
*
* STATUS: BEV=1 and EXL=0
* CAUSE: IV=1
* JTAG: ProbEn=0
* And multi-vector support disabled
*
* In that configuration, the vector locations become:
*
* Reset, Soft Reset bfc0:0000
* TLB Refill bfc0:0200
* Cache Error bfc0:0300
* All others bfc0:0380
* Interrupt bfc0:0400
* EJTAG Debug bfc0:0480
*/
/* KSEG1 exception handler "trampolines" */
.gen_excpt :
{
KEEP (*(.gen_excpt))
} > kseg1_genexcpt
.ebase_excpt :
{
KEEP (*(.ebase_excpt))
} > kseg1_ebexcpt
.bev_excpt :
{
KEEP (*(.bev_excpt))
} > kseg1_bevexcpt
.int_excpt :
{
KEEP (*(.int_excpt))
} > kseg1_intexcpt
.dbg_excpt = ORIGIN(kseg1_dbgexcpt);
.start :
{
/* KSEG0 Reset startup logic */
*(.start)
/* KSEG0 exception handlers */
*(.nmi_handler)
*(.bev_handler)
*(.int_handler)
} > kseg0_bootmem
.dbg_code = ORIGIN(kseg1_dbgcode);
.devcfg :
{
KEEP (*(.devcfg))
} > kseg1_devcfg
/* Program FLASH sections */
.text :
{
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.stub)
KEEP (*(.text.*personality*))
*(.gnu.linkonce.t.*)
*(.gnu.warning)
*(.mips16.fn.*)
*(.mips16.call.*)
/* Read-only data is included in the text section */
*(.rodata .rodata.*)
*(.rodata1)
*(.gnu.linkonce.r.*)
/* Small initialized constant global and static data */
*(.sdata2 .sdata2.*)
*(.gnu.linkonce.s2.*)
/* Uninitialized constant global and static data */
*(.sbss2 .sbss2.*)
*(.gnu.linkonce.sb2.*)
_etext = ABSOLUTE(.);
} > kseg0_progmem
/* Initialization data begins here in progmem */
_data_loaddr = LOADADDR(.data);
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
/* RAM functions are positioned at the beginning of RAM so that
* they can be guaranteed to satisfy the 2Kb alignment requirement.
*/
/* This causes failures if there are no RAM functions
.ramfunc ALIGN(2K) :
{
_sramfunc = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfunc = ABSOLUTE(.);
} > kseg1_datamem AT > kseg0_progmem
_ramfunc_loadaddr = LOADADDR(.ramfunc);
_ramfunc_sizeof = SIZEOF(.ramfunc);
_bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
_bmxdudba_address = LENGTH(kseg1_datamem) ;
_bmxdupba_address = LENGTH(kseg1_datamem) ;
*/
.data :
{
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
*(.data1)
} > kseg1_datamem AT > kseg0_progmem
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
_gp = ALIGN(16) + 0x7FF0 ;
.got :
{
*(.got.plt) *(.got)
} > kseg1_datamem AT > kseg0_progmem
.sdata :
{
*(.sdata .sdata.* .gnu.linkonce.s.*)
} > kseg1_datamem AT > kseg0_progmem
.lit8 :
{
*(.lit8)
} > kseg1_datamem AT > kseg0_progmem
.lit4 :
{
*(.lit4)
_edata = ABSOLUTE(.);
} >kseg1_datamem AT>kseg0_progmem
.sbss :
{
_sbss = ABSOLUTE(.);
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
} >kseg1_datamem
.bss :
{
*(.dynbss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > kseg1_datamem
/* 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) }
/* DWARF debug sections */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.note.GNU-stack) }
}

View File

@ -1,7 +1,7 @@
############################################################################
# configs/sure-pic32mx/src/Makefile
#
# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -35,48 +35,52 @@
-include $(TOPDIR)/Make.defs
CFLAGS += -I$(TOPDIR)/sched
CFLAGS += -I$(TOPDIR)/sched
ASRCS =
CSRCS = up_boot.c up_spi.c
ASRCS =
CSRCS = pic32mx_boot.c pic32mx_spi.c
# Only the DB_DP11215 PIC32 Storage Demo Board board has user controllable
# LEDs
ifeq ($(CONFIG_ARCH_DBDP11215),y)
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += up_leds.c
CSRCS += pic32mx_autoleds.c
endif
endif
ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += up_buttons.c
CSRCS += pic32mx_buttons.c
endif
ifeq ($(CONFIG_PIC32MX_USBDEV),y)
CSRCS += up_usbdev.c
CSRCS += pic32mx_usbdev.c
ifeq ($(CONFIG_EXAMPLES_USBTERM_DEVINIT),y)
CSRCS += up_usbterm.c
CSRCS += pic32mx_usbterm.c
endif
endif
ifeq ($(CONFIG_LCD_LCD1602),y)
CSRCS += pic32mx_lcd1602.c
endif
ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += up_nsh.c
CSRCS += pic32mx_nsh.c
endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
SRCS = $(ASRCS) $(CSRCS)
OBJS = $(AOBJS) $(COBJS)
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
ifeq ($(WINTOOL),y)
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
-I "${shell cygpath -w $(ARCH_SRCDIR)/mips32}"
else
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/mips32
endif
all: libboard$(LIBEXT)

View File

@ -1,8 +1,7 @@
/****************************************************************************
* configs/sure-pic32mx/src/up_leds.c
* arch/arm/src/board/up_leds.c
* configs/sure-pic32mx/src/pic32mx_leds.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -52,7 +51,7 @@
#include "pic32mx-internal.h"
#include "pic32mx-ioport.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
#ifdef CONFIG_ARCH_LEDS

View File

@ -1,8 +1,7 @@
/************************************************************************************
* configs/sure-pic32mx/src/up_boot.c
* arch/mips/src/board/up_boot.c
* configs/sure-pic32mx/src/pic32mx_boot.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -48,7 +47,7 @@
#include "up_internal.h"
#include "pic32mx-internal.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
/************************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/sure-pic32mx/src/up_buttons.c
* configs/sure-pic32mx/src/pic32mx_buttons.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -51,7 +51,7 @@
#include "pic32mx-internal.h"
#include "pic32mx-ioport.h"
#include "pic32mx-adc.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
#ifdef CONFIG_ARCH_BUTTONS

View File

@ -0,0 +1,961 @@
/****************************************************************************
* configs/sure-pic32mx/src/pic32mx_lcd1602.c
*
* This logic supports the connection of an LCD1602 LCD to the PCB Logic
* PIC32MX board. The LCD1602 is based on the Hitachi HD44780U LCD
* controller
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
*
****************************************************************************/
/* LCD pin mapping (see configs/pcblogic-pic32mx/README.txt)
*
* --------------------- ---------- ----------------------------------
* PIC32 Sure JP1 Sure Signal Description
* PIN SIGNAL NAME PIN NAME(s)
* --------------------- ---------- ----------------------------------
* 34 Vbus 1. +5V +5V VBUS device mode
* To GND via capacitor
* 2. GND GND
* 49 RD1 3. Vo Transistor circuit driven by PWM2
* 44 PMA0/AN15/RB15 4. RS PMA0, Selects registers
* 53 PMRD/RD5 5. RW PMRD/PMWR, Selects read or write
* 45 PMPCS1/RD11 6. E Starts data read/write
* 60 PMD0/RE0 7. DB0 PMD0
* 61 PMD1/RE1 8. DB1 PMD1
* 62 PMD2/RE2 9. DB2 PMD2
* 63 PMD3/RE3 10. DB3 PMD3
* 64 PMD4/RE4 11. DB4 PMD4
* 1 PMD5/RE5 12. DB5 PMD5
* 2 PMD6/RE6 13. DB6 PMD6
* 3 PMD7/RE7 14. DB7 PMD7
* 15. A +5V_DUSB
* 46 INT0/RD0 16. K Transistor circuit driven by PWM1
* --------------------- ---------- ----------------------------------
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <semaphore.h>
#include <ctype.h>
#include <poll.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/ascii.h>
#include <nuttx/fs/fs.h>
#include <nuttx/lcd/hd4478ou.h>
#include <nuttx/lcd/slcd_ioctl.h>
#include <nuttx/lcd/slcd_codec.h>
#include "up_arch.h"
#include "pic32mx-pmp.h"
#include "pic32mx-int.h"
#include "pic32mx-internal.h"
#include "sure-pic32mx.h"
#ifdef CONFIG_LCD_LCD1602
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_PIC32MX_PMP
# error "CONFIG_PIC32MX_PMP is required to use the LCD"
#endif
/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must
* also be enabled.
*/
#ifndef CONFIG_DEBUG
# undef CONFIG_DEBUG_VERBOSE
# undef CONFIG_DEBUG_GRAPHICS
# undef CONFIG_DEBUG_LCD
#endif
#ifndef CONFIG_DEBUG_VERBOSE
# undef CONFIG_DEBUG_LCD
#endif
/* The ever-present MIN/MAX macros ******************************************/
#ifndef MIN
# define MIN(a,b) (a < b ? a : b)
#endif
#ifndef MAX
# define MAX(a,b) (a > b ? a : b)
#endif
/* Pin configuration ********************************************************/
/* RB15, RS -- High values selects data */
#define GPIO_LCD_RS (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTB|GPIO_PIN15)
/* LCD **********************************************************************/
#define LCD_NROWS 2
#define LCD_NCOLUMNS 16
#define LCD_NCHARS (LCD_NROWS * LCD_NCOLUMNS)
/* Debug ********************************************************************/
#ifdef CONFIG_DEBUG_LCD
# define lcddbg dbg
# define lcdvdbg vdbg
#else
# define lcddbg(x...)
# define lcdvdbg(x...)
#endif
/****************************************************************************
* Private Type Definition
****************************************************************************/
/* SLCD incoming stream structure */
struct lcd_instream_s
{
struct lib_instream_s stream;
FAR const char *buffer;
ssize_t nbytes;
};
/* Global LCD state */
struct lcd1602_2
{
bool initialized; /* True: Completed initialization sequence */
uint8_t currow; /* Current row */
uint8_t curcol; /* Current column */
};
/****************************************************************************
* Private Function Protototypes
****************************************************************************/
/* Debug */
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
static void lcd_dumpstate(FAR const char *msg);
static void lcd_dumpstream(FAR const char *msg,
FAR const struct lcd_instream_s *stream);
#else
# define lcd_dumpstate(msg)
# define lcd_dumpstream(msg, stream)
#endif
/* Internal functions */
static int lcd_getstream(FAR struct lib_instream_s *instream);
static void lcd_wrcommand(uint8_t cmd);
static void lcd_wrdata(uint8_t data);
static uint8_t lcd_rddata(void);
static uint8_t lcd_readch(uint8_t row, uint8_t column);
static void lcd_writech(uint8_t ch, uint8_t row, uint8_t column);
static void lcd_appendch(uint8_t ch);
static void lcd_action(enum slcdcode_e code, uint8_t count);
/* Character driver operations */
static ssize_t lcd_read(FAR struct file *, FAR char *, size_t);
static ssize_t lcd_write(FAR struct file *, FAR const char *, size_t);
static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg);
#ifndef CONFIG_DISABLE_POLL
static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, bool setup);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/* Character driver operations */
static const struct file_operations g_lcdops =
{
0, /* open */
0, /* close */
lcd_read, /* read */
lcd_write, /* write */
0, /* seek */
lcd_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL
, lcd_poll /* poll */
#endif
};
/* This is the driver state structure */
static struct lcd1602_2 g_lcd1602;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: lcd_dumpstate
****************************************************************************/
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
static void lcd_dumpstate(FAR const char *msg)
{
uint8_t buffer[LCD_NCOLUMNS];
uint8_t ch;
int row;
int column;
lcdvdbg("%s:\n", msg);
lcdvdbg(" currow: %d curcol: %d\n",
g_lcd1602.currow, g_lcd1602.curcol);
for (row = 0, column = 0; row < LCD_NROWS; )
{
ch = lcd_readch(row, column);
buffer[column] = isprint(ch) ? ch : '.';
if (++column >= LCD_NCOLUMNS)
{
lcdvdbg(" [%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c]\n",
buffer[0], buffer[1], buffer[2], buffer[3],
buffer[4], buffer[5], buffer[6], buffer[7],
buffer[8], buffer[9], buffer[10], buffer[11],
buffer[12], buffer[13], buffer[14], buffer[15]);
column = 0;
row++;
}
}
}
#endif
/****************************************************************************
* Name: lcd_dumpstate
****************************************************************************/
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
static void lcd_dumpstream(FAR const char *msg,
FAR const struct lcd_instream_s *stream)
{
lcdvdbg("%s:\n", msg);
lcdvdbg(" nget: %d nbytes: %d\n",
stream->stream.nget, stream->nbytes);
lib_dumpbuffer("STREAM", stream->buffer, stream->nbytes);
}
#endif
/****************************************************************************
* Name: lcd_getstream
*
* Description:
* Get one character from the keyboard.
*
****************************************************************************/
static int lcd_getstream(FAR struct lib_instream_s *instream)
{
FAR struct lcd_instream_s *lcdstream = (FAR struct lcd_instream_s *)instream;
DEBUGASSERT(lcdstream && lcdstream->buffer);
if (lcdstream->nbytes > 0)
{
lcdstream->nbytes--;
lcdstream->stream.nget++;
return (int)*lcdstream->buffer++;
}
return EOF;
}
/****************************************************************************
* Name: lcd_wrcommand
*
* Description:
* Configure to write an LCD command
*
****************************************************************************/
static void lcd_wrcommand(uint8_t cmd)
{
/* Address bit A0 is RS. Set the address latch to A0=0 */
putreg32(1, PIC32MX_PMP_ADDRCLR);
/* And write the command to the data out register */
putreg32((uint32_t)cmd, PIC32MX_PMP_DOUT);
}
/****************************************************************************
* Name: lcd_wrdata
*
* Description:
* Configure to read or write LCD data
*
****************************************************************************/
static void lcd_wrdata(uint8_t data)
{
/* Address bit A0 is RS. Set the address latch to A0=1 */
putreg32(1, PIC32MX_PMP_ADDRSET);
/* And write the data to the data out register */
putreg32((uint32_t)data, PIC32MX_PMP_DOUT);
}
/****************************************************************************
* Name: lcd_rddata
*
* Description:
* Configure to read or write LCD data
*
****************************************************************************/
static uint8_t lcd_rddata(void)
{
/* Address bit A0 is RS. Set the address latch to A0=1 */
putreg32(1, PIC32MX_PMP_ADDRSET);
/* And read the data to the data in register */
return (uint8_t)getreg32(PIC32MX_PMP_DIN);
}
/****************************************************************************
* Name: lcd_readch
****************************************************************************/
static uint8_t lcd_readch(uint8_t row, uint8_t column)
{
uint8_t addr;
/* Set the cursor position. Internally, the HD44780U supports a display
* size of up to 2x40 addressed as follows:
*
* Column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 39
* Row 0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ... 27
* Ro1 1 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f ... 67
*/
addr = column;
if (row > 0)
{
addr |= HD4478OU_DDRAM_ROW1;
}
lcd_wrcommand(HD4478OU_DDRAM_AD(addr));
/* And write the character here */
return lcd_rddata();
}
/****************************************************************************
* Name: lcd_writech
****************************************************************************/
static void lcd_writech(uint8_t ch, uint8_t row, uint8_t column)
{
uint8_t addr;
/* Set the cursor position. Internally, the HD44780U supports a display
* size of up to 2x40 addressed as follows:
*
* Column 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... 39
* Row 0 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ... 27
* Ro1 1 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f ... 67
*/
addr = column;
if (row > 0)
{
addr |= HD4478OU_DDRAM_ROW1;
}
lcd_wrcommand(HD4478OU_DDRAM_AD(addr));
/* And write the character here */
lcd_wrdata(ch);
}
/****************************************************************************
* Name: lcd_appendch
****************************************************************************/
static void lcd_appendch(uint8_t ch)
{
if (g_lcd1602.curcol < LCD_NCOLUMNS)
{
lcd_writech(ch, g_lcd1602.currow, g_lcd1602.curcol);
g_lcd1602.curcol++;
}
}
/****************************************************************************
* Name: lcd_action
****************************************************************************/
static void lcd_action(enum slcdcode_e code, uint8_t count)
{
lcdvdbg("Action: %d count: %d\n", code, count);
lcd_dumpstate("BEFORE ACTION");
switch (code)
{
/* Erasure */
case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */
{
int tmp;
/* If we are at the home position or if the count is zero, then ignore the action */
if (g_lcd1602.curcol < 1 || count < 1)
{
break;
}
/* Otherwise, BACKDEL is like moving the cursor back N characters then doing a
* forward deletion. Decrement the cursor position and fall through.
*/
tmp = (int)g_lcd1602.curcol - count;
if (tmp < 0)
{
tmp = 0;
count = g_lcd1602.curcol;
}
/* Save the updated cursor positions */
g_lcd1602.curcol = tmp;
}
case SLCDCODE_FWDDEL: /* DELete (forward delete) N characters moving text */
if (count > 0)
{
int nchars;
int nmove;
int i;
/* How many characters are to the right of the cursor position
* (including the one at the cursor position)? Then get the
* number of characters to move.
*/
nchars = LCD_NCOLUMNS - g_lcd1602.curcol;
nmove = MIN(nchars, count) - 1;
/* Move all characters after the current cursor position left by 'nmove' characters */
for (i = g_lcd1602.curcol + nmove; i < LCD_NCOLUMNS - 1; i++)
{
uint8_t ch = lcd_readch(g_lcd1602.currow, i);
lcd_writech(ch, g_lcd1602.currow, i - nmove);
}
/* Erase the last 'nmove' characters on the display */
for (i = LCD_NCOLUMNS - nmove; i < LCD_NCOLUMNS; i++)
{
lcd_writech(' ', i, 0);
}
}
break;
case SLCDCODE_ERASE: /* Erase N characters from the cursor position */
if (count > 0)
{
int last;
int i;
/* Get the last position to clear and make sure that the last
* position is on the SLCD.
*/
last = g_lcd1602.curcol + count - 1;
if (last >= LCD_NCOLUMNS)
{
last = LCD_NCOLUMNS - 1;
}
/* Erase N characters after the current cursor position left by one */
for (i = g_lcd1602.curcol; i < last; i++)
{
lcd_writech(' ', g_lcd1602.currow, i);
}
}
break;
case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */
{
/* Clear the display */
lcd_wrcommand(HD4478OU_CLEAR);
/* And home the cursor */
g_lcd1602.currow = 0;
g_lcd1602.curcol = 0;
}
break;
case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end of line */
{
int i;
/* Erase characters after the current cursor position to the end of the line */
for (i = g_lcd1602.curcol; i < LCD_NCOLUMNS; i++)
{
lcd_writech(' ', g_lcd1602.currow, i);
}
}
break;
/* Cursor movement */
case SLCDCODE_HOME: /* Cursor home */
{
g_lcd1602.currow = 0;
g_lcd1602.curcol = 0;
}
break;
case SLCDCODE_END: /* Cursor end */
{
g_lcd1602.curcol = LCD_NCOLUMNS - 1;
}
break;
case SLCDCODE_LEFT: /* Cursor left by N characters */
{
int tmp = (int)g_lcd1602.curcol - count;
/* Don't permit movement past the beginning of the SLCD */
if (tmp < 0)
{
tmp = 0;
}
/* Save the new cursor position */
g_lcd1602.curcol = (uint8_t)tmp;
}
break;
case SLCDCODE_RIGHT: /* Cursor right by N characters */
{
int tmp = (int)g_lcd1602.curcol + count;
/* Don't permit movement past the end of the SLCD */
if (tmp >= LCD_NCOLUMNS)
{
tmp = LCD_NCOLUMNS - 1;
}
/* Save the new cursor position */
g_lcd1602.curcol = (uint8_t)tmp;
}
break;
case SLCDCODE_UP: /* Cursor up by N lines */
{
int tmp = (int)g_lcd1602.currow - count;
/* Don't permit movement past the top of the SLCD */
if (tmp < 0)
{
tmp = 0;
}
/* Save the new cursor position */
g_lcd1602.currow = (uint8_t)tmp;
}
break;
case SLCDCODE_DOWN: /* Cursor down by N lines */
{
int tmp = (int)g_lcd1602.currow + count;
/* Don't permit movement past the bottom of the SLCD */
if (tmp >= LCD_NROWS)
{
tmp = LCD_NROWS - 1;
}
/* Save the new cursor position */
g_lcd1602.currow = (uint8_t)tmp;
}
break;
case SLCDCODE_PAGEUP: /* Cursor up by N pages */
case SLCDCODE_PAGEDOWN: /* Cursor down by N pages */
break; /* Not supportable on this SLCD */
/* Blinking */
case SLCDCODE_BLINKSTART: /* Start blinking with current cursor position */
case SLCDCODE_BLINKEND: /* End blinking after the current cursor position */
case SLCDCODE_BLINKOFF: /* Turn blinking off */
break; /* Not implemented */
/* These are actually unreportable errors */
default:
case SLCDCODE_NORMAL: /* Not a special keycode */
break;
}
lcd_dumpstate("AFTER ACTION");
}
/****************************************************************************
* Name: lcd_read
****************************************************************************/
static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len)
{
uint8_t row;
uint8_t column;
int nread;
/* Try to read the entire display. Notice that the seek offset
* (filp->f_pos) is ignored. It probably should be taken into account
* and also updated after each read and write.
*/
row = 0;
column = 0;
for (nread = 0; nread < len; nread++)
{
*buffer++ = lcd_readch(row, column);
if (++column >= LCD_NCOLUMNS)
{
column = 0;
if (++row >= LCD_NROWS)
{
break;
}
}
}
return nread;
}
/****************************************************************************
* Name: lcd_write
****************************************************************************/
static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer,
size_t len)
{
struct lcd_instream_s instream;
struct slcdstate_s state;
enum slcdret_e result;
uint8_t ch;
uint8_t count;
/* Initialize the stream for use with the SLCD CODEC */
instream.stream.get = lcd_getstream;
instream.stream.nget = 0;
instream.buffer = buffer;
instream.nbytes = len;
lcd_dumpstream("BEFORE WRITE", &instream);
/* Now decode and process every byte in the input buffer */
memset(&state, 0, sizeof(struct slcdstate_s));
while ((result = slcd_decode(&instream.stream, &state, &ch, &count)) != SLCDRET_EOF)
{
lcdvdbg("slcd_decode returned result=%d char=%d count=%d\n",
result, ch, count);
if (result == SLCDRET_CHAR) /* A normal character was returned */
{
/* Check for ASCII control characters */
if (ch < ASCII_SPACE)
{
/* All are ignored except for backspace and carriage return */
if (ch == ASCII_BS)
{
/* Perform the backward deletion */
lcd_action(SLCDCODE_BACKDEL, 1);
}
else if (ch == ASCII_CR)
{
/* Perform the carriage return */
g_lcd1602.curcol = 0;
lcd_action(SLCDCODE_DOWN, 1);
}
}
/* Handle ASCII_DEL */
else if (ch == ASCII_DEL)
{
/* Perform the forward deletion */
lcd_action(SLCDCODE_FWDDEL, 1);
}
/* The rest of the 7-bit ASCII characters are fair game */
else if (ch < 128)
{
/* Write the character if it valid */
lcd_appendch(ch);
}
}
else /* (result == SLCDRET_SPEC) */ /* A special SLCD action was returned */
{
/* Then Perform the action */
lcd_action((enum slcdcode_e)ch, count);
}
}
/* Assume that the entire input buffer was processed */
lcd_dumpstream("AFTER WRITE", &instream);
return (ssize_t)len;
}
/****************************************************************************
* Name: lcd_ioctl
****************************************************************************/
static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
{
switch (cmd)
{
/* SLCDIOC_GEOMETRY: Get the SLCD geometry (rows x characters)
*
* argument: Pointer to struct slcd_geometry_s in which values will be
* returned
*/
case SLCDIOC_GEOMETRY:
{
FAR struct slcd_geometry_s *geo = (FAR struct slcd_geometry_s *)((uintptr_t)arg);
lcdvdbg("SLCDIOC_GEOMETRY: nrows=%d ncolumns=%d\n", LCD_NROWS, LCD_NCOLUMNS);
if (!geo)
{
return -EINVAL;
}
geo->nrows = LCD_NROWS;
geo->ncolumns = LCD_NCOLUMNS;
geo->nbars = 0;
}
break;
/* SLCDIOC_CURPOS: Get the SLCD cursor positioni (rows x characters)
*
* argument: Pointer to struct slcd_curpos_s in which values will be
* returned
*/
case SLCDIOC_CURPOS:
{
FAR struct slcd_curpos_s *curpos = (FAR struct slcd_curpos_s *)((uintptr_t)arg);
lcdvdbg("SLCDIOC_CURPOS: row=%d column=%d\n", g_lcd1602.currow, g_lcd1602.curcol);
if (!curpos)
{
return -EINVAL;
}
curpos->row = g_lcd1602.currow;
curpos->column = g_lcd1602.curcol;
}
break;
case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */
case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current contrast setting */
case SLCDIOC_MAXCONTRAST: /* SLCDIOC_MAXCONTRAST: Get the maximum contrast setting */
case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a new value */
default:
return -ENOTTY;
}
return OK;
}
/****************************************************************************
* Name: lcd_poll
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds,
bool setup)
{
if (setup)
{
/* Data is always avaialble to be read */
fds->revents |= (fds->events & (POLLIN|POLLOUT));
if (fds->revents != 0)
{
sem_post(fds->sem);
}
}
return OK;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_lcd1602_initialize
*
* Description:
* Initialize the LCD1602 hardware and register the character driver as
* /dev/lcd1602. Prototype is in include/nuttx/lcd/hd4478ou.h.
*
****************************************************************************/
int up_lcd1602_initialize(void)
{
uint32_t regval;
int ret = OK;
/* Only initialize the driver once. */
if (!g_lcd1602.initialized)
{
lcdvdbg("Initializing\n");
/* PMP Master mode configuration */
/* Make sure that interrupts are disabled */
putreg32(INT_PMP, PIC32MX_INT_IEC1CLR);
/* Stop and reset the PMP module and clear the mode and control registers. */
putreg32(0, PIC32MX_PMP_MODE);
putreg32(0, PIC32MX_PMP_AEN);
putreg32(0, PIC32MX_PMP_CON);
putreg32(0, PIC32MX_PMP_ADDR);
/* Set LCD timing values, PMP master mode 3, 8-bit mode, no address
* increment, and no interrupts.
*/
regval = (PMP_MODE_WAITE_RD(0) | PMP_MODE_WAITM(3) | PMP_MODE_WAITB_1TPB |
PMP_MODE_MODE_MODE1 | PMP_MODE_MODE8 | PMP_MODE_INCM_NONE |
PMP_MODE_IRQM_NONE);
putreg32(regval, PIC32MX_PMP_MODE);
/* Enable the PMP for reading and writing
* PMRD/PMWR is active high (1=RD; 0=WR)
* PMENB is active high.
* No chip selects
* Address latch is active high
* Enable PMRD/PMWR, PMENB, and the PMP.
*/
regval = (PMP_CON_RDSP | PMP_CON_WRSP | PMP_CON_ALP |
PMP_CON_CSF_ADDR1415 | PMP_CON_PTRDEN | PMP_CON_PTWREN |
PMP_CON_ADRMUX_NONE | PMP_CON_ON);
putreg32(regval, PIC32MX_PMP_CON);
/* Configure and enable the LCD */
/* Wait > 15 milliseconds afer Vdd > 4.5V */
up_mdelay(100);
/* Select the 8-bit interface. BF cannot be checked before this command.
* This needs to be done a few times with some magic delays.
*/
lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1);
up_mdelay(50);
lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1);
up_udelay(50);
lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1);
lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1);
/* Configure the display */
lcd_wrcommand(HD4478OU_DISPLAY); /* Display, cursor, and blink off */
lcd_wrcommand(HD4478OU_CLEAR); /* Clear the display */
lcd_wrcommand(HD4478OU_INPUT | HD4478OU_INPUT_INCR); /* Increment mode */
lcd_wrcommand(HD4478OU_DISPLAY | HD4478OU_DISPLAY_ON); /* Display on, cursor and blink off */
lcd_wrcommand(HD4478OU_DDRAM_AD(0)); /* Select DDRAM RAM AD=0 */
/* Register the LCD device driver */
ret = register_driver("/dev/lcd1602", &g_lcdops, 0644, &g_lcd1602);
g_lcd1602.initialized = true;
}
return ret;
}
#endif /* CONFIG_LCD_LCD1602 */

View File

@ -1,6 +1,5 @@
/****************************************************************************
* config/sure-pic32mx/src/up_nsh.c
* arch/arm/src/board/up_nsh.c
* config/sure-pic32mx/src/pic32mx_nsh.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -47,10 +46,11 @@
#include <nuttx/spi.h>
#include <nuttx/mmcsd.h>
#include <nuttx/lcd/hd4478ou.h>
#include <nuttx/usb/usbhost.h>
#include "pic32mx-internal.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
/****************************************************************************
* Pre-Processor Definitions
@ -60,27 +60,13 @@
/* PORT and SLOT number probably depend on the board configuration */
#ifdef CONFIG_ARCH_BOARD_SUREPIC32MX
# define NSH_HAVEMMCSD 1
# define NSH_HAVEUSBHOST 1
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 2
# error "The Sure PIC32MX MMC/SD is on SPI2"
# undef CONFIG_NSH_MMCSDSPIPORTNO
# define CONFIG_NSH_MMCSDSPIPORTNO 2
# endif
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
# error "The Sure PIC32MX MMC/SD has only one slot (0)"
# undef CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
# endif
# ifndef CONFIG_PIC32MX_SPI2
# warning "CONFIG_PIC32MX_SPI2 is not enabled"
# undef NSH_HAVEMMCSD
# endif
#else
# error "Unrecognized board"
#define NSH_HAVEMMCSD 1
#define NSH_HAVEUSBHOST 1
/* Can't support MMC/SD if SPI2 is not enabled */
#ifndef CONFIG_PIC32MX_SPI2
# undef NSH_HAVEMMCSD
# undef NSH_HAVEUSBHOST
#endif
/* Can't support MMC/SD features if mountpoints are disabled */
@ -89,21 +75,37 @@
# undef NSH_HAVEMMCSD
#endif
#ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
/* MMC/SD configuration */
#ifdef NSH_HAVEMMCSD
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 2
# warning "The Sure PIC32MX MMC/SD is on SPI2"
# undef CONFIG_NSH_MMCSDSPIPORTNO
# define CONFIG_NSH_MMCSDSPIPORTNO 2
# endif
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
# error "The Sure PIC32MX MMC/SD has only one slot (0)"
# warning CONFIG_NSH_MMCSDSLOTNO
# define CONFIG_NSH_MMCSDSLOTNO 0
# endif
# ifndef CONFIG_NSH_MMCSDMINOR
# define CONFIG_NSH_MMCSDMINOR 0
# endif
#endif
/* USB Host */
#ifdef CONFIG_USBHOST
# ifndef CONFIG_PIC32MX_USBHOST
# error "CONFIG_PIC32MX_USBHOST is not selected"
# warning "CONFIG_PIC32MX_USBHOST is not selected"
# undef CONFIG_USBHOST
# endif
#endif
#ifdef CONFIG_PIC32MX_USBHOST
# ifndef CONFIG_USBHOST
# warning "CONFIG_USBHOST is not selected"
# undef CONFIG_PIC32MX_USBHOST
# endif
#endif
@ -340,9 +342,18 @@ int nsh_archinitialize(void)
{
int ret;
/* Initialize SPI-based microSD */
/* Initialize the LCD1602 and register the device as /dev/lcd1602 */
#ifdef CONFIG_LCD_LCD1602
ret = up_lcd1602_initialize();
if (ret == OK)
#endif
{
/* Initialize SPI-based microSD */
ret = nsh_sdinitialize();
}
ret = nsh_sdinitialize();
if (ret == OK)
{
/* Initialize USB host */
@ -356,5 +367,6 @@ int nsh_archinitialize(void)
ret = nsh_usbdevinitialize();
}
return ret;
}

View File

@ -1,8 +1,7 @@
/************************************************************************************
* configs/sure-pic32mx/src/up_spi.c
* arch/arm/src/board/up_spi.c
* configs/sure-pic32mx/src/pic32mx_spi.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -50,7 +49,7 @@
#include "up_arch.h"
#include "chip.h"
#include "pic32mx-internal.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
#if defined(CONFIG_PIC32MX_SPI2)

View File

@ -1,8 +1,7 @@
/************************************************************************************
* configs/sure-pic32mx/src/up_usbdev.c
* arch/arm/src/board/up_usbdev.c
* configs/sure-pic32mx/src/pic32mx_usbdev.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@ -49,7 +48,7 @@
#include <nuttx/usb/usbdev.h>
#include "pic32mx-internal.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
#if defined(CONFIG_PIC32MX_USBDEV)

View File

@ -1,8 +1,7 @@
/************************************************************************************
* configs/sure-pic32mx/src/up_usbterm.c
* arch/arm/src/board/up_usbterm.c
* configs/sure-pic32mx/src/pic32mx_usbterm.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@ -49,7 +48,7 @@
#include <nuttx/usb/usbdev.h>
#include "pic32mx-internal.h"
#include "sure-internal.h"
#include "sure-pic32mx.h"
#if defined(CONFIG_PIC32MX_USBDEV) && defined(CONFIG_EXAMPLES_USBTERM_DEVINIT)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/sure-pic32mx/src/sure-internal.h
* configs/sure-pic32mx/src/sure-pic32mx.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H
#define __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H
#ifndef __CONFIGS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H
#define __CONFIGS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H
/****************************************************************************
* Included Files
@ -86,7 +86,7 @@ extern "C" {
************************************************************************************/
#if defined(CONFIG_PIC32MX_SPI2)
EXTERN void weak_function pic32mx_spiinitialize(void);
void weak_function pic32mx_spiinitialize(void);
#endif
/************************************************************************************
@ -98,7 +98,7 @@ EXTERN void weak_function pic32mx_spiinitialize(void);
************************************************************************************/
#if defined(CONFIG_PIC32MX_USBDEV)
EXTERN void weak_function pic32mx_usbdevinitialize(void);
void weak_function pic32mx_usbdevinitialize(void);
#endif
/************************************************************************************
@ -110,7 +110,7 @@ EXTERN void weak_function pic32mx_usbdevinitialize(void);
************************************************************************************/
#ifdef CONFIG_ARCH_LEDS
EXTERN void pic32mx_ledinit(void);
void pic32mx_ledinit(void);
#endif
#undef EXTERN
@ -119,4 +119,4 @@ EXTERN void pic32mx_ledinit(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_SURE_PIC32MX_SRC_SURE_INTERNAL_H */
#endif /* __CONFIGS_SURE_PIC32MX_SRC_SURE_PIC32MXL_H */

View File

@ -1,7 +1,7 @@
############################################################################
# configs/sure-pic32mx/usbnsh/Make.defs
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2012, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -44,13 +44,13 @@ ifeq ($(WINTOOL),y)
MKDEP = $(TOPDIR)/tools/mknulldeps.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)/usbnsh/ld.script}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}"
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/usbnsh/ld.script
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script
endif
CC = $(CROSSDEV)gcc

View File

@ -1,47 +0,0 @@
############################################################################
# configs/sure-pic32mx/usbnsh/appconfig
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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.
#
############################################################################
############################################################################
# Path to example in apps/examples containing the user_start entry point
############################################################################
CONFIGURED_APPS += examples/nsh
############################################################################
# The NSH application library
############################################################################
CONFIGURED_APPS += system/readline
CONFIGURED_APPS += nshlib

File diff suppressed because it is too large Load Diff

View File

@ -1,317 +0,0 @@
/****************************************************************************
* configs/sure-pic32mx/usbnsh/ld.script
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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 Regions ***********************************************************/
MEMORY
{
/* The PIC32MX440F512H has 512Kb of program FLASH at physical address
* 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
*/
kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
/* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
* 0x1fc00000. The initial reset vector is in KSEG1, but all other
* accesses are in KSEG0.
*
* REGION PHYSICAL KSEG SIZE
* DESCRIPTION START ADDR (BYTES)
* ------------- ---------- ------ ----------------------
* Exceptions:*
* Reset 0x1fc00000 KSEG1 512 512
* TLB Refill 0x1fc00200 KSEG1 256 768
* Cache Error 0x1fc00300 KSEG1 128 896
* Others 0x1fc00380 KSEG1 128 1024 (1Kb)
* Interrupt 0x1fc00400 KSEG1 128 1152
* JTAG 0x1fc00480 KSEG1 16 1168
* Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
* Debug code 0x1fc02000 KSEG1 4096-16 12272
* DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
*
* Exceptions assume:
*
* STATUS: BEV=0/1 and EXL=0
* CAUSE: IV=1
* JTAG: ProbEn=0
* And multi-vector support disabled
*/
kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
/* The PIC32MX440F512H has 32Kb of data memory at physical address
* 0x00000000. Since the PIC32MX has no data cache, this memory is
* always accessed through KSEG1.
*
* When used with MPLAB, we need to set aside 512 bytes of memory
* for use by MPLAB.
*/
kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
}
OUTPUT_FORMAT("elf32-tradlittlemips")
OUTPUT_ARCH(pic32mx)
ENTRY(__start)
SECTIONS
{
/* Boot FLASH sections */
.reset :
{
KEEP (*(.reset))
} > kseg1_reset
/* Exception handlers. The following is assumed:
*
* STATUS: BEV=1 and EXL=0
* CAUSE: IV=1
* JTAG: ProbEn=0
* And multi-vector support disabled
*
* In that configuration, the vector locations become:
*
* Reset, Soft Reset bfc0:0000
* TLB Refill bfc0:0200
* Cache Error bfc0:0300
* All others bfc0:0380
* Interrupt bfc0:0400
* EJTAG Debug bfc0:0480
*/
/* KSEG1 exception handler "trampolines" */
.gen_excpt :
{
KEEP (*(.gen_excpt))
} > kseg1_genexcpt
.ebase_excpt :
{
KEEP (*(.ebase_excpt))
} > kseg1_ebexcpt
.bev_excpt :
{
KEEP (*(.bev_excpt))
} > kseg1_bevexcpt
.int_excpt :
{
KEEP (*(.int_excpt))
} > kseg1_intexcpt
.dbg_excpt = ORIGIN(kseg1_dbgexcpt);
.start :
{
/* KSEG0 Reset startup logic */
*(.start)
/* KSEG0 exception handlers */
*(.nmi_handler)
*(.bev_handler)
*(.int_handler)
} > kseg0_bootmem
.dbg_code = ORIGIN(kseg1_dbgcode);
.devcfg :
{
KEEP (*(.devcfg))
} > kseg1_devcfg
/* Program FLASH sections */
.text :
{
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.stub)
KEEP (*(.text.*personality*))
*(.gnu.linkonce.t.*)
*(.gnu.warning)
*(.mips16.fn.*)
*(.mips16.call.*)
/* Read-only data is included in the text section */
*(.rodata .rodata.*)
*(.rodata1)
*(.gnu.linkonce.r.*)
/* Small initialized constant global and static data */
*(.sdata2 .sdata2.*)
*(.gnu.linkonce.s2.*)
/* Uninitialized constant global and static data */
*(.sbss2 .sbss2.*)
*(.gnu.linkonce.sb2.*)
_etext = ABSOLUTE(.);
} > kseg0_progmem
/* Initialization data begins here in progmem */
_data_loaddr = LOADADDR(.data);
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
/* RAM functions are positioned at the beginning of RAM so that
* they can be guaranteed to satisfy the 2Kb alignment requirement.
*/
/* This causes failures if there are no RAM functions
.ramfunc ALIGN(2K) :
{
_sramfunc = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfunc = ABSOLUTE(.);
} > kseg1_datamem AT > kseg0_progmem
_ramfunc_loadaddr = LOADADDR(.ramfunc);
_ramfunc_sizeof = SIZEOF(.ramfunc);
_bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
_bmxdudba_address = LENGTH(kseg1_datamem) ;
_bmxdupba_address = LENGTH(kseg1_datamem) ;
*/
.data :
{
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
*(.data1)
} > kseg1_datamem AT > kseg0_progmem
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
_gp = ALIGN(16) + 0x7FF0 ;
.got :
{
*(.got.plt) *(.got)
} > kseg1_datamem AT > kseg0_progmem
.sdata :
{
*(.sdata .sdata.* .gnu.linkonce.s.*)
} > kseg1_datamem AT > kseg0_progmem
.lit8 :
{
*(.lit8)
} > kseg1_datamem AT > kseg0_progmem
.lit4 :
{
*(.lit4)
_edata = ABSOLUTE(.);
} >kseg1_datamem AT>kseg0_progmem
.sbss :
{
_sbss = ABSOLUTE(.);
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
} >kseg1_datamem
.bss :
{
*(.dynbss)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > kseg1_datamem
/* 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) }
/* DWARF debug sections */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.note.GNU-stack) }
}