mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
Merge remote-tracking branch 'origin/master' into misoc
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
|
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
|
||||||
<p>Last Updated: July 3, 2016</p>
|
<p>Last Updated: November 1, 2016</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -62,6 +62,8 @@ nuttx/
|
|||||||
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/arduino-due/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/arduino-due/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||||
| |- avr32dev1/
|
| |- avr32dev1/
|
||||||
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/avr32dev1/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/avr32dev1/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||||
|
| |- bambino-200e/
|
||||||
|
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/bambino-200e/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||||
| |- c5471evm/
|
| |- c5471evm/
|
||||||
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/c5471evm/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
| | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/configs/c5471evm/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||||
| |- cc3200-launchpad/
|
| |- cc3200-launchpad/
|
||||||
|
|||||||
+3
-1
@@ -987,7 +987,7 @@ Native Windows Build
|
|||||||
The windows native build logic initiated if CONFIG_WINDOWS_NATIVE=y is
|
The windows native build logic initiated if CONFIG_WINDOWS_NATIVE=y is
|
||||||
defined in the NuttX configuration file:
|
defined in the NuttX configuration file:
|
||||||
|
|
||||||
|
|
||||||
This build:
|
This build:
|
||||||
|
|
||||||
- Uses all Windows style paths
|
- Uses all Windows style paths
|
||||||
@@ -1279,6 +1279,8 @@ nuttx/
|
|||||||
| | `- README.txt
|
| | `- README.txt
|
||||||
| |- avr32dev1/
|
| |- avr32dev1/
|
||||||
| | `- README.txt
|
| | `- README.txt
|
||||||
|
| |- bambino-200e/
|
||||||
|
| | `- README.txt
|
||||||
| |- c5471evm/
|
| |- c5471evm/
|
||||||
| | `- README.txt
|
| | `- README.txt
|
||||||
| |- cc3200-launchpad/
|
| |- cc3200-launchpad/
|
||||||
|
|||||||
@@ -81,7 +81,11 @@
|
|||||||
#define WRITE_TX0 0x00
|
#define WRITE_TX0 0x00
|
||||||
#define WRITE_TX1 0xFF
|
#define WRITE_TX1 0xFF
|
||||||
|
|
||||||
#define PIN_OPENDRAIN(GPIO) ((GPIO) | GPIO_OPENDRAIN)
|
#define PIN_OPENDRAIN(GPIO) ((GPIO) | GPIO_CNF_OUTOD)
|
||||||
|
|
||||||
|
#if defined(CONFIG_STM32_STM32F10XX)
|
||||||
|
# define USART_CR3_ONEBIT (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@@ -568,13 +572,13 @@ static void stm32_1wire_set_apb_clock(struct stm32_1wire_priv_s *priv,
|
|||||||
regaddr = STM32_RCC_APB1ENR;
|
regaddr = STM32_RCC_APB1ENR;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_STM32_UART4
|
#ifdef CONFIG_STM32_UART4_1WIREDRIVER
|
||||||
case STM32_UART4_BASE:
|
case STM32_UART4_BASE:
|
||||||
rcc_en = RCC_APB1ENR_UART4EN;
|
rcc_en = RCC_APB1ENR_UART4EN;
|
||||||
regaddr = STM32_RCC_APB1ENR;
|
regaddr = STM32_RCC_APB1ENR;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_STM32_UART5
|
#ifdef CONFIG_STM32_UART5_1WIREDRIVER
|
||||||
case STM32_UART5_BASE:
|
case STM32_UART5_BASE:
|
||||||
rcc_en = RCC_APB1ENR_UART5EN;
|
rcc_en = RCC_APB1ENR_UART5EN;
|
||||||
regaddr = STM32_RCC_APB1ENR;
|
regaddr = STM32_RCC_APB1ENR;
|
||||||
@@ -586,13 +590,13 @@ static void stm32_1wire_set_apb_clock(struct stm32_1wire_priv_s *priv,
|
|||||||
regaddr = STM32_RCC_APB2ENR;
|
regaddr = STM32_RCC_APB2ENR;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_STM32_UART7
|
#ifdef CONFIG_STM32_UART7_1WIREDRIVER
|
||||||
case STM32_UART7_BASE:
|
case STM32_UART7_BASE:
|
||||||
rcc_en = RCC_APB1ENR_UART7EN;
|
rcc_en = RCC_APB1ENR_UART7EN;
|
||||||
regaddr = STM32_RCC_APB1ENR;
|
regaddr = STM32_RCC_APB1ENR;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_STM32_UART8
|
#ifdef CONFIG_STM32_UART8_1WIREDRIVER
|
||||||
case STM32_UART8_BASE:
|
case STM32_UART8_BASE:
|
||||||
rcc_en = RCC_APB1ENR_UART8EN;
|
rcc_en = RCC_APB1ENR_UART8EN;
|
||||||
regaddr = STM32_RCC_APB1ENR;
|
regaddr = STM32_RCC_APB1ENR;
|
||||||
|
|||||||
@@ -318,6 +318,15 @@ config ARCH_BOARD_LPCXPRESSO
|
|||||||
Embedded Artists base board with NXP LPCExpresso LPC1768. This board
|
Embedded Artists base board with NXP LPCExpresso LPC1768. This board
|
||||||
is based on the NXP LPC1768. The Code Red toolchain is used by default.
|
is based on the NXP LPC1768. The Code Red toolchain is used by default.
|
||||||
|
|
||||||
|
config ARCH_BOARD_BAMBINO_200E
|
||||||
|
bool "Micromint Bambino 200E"
|
||||||
|
depends on ARCH_CHIP_LPC4330FBD144
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
select ARCH_HAVE_BUTTONS
|
||||||
|
select ARCH_HAVE_IRQBUTTONS
|
||||||
|
---help---
|
||||||
|
Micromint Bambino board. This board is based on the LPC4330FBD144.
|
||||||
|
|
||||||
config ARCH_BOARD_LPC4330_XPLORER
|
config ARCH_BOARD_LPC4330_XPLORER
|
||||||
bool "NXG LPC4330-Xplorer"
|
bool "NXG LPC4330-Xplorer"
|
||||||
depends on ARCH_CHIP_LPC4330FET100
|
depends on ARCH_CHIP_LPC4330FET100
|
||||||
@@ -1381,6 +1390,7 @@ config ARCH_BOARD
|
|||||||
default "arduino-mega2560" if ARCH_BOARD_ARDUINO_MEGA2560
|
default "arduino-mega2560" if ARCH_BOARD_ARDUINO_MEGA2560
|
||||||
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
|
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
|
||||||
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
|
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
|
||||||
|
default "bambino-200e" if ARCH_BOARD_BAMBINO_200E
|
||||||
default "c5471evm" if ARCH_BOARD_C5471EVM
|
default "c5471evm" if ARCH_BOARD_C5471EVM
|
||||||
default "cloudctrl" if ARCH_BOARD_CLOUDCTRL
|
default "cloudctrl" if ARCH_BOARD_CLOUDCTRL
|
||||||
default "compal_e86" if ARCH_BOARD_COMPALE86
|
default "compal_e86" if ARCH_BOARD_COMPALE86
|
||||||
@@ -1555,6 +1565,9 @@ endif
|
|||||||
if ARCH_BOARD_AVR32DEV1
|
if ARCH_BOARD_AVR32DEV1
|
||||||
source "configs/avr32dev1/Kconfig"
|
source "configs/avr32dev1/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_BAMBINO_200E
|
||||||
|
source "configs/bambino-200e/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_C5471EVM
|
if ARCH_BOARD_C5471EVM
|
||||||
source "configs/c5471evm/Kconfig"
|
source "configs/c5471evm/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ configs/avr32dev1
|
|||||||
Atmel website. STATUS: This port is functional but very basic. There
|
Atmel website. STATUS: This port is functional but very basic. There
|
||||||
are configurations for NSH and the OS test.
|
are configurations for NSH and the OS test.
|
||||||
|
|
||||||
|
configs/bambino-200e
|
||||||
|
Micromint Bambino board. This board is based on the LPC4330FBD144.
|
||||||
|
|
||||||
configs/c5471evm
|
configs/c5471evm
|
||||||
This is a port to the Spectrum Digital C5471 evaluation board. The
|
This is a port to the Spectrum Digital C5471 evaluation board. The
|
||||||
TMS320C5471 is a dual core processor from TI with an ARM7TDMI general
|
TMS320C5471 is a dual core processor from TI with an ARM7TDMI general
|
||||||
|
|||||||
@@ -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_BAMBINO_200E
|
||||||
|
endif
|
||||||
@@ -0,0 +1,453 @@
|
|||||||
|
README
|
||||||
|
======
|
||||||
|
|
||||||
|
README for NuttX port to the "Bambino 200E" board from Micromint USA
|
||||||
|
featuring the NXP LPC4330FBD144 MCU
|
||||||
|
|
||||||
|
Contents
|
||||||
|
========
|
||||||
|
|
||||||
|
- Bambino 200E board
|
||||||
|
- Status
|
||||||
|
- Serial Console
|
||||||
|
- FPU
|
||||||
|
- Bambino-200e Configuration Options
|
||||||
|
- Configurations
|
||||||
|
|
||||||
|
Bambino 200E board
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Memory Map
|
||||||
|
----------
|
||||||
|
|
||||||
|
Block Start Length
|
||||||
|
Name Address
|
||||||
|
--------------------- ---------- ------
|
||||||
|
RAM 0x10000000 128K
|
||||||
|
RAM2 0x10080000 72K
|
||||||
|
RAMAHB 0x20000000 32K
|
||||||
|
RAMAHB2 0x20008000 16K
|
||||||
|
RAMAHB3 0x2000c000 16K
|
||||||
|
SPIFI flash 0x1e000000 4096K
|
||||||
|
|
||||||
|
GPIO Usage:
|
||||||
|
-----------
|
||||||
|
|
||||||
|
GPIO PIN SIGNAL NAME
|
||||||
|
-------------------------------- ------- --------------
|
||||||
|
gpio3[7] - LED1 101 GPIO3[7]
|
||||||
|
gpio5[5] - LED2 91 GPIO5[5]
|
||||||
|
gpio0[7] - BTN1 96 GPIO0[7]
|
||||||
|
|
||||||
|
Console
|
||||||
|
-------
|
||||||
|
|
||||||
|
The Bambino 200E default console is the UART1 on Gadgeteer Sockets 5 (U).
|
||||||
|
|
||||||
|
Status
|
||||||
|
======
|
||||||
|
|
||||||
|
Many drivers are working (USB0 Device, Ethernet, etc), but many drivers are
|
||||||
|
missing.
|
||||||
|
|
||||||
|
Development Environment
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Either Linux or Cygwin on Windows can be used for the development environment.
|
||||||
|
The source has been built only using the GNU toolchain (see below). Other
|
||||||
|
toolchains will likely cause problems. Testing was performed using the Cygwin
|
||||||
|
environment.
|
||||||
|
|
||||||
|
Serial Console
|
||||||
|
==============
|
||||||
|
|
||||||
|
The LPC4330 Xplorer does not have RS-232 drivers or serial connectors on board.
|
||||||
|
USART0 and UART1 are available on J8 as follows:
|
||||||
|
|
||||||
|
------ ------ -----------------------
|
||||||
|
SIGNAL J8 PIN LPC4330FET100 PIN
|
||||||
|
(TFBGA100 package)
|
||||||
|
------ ------ -----------------------
|
||||||
|
U0_TXD pin 9 F6 P6_4 U0_TXD=Alt 2
|
||||||
|
U0_RXD pin 10 F9 P6_5 U0_RXD=Alt 2
|
||||||
|
U1_TXD pin 13 H8 P1_13 U1_TXD=Alt 1
|
||||||
|
U1_RXD pin 14 J8 P1_14 U1_RXD=Alt 1
|
||||||
|
------ ------ -----------------------
|
||||||
|
|
||||||
|
GND is available on J8 pin 1
|
||||||
|
5V is available on J8 pin 2
|
||||||
|
VBAT is available on J8 pin 3
|
||||||
|
|
||||||
|
FPU
|
||||||
|
===
|
||||||
|
|
||||||
|
FPU Configuration Options
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
There are two version of the FPU support built into the most NuttX Cortex-M4
|
||||||
|
ports. The current LPC43xx port support only one of these options, the "Non-
|
||||||
|
Lazy Floating Point Register Save". As a consequence, CONFIG_ARMV7M_CMNVECTOR
|
||||||
|
must be defined in *all* LPC43xx configuration files.
|
||||||
|
|
||||||
|
1. Lazy Floating Point Register Save.
|
||||||
|
|
||||||
|
This is an untested implementation that saves and restores FPU registers
|
||||||
|
only on context switches. This means: (1) floating point registers are
|
||||||
|
not stored on each context switch and, hence, possibly better interrupt
|
||||||
|
performance. But, (2) since floating point registers are not saved,
|
||||||
|
you cannot use floating point operations within interrupt handlers.
|
||||||
|
|
||||||
|
This logic can be enabled by simply adding the following to your .config
|
||||||
|
file:
|
||||||
|
|
||||||
|
CONFIG_ARCH_FPU=y
|
||||||
|
|
||||||
|
2. Non-Lazy Floating Point Register Save
|
||||||
|
|
||||||
|
Mike Smith has contributed an extensive re-write of the ARMv7-M exception
|
||||||
|
handling logic. This includes verified support for the FPU. These changes
|
||||||
|
have not yet been incorporated into the mainline and are still considered
|
||||||
|
experimental. These FPU logic can be enabled with:
|
||||||
|
|
||||||
|
CONFIG_ARCH_FPU=y
|
||||||
|
CONFIG_ARMV7M_CMNVECTOR=y
|
||||||
|
|
||||||
|
You will probably also changes to the ld.script in if this option is selected.
|
||||||
|
This should work:
|
||||||
|
|
||||||
|
-ENTRY(_stext)
|
||||||
|
+ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
|
||||||
|
+EXTERN(_vectors) /* Force the vectors to be included in the output */
|
||||||
|
|
||||||
|
CFLAGS
|
||||||
|
------
|
||||||
|
|
||||||
|
Only the recent toolchains have built-in support for the Cortex-M4 FPU. You will see
|
||||||
|
the following lines in each Make.defs file:
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||||
|
else
|
||||||
|
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
|
||||||
|
endif
|
||||||
|
|
||||||
|
Configuration Changes
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Below are all of the configuration changes that I had to make to configs/stm3240g-eval/nsh2
|
||||||
|
in order to successfully build NuttX using the Atollic toolchain WITH FPU support:
|
||||||
|
|
||||||
|
-CONFIG_ARCH_FPU=n : Enable FPU support
|
||||||
|
+CONFIG_ARCH_FPU=y
|
||||||
|
|
||||||
|
-CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : Disable the CodeSourcery toolchain
|
||||||
|
+CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=n
|
||||||
|
|
||||||
|
-CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC=n : Enable the Atollic toolchains
|
||||||
|
+CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC=y :
|
||||||
|
|
||||||
|
-CONFIG_INTELHEX_BINARY=y : Suppress generation FLASH download formats
|
||||||
|
+CONFIG_INTELHEX_BINARY=n : (Only necessary with the "Lite" version)
|
||||||
|
|
||||||
|
-CONFIG_HAVE_CXX=y : Suppress generation of C++ code
|
||||||
|
+CONFIG_HAVE_CXX=n : (Only necessary with the "Lite" version)
|
||||||
|
|
||||||
|
See the section above on Toolchains, NOTE 2, for explanations for some of
|
||||||
|
the configuration settings. Some of the usual settings are just not supported
|
||||||
|
by the "Lite" version of the Atollic toolchain.
|
||||||
|
|
||||||
|
Bambino-200e Configuration Options
|
||||||
|
==================================
|
||||||
|
|
||||||
|
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
|
||||||
|
be set to:
|
||||||
|
|
||||||
|
CONFIG_ARCH=arm
|
||||||
|
|
||||||
|
CONFIG_ARCH_family - For use in C code:
|
||||||
|
|
||||||
|
CONFIG_ARCH_ARM=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_architecture - For use in C code:
|
||||||
|
|
||||||
|
CONFIG_ARCH_CORTEXM4=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP=lpc43xx
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
||||||
|
chip:
|
||||||
|
|
||||||
|
CONFIG_ARCH_CHIP_LPC4330=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||||
|
hence, the board that supports the particular chip or SoC.
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD=bambino-200e (for the Bambino-200e board)
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD_name - For use in C code
|
||||||
|
|
||||||
|
CONFIG_ARCH_BOARD_BAMBINO_200E=y
|
||||||
|
|
||||||
|
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
|
||||||
|
of delay loops
|
||||||
|
|
||||||
|
CONFIG_ENDIAN_BIG - define if big endian (default is little
|
||||||
|
endian)
|
||||||
|
|
||||||
|
CONFIG_RAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
|
||||||
|
|
||||||
|
CONFIG_RAM_SIZE=(32*1024) (32Kb)
|
||||||
|
|
||||||
|
There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
|
||||||
|
|
||||||
|
CONFIG_RAM_START - The start address of installed DRAM
|
||||||
|
|
||||||
|
CONFIG_RAM_START=0x10000000
|
||||||
|
|
||||||
|
CONFIG_ARCH_FPU - The LPC43xxx supports a floating point unit (FPU)
|
||||||
|
|
||||||
|
CONFIG_ARCH_FPU=y
|
||||||
|
|
||||||
|
CONFIG_LPC43_BOOT_xxx - The startup code needs to know if the code is running
|
||||||
|
from internal FLASH, external FLASH, SPIFI, or SRAM in order to
|
||||||
|
initialize properly. Note that a boot device is not specified for
|
||||||
|
cases where the code is copied into SRAM; those cases are all covered
|
||||||
|
by CONFIG_LPC43_BOOT_SRAM.
|
||||||
|
|
||||||
|
CONFIG_LPC43_BOOT_SRAM=y : Running from SRAM (0x1000:0000)
|
||||||
|
CONFIG_LPC43_BOOT_SPIFI=y : Running from QuadFLASH (0x1400:0000)
|
||||||
|
CONFIG_LPC43_BOOT_FLASHA=y : Running in internal FLASHA (0x1a00:0000)
|
||||||
|
CONFIG_LPC43_BOOT_FLASHB=y : Running in internal FLASHA (0x1b00:0000)
|
||||||
|
CONFIG_LPC43_BOOT_CS0FLASH=y : Running in external FLASH CS0 (0x1c00:0000)
|
||||||
|
CONFIG_LPC43_BOOT_CS1FLASH=y : Running in external FLASH CS1 (0x1d00:0000)
|
||||||
|
CONFIG_LPC43_BOOT_CS2FLASH=y : Running in external FLASH CS2 (0x1e00:0000)
|
||||||
|
CONFIG_LPC43_BOOT_CS3FLASH=y : Running in external FLASH CS3 (0x1f00:0000)
|
||||||
|
|
||||||
|
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
|
||||||
|
have LEDs
|
||||||
|
|
||||||
|
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||||
|
stack. If defined, this symbol is the size of the interrupt
|
||||||
|
stack in bytes. If not defined, the user task stacks will be
|
||||||
|
used during interrupt handling.
|
||||||
|
|
||||||
|
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||||
|
|
||||||
|
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
|
||||||
|
|
||||||
|
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
||||||
|
cause a 100 second delay during boot-up. This 100 second delay
|
||||||
|
serves no purpose other than it allows you to calibratre
|
||||||
|
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
||||||
|
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
||||||
|
the delay actually is 100 seconds.
|
||||||
|
|
||||||
|
Individual subsystems can be enabled:
|
||||||
|
|
||||||
|
CONFIG_LPC43_ADC0=y
|
||||||
|
CONFIG_LPC43_ADC1=y
|
||||||
|
CONFIG_LPC43_ATIMER=y
|
||||||
|
CONFIG_LPC43_CAN1=y
|
||||||
|
CONFIG_LPC43_CAN2=y
|
||||||
|
CONFIG_LPC43_DAC=y
|
||||||
|
CONFIG_LPC43_EMC=y
|
||||||
|
CONFIG_LPC43_ETHERNET=y
|
||||||
|
CONFIG_LPC43_EVNTMNTR=y
|
||||||
|
CONFIG_LPC43_GPDMA=y
|
||||||
|
CONFIG_LPC43_I2C0=y
|
||||||
|
CONFIG_LPC43_I2C1=y
|
||||||
|
CONFIG_LPC43_I2S0=y
|
||||||
|
CONFIG_LPC43_I2S1=y
|
||||||
|
CONFIG_LPC43_LCD=y
|
||||||
|
CONFIG_LPC43_MCPWM=y
|
||||||
|
CONFIG_LPC43_QEI=y
|
||||||
|
CONFIG_LPC43_RIT=y
|
||||||
|
CONFIG_LPC43_RTC=y
|
||||||
|
CONFIG_LPC43_SCT=y
|
||||||
|
CONFIG_LPC43_SDMMC=y
|
||||||
|
CONFIG_LPC43_SPI=y
|
||||||
|
CONFIG_LPC43_SPIFI=y
|
||||||
|
CONFIG_LPC43_SSP0=y
|
||||||
|
CONFIG_LPC43_SSP1=y
|
||||||
|
CONFIG_LPC43_TMR0=y
|
||||||
|
CONFIG_LPC43_TMR1=y
|
||||||
|
CONFIG_LPC43_TMR2=y
|
||||||
|
CONFIG_LPC43_TMR3=y
|
||||||
|
CONFIG_LPC43_USART0=y
|
||||||
|
CONFIG_LPC43_UART1=y
|
||||||
|
CONFIG_LPC43_USART2=y
|
||||||
|
CONFIG_LPC43_USART3=y
|
||||||
|
CONFIG_LPC43_USB0=y
|
||||||
|
CONFIG_LPC43_USB1=y
|
||||||
|
CONFIG_LPC43_USB1_ULPI=y
|
||||||
|
CONFIG_LPC43_WWDT=y
|
||||||
|
|
||||||
|
LPC43xx specific U[S]ART device driver settings
|
||||||
|
|
||||||
|
CONFIG_U[S]ARTn_SERIAL_CONSOLE - selects the UARTn for the
|
||||||
|
console and ttys0 (default is the USART0).
|
||||||
|
CONFIG_U[S]ARTn_RXBUFSIZE - Characters are buffered as received.
|
||||||
|
This specific the size of the receive buffer
|
||||||
|
CONFIG_U[S]ARTn_TXBUFSIZE - Characters are buffered before
|
||||||
|
being sent. This specific the size of the transmit buffer
|
||||||
|
CONFIG_U[S]ARTn_BAUD - The configure BAUD of the UART. Must be
|
||||||
|
CONFIG_U[S]ARTn_BITS - The number of bits. Must be either 7 or 8.
|
||||||
|
CONFIG_U[S]ARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||||
|
CONFIG_U[S]ARTn_2STOP - Two stop bits
|
||||||
|
|
||||||
|
CONFIG_USARTn_RS485MODE - Support LPC43xx USART0,2,3 RS485 mode
|
||||||
|
ioctls (TIOCSRS485 and TIOCGRS485) to enable and disable
|
||||||
|
RS-485 mode.
|
||||||
|
|
||||||
|
LPC43xx specific CAN device driver settings. These settings all
|
||||||
|
require CONFIG_CAN:
|
||||||
|
|
||||||
|
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
|
||||||
|
Standard 11-bit IDs.
|
||||||
|
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN1 is defined.
|
||||||
|
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC43_CAN2 is defined.
|
||||||
|
CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
|
||||||
|
(the CCLK frequency is divided by this number to get the CAN clock).
|
||||||
|
Options = {1,2,4,6}. Default: 4.
|
||||||
|
CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
|
||||||
|
(the CCLK frequency is divided by this number to get the CAN clock).
|
||||||
|
Options = {1,2,4,6}. Default: 4.
|
||||||
|
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
|
||||||
|
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
|
||||||
|
|
||||||
|
LPC43xx specific PHY/Ethernet device driver settings. These setting
|
||||||
|
also require CONFIG_NET and CONFIG_LPC43_ETHERNET.
|
||||||
|
|
||||||
|
CONFIG_ETH0_PHY_KS8721 - Selects Micrel KS8721 PHY
|
||||||
|
CONFIG_PHY_AUTONEG - Enable auto-negotion
|
||||||
|
CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
|
||||||
|
CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
|
||||||
|
|
||||||
|
CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
|
||||||
|
CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
|
||||||
|
CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
|
||||||
|
CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
|
||||||
|
CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
|
||||||
|
CONFIG_DEBUG_FEATURES.
|
||||||
|
CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
|
||||||
|
Also needs CONFIG_DEBUG_FEATURES.
|
||||||
|
CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
|
||||||
|
|
||||||
|
LPC43xx USB Device Configuration
|
||||||
|
|
||||||
|
CONFIG_LPC43_USBDEV_FRAME_INTERRUPT
|
||||||
|
Handle USB Start-Of-Frame events.
|
||||||
|
Enable reading SOF from interrupt handler vs. simply reading on demand.
|
||||||
|
Probably a bad idea... Unless there is some issue with sampling the SOF
|
||||||
|
from hardware asynchronously.
|
||||||
|
CONFIG_LPC43_USBDEV_EPFAST_INTERRUPT
|
||||||
|
Enable high priority interrupts. I have no idea why you might want to
|
||||||
|
do that
|
||||||
|
CONFIG_LPC43_USBDEV_NDMADESCRIPTORS
|
||||||
|
Number of DMA descriptors to allocate in SRAM.
|
||||||
|
CONFIG_LPC43_USBDEV_DMA
|
||||||
|
Enable lpc17xx-specific DMA support
|
||||||
|
CONFIG_LPC43_USBDEV_NOVBUS
|
||||||
|
Define if the hardware implementation does not support the VBUS signal
|
||||||
|
CONFIG_LPC43_USBDEV_NOLED
|
||||||
|
Define if the hardware implementation does not support the LED output
|
||||||
|
|
||||||
|
LPC43xx USB Host Configuration
|
||||||
|
|
||||||
|
CONFIG_USBHOST_OHCIRAM_SIZE
|
||||||
|
Total size of OHCI RAM (in AHB SRAM Bank 1)
|
||||||
|
CONFIG_USBHOST_NEDS
|
||||||
|
Number of endpoint descriptors
|
||||||
|
CONFIG_USBHOST_NTDS
|
||||||
|
Number of transfer descriptors
|
||||||
|
CONFIG_USBHOST_TDBUFFERS
|
||||||
|
Number of transfer descriptor buffers
|
||||||
|
CONFIG_USBHOST_TDBUFSIZE
|
||||||
|
Size of one transfer descriptor buffer
|
||||||
|
CONFIG_USBHOST_IOBUFSIZE
|
||||||
|
Size of one end-user I/O buffer. This can be zero if the
|
||||||
|
application can guarantee that all end-user I/O buffers
|
||||||
|
reside in AHB SRAM.
|
||||||
|
|
||||||
|
Configurations
|
||||||
|
==============
|
||||||
|
|
||||||
|
Each Bambino-200e configuration is maintained in a sub-directory and can be selected
|
||||||
|
as follow:
|
||||||
|
|
||||||
|
cd tools
|
||||||
|
./configure.sh bambino-200e/<subdir>
|
||||||
|
cd -
|
||||||
|
. ./setenv.sh
|
||||||
|
|
||||||
|
Where <subdir> is one of the following:
|
||||||
|
|
||||||
|
nsh:
|
||||||
|
----
|
||||||
|
This configuration is the NuttShell (NSH) example at examples/nsh/.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
2. By default, this project assumes that you are executing directly from
|
||||||
|
SRAM.
|
||||||
|
|
||||||
|
CONFIG_LPC43_BOOT_SRAM=y : Executing in SRAM
|
||||||
|
CONFIG_ARMV7M_TOOLCHAIN_CODEREDW=y : Code Red under Windows
|
||||||
|
|
||||||
|
3. To execute from SPIFI, you would need to set:
|
||||||
|
|
||||||
|
CONFIG_LPC43_BOOT_SPIFI=y : Executing from SPIFI
|
||||||
|
CONFIG_RAM_SIZE=(128*1024) : SRAM Bank0 size
|
||||||
|
CONFIG_RAM_START=0x10000000 : SRAM Bank0 base address
|
||||||
|
CONFIG_SPIFI_OFFSET=(512*1024) : SPIFI file system offset
|
||||||
|
|
||||||
|
CONFIG_MM_REGIONS should also be increased if you want to other SRAM banks
|
||||||
|
to the memory pool.
|
||||||
|
|
||||||
|
4. This configuration an also be used create a block device on the SPIFI
|
||||||
|
FLASH. CONFIG_LPC43_SPIFI=y must also be defined to enable SPIFI setup
|
||||||
|
support:
|
||||||
|
|
||||||
|
SPIFI device geometry:
|
||||||
|
|
||||||
|
CONFIG_SPIFI_OFFSET - Offset the beginning of the block driver this many
|
||||||
|
bytes into the device address space. This offset must be an exact
|
||||||
|
multiple of the erase block size (CONFIG_SPIFI_BLKSIZE). Default 0.
|
||||||
|
CONFIG_SPIFI_BLKSIZE - The size of one device erase block. If not defined
|
||||||
|
then the driver will try to determine the correct erase block size by
|
||||||
|
examining that data returned from spifi_initialize (which sometimes
|
||||||
|
seems bad).
|
||||||
|
|
||||||
|
Other SPIFI options
|
||||||
|
|
||||||
|
CONFIG_SPIFI_SECTOR512 - If defined, then the driver will report a more
|
||||||
|
FAT friendly 512 byte sector size and will manage the read-modify-write
|
||||||
|
operations on the larger erase block.
|
||||||
|
CONFIG_SPIFI_READONLY - Define to support only read-only operations.
|
||||||
|
CONFIG_SPIFI_LIBRARY - Don't use the LPC43xx ROM routines but, instead,
|
||||||
|
use an external library implementation of the SPIFI interface.
|
||||||
|
CONFIG_SPIFI_VERIFY - Verify all spifi_program() operations by reading
|
||||||
|
from the SPI address space after each write.
|
||||||
|
CONFIG_DEBUG_SPIFI_DUMP - Debug option to dump read/write buffers. You
|
||||||
|
probably do not want to enable this unless you want to dig through a
|
||||||
|
*lot* of debug output! Also required CONFIG_DEBUG_FEATURES, CONFIG_DEBUG_INFO,
|
||||||
|
and CONFIG_DEBUG_FS,
|
||||||
|
|
||||||
|
5. In my experience, there were some missing function pointers in the LPC43xx
|
||||||
|
SPIFI ROM routines and the SPIFI configuration could only be built with
|
||||||
|
CONFIG_SPIFI_LIBRARY=y. The SPIFI library is proprietary and cannot be
|
||||||
|
provided within NuttX open source repository; SPIFI library binaries can
|
||||||
|
be found on the lpcware.com website. In this build sceneario, you must
|
||||||
|
also provide the patch to the external SPIFI library be defining the make
|
||||||
|
variable EXTRA_LIBS in the top-level Make.defs file. Good luck!
|
||||||
@@ -0,0 +1,360 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/include/board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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 __CONFIG_BAMBINO_200E_INCLUDE_BOARD_H
|
||||||
|
#define __CONFIG_BAMBINO_200E_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||||
|
# include <nuttx/irq.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking ****************************************************************/
|
||||||
|
/* NOTE: The following definitions require lpc43_cgu.h. It is not included
|
||||||
|
* here because the including C file may not have that file in its include
|
||||||
|
* path.
|
||||||
|
*
|
||||||
|
* The Xplorer board has four crystals on board:
|
||||||
|
*
|
||||||
|
* Y1 - RTC 32.768 MHz oscillator input,
|
||||||
|
* Y2 - 24.576 MHz input to the UDA 1380 audio codec,
|
||||||
|
* Y3 - 12.000 MHz LPC43xx crystal oscillator input
|
||||||
|
* Y4 - 50 MHz input for Ethernet
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency (Y3) */
|
||||||
|
#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency (Y1) */
|
||||||
|
#define BOARD_INTRCOSC_FREQUENCY (4000000) /* Internal RC oscillator frequency */
|
||||||
|
|
||||||
|
/* Integer and direct modes are supported:
|
||||||
|
*
|
||||||
|
* In integer mode (Fclkout < 156000000):
|
||||||
|
* Fclkin = BOARD_XTAL_FREQUENCY
|
||||||
|
* Fclkout = Msel * FClkin / Nsel
|
||||||
|
* Fcco = 2 * Psel * Fclkout
|
||||||
|
* In direct mode (Fclkout > 156000000):
|
||||||
|
* Fclkin = BOARD_XTAL_FREQUENCY
|
||||||
|
* Fclkout = Msel * FClkin / Nsel
|
||||||
|
* Fcco = Fclkout
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_LPC43_72MHz
|
||||||
|
|
||||||
|
/* NOTE: At 72MHz, the calibrated value of CONFIG_BOARD_LOOPSPERMSEC was
|
||||||
|
* determined to be:
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LOOPSPERMSEC=7191
|
||||||
|
*
|
||||||
|
* executing from SRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Final clocking (Integer mode with no ramp-up)
|
||||||
|
*
|
||||||
|
* Fclkout = 6 * 12MHz / 1 = 72MHz
|
||||||
|
* Fcco = 2 * 2 * 72MHz = 216MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define BOARD_PLL_MSEL (6) /* Msel = 6 */
|
||||||
|
# define BOARD_PLL_NSEL (1) /* Nsel = 1 */
|
||||||
|
# define BOARD_PLL_PSEL (2) /* Psel = 2 */
|
||||||
|
|
||||||
|
# define BOARD_FCLKOUT_FREQUENCY (72000000) /* 6 * 12,000,000 / 1 */
|
||||||
|
# define BOARD_FCCO_FREQUENCY (244000000) /* 2 * 2 * Fclkout */
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* NOTE: At 72MHz, the calibrated value of CONFIG_BOARD_LOOPSPERMSEC was
|
||||||
|
* determined to be:
|
||||||
|
*
|
||||||
|
* CONFIG_BOARD_LOOPSPERMSEC=18535
|
||||||
|
*
|
||||||
|
* executing from SRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Intermediate ramp-up clocking (Integer mode). If BOARD_PLL_RAMP_MSEL
|
||||||
|
* is not defined, there will be no ramp-up.
|
||||||
|
*
|
||||||
|
* Fclkout = 9 * 12MHz / 1 = 108MHz
|
||||||
|
* Fcco = 2 * 1 * 108MHz = 216MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define BOARD_PLL_RAMP_MSEL (9) /* Msel = 9 */
|
||||||
|
# define BOARD_PLL_RAMP_NSEL (1) /* Nsel = 1 */
|
||||||
|
# define BOARD_PLL_RAMP_PSEL (1) /* Psel = 1 */
|
||||||
|
|
||||||
|
# define BOARD_RAMP_FCLKOUT (108000000) /* 9 * 12,000,000 / 1 */
|
||||||
|
# define BOARD_RAMP_FCCO (216000000) /* 2 * 1 * Fclkout */
|
||||||
|
|
||||||
|
/* Final clocking (Direct mode).
|
||||||
|
*
|
||||||
|
* Fclkout = 17 * 12MHz / 1 = 204MHz
|
||||||
|
* Fcco = Fclockout = 204MHz
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define BOARD_PLL_MSEL (17) /* Msel = 17 */
|
||||||
|
# define BOARD_PLL_NSEL (1) /* Nsel = 1 */
|
||||||
|
|
||||||
|
# define BOARD_FCLKOUT_FREQUENCY (204000000) /* 17 * 12,000,000 / 1 */
|
||||||
|
# define BOARD_FCCO_FREQUENCY (204000000) /* Fclockout */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 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 / 6 = 80MHz -> CCLK divider = 6
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LPC43_CCLK BOARD_FCLKOUT_FREQUENCY
|
||||||
|
|
||||||
|
/* APB Clocking */
|
||||||
|
|
||||||
|
#if defined(CONFIG_LPC43_BUS) || defined(CONFIG_LPC43_MCPWM) || \
|
||||||
|
defined(CONFIG_LPC43_I2C0) || defined(CONFIG_LPC43_I2S0) || \
|
||||||
|
defined(CONFIG_LPC43_I2S1) || defined(CONFIG_LPC43_CAN1)
|
||||||
|
# define BOARD_ABP1_CLKSRC BASE_APB_CLKSEL_XTAL
|
||||||
|
# define BOARD_ABP1_FREQUENCY BOARD_XTAL_FREQUENCY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CONFIG_LPC43_BUS) || defined(CONFIG_LPC43_I2C1) || \
|
||||||
|
defined(CONFIG_LPC43_DAC) || defined(CONFIG_LPC43_ADC0) || \
|
||||||
|
defined(CONFIG_LPC43_ADC1) || defined(CONFIG_LPC43_CAN0)
|
||||||
|
# define BOARD_ABP3_CLKSRC BASE_APB_CLKSEL_XTAL
|
||||||
|
# define BOARD_ABP3_FREQUENCY BOARD_XTAL_FREQUENCY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* SSP Clocking */
|
||||||
|
|
||||||
|
#define BOARD_IDIVA_DIVIDER (2)
|
||||||
|
#define BOARD_IDIVA_CLKSRC IDIVA_CLKSEL_PLL1
|
||||||
|
#define BOARD_IDIVA_FREQUENCY (BOARD_FCLKOUT_FREQUENCY/BOARD_IDIVA_DIVIDER)
|
||||||
|
|
||||||
|
#define BOARD_SSP0_CLKSRC BASE_SSP0_CLKSEL_IDIVA
|
||||||
|
#define BOARD_SSP0_BASEFREQ BOARD_IDIVA_FREQUENCY
|
||||||
|
|
||||||
|
#define BOARD_SSP1_CLKSRC BASE_SSP1_CLKSEL_IDIVA
|
||||||
|
#define BOARD_SSP1_BASEFREQ BOARD_IDIVA_FREQUENCY
|
||||||
|
|
||||||
|
/* USB0 ********************************************************************/
|
||||||
|
/* Settings needed in lpc43_cpu.c */
|
||||||
|
|
||||||
|
#define BOARD_USB0_CLKSRC PLL0USB_CLKSEL_XTAL
|
||||||
|
#define BOARD_USB0_MDIV 0x06167ffa /* Table 149 datsheet, valid for 12Mhz Fclkin */
|
||||||
|
#define BOARD_USB0_NP_DIV 0x00302062 /* Table 149 datsheet, valid for 12Mhz Fclkin */
|
||||||
|
|
||||||
|
/* SPIFI clocking **********************************************************/
|
||||||
|
/* The SPIFI will receive clocking from a divider per the settings provided
|
||||||
|
* in this file. The NuttX code will configure PLL1 as the input clock
|
||||||
|
* for the selected divider
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef BOARD_SPIFI_PLL1 /* No division */
|
||||||
|
#undef BOARD_SPIFI_DIVA /* Supports division by 1-4 */
|
||||||
|
#undef BOARD_SPIFI_DIVB /* Supports division by 1-16 */
|
||||||
|
#undef BOARD_SPIFI_DIVC /* Supports division by 1-16 */
|
||||||
|
#undef BOARD_SPIFI_DIVD /* Supports division by 1-16 */
|
||||||
|
#undef BOARD_SPIFI_DIVE /* Supports division by 1-256 */
|
||||||
|
|
||||||
|
#if BOARD_FCLKOUT_FREQUENCY < 20000000
|
||||||
|
# define BOARD_SPIFI_PLL1 1 /* Use PLL1 directly */
|
||||||
|
#else
|
||||||
|
# define BOARD_SPIFI_DIVB 1 /* Use IDIVB */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* We need to configure the divider so that its output is as close to the
|
||||||
|
* desired SCLK value. The peak data transfer rate will be about half of
|
||||||
|
* this frequency in bytes per second.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if BOARD_FCLKOUT_FREQUENCY < 20000000
|
||||||
|
# define BOARD_SPIFI_FREQUENCY BOARD_FCLKOUT_FREQUENCY /* 72Mhz? */
|
||||||
|
#else
|
||||||
|
# define BOARD_SPIFI_DIVIDER (14) /* 204MHz / 14 = 14.57MHz */
|
||||||
|
# define BOARD_SPIFI_FREQUENCY (102000000) /* 204MHz / 14 = 14.57MHz */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* UART clocking ***********************************************************/
|
||||||
|
/* Configure all U[S]ARTs to use the XTAL input frequency */
|
||||||
|
|
||||||
|
#define BOARD_USART0_CLKSRC BASE_USART0_CLKSEL_XTAL
|
||||||
|
#define BOARD_USART0_BASEFREQ BOARD_XTAL_FREQUENCY
|
||||||
|
|
||||||
|
#define BOARD_UART1_CLKSRC BASE_UART1_CLKSEL_XTAL
|
||||||
|
#define BOARD_UART1_BASEFREQ BOARD_XTAL_FREQUENCY
|
||||||
|
|
||||||
|
#define BOARD_USART2_CLKSRC BASE_USART2_CLKSEL_XTAL
|
||||||
|
#define BOARD_USART2_BASEFREQ BOARD_XTAL_FREQUENCY
|
||||||
|
|
||||||
|
#define BOARD_USART3_CLKSRC BASE_USART3_CLKSEL_XTAL
|
||||||
|
#define BOARD_USART3_BASEFREQ BOARD_XTAL_FREQUENCY
|
||||||
|
|
||||||
|
/* LED definitions *********************************************************/
|
||||||
|
/* The Bambino 200E has 2 user-controllable LEDs labeled LED1 and LED2 in the
|
||||||
|
* schematic and on bus referred to has GPIO3[7] and GPIO5[5], respectively.
|
||||||
|
*
|
||||||
|
* LED1 GPIO3[7]
|
||||||
|
* LED2 GPIO5[5]
|
||||||
|
*
|
||||||
|
* LEDs are pulled high to a low output illuminates the LED.
|
||||||
|
*
|
||||||
|
* LED index values for use with board_userled()
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOARD_LED1 0
|
||||||
|
#define BOARD_LED2 1
|
||||||
|
#define BOARD_NLEDS 2
|
||||||
|
|
||||||
|
/* LED bits for use with board_userled_all() */
|
||||||
|
|
||||||
|
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||||
|
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||||
|
|
||||||
|
/* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
|
||||||
|
* for NuttX debug functionality (where NC means "No Change"). If
|
||||||
|
* CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
|
||||||
|
* control of the application. The following interfaces are then available
|
||||||
|
* for application control of the LEDs:
|
||||||
|
*
|
||||||
|
* void board_userled_initialize(void);
|
||||||
|
* void board_userled(int led, bool ledon);
|
||||||
|
* void board_userled_all(uint8_t ledset);
|
||||||
|
*/
|
||||||
|
/* ON OFF */
|
||||||
|
/* LED1 LED2 LED1 LED2 */
|
||||||
|
#define LED_STARTED 0 /* OFF OFF - - */
|
||||||
|
#define LED_HEAPALLOCATE 1 /* ON OFF - - */
|
||||||
|
#define LED_IRQSENABLED 1 /* ON OFF - - */
|
||||||
|
#define LED_STACKCREATED 1 /* ON OFF - - */
|
||||||
|
#define LED_INIRQ 2 /* NC ON NC OFF */
|
||||||
|
#define LED_SIGNAL 2 /* NC ON NC OFF */
|
||||||
|
#define LED_ASSERTION 2 /* NC ON NC OFF */
|
||||||
|
#define LED_PANIC 2 /* NC ON NC OFF */
|
||||||
|
|
||||||
|
/* UART Pins ****************************************************************/
|
||||||
|
/* The Bambino 200E does not have RS-232 drivers or serial connectors on
|
||||||
|
* board. UART1 and USART2 are availables on Socket 5 and 10, recpectively:
|
||||||
|
*
|
||||||
|
* ------ ---------- -----------------------
|
||||||
|
* SIGNAL Socket/Pin LPC4330FBD144 PIN
|
||||||
|
* ------ ---------- -----------------------
|
||||||
|
* U1_TXD s:5 / p:4 63 P5_6 U1_TXD=Alt 1
|
||||||
|
* U1_RXD s:5 / p:5 61 P1_14 U1_RXD=Alt 1
|
||||||
|
* U2_TXD s:10 / p:4 104 P2_10 U2_TXD=Alt 1
|
||||||
|
* U2_RXD s:10 / p:5 105 P2_11 U2_RXD=Alt 1
|
||||||
|
* ------ ---------- -----------------------
|
||||||
|
*
|
||||||
|
* The following definitions must be provided so that the LPC43 serial
|
||||||
|
* driver can set up the U[S]ART for the serial console properly (see the
|
||||||
|
* file arch/arc/src/lpc43xx/lpc4310203050_pinconf.h for more info).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PINCONF_U0_TXD PINCONF_U0_TXD_3
|
||||||
|
#define PINCONF_U0_RXD PINCONF_U0_RXD_3
|
||||||
|
#define PINCONF_U0_DIR PINCONF_U0_DIR_3
|
||||||
|
|
||||||
|
#define PINCONF_U1_TXD PINCONF_U1_TXD_5
|
||||||
|
#define PINCONF_U1_RXD PINCONF_U1_RXD_1
|
||||||
|
|
||||||
|
#define PINCONF_U2_TXD PINCONF_U2_TXD_2
|
||||||
|
#define PINCONF_U2_RXD PINCONF_U2_RXD_2
|
||||||
|
#define PINCONF_U2_DIR PINCONF_U2_DIR_2
|
||||||
|
|
||||||
|
#define PINCONF_U3_TXD PINCONF_U3_TXD_2
|
||||||
|
#define PINCONF_U3_RXD PINCONF_U3_RXD_2
|
||||||
|
#define PINCONF_U3_DIR PINCONF_U3_DIR_2
|
||||||
|
|
||||||
|
/* Ethernet */
|
||||||
|
|
||||||
|
#define PINCONF_ENET_RX_DV PINCONF_ENET_RX_DV_2
|
||||||
|
#define PINCONF_ENET_RESET PINCONF_GPIO0p4
|
||||||
|
#define GPIO_ENET_RESET (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN4)
|
||||||
|
#define PINCONF_ENET_MDC PINCONF_ENET_MDC_3
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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: lpc43_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All LPC43xx 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 lpc43_boardinitialize(void);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __CONFIG_BAMBINO_200E_INCLUDE_BOARD_H */
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/bambino-200e/nsh/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
# Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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
|
||||||
|
|
||||||
|
# Setup for the kind of memory that we are executing from
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_LPC43_BOOT_SRAM),y)
|
||||||
|
LDSCRIPT = ramconfig.ld
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_LPC43_BOOT_SPIFI),y)
|
||||||
|
LDSCRIPT = spificonfig.ld
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_LPC43_BOOT_FLASHA),y)
|
||||||
|
LDSCRIPT = flashaconfig.ld
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_LPC43_BOOT_FLASHB),y)
|
||||||
|
LDSCRIPT = flashaconfig.ld
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_LPC43_BOOT_CS0FLASH),y)
|
||||||
|
LDSCRIPT = cs0flash.ld
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Setup for Windows vs Linux/Cygwin/OSX environments
|
||||||
|
|
||||||
|
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/$(LDSCRIPT)}"
|
||||||
|
else
|
||||||
|
# Linux/Cygwin-native toolchain
|
||||||
|
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||||
|
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||||
|
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||||
|
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC = $(CROSSDEV)gcc
|
||||||
|
CXX = $(CROSSDEV)g++
|
||||||
|
CPP = $(CROSSDEV)gcc -E
|
||||||
|
LD = $(CROSSDEV)ld
|
||||||
|
AR = $(ARCROSSDEV)ar rcs
|
||||||
|
NM = $(ARCROSSDEV)nm
|
||||||
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ARCHCFLAGS = -fno-builtin
|
||||||
|
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||||
|
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) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||||
|
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
ASMEXT = .S
|
||||||
|
OBJEXT = .o
|
||||||
|
LIBEXT = .a
|
||||||
|
EXEEXT =
|
||||||
|
|
||||||
|
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||||
|
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
LDFLAGS += -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# configs/bambino-200e/nsh/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
# Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$_" = "$0" ] ; then
|
||||||
|
echo "You must source this script, not run it!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WD=`pwd`
|
||||||
|
if [ ! -x "setenv.sh" ]; then
|
||||||
|
echo "This script must be executed from the top-level NuttX build directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${PATH_ORIG}" ]; then
|
||||||
|
export PATH_ORIG="${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the Code Red
|
||||||
|
# toolchain under windows. You will have to edit this if you install the
|
||||||
|
# Code Red toolchain in any other location or if you install a different
|
||||||
|
# version
|
||||||
|
export TOOLCHAIN_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/Tools/bin"
|
||||||
|
#export SCRIPT_BIN="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
||||||
|
export SCRIPT_BIN="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the CodeSourcery toolchain in any other location
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||||
|
#export SCRIPT_BIN=
|
||||||
|
|
||||||
|
# These are the Cygwin paths to the locations where I installed the Atollic
|
||||||
|
# toolchain under windows. You will also have to edit this if you install
|
||||||
|
# the Atollic toolchain in any other location. /usr/bin is added before
|
||||||
|
# the Atollic bin path because there is are binaries named gcc.exe and g++.exe
|
||||||
|
# at those locations as well.
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin"
|
||||||
|
#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin"
|
||||||
|
#export SCRIPT_BIN=
|
||||||
|
|
||||||
|
# This is the Cygwin path to the location where I build the buildroot
|
||||||
|
# toolchain.
|
||||||
|
#export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||||
|
#export SCRIPT_BIN=
|
||||||
|
|
||||||
|
# And add the selected toolchain path[s] to the PATH variable
|
||||||
|
|
||||||
|
export PATH="/sbin:/usr/sbin:${PATH_ORIG}"
|
||||||
|
|
||||||
|
if [ ! -z ${SCRIPT_BIN} ]; then
|
||||||
|
export PATH="${SCRIPT_BIN}:${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH="${TOOLCHAIN_BIN}:${PATH}"
|
||||||
|
echo "PATH : ${PATH}"
|
||||||
|
|
||||||
|
# Set an alias that can be used to put the LPC43xx in boot mode
|
||||||
|
|
||||||
|
alias lpc43xx='${SCRIPT_BIN}/Scripts/bootLPCXpresso.cmd winusb'
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
####################################################################################
|
||||||
|
# flash.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
# Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
#
|
||||||
|
####################################################################################
|
||||||
|
set -x
|
||||||
|
|
||||||
|
USAGE="$0 <nuttx-path>"
|
||||||
|
|
||||||
|
# LPCXpresso 3.6 installed at /cygdrive/c/nxp/lpcxpresso_3.6"
|
||||||
|
|
||||||
|
BINDIR="/cygdrive/c/nxp/LPCXpresso_4.2.3_292/lpcxpresso/bin"
|
||||||
|
|
||||||
|
# RedSuite with LPC4330 support installed at /cygdrive/c/code_red/RedSuite_4.2.3_379 "
|
||||||
|
|
||||||
|
#BINDIR="/cygdrive/c/code_red/RedSuite_4.2.3_379/redsuite/bin"
|
||||||
|
|
||||||
|
TARGET=LPC4330
|
||||||
|
|
||||||
|
echo "############################################################################"
|
||||||
|
echo "# Assumptions:"
|
||||||
|
echo "#"
|
||||||
|
echo "# - Windows 7"
|
||||||
|
echo "# - Binaries installed at ${BINDIR}"
|
||||||
|
echo "# - AXF image built with Code Red"
|
||||||
|
echo "# - ${TARGET}"
|
||||||
|
echo "#"
|
||||||
|
echo "# You will need to edit this is any of the above are false"
|
||||||
|
echo "#"
|
||||||
|
echo "############################################################################"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# This is the default install location for binaries on Windows (note that this
|
||||||
|
# path could change with the Code Red version number)
|
||||||
|
|
||||||
|
if [ ! -d "${BINDIR}" ]; then
|
||||||
|
echo "Directory ${BINDIR} does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is the relative path to the booLPCXpresso utility.
|
||||||
|
|
||||||
|
BOOTLPC="Scripts/bootLPCXpresso.cmd"
|
||||||
|
if [ ! -x "${BINDIR}/${BOOTLPC}" ]; then
|
||||||
|
echo "No executable at ${BINDIR}/${BOOTLPC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# bootLPCXpresso arguments
|
||||||
|
|
||||||
|
BOOTLPC_ARG=winusb # Win7
|
||||||
|
|
||||||
|
# Use the LPC18xx/LPC43xx flash utility
|
||||||
|
|
||||||
|
FLASHUTIL="crt_emu_lpc18_43_nxp" # for LPC18xx/LPC43xx parts
|
||||||
|
|
||||||
|
if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then
|
||||||
|
echo "No executable file at ${BINDIR}/${FLASHUTIL}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FLUSHUTIL arguements
|
||||||
|
|
||||||
|
WIRE="-wire=winusb" # for LPC-Link on Windows Vista/Windows 7)
|
||||||
|
|
||||||
|
# The nuttx directory must be provided as an argument
|
||||||
|
|
||||||
|
NUTTX=$1
|
||||||
|
if [ -z "${NUTTX}" ]; then
|
||||||
|
echo "Missing argument"
|
||||||
|
echo $USAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "${NUTTX}" ]; then
|
||||||
|
echo "Directory ${NUTTX} does not exist"
|
||||||
|
echo $USAGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The binary to download:
|
||||||
|
|
||||||
|
if [ ! -f "${NUTTX}/nuttx.axf" ]; then
|
||||||
|
if [ -f "${NUTTX}/nuttx" ]; then
|
||||||
|
echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
|
||||||
|
mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -f "${NUTTX}/nuttx" ]; then
|
||||||
|
echo "Both ${NUTTX}/nuttx ${NUTTX}/nuttx.axf exist.."
|
||||||
|
echo " Deleting ${NUTTX}/nuttx.axf"
|
||||||
|
rm -f ${NUTTX}/nuttx.axf
|
||||||
|
echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf"
|
||||||
|
mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"`
|
||||||
|
|
||||||
|
# First of all boot the LPC-Link using the script: ${BINDIR}/${BOOTLPC}
|
||||||
|
|
||||||
|
cd ${BINDIR} || \
|
||||||
|
{ echo "Failed to CD to ${BINDIR}"; exit 1; }
|
||||||
|
./${BOOTLPC} ${BOOTLPC_ARG} || \
|
||||||
|
{ echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; }
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Wait a bit"
|
||||||
|
echo "5..."
|
||||||
|
sleep 1
|
||||||
|
echo "4..."
|
||||||
|
sleep 1
|
||||||
|
echo "3..."
|
||||||
|
sleep 1
|
||||||
|
echo "2..."
|
||||||
|
sleep 1
|
||||||
|
echo "1..."
|
||||||
|
sleep 1
|
||||||
|
echo "0..."
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Then program the FLASH
|
||||||
|
|
||||||
|
cd ${BINDIR} || \
|
||||||
|
{ echo "Failed to CD to ${BINDIR}"; exit 1; }
|
||||||
|
./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/scripts/ramconfig.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
/*
|
||||||
|
* Power-Up Reset Overview
|
||||||
|
* -----------------------
|
||||||
|
*
|
||||||
|
* The ARM core starts executing code on reset with the program counter set
|
||||||
|
* to 0x0000 0000. The LPC43xx contains a shadow pointer register that
|
||||||
|
* allows areas of memory to be mapped to address 0x0000 0000. The default,
|
||||||
|
* reset value of the shadow pointer is 0x1040 0000 so that on reset code in
|
||||||
|
* the boot ROM is always executed first.
|
||||||
|
*
|
||||||
|
* The boot starts after reset is released. The IRC is selected as CPU clock
|
||||||
|
* and the Cortex-M4 starts the boot loader. By default the JTAG access to the
|
||||||
|
* chip is disabled at reset. The boot ROM determines the boot mode based on
|
||||||
|
* the OTP BOOT_SRC value or reset state pins. For flash-based parts, the part
|
||||||
|
* boots from internal flash by default. Otherwse, the boot ROM copies the
|
||||||
|
* image to internal SRAM at location 0x1000 0000, sets the ARM's shadow
|
||||||
|
* pointer to 0x1000 0000, and jumps to that location.
|
||||||
|
*
|
||||||
|
* However, using JTAG the executable image can be also loaded directly into
|
||||||
|
* and executed from SRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The LPC4330 on the LPC4330-Xplorer has the following memory resources:
|
||||||
|
*
|
||||||
|
* 1. 4096Kb of SPIFI FLASH beginning at address 0x1400:0000
|
||||||
|
* 2. 264KB of total SRAM:
|
||||||
|
* a. 128KB of SRAM in the CPU block beginning at address 0x1000:0000
|
||||||
|
* b. 72KB beginning at address 0x1008:0000 and
|
||||||
|
* c. 64KB of AHB SRAM in three banks beginning at addresses 0x2000:0000,
|
||||||
|
* 0x2000:8000 and 0x2000:C000.
|
||||||
|
* 3. No internal FLASH
|
||||||
|
*
|
||||||
|
* Here we assume that:
|
||||||
|
*
|
||||||
|
* 1. We will be running out of SRAM at 0x1000:0000, and
|
||||||
|
* 2. All .data and .bss will all fit into the 72KB SRAM block.
|
||||||
|
*
|
||||||
|
* NOTE: That initialized data is kept in the program memory SRAM and copied
|
||||||
|
* to .data SRAM. This is wasteful and unnecessary but provides a good test
|
||||||
|
* for future, FLASH-resident code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
progmem (rx) : ORIGIN = 0x10000000, LENGTH = 128K
|
||||||
|
datamem (rwx) : ORIGIN = 0x10080000, LENGTH = 72K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
|
||||||
|
EXTERN(_vectors) /* Force the vectors to be included in the output */
|
||||||
|
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(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > progmem
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > datamem AT > progmem
|
||||||
|
|
||||||
|
.bss : { /* BSS */
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > 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) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/scripts/spificonfig.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
/*
|
||||||
|
* Power-Up Reset Overview
|
||||||
|
* -----------------------
|
||||||
|
*
|
||||||
|
* The ARM core starts executing code on reset with the program counter set
|
||||||
|
* to 0x0000 0000. The LPC43xx contains a shadow pointer register that
|
||||||
|
* allows areas of memory to be mapped to address 0x0000 0000. The default,
|
||||||
|
* reset value of the shadow pointer is 0x1040 0000 so that on reset code in
|
||||||
|
* the boot ROM is always executed first.
|
||||||
|
*
|
||||||
|
* The boot starts after reset is released. The IRC is selected as CPU clock
|
||||||
|
* and the Cortex-M4 starts the boot loader. By default the JTAG access to the
|
||||||
|
* chip is disabled at reset. The boot ROM determines the boot mode based on
|
||||||
|
* the OTP BOOT_SRC value or reset state pins. For flash-based parts, the part
|
||||||
|
* boots from internal flash by default. Otherwse, the boot ROM copies the
|
||||||
|
* image to internal SRAM at location 0x1000 0000, sets the ARM's shadow
|
||||||
|
* pointer to 0x1000 0000, and jumps to that location.
|
||||||
|
*
|
||||||
|
* Of course, using JTAG the executable image can be also loaded directly
|
||||||
|
* into and executed from SRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The LPC4330 on the LPC4330-Xplorer has the following memory resources:
|
||||||
|
*
|
||||||
|
* 1. 4096Kb of SPIFI FLASH beginning at address 0x1400:0000
|
||||||
|
* 2. 264KB of total SRAM:
|
||||||
|
* a. 128KB of SRAM in the CPU block beginning at address 0x1000:0000
|
||||||
|
* b. 72KB beginning at address 0x1008:0000 and
|
||||||
|
* c. 64KB of AHB SRAM in three banks beginning at addresses 0x2000:0000,
|
||||||
|
* 0x2000:8000 and 0x2000:C000.
|
||||||
|
* 3. No internal FLASH
|
||||||
|
*
|
||||||
|
* Here we assume that:
|
||||||
|
*
|
||||||
|
* 1. We will be running out of SPIFI flash at 0x1400:0000, and
|
||||||
|
* 2. All .data and .bss will all fit into the 128KB CPU SRAM block.
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
progmem (rx) : ORIGIN = 0x14000000, LENGTH = 1024K
|
||||||
|
datamem (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
|
||||||
|
}
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
|
||||||
|
EXTERN(_vectors) /* Force the vectors to be included in the output */
|
||||||
|
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(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
*(.init_array .init_array.*)
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > progmem
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > progmem
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > datamem AT > progmem
|
||||||
|
|
||||||
|
.bss : { /* BSS */
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > 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) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_info 0 : { *(.debug_info) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/.depend
|
||||||
|
/Make.dep
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/bambino-200e/src/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
# Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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)/Make.defs
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
CSRCS = lpc43_boot.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
|
CSRCS += lpc43_appinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
CSRCS += lpc43_ostest.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += lpc43_autoleds.c
|
||||||
|
else
|
||||||
|
CSRCS += lpc43_userleds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||||
|
CSRCS += lpc43_buttons.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_USBMSC),y)
|
||||||
|
CSRCS += lpc43_usbmsc.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SPIFI_LIBRARY),y)
|
||||||
|
CFLAGS += -DEUROBIRD
|
||||||
|
SPIFI_LIB = spifi_lib
|
||||||
|
CSRCS += $(SPIFI_LIB)/spifi_rom_api.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/amic.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/atmel.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/chi.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/eon.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/esmt.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/esmt.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/giga.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/macronix.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/numonyx.c
|
||||||
|
CSRCS += $(SPIFI_LIB)/spansion.c
|
||||||
|
#CSRCS += $(SPIFI_LIB)/sst.c
|
||||||
|
CSRCS += $(SPIFI_LIB)/winbond.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(TOPDIR)/configs/Board.mk
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/src/bambino-200e.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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_BAMBINO_200E_SRC_BAMBINO_H
|
||||||
|
#define _CONFIGS_BAMBINO_200E_SRC_BAMBINO_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
|
#include "lpc43_pinconfig.h"
|
||||||
|
#include "lpc43_gpio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* LEDs GPIO PIN SIGNAL NAME
|
||||||
|
* -------------------------------- ------- --------------
|
||||||
|
* gpio3[7] - LED1 101 GPIO3[7]
|
||||||
|
* gpio5[5] - LED2 91 GPIO5[5]
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Definitions to configure LED pins as GPIOs:
|
||||||
|
*
|
||||||
|
* - Floating
|
||||||
|
* - Normal drive
|
||||||
|
* - No buffering, glitch filtering, slew=slow
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PINCONFIG_LED1 PINCONF_GPIO3p7
|
||||||
|
#define PINCONFIG_LED2 PINCONF_GPIO5p5
|
||||||
|
#define GPIO_LED1 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT3 | GPIO_PIN7)
|
||||||
|
#define GPIO_LED2 (GPIO_MODE_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT5 | GPIO_PIN5)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Buttons GPIO
|
||||||
|
* ----------------------------
|
||||||
|
* gpio0[7] - User Button USR1
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define BAMBINO_BUT1 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT0 | GPIO_PIN7)
|
||||||
|
|
||||||
|
/* Button IRQ numbers */
|
||||||
|
|
||||||
|
#define BAMBINO_BUT1_IRQ LPC43_IRQ_P0p23
|
||||||
|
|
||||||
|
#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
|
||||||
|
#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
|
||||||
|
#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
|
||||||
|
#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
|
||||||
|
|
||||||
|
/* We need to redefine USB_PWRD as GPIO to get USB Host working
|
||||||
|
* Also remember to add 2 resistors of 15K to D+ and D- pins.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_USBHOST
|
||||||
|
# ifdef GPIO_USB_PWRD
|
||||||
|
# undef GPIO_USB_PWRD
|
||||||
|
# define GPIO_USB_PWRD (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN22)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lpc43_sspdev_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Called to configure SPI chip select GPIO pins for the Lincoln 80 board.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void weak_function lpc43_sspdev_initialize(void);
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* _CONFIGS_BAMBINO_200E_SRC_BAMBINO_H */
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/bambino-200e/src/lpc43_appinit.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_LPC43_SPIFI
|
||||||
|
# include <nuttx/mtd/mtd.h>
|
||||||
|
# include "lpc43_spifi.h"
|
||||||
|
|
||||||
|
# ifdef CONFIG_SPFI_NXFFS
|
||||||
|
# include <sys/mount.h>
|
||||||
|
# include <nuttx/fs/nxffs.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_SPIFI_DEVNO
|
||||||
|
# define CONFIG_SPIFI_DEVNO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nsh_spifi_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Make the SPIFI (or part of it) into a block driver that can hold a
|
||||||
|
* file system.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_LPC43_SPIFI
|
||||||
|
static int nsh_spifi_initialize(void)
|
||||||
|
{
|
||||||
|
FAR struct mtd_dev_s *mtd;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Initialize the SPIFI interface and create the MTD driver instance */
|
||||||
|
|
||||||
|
mtd = lpc43_spifi_initialize();
|
||||||
|
if (!mtd)
|
||||||
|
{
|
||||||
|
ferr("ERROR: lpc43_spifi_initialize failed\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_SPFI_NXFFS
|
||||||
|
/* And finally, use the FTL layer to wrap the MTD driver as a block driver */
|
||||||
|
|
||||||
|
ret = ftl_initialize(CONFIG_SPIFI_DEVNO, mtd);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ferr("ERROR: Initializing the FTL layer: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* Initialize to provide NXFFS on the MTD interface */
|
||||||
|
|
||||||
|
ret = nxffs_initialize(mtd);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ferr("ERROR: NXFFS initialization failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mount the file system at /mnt/spifi */
|
||||||
|
|
||||||
|
ret = mount(NULL, "/mnt/spifi", "nxffs", 0, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define nsh_spifi_initialize() (OK)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_app_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization
|
||||||
|
*
|
||||||
|
* 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 initalization logic and the 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)
|
||||||
|
{
|
||||||
|
/* Initialize the SPIFI block device */
|
||||||
|
|
||||||
|
return nsh_spifi_initialize();
|
||||||
|
}
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/src/lpc43_autoleds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
|
||||||
|
#include "bambino-200e.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
/* The LPC4330-Xplorer has 2 user-controllable LEDs labeled D2 an D3 in the
|
||||||
|
* schematic and on but referred to has LED1 and LED2 here, respectively.
|
||||||
|
*
|
||||||
|
* LED1 D2 GPIO1[12]
|
||||||
|
* LED2 D3 GPIO1[11]
|
||||||
|
*
|
||||||
|
* LEDs are pulled high to a low output illuminates the LED.
|
||||||
|
*
|
||||||
|
* If CONFIG_ARCH_LEDS is defined, the LEDs will be controlled as follows
|
||||||
|
* for NuttX debug functionality (where NC means "No Change").
|
||||||
|
*
|
||||||
|
* ON OFF
|
||||||
|
* LED1 LED2 LED1 LED2
|
||||||
|
* LED_STARTED 0 OFF OFF - -
|
||||||
|
* LED_HEAPALLOCATE 1 ON OFF - -
|
||||||
|
* LED_IRQSENABLED 1 ON OFF - -
|
||||||
|
* LED_STACKCREATED 1 ON OFF - -
|
||||||
|
* LED_INIRQ 2 NC ON NC OFF
|
||||||
|
* LED_SIGNAL 2 NC ON NC OFF
|
||||||
|
* LED_ASSERTION 2 NC ON NC OFF
|
||||||
|
* LED_PANIC 2 NC ON NC OFF
|
||||||
|
*
|
||||||
|
* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
|
||||||
|
* control of the application. The following interfaces are then available
|
||||||
|
* for application control of the LEDs:
|
||||||
|
*
|
||||||
|
* void board_userled_initialize(void);
|
||||||
|
* void board_userled(int led, bool ledon);
|
||||||
|
* void board_userled_all(uint8_t ledset);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: led_dumppins
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LED_VERBOSE
|
||||||
|
static void led_dumppins(FAR const char *msg)
|
||||||
|
{
|
||||||
|
lpc43_pin_dump(PINCONFIG_LED1, msg);
|
||||||
|
lpc43_gpio_dump(GPIO_LED2, msg);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define led_dumppins(m)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure all LED pins as GPIO outputs */
|
||||||
|
|
||||||
|
led_dumppins("board_autoled_initialize() Entry)");
|
||||||
|
|
||||||
|
/* Configure LED pins as GPIOs, then configure GPIOs as outputs */
|
||||||
|
|
||||||
|
lpc43_pin_config(PINCONFIG_LED1);
|
||||||
|
lpc43_gpio_config(GPIO_LED1);
|
||||||
|
|
||||||
|
lpc43_pin_config(PINCONFIG_LED2);
|
||||||
|
lpc43_gpio_config(GPIO_LED2);
|
||||||
|
|
||||||
|
led_dumppins("board_autoled_initialize() Exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_on
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 0:
|
||||||
|
lpc43_gpio_write(GPIO_LED1, true); /* LED1 OFF */
|
||||||
|
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
lpc43_gpio_write(GPIO_LED1, false); /* LED1 ON */
|
||||||
|
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
lpc43_gpio_write(GPIO_LED2, false); /* LED2 ON */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_off
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/bambino-200e/src/lpc43_boot.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* 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 "bambino-200e.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Name: lpc43_boardinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* All LPC43xx 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 lpc43_boardinitialize(void)
|
||||||
|
{
|
||||||
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
board_autoled_initialize();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/src/lpc43_buttons.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "bambino-200e.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Pin configuration for each LPC4330 Xplorer button. This array is indexed
|
||||||
|
* by the BUTTON_* definitions in board.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const uint16_t g_buttoncfg[BOARD_NUM_BUTTONS] =
|
||||||
|
{
|
||||||
|
BAMBINO_BUT1
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This array defines all of the interrupt handlers current attached to
|
||||||
|
* button events.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||||
|
static xcpt_t g_buttonisr[BOARD_NUM_BUTTONS];
|
||||||
|
|
||||||
|
/* This array provides the mapping from button ID numbers to button IRQ
|
||||||
|
* numbers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
|
||||||
|
{
|
||||||
|
BAMBINO_BUT1_IRQ
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_button_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources.
|
||||||
|
* After that, board_buttons() may be called to collect the current state
|
||||||
|
* of all buttons or board_button_irq() may be called to register button
|
||||||
|
* interrupt handlers.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_button_initialize(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Configure the GPIO pins as interrupting inputs. */
|
||||||
|
|
||||||
|
for (i = 0; i < BOARD_NUM_BUTTONS; i++)
|
||||||
|
{
|
||||||
|
lpc43_configgpio(g_buttoncfg[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_buttons
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources. After
|
||||||
|
* that, board_buttons() may be called to collect the current state of all
|
||||||
|
* buttons.
|
||||||
|
*
|
||||||
|
* board_buttons() may be called at any time to harvest the state of every
|
||||||
|
* button. The state of the buttons is returned as a bitset with one
|
||||||
|
* bit corresponding to each button: If the bit is set, then the button
|
||||||
|
* is pressed. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
|
||||||
|
* definitions in board.h for the meaning of each bit.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
uint8_t board_buttons(void)
|
||||||
|
{
|
||||||
|
uint8_t ret = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Check that state of each key */
|
||||||
|
|
||||||
|
for (i = 0; i < BOARD_NUM_BUTTONS; i++)
|
||||||
|
{
|
||||||
|
/* A LOW value means that the key is pressed. */
|
||||||
|
|
||||||
|
bool released = lpc43_gpio_read(g_buttoncfg[i]);
|
||||||
|
|
||||||
|
/* Accumulate the set of depressed (not released) keys */
|
||||||
|
|
||||||
|
if (!released)
|
||||||
|
{
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Button support.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* board_button_initialize() must be called to initialize button resources. After
|
||||||
|
* that, board_button_irq() may be called to register button interrupt handlers.
|
||||||
|
*
|
||||||
|
* board_button_irq() may be called to register an interrupt handler that will
|
||||||
|
* be called when a button is depressed or released. The ID value is a
|
||||||
|
* button enumeration value that uniquely identifies a button resource. See the
|
||||||
|
* BOARD_BUTTON_* and BOARD_JOYSTICK_* definitions in board.h for the meaning
|
||||||
|
* of enumeration values. The previous interrupt handler address is returned
|
||||||
|
* (so that it may restored, if so desired).
|
||||||
|
*
|
||||||
|
* Note that board_button_irq() also enables button interrupts. Button
|
||||||
|
* interrupts will remain enabled after the interrupt handler is attached.
|
||||||
|
* Interrupts may be disabled (and detached) by calling board_button_irq with
|
||||||
|
* irqhandler equal to NULL.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC43_GPIO_IRQ)
|
||||||
|
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||||
|
{
|
||||||
|
xcpt_t oldhandler = NULL;
|
||||||
|
irqstate_t flags;
|
||||||
|
int irq;
|
||||||
|
|
||||||
|
/* Verify that the button ID is within range */
|
||||||
|
|
||||||
|
if ((unsigned)id < BOARD_NUM_BUTTONS)
|
||||||
|
{
|
||||||
|
/* Return the current button handler and set the new interrupt handler */
|
||||||
|
|
||||||
|
oldhandler = g_buttonisr[id];
|
||||||
|
g_buttonisr[id] = irqhandler;
|
||||||
|
|
||||||
|
/* Disable interrupts until we are done */
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
|
/* Configure the interrupt. Either attach and enable the new
|
||||||
|
* interrupt or disable and detach the old interrupt handler.
|
||||||
|
*/
|
||||||
|
|
||||||
|
irq = g_buttonirq[id];
|
||||||
|
if (irqhandler)
|
||||||
|
{
|
||||||
|
/* Attach then enable the new interrupt handler */
|
||||||
|
|
||||||
|
(void)irq_attach(irq, irqhandler);
|
||||||
|
up_enable_irq(irq);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable then detach the old interrupt handler */
|
||||||
|
|
||||||
|
up_disable_irq(irq);
|
||||||
|
(void)irq_detach(irq);
|
||||||
|
}
|
||||||
|
leave_critical_section(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
return oldhandler;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* configs/bambino-200e/src/lpc43_ostest.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <nuttx/irq.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
#include "bambino-200e.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Configuration ********************************************************************/
|
||||||
|
|
||||||
|
#undef HAVE_FPU
|
||||||
|
#if defined(CONFIG_ARCH_FPU) && defined(CONFIG_EXAMPLES_OSTEST_FPUSIZE) && \
|
||||||
|
defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_DISABLE_SIGNALS) && \
|
||||||
|
!defined(CONFIG_ARMV7M_CMNVECTOR)
|
||||||
|
# define HAVE_FPU 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FPU
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLES_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
|
||||||
|
# error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Private Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
static uint32_t g_saveregs[XCPTCONTEXT_REGS];
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Given an array of size CONFIG_EXAMPLES_OSTEST_FPUSIZE, this function will return
|
||||||
|
* the current FPU registers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void arch_getfpu(FAR uint32_t *fpusave)
|
||||||
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
/* Take a snapshot of the thread context right now */
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
up_saveusercontext(g_saveregs);
|
||||||
|
|
||||||
|
/* Return only the floating register values */
|
||||||
|
|
||||||
|
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
|
||||||
|
leave_critical_section(flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
|
||||||
|
* will compare them and return true if they are identical.
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
|
||||||
|
{
|
||||||
|
return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_FPU */
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/bambino-200e/src/lpc43_userleds.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@yahoogroups.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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
|
||||||
|
#include "bambino-200e.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARCH_LEDS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
/* The LPC4330-Xplorer has 2 user-controllable LEDs labeled D2 an D3 in the
|
||||||
|
* schematic and on but referred to has LED1 and LED2 here, respectively.
|
||||||
|
*
|
||||||
|
* LED1 D2 GPIO1[12]
|
||||||
|
* LED2 D3 GPIO1[11]
|
||||||
|
*
|
||||||
|
* LEDs are pulled high to a low output illuminates the LED.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: led_dumppins
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LED_VERBOSE
|
||||||
|
static void led_dumppins(FAR const char *msg)
|
||||||
|
{
|
||||||
|
lpc43_pin_dump(PINCONFIG_LED1, msg);
|
||||||
|
lpc43_gpio_dump(GPIO_LED2, msg);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define led_dumppins(m)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_initialize
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_initialize(void)
|
||||||
|
{
|
||||||
|
/* Configure all LED GPIO lines */
|
||||||
|
|
||||||
|
led_dumppins("board_userled_initialize() Entry)");
|
||||||
|
|
||||||
|
/* Configure LED pins as GPIOs, then configure GPIOs as outputs */
|
||||||
|
|
||||||
|
lpc43_pin_config(PINCONFIG_LED1);
|
||||||
|
lpc43_gpio_config(GPIO_LED1);
|
||||||
|
|
||||||
|
lpc43_pin_config(PINCONFIG_LED2);
|
||||||
|
lpc43_gpio_config(GPIO_LED2);
|
||||||
|
|
||||||
|
led_dumppins("board_userled_initialize() Exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled(int led, bool ledon)
|
||||||
|
{
|
||||||
|
uint16_t gpiocfg = (led == BOARD_LED1 ? GPIO_LED1 : GPIO_LED2);
|
||||||
|
lpc43_gpio_write(gpiocfg, !ledon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_userled_all
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_userled_all(uint8_t ledset)
|
||||||
|
{
|
||||||
|
lpc43_gpio_write(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
|
||||||
|
lpc43_gpio_write(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !CONFIG_ARCH_LEDS */
|
||||||
@@ -23,6 +23,7 @@ Contents
|
|||||||
o Buttons and LEDs
|
o Buttons and LEDs
|
||||||
o SMP
|
o SMP
|
||||||
o Configurations
|
o Configurations
|
||||||
|
o Things to Do
|
||||||
|
|
||||||
STATUS
|
STATUS
|
||||||
======
|
======
|
||||||
@@ -116,7 +117,7 @@ SMP
|
|||||||
|
|
||||||
Open Issues:
|
Open Issues:
|
||||||
|
|
||||||
1. Currently all device interrupts are handled on the PRO CPU only. Critical
|
1. Currently all device interrupts are handled on the PRO CPU only. Critical
|
||||||
sections will attempt to disable interrupts but will now disable interrupts
|
sections will attempt to disable interrupts but will now disable interrupts
|
||||||
only on the current CPU (which may not be CPU0). Perhaps that should be a
|
only on the current CPU (which may not be CPU0). Perhaps that should be a
|
||||||
spinlock to prohibit execution of interrupts on CPU0 when other CPUs are in
|
spinlock to prohibit execution of interrupts on CPU0 when other CPUs are in
|
||||||
@@ -196,3 +197,19 @@ NOTES:
|
|||||||
SMP operation.
|
SMP operation.
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
|
||||||
|
Things to Do
|
||||||
|
============
|
||||||
|
|
||||||
|
1. There is no support for an interrupt stack yet.
|
||||||
|
2. I did not implement the lazy co-processor save logic supported by Xtensa. That logic works like this:
|
||||||
|
|
||||||
|
a. CPENABLE is set to zero on each context switch, disabling all co-processors.
|
||||||
|
b. If/when the task attempts to use the disabled co-processor, an exception occurs
|
||||||
|
c. The co-processor exception handler re-enables the co-processor.
|
||||||
|
|
||||||
|
Instead, the NuttX logic saves and restores CPENABLE on each context switch.
|
||||||
|
|
||||||
|
3. Currently the Xtensa port copies register state save information from the stack into the TCB. A more efficient alternative would be to just save a pointer to a register state save area in the TCB. This would add some complexity to signal handling and also also the the up_initialstate(). But the performance improvement might be worth the effort.
|
||||||
|
|
||||||
|
4. See SMP-related issues above
|
||||||
@@ -139,6 +139,10 @@
|
|||||||
# define CONFIG_AT24XX_MTD_BLOCKSIZE AT24XX_PAGESIZE
|
# define CONFIG_AT24XX_MTD_BLOCKSIZE AT24XX_PAGESIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_AT24XX_TIMEOUT_MS
|
||||||
|
# define CONFIG_AT24XX_TIMEOUT_MS 10
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
@@ -252,6 +256,7 @@ static int at24c_eraseall(FAR struct at24c_dev_s *priv)
|
|||||||
{
|
{
|
||||||
uint8_t buf[AT24XX_PAGESIZE + AT24XX_ADDRSIZE];
|
uint8_t buf[AT24XX_PAGESIZE + AT24XX_ADDRSIZE];
|
||||||
int startblock = 0;
|
int startblock = 0;
|
||||||
|
uint16_t wait;
|
||||||
|
|
||||||
memset(&buf[AT24XX_ADDRSIZE], 0xff, priv->pagesize);
|
memset(&buf[AT24XX_ADDRSIZE], 0xff, priv->pagesize);
|
||||||
|
|
||||||
@@ -269,8 +274,15 @@ static int at24c_eraseall(FAR struct at24c_dev_s *priv)
|
|||||||
at24addr = (priv->addr | ((offset >> 8) & 0x07));
|
at24addr = (priv->addr | ((offset >> 8) & 0x07));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wait = CONFIG_AT24XX_TIMEOUT_MS;
|
||||||
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
||||||
{
|
{
|
||||||
|
finfo("wait\n");
|
||||||
|
if (!wait--)
|
||||||
|
{
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +313,7 @@ static ssize_t at24c_read_internal(FAR struct at24c_dev_s *priv, off_t offset,
|
|||||||
{
|
{
|
||||||
uint8_t buf[AT24XX_ADDRSIZE];
|
uint8_t buf[AT24XX_ADDRSIZE];
|
||||||
uint16_t at24addr;
|
uint16_t at24addr;
|
||||||
|
uint16_t wait;
|
||||||
|
|
||||||
finfo("offset: %lu nbytes: %lu address: %02x\n",
|
finfo("offset: %lu nbytes: %lu address: %02x\n",
|
||||||
(unsigned long)offset, (unsigned long)nbytes, address);
|
(unsigned long)offset, (unsigned long)nbytes, address);
|
||||||
@@ -327,9 +340,15 @@ static ssize_t at24c_read_internal(FAR struct at24c_dev_s *priv, off_t offset,
|
|||||||
at24addr = (address | ((offset >> 8) & 0x07));
|
at24addr = (address | ((offset >> 8) & 0x07));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wait = CONFIG_AT24XX_TIMEOUT_MS;
|
||||||
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
||||||
{
|
{
|
||||||
finfo("wait\n");
|
finfo("wait\n");
|
||||||
|
if (!wait--)
|
||||||
|
{
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,6 +429,7 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t
|
|||||||
FAR struct at24c_dev_s *priv = (FAR struct at24c_dev_s *)dev;
|
FAR struct at24c_dev_s *priv = (FAR struct at24c_dev_s *)dev;
|
||||||
size_t blocksleft;
|
size_t blocksleft;
|
||||||
uint8_t buf[AT24XX_PAGESIZE + AT24XX_ADDRSIZE];
|
uint8_t buf[AT24XX_PAGESIZE + AT24XX_ADDRSIZE];
|
||||||
|
uint16_t wait;
|
||||||
|
|
||||||
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
#if CONFIG_AT24XX_MTD_BLOCKSIZE > AT24XX_PAGESIZE
|
||||||
startblock *= (CONFIG_AT24XX_MTD_BLOCKSIZE / AT24XX_PAGESIZE);
|
startblock *= (CONFIG_AT24XX_MTD_BLOCKSIZE / AT24XX_PAGESIZE);
|
||||||
@@ -443,9 +463,15 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t
|
|||||||
at24addr = (priv->addr | ((offset >> 8) & 0x07));
|
at24addr = (priv->addr | ((offset >> 8) & 0x07));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wait = CONFIG_AT24XX_TIMEOUT_MS;
|
||||||
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
while (at24c_i2c_write(priv, at24addr, buf, AT24XX_ADDRSIZE) < 0)
|
||||||
{
|
{
|
||||||
finfo("wait\n");
|
finfo("wait\n");
|
||||||
|
if (!wait--)
|
||||||
|
{
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,12 +61,13 @@
|
|||||||
struct inode;
|
struct inode;
|
||||||
struct nsem_inode_s
|
struct nsem_inode_s
|
||||||
{
|
{
|
||||||
|
sem_t ns_sem; /* The contained semaphore */
|
||||||
|
|
||||||
/* Inode payload unique to named semaphores. ns_inode must appear first
|
/* Inode payload unique to named semaphores. ns_inode must appear first
|
||||||
* in this structure in order to support casting between type sem_t and
|
* in this structure in order to support casting between type sem_t and
|
||||||
* types of struct nsem_inode_s. */
|
* types of struct nsem_inode_s. */
|
||||||
|
|
||||||
FAR struct inode *ns_inode; /* Containing inode */
|
FAR struct inode *ns_inode; /* Containing inode */
|
||||||
sem_t ns_sem; /* The semaphore */
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+22
-4
@@ -135,6 +135,12 @@
|
|||||||
|
|
||||||
#define PTHREAD_BARRIER_SERIAL_THREAD 0x1000
|
#define PTHREAD_BARRIER_SERIAL_THREAD 0x1000
|
||||||
|
|
||||||
|
/* Values for protocol attribute */
|
||||||
|
|
||||||
|
#define PTHREAD_PRIO_NONE SEM_PRIO_NONE
|
||||||
|
#define PTHREAD_PRIO_INHERIT SEM_PRIO_INHERIT
|
||||||
|
#define PTHREAD_PRIO_PROTECT SEM_PRIO_PROTECT
|
||||||
|
|
||||||
/* Definitions to map some non-standard, BSD thread management interfaces to
|
/* Definitions to map some non-standard, BSD thread management interfaces to
|
||||||
* the non-standard Linux-like prctl() interface. Since these are simple
|
* the non-standard Linux-like prctl() interface. Since these are simple
|
||||||
* mappings to prctl, they will return 0 on success and -1 on failure with the
|
* mappings to prctl, they will return 0 on success and -1 on failure with the
|
||||||
@@ -212,6 +218,9 @@ typedef struct pthread_cond_s pthread_cond_t;
|
|||||||
struct pthread_mutexattr_s
|
struct pthread_mutexattr_s
|
||||||
{
|
{
|
||||||
uint8_t pshared; /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */
|
uint8_t pshared; /* PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED */
|
||||||
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
|
uint8_t proto; /* See PTHREAD_PRIO_* definitions */
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_MUTEX_TYPES
|
#ifdef CONFIG_MUTEX_TYPES
|
||||||
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
|
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
|
||||||
#endif
|
#endif
|
||||||
@@ -222,11 +231,11 @@ typedef struct pthread_mutexattr_s pthread_mutexattr_t;
|
|||||||
|
|
||||||
struct pthread_mutex_s
|
struct pthread_mutex_s
|
||||||
{
|
{
|
||||||
int pid; /* ID of the holder of the mutex */
|
int pid; /* ID of the holder of the mutex */
|
||||||
sem_t sem; /* Semaphore underlying the implementation of the mutex */
|
sem_t sem; /* Semaphore underlying the implementation of the mutex */
|
||||||
#ifdef CONFIG_MUTEX_TYPES
|
#ifdef CONFIG_MUTEX_TYPES
|
||||||
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
|
uint8_t type; /* Type of the mutex. See PTHREAD_MUTEX_* definitions */
|
||||||
int nlocks; /* The number of recursive locks held */
|
int nlocks; /* The number of recursive locks held */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -395,6 +404,15 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex);
|
|||||||
int pthread_mutex_trylock(FAR pthread_mutex_t *mutex);
|
int pthread_mutex_trylock(FAR pthread_mutex_t *mutex);
|
||||||
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex);
|
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex);
|
||||||
|
|
||||||
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
|
/* Manage priority inheritance */
|
||||||
|
|
||||||
|
int pthread_mutexattr_getprotocol(FAR const pthread_mutexattr_t *attr,
|
||||||
|
FAR int *protocol);
|
||||||
|
int pthread_mutexattr_setprotocol(FAR pthread_mutexattr_t *attr,
|
||||||
|
int protocol);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Operations on condition variables */
|
/* Operations on condition variables */
|
||||||
|
|
||||||
int pthread_condattr_init(FAR pthread_condattr_t *attr);
|
int pthread_condattr_init(FAR pthread_condattr_t *attr);
|
||||||
|
|||||||
+21
-2
@@ -57,6 +57,17 @@ extern "C"
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Values for protocol attribute */
|
||||||
|
|
||||||
|
#define SEM_PRIO_NONE 0
|
||||||
|
#define SEM_PRIO_INHERIT 1
|
||||||
|
#define SEM_PRIO_PROTECT 2
|
||||||
|
|
||||||
|
/* Bit definitions for the struct sem_s flags field */
|
||||||
|
|
||||||
|
#define PRIOINHERIT_FLAGS_DISABLE (1 << 0) /* Bit 0: Priority inheritance
|
||||||
|
* is disabled for this semaphore. */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Declarations
|
* Public Type Declarations
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -92,6 +103,7 @@ struct sem_s
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
|
uint8_t flags; /* See PRIOINHERIT_FLAGS_* definitions */
|
||||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||||
FAR struct semholder_s *hhead; /* List of holders of semaphore counts */
|
FAR struct semholder_s *hhead; /* List of holders of semaphore counts */
|
||||||
# else
|
# else
|
||||||
@@ -106,9 +118,9 @@ typedef struct sem_s sem_t;
|
|||||||
|
|
||||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
# if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||||
# define SEM_INITIALIZER(c) {(c), NULL} /* semcount, hhead */
|
# define SEM_INITIALIZER(c) {(c), 0, NULL} /* semcount, flags, hhead */
|
||||||
# else
|
# else
|
||||||
# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER} /* semcount, holder */
|
# define SEM_INITIALIZER(c) {(c), 0, SEMHOLDER_INITIALIZER} /* semcount, flags, holder */
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define SEM_INITIALIZER(c) {(c)} /* semcount */
|
# define SEM_INITIALIZER(c) {(c)} /* semcount */
|
||||||
@@ -141,6 +153,13 @@ int sem_close(FAR sem_t *sem);
|
|||||||
int sem_unlink(FAR const char *name);
|
int sem_unlink(FAR const char *name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
|
/* Non-standard interfaces to manage priority inheritance */
|
||||||
|
|
||||||
|
int sem_getprotocol(FAR sem_t *sem, FAR int *protocol);
|
||||||
|
int sem_setprotocol(FAR sem_t *sem, int protocol);
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-5
@@ -91,15 +91,22 @@
|
|||||||
#define SYS_sem_trywait (CONFIG_SYS_RESERVED+18)
|
#define SYS_sem_trywait (CONFIG_SYS_RESERVED+18)
|
||||||
#define SYS_sem_wait (CONFIG_SYS_RESERVED+19)
|
#define SYS_sem_wait (CONFIG_SYS_RESERVED+19)
|
||||||
|
|
||||||
|
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||||
|
# define SYS_sem_setprotocol (CONFIG_SYS_RESERVED+20)
|
||||||
|
# define __SYS_named_sem (CONFIG_SYS_RESERVED+21)
|
||||||
|
#else
|
||||||
|
# define __SYS_named_sem (CONFIG_SYS_RESERVED+20)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Named semaphores */
|
/* Named semaphores */
|
||||||
|
|
||||||
#ifdef CONFIG_FS_NAMED_SEMAPHORES
|
#ifdef CONFIG_FS_NAMED_SEMAPHORES
|
||||||
# define SYS_sem_open (CONFIG_SYS_RESERVED+20)
|
# define SYS_sem_open __SYS_named_sem
|
||||||
# define SYS_sem_close (CONFIG_SYS_RESERVED+21)
|
# define SYS_sem_close (__SYS_named_sem+1)
|
||||||
# define SYS_sem_unlink (CONFIG_SYS_RESERVED+22)
|
# define SYS_sem_unlink (__SYS_named_sem+2)
|
||||||
# define __SYS_task_create (CONFIG_SYS_RESERVED+23)
|
# define __SYS_task_create (__SYS_named_sem+3)
|
||||||
#else
|
#else
|
||||||
# define __SYS_task_create (CONFIG_SYS_RESERVED+20)
|
# define __SYS_task_create __SYS_named_sem
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Task creation APIs based on global entry points cannot be use with
|
/* Task creation APIs based on global entry points cannot be use with
|
||||||
|
|||||||
+16
-12
@@ -35,23 +35,27 @@
|
|||||||
|
|
||||||
# Add the pthread C files to the build
|
# Add the pthread C files to the build
|
||||||
|
|
||||||
CSRCS += pthread_attrinit.c pthread_attrdestroy.c \
|
CSRCS += pthread_attr_init.c pthread_attr_destroy.c \
|
||||||
pthread_attrsetschedpolicy.c pthread_attrgetschedpolicy.c \
|
pthread_attr_setschedpolicy.c pthread_attr_getschedpolicy.c \
|
||||||
pthread_attrsetinheritsched.c pthread_attrgetinheritsched.c \
|
pthread_attr_setinheritsched.c pthread_attr_getinheritsched.c \
|
||||||
pthread_attrsetstacksize.c pthread_attrgetstacksize.c \
|
pthread_attr_setstacksize.c pthread_attr_getstacksize.c \
|
||||||
pthread_attrsetschedparam.c pthread_attrgetschedparam.c \
|
pthread_attr_setschedparam.c pthread_attr_getschedparam.c \
|
||||||
pthread_barrierattrinit.c pthread_barrierattrdestroy.c \
|
pthread_barrierattr_init.c pthread_barrierattr_destroy.c \
|
||||||
pthread_barrierattrgetpshared.c pthread_barrierattrsetpshared.c \
|
pthread_barrierattr_getpshared.c pthread_barrierattr_setpshared.c \
|
||||||
pthread_condattrinit.c pthread_condattrdestroy.c \
|
pthread_condattr_init.c pthread_condattr_destroy.c \
|
||||||
pthread_mutexattrinit.c pthread_mutexattrdestroy.c \
|
pthread_mutexattr_init.c pthread_mutexattr_destroy.c \
|
||||||
pthread_mutexattrgetpshared.c pthread_mutexattrsetpshared.c
|
pthread_mutexattr_getpshared.c pthread_mutexattr_setpshared.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_SMP),y)
|
ifeq ($(CONFIG_SMP),y)
|
||||||
CSRCS += pthread_attrgetaffinity.c pthread_attrsetaffinity.c
|
CSRCS += pthread_attr_getaffinity.c pthread_attr_setaffinity.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MUTEX_TYPES),y)
|
ifeq ($(CONFIG_MUTEX_TYPES),y)
|
||||||
CSRCS += pthread_mutexattrsettype.c pthread_mutexattrgettype.c
|
CSRCS += pthread_mutexattr_settype.c pthread_mutexattr_gettype.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_PRIORITY_INHERITANCE),y)
|
||||||
|
CSRCS += pthread_mutexattr_setprotocol.c pthread_mutexattr_getprotocol.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrdestroy.c
|
* libc/pthread/pthread_attr_destroy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -52,8 +52,7 @@
|
|||||||
* Function: pthread_attr_destroy
|
* Function: pthread_attr_destroy
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* An attributes object can be deleted when it is no longer
|
* An attributes object can be deleted when it is no longer needed.
|
||||||
* needed.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* attr
|
* attr
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrgetaffinity.c
|
* libc/pthread/pthread_attr_getaffinity.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrgetinheritsched.c
|
* libc/pthread/pthread_attr_getinheritsched.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrgetschedparam.c
|
* libc/pthread/pthread_attr_getschedparam.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrgetschedpolicy.c
|
* libc/pthread/pthread_attr_getschedpolicy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrgetstacksize.c
|
* libc/pthread/pthread_attr_getstacksize.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrinit.c
|
* libc/pthread/pthread_attr_init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetaffinity.c
|
* libc/pthread/pthread_attr_setaffinity.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetinheritsched.c
|
* libc/pthread/pthread_attr_setinheritsched.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetschedparam.c
|
* libc/pthread/pthread_attr_setschedparam.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetschedpolicy.c
|
* libc/pthread/pthread_attr_setschedpolicy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011, 2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_attrsetstacksize.c
|
* libc/pthread/pthread_attr_setstacksize.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* libc/pthread/pthread_barrierattrdestroy.c
|
* libc/pthread/pthread_barrierattr_destroy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* libc/pthread/pthread_barrierattrgetpshared.c
|
* libc/pthread/pthread_barrierattr_getpshared.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* libc/pthread/pthread_barrierattrinit.c
|
* libc/pthread/pthread_barrierattr_init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* libc/pthread/pthread_barrierattrsetpshared.c
|
* libc/pthread/pthread_barrierattr_setpshared.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_condattrdestroy.c
|
* libc/pthread/pthread_condattr_destroy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_condattrinit.c
|
* libc/pthread/pthread_condattr_init.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* libc/pthread/pthread_mutexattrdestroy.c
|
* libc/pthread/pthread_mutexattr_destroy.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@@ -55,7 +55,6 @@
|
|||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* attr
|
* attr
|
||||||
* pshared
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* 0 if successful. Otherwise, an error code.
|
* 0 if successful. Otherwise, an error code.
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* libc/pthread/pthread_mutexattr_getprotocol.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: pthread_mutexattr_getprotocol
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the value of the mutex protocol attribute.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* attr - A pointer to the mutex attributes to be queried.
|
||||||
|
* protocol - The user provided location in which to store the protocol
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* 0 if successful. Otherwise, an error code.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int pthread_mutexattr_getprotocol(FAR const pthread_mutexattr_t *attr,
|
||||||
|
FAR int *protocol)
|
||||||
|
{
|
||||||
|
DEBUGASSERT(attr != NULL && protocol != NULL);
|
||||||
|
|
||||||
|
linfo("Returning %d\n", attr->proto);
|
||||||
|
return attr->proto;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user