diff --git a/Documentation/README.html b/Documentation/README.html
index 00be93a5a4f..8287cadb283 100644
--- a/Documentation/README.html
+++ b/Documentation/README.html
@@ -63,6 +63,8 @@ nuttx/
| | `- README.txt
| |- avr32dev1/
| | `- README.txt
+ | |- axoloti/
+ | | `- README.txt
| |- b-l475e-iot01a/
| | `- README.txt
| |- bambino-200e/
diff --git a/README.txt b/README.txt
index 26ee173b258..b95e425525a 100644
--- a/README.txt
+++ b/README.txt
@@ -1738,6 +1738,8 @@ nuttx/
| | `- README.txt
| |- avr32dev1/
| | `- README.txt
+ | |- axoloti/
+ | | `- README.txt
| |- b-l475e-iot01a/
| | `- README.txt
| |- bambino-200e/
diff --git a/configs/Kconfig b/configs/Kconfig
index 881b709cda7..5c9c089fca7 100644
--- a/configs/Kconfig
+++ b/configs/Kconfig
@@ -49,6 +49,16 @@ config ARCH_BOARD_AVR32DEV1
Atmel website. STATUS: This port is functional but very basic. There
are configurations for NSH and the OS test.
+config ARCH_BOARD_AXOLOTI
+ bool "Axoloti board"
+ depends on ARCH_CHIP_STM32F427I
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ select ARCH_HAVE_IRQBUTTONS
+ ---help---
+ Axoloti synthesizer board based on the STMicro STM32F427IGH6 MCU.
+ See: http://www.axoloti.com/
+
config ARCH_BOARD_C5471EVM
bool "Spectrum Digital C5471 evaluation board"
depends on ARCH_CHIP_C5471
@@ -1814,6 +1824,7 @@ config ARCH_BOARD
default "arduino-mega2560" if ARCH_BOARD_ARDUINO_MEGA2560
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
+ default "axoloti" if ARCH_BOARD_AXOLOTI
default "bambino-200e" if ARCH_BOARD_BAMBINO_200E
default "c5471evm" if ARCH_BOARD_C5471EVM
default "clicker2-stm32" if ARCH_BOARD_CLICKER2_STM32
diff --git a/configs/README.txt b/configs/README.txt
index 82cb757c51a..8d07fe78c69 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -183,6 +183,10 @@ configs/avr32dev1
Atmel website. STATUS: This port is functional but very basic. There
are configurations for NSH and the OS test.
+configs/axoloti
+ Support for the Axoloti synthesizer board based on the STMicro
+ STM32F427IGH6 MCU. See: http://www.axoloti.com/
+
configs/b-l072z-lrwan1
STMicro STM32L0 Discovery kit with LoRa/SigFox based on STM32L072CZ MCU.
diff --git a/configs/axoloti/Kconfig b/configs/axoloti/Kconfig
new file mode 100644
index 00000000000..cc8297892e0
--- /dev/null
+++ b/configs/axoloti/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_AXOLOTI
+
+endif
diff --git a/configs/axoloti/README.txt b/configs/axoloti/README.txt
new file mode 100644
index 00000000000..ee0bc922517
--- /dev/null
+++ b/configs/axoloti/README.txt
@@ -0,0 +1,20 @@
+README
+======
+
+This README discusses issues unique to NuttX configurations for the
+Axoloti open source synthesizer board featuring the STM32F427IGH6
+MCU. The STM32F427IGH6 has a 180MHz Cortex-M4 core with 1MiB Flash
+memory and 256KiB of SRAM. The board features:
+
+ - ADAU1961 24-bit 96 kHz stereo CODEC
+ - 1/4" in/out jacks for analog audio signals
+ - 3.5 mm jack for analog audio signals
+ - 8 MiB of SDRAM (Alliance Memory AS4C4M16SA)
+ - Serial MIDI in/out ports
+ - SD Card slot
+ - Two user LEDs and one (GPIO) push-button
+ - USB OTG FS with Micro-AB connector (USB device mode operation)
+ - USB OTG HS with Type-A connector (USB host mode operation)
+ - Easy access to most IO pins
+
+Refer to http://www.axoloti.com/ for further information about this board.
diff --git a/configs/axoloti/include/board.h b/configs/axoloti/include/board.h
new file mode 100644
index 00000000000..6c16644fa0d
--- /dev/null
+++ b/configs/axoloti/include/board.h
@@ -0,0 +1,275 @@
+/************************************************************************************
+ * configs/axoloti/include/board.h
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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_AXOLOTI_INCLUDE_BOARD_H
+#define __CONFIGS_AXOLOTI_INCLUDE_BOARD_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#ifndef __ASSEMBLY__
+# include
+# include
+#endif
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Clocking
+ * The Axoloti board has an external 8MHz crystal.
+ * The SoC can run at 180MHz, but the required USB clock of 48MHz cannot be
+ * configured at that system clock rate, so the core clock is 168MHz.
+ *
+ * This is the canonical configuration:
+ * System Clock source : PLL (HSE)
+ * SYSCLK(Hz) : 168000000 Determined by PLL configuration
+ * HCLK(Hz) : 168000000 (STM32_RCC_CFGR_HPRE)
+ * AHB Prescaler : 1 (STM32_RCC_CFGR_HPRE)
+ * APB1 Prescaler : 4 (STM32_RCC_CFGR_PPRE1)
+ * APB2 Prescaler : 2 (STM32_RCC_CFGR_PPRE2)
+ * HSE Frequency(Hz) : 8000000 (STM32_BOARD_XTAL)
+ * PLLM : 8 (STM32_PLLCFG_PLLM)
+ * PLLN : 336 (STM32_PLLCFG_PLLN)
+ * PLLP : 2 (STM32_PLLCFG_PLLP)
+ * PLLQ : 7 (STM32_PLLCFG_PLLQ)
+ * Main regulator output voltage : Scale1 mode Needed for high speed SYSCLK
+ * Flash Latency(WS) : 5
+ * Prefetch Buffer : OFF
+ * Instruction cache : ON
+ * Data cache : ON
+ * Require 48MHz for USB OTG FS, : Enabled
+ * SDIO and RNG clock
+ */
+
+/* HSI - 16 MHz RC factory-trimmed
+ * LSI - 32 KHz RC
+ * HSE - On-board crystal frequency is 8MHz
+ * LSE - 32.768 kHz
+ */
+
+#define STM32_BOARD_XTAL 8000000ul
+
+#define STM32_HSI_FREQUENCY 16000000ul
+#define STM32_LSI_FREQUENCY 32000
+#define STM32_HSE_FREQUENCY STM32_BOARD_XTAL
+#define STM32_LSE_FREQUENCY 32768
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE
+ * PLL_VCO = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * = (8,000,000 / 8) * 336
+ * = 336,000,000
+ * SYSCLK = PLL_VCO / PLLP
+ * = 336,000,000 / 2 = 168,000,000
+ * USB OTG FS, SDIO and RNG Clock
+ * = PLL_VCO / PLLQ
+ * = 48,000,000
+ */
+
+#define STM32_PLLCFG_PLLM RCC_PLLCFG_PLLM(8)
+#define STM32_PLLCFG_PLLN RCC_PLLCFG_PLLN(336)
+#define STM32_PLLCFG_PLLP RCC_PLLCFG_PLLP_2
+#define STM32_PLLCFG_PLLQ RCC_PLLCFG_PLLQ(7)
+
+#define STM32_SYSCLK_FREQUENCY 168000000ul
+
+/* AHB clock (HCLK) is SYSCLK (168MHz) */
+
+#define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */
+#define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY
+#define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */
+
+/* APB1 clock (PCLK1) is HCLK/4 (42MHz) */
+
+#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4)
+
+/* APB2 clock (PCLK2) is HCLK/2 (84MHz) */
+
+#define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */
+#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/************************************************************************************
+ * LED Definitions
+ * If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ * way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with board_userled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_NLEDS 2
+#define BOARD_LED_GREEN BOARD_LED1
+#define BOARD_LED_RED BOARD_LED2
+
+/* LED bits for use with board_userled_all() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+
+/************************************************************************************
+ * Button Definitions
+ * There are two buttons on the axoloti, one of them is GPIO connected. The other
+ * is a reset button and is not under software control.
+ */
+
+#define BUTTON_USER 0
+#define NUM_BUTTONS 1
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/************************************************************************************
+ * UARTs
+ * The MIDI in/out ports of the axoloti are connected on USART6.
+ * It maybe convenient to run a serial port connected to the header pins,
+ * so we can optionally use USART1 for that.
+ */
+
+/* USART1 - console on header pins */
+
+#define GPIO_USART1_RX GPIO_USART1_RX_2 /* AF7, PB7 */
+#define GPIO_USART1_TX GPIO_USART1_TX_2 /* AF7, PB6 */
+
+/* USART6 - midi in/out */
+
+#define GPIO_USART6_RX (GPIO_ALT|GPIO_AF8|GPIO_PORTG|GPIO_PIN9| \
+ GPIO_PULLUP|GPIO_SPEED_2MHz|GPIO_PUSHPULL)
+
+#define GPIO_USART6_TX (GPIO_ALT|GPIO_AF8|GPIO_PORTG|GPIO_PIN14| \
+ GPIO_FLOAT|GPIO_SPEED_2MHz|GPIO_OPENDRAIN)
+
+/************************************************************************************
+ * I2C Bus
+ * Turn on the internal pullups since there are no external pullups.
+ */
+
+/* I2C1 - for external devices */
+
+#define GPIO_I2C1_SCL (GPIO_ALT|GPIO_AF4|GPIO_PORTB|GPIO_PIN8| \
+ GPIO_SPEED_2MHz|GPIO_OPENDRAIN|GPIO_PULLUP)
+
+#define GPIO_I2C1_SDA (GPIO_ALT|GPIO_AF4|GPIO_PORTB|GPIO_PIN9| \
+ GPIO_SPEED_2MHz|GPIO_OPENDRAIN|GPIO_PULLUP)
+
+/* I2C3 - for the ADAU1961 codec */
+
+#define GPIO_I2C3_SCL (GPIO_ALT|GPIO_AF4|GPIO_PORTH|GPIO_PIN7| \
+ GPIO_SPEED_2MHz|GPIO_OPENDRAIN|GPIO_PULLUP)
+
+#define GPIO_I2C3_SDA (GPIO_ALT|GPIO_AF4|GPIO_PORTH|GPIO_PIN8| \
+ GPIO_SPEED_2MHz|GPIO_OPENDRAIN|GPIO_PULLUP)
+
+/************************************************************************************
+ * SAI Bus
+ * Used with the ADAU1961 CODEC
+ * PE3_SAI1_SD_B (GPIO_SAI1_SD_B_1)
+ * PE4_SAI1_FS_A (GPIO_SAI1_FS_A)
+ * PE5_SAI1_SCK_A (GPIO_SAI1_SCK_A)
+ * PE6_SAI1_SD_A (GPIO_SAI1_SD_A_2)
+ * PA8_MCO1
+ */
+
+#define GPIO_SAI1_SD_B GPIO_SAI1_SD_B_1 /* AF6, PE3 */
+#define GPIO_SAI1_SD_A GPIO_SAI1_SD_A_2 /* AF6, PE6 */
+
+#define STM32_SAI1_FREQUENCY (48000 * 2 * 256) /* TODO ?? */
+
+/* DAC DMA to Codec
+ * dma 2, stream 1, channel 0
+ * memory to peripheral
+ * 32 bits
+ */
+#define DMACHAN_SAI1_A DMAMAP_SAI1_A_1
+
+/* ADC DMA from Codec
+ * dma 2, stream 4, channel 1,
+ * peripheral to memory
+ * 32 bits
+ */
+#define DMACHAN_SAI1_B DMAMAP_SAI1_B_2
+
+/************************************************************************************
+ * SDIO
+ * Used for the SD card interface.
+ * d0 (AF12, PC8)
+ * d1 (AF12, PC9)
+ * d2 (AF12, PC10)
+ * d3 (AF12, PC11)
+ * clk (AF12, PC12)
+ * cmd (AF12, PD2)
+ * cd1 PD13
+ */
+
+/* SDIO dividers. Note that slower clocking is required when DMA is disabled
+ * in order to avoid RX overrun/TX underrun errors due to delayed responses
+ * to service FIFOs in interrupt driven mode. These values have not been
+ * tuned!!!
+ *
+ * SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(118+2)=400 KHz
+ */
+
+#define SDIO_INIT_CLKDIV (118 << SDIO_CLKCR_CLKDIV_SHIFT)
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_MMCXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* DMA ON: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(1+2)=16 MHz
+ * DMA OFF: SDIOCLK=48MHz, SDIO_CK=SDIOCLK/(2+2)=12 MHz
+ */
+
+#ifdef CONFIG_SDIO_DMA
+# define SDIO_SDXFR_CLKDIV (1 << SDIO_CLKCR_CLKDIV_SHIFT)
+#else
+# define SDIO_SDXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
+#endif
+
+/* dma 2, stream 6, channel 4 */
+
+#define DMAMAP_SDIO DMAMAP_SDIO_2
+
+#endif /* __CONFIG_AXOLOTI_INCLUDE_BOARD_H */
diff --git a/configs/axoloti/nsh/defconfig b/configs/axoloti/nsh/defconfig
new file mode 100644
index 00000000000..ef743ced625
--- /dev/null
+++ b/configs/axoloti/nsh/defconfig
@@ -0,0 +1,41 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_ARCH_FPU is not set
+# CONFIG_ARCH_LEDS is not set
+# CONFIG_NSH_DISABLE_PRINTF is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_STANDARD_SERIAL is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="axoloti"
+CONFIG_ARCH_BOARD_AXOLOTI=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CHIP_STM32=y
+CONFIG_ARCH_CHIP_STM32F427I=y
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_BOARD_LATE_INITIALIZE=y
+CONFIG_BOARD_LOOPSPERMSEC=16717
+CONFIG_BUTTONS=y
+CONFIG_BUTTONS_LOWER=y
+CONFIG_CLOCK_MONOTONIC=y
+CONFIG_INPUT=y
+CONFIG_LIBC_FLOATINGPOINT=y
+CONFIG_MM_REGIONS=2
+CONFIG_RAW_BINARY=y
+CONFIG_STM32_CCMEXCLUDE=y
+CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
+CONFIG_STM32_JTAG_FULL_ENABLE=y
+CONFIG_STM32_USART1=y
+CONFIG_STM32_USART6=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_USART1_SERIAL_CONSOLE=y
+CONFIG_USART6_BAUD=31250
+CONFIG_USART6_RXBUFSIZE=128
+CONFIG_USART6_TXBUFSIZE=32
+CONFIG_USERLED=y
+CONFIG_USERLED_LOWER=y
+CONFIG_USER_ENTRYPOINT="nsh_main"
diff --git a/configs/axoloti/scripts/Make.defs b/configs/axoloti/scripts/Make.defs
new file mode 100644
index 00000000000..83e57ec3341
--- /dev/null
+++ b/configs/axoloti/scripts/Make.defs
@@ -0,0 +1,138 @@
+############################################################################
+# configs/axoloti/scripts/Make.defs
+#
+# Copyright (C) 2011-2012, 2016-2017 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
+#
+# 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
+
+LDSCRIPT = ld.script
+
+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
+STRIP = $(CROSSDEV)strip --strip-unneeded
+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
+
+# Loadable module definitions
+
+CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
+
+LDMODULEFLAGS = -r -e module_initialize
+ifeq ($(WINTOOL),y)
+ LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
+else
+ LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
+endif
+
+# ELF module definitions
+
+CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
+CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
+
+LDELFFLAGS = -r -e main
+ifeq ($(WINTOOL),y)
+ LDELFFLAGS += -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/gnu-elf.ld}"
+else
+ LDELFFLAGS += -T $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/gnu-elf.ld
+endif
+
+
+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 =
+
diff --git a/configs/axoloti/scripts/gnu-elf.ld b/configs/axoloti/scripts/gnu-elf.ld
new file mode 100644
index 00000000000..45590f51b33
--- /dev/null
+++ b/configs/axoloti/scripts/gnu-elf.ld
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * configs/axoloti/scripts/gnu-elf.ld
+ *
+ * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+SECTIONS
+{
+ .text 0x00000000 :
+ {
+ _stext = . ;
+ *(.text)
+ *(.text.*)
+ *(.gnu.warning)
+ *(.stub)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.jcr)
+
+ /* C++ support: The .init and .fini sections contain specific logic
+ * to manage static constructors and destructors.
+ */
+
+ *(.gnu.linkonce.t.*)
+ *(.init) /* Old ABI */
+ *(.fini) /* Old ABI */
+ _etext = . ;
+ }
+
+ .ARM.extab :
+ {
+ *(.ARM.extab*)
+ }
+
+ .ARM.exidx :
+ {
+ *(.ARM.exidx*)
+ }
+
+ .rodata :
+ {
+ _srodata = . ;
+ *(.rodata)
+ *(.rodata1)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ _erodata = . ;
+ }
+
+ .data :
+ {
+ _sdata = . ;
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+ _edata = . ;
+ }
+
+ /* C++ support. For each global and static local C++ object,
+ * GCC creates a small subroutine to construct the object. Pointers
+ * to these routines (not the routines themselves) are stored as
+ * simple, linear arrays in the .ctors section of the object file.
+ * Similarly, pointers to global/static destructor routines are
+ * stored in .dtors.
+ */
+
+ .ctors :
+ {
+ _sctors = . ;
+ *(.ctors) /* Old ABI: Unallocated */
+ *(.init_array) /* New ABI: Allocated */
+ _edtors = . ;
+ }
+
+ .dtors :
+ {
+ _sdtors = . ;
+ *(.dtors) /* Old ABI: Unallocated */
+ *(.fini_array) /* New ABI: Allocated */
+ _edtors = . ;
+ }
+
+ .bss :
+ {
+ _sbss = . ;
+ *(.bss)
+ *(.bss.*)
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ _ebss = . ;
+ }
+
+ /* 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) }
+}
diff --git a/configs/axoloti/scripts/kernel-space.ld b/configs/axoloti/scripts/kernel-space.ld
new file mode 100644
index 00000000000..68287ec7661
--- /dev/null
+++ b/configs/axoloti/scripts/kernel-space.ld
@@ -0,0 +1,110 @@
+/****************************************************************************
+ * configs/axoloti/scripts/kernel-space.ld
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/* NOTE: This depends on the memory.ld script having been included prior to
+ * this script.
+ */
+
+OUTPUT_ARCH(arm)
+EXTERN(_vectors)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > kflash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > kflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > kflash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > kflash
+
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > ksram AT > kflash
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > ksram
+
+ /* 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) }
+}
diff --git a/configs/axoloti/scripts/ld.script b/configs/axoloti/scripts/ld.script
new file mode 100644
index 00000000000..135aaf128c6
--- /dev/null
+++ b/configs/axoloti/scripts/ld.script
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * configs/axoloti/scripts/ld.script
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F427IGH6 has 1024KiB of FLASH beginning at address 0x0800:0000 and
+ * 256KiB of SRAM. SRAM is split up into four blocks:
+ *
+ * 1) 112KiB of SRAM beginning at address 0x2000:0000
+ * 2) 16KiB of SRAM beginning at address 0x2001:c000
+ * 3) 64KiB of SRAM beginning at address 0x2002:0000
+ * 4) 64KiB of CCM SRAM beginning at address 0x1000:0000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address
+ * range.
+ */
+
+MEMORY
+{
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
+ sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
+}
+
+OUTPUT_ARCH(arm)
+EXTERN(_vectors)
+ENTRY(_stext)
+SECTIONS
+{
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ /* The RAM vector table (if present) should lie at the beginning of SRAM */
+
+ .ram_vectors : {
+ *(.ram_vectors)
+ } > sram
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/configs/axoloti/scripts/memory.ld b/configs/axoloti/scripts/memory.ld
new file mode 100644
index 00000000000..109a893f974
--- /dev/null
+++ b/configs/axoloti/scripts/memory.ld
@@ -0,0 +1,101 @@
+/****************************************************************************
+ * configs/axoloti/scripts/memory.ld
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* The STM32F427IGH6 has 1024KiB of FLASH beginning at address 0x0800:0000 and
+ * 256KiB of SRAM. SRAM is split up into four blocks:
+ *
+ * 1) 112KiB of SRAM beginning at address 0x2000:0000
+ * 2) 16KiB of SRAM beginning at address 0x2001:c000
+ * 3) 64KiB of SRAM beginning at address 0x2002:0000
+ * 4) 64KiB of CCM SRAM beginning at address 0x1000:0000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address range.
+ *
+ * For MPU support, the kernel-mode NuttX section is assumed to be 128Kb of
+ * FLASH and 4Kb of SRAM. That is an excessive amount for the kernel which
+ * should fit into 64KB and, of course, can be optimized as needed (See
+ * also configs/axoloti/scripts/kernel-space.ld). Allowing the
+ * additional does permit addition debug instrumentation to be added to the
+ * kernel space without overflowing the partition.
+ *
+ * Alignment of the user space FLASH partition is also a critical factor:
+ * The user space FLASH partition will be spanned with a single region of
+ * size 2**n bytes. The alignment of the user-space region must be the same.
+ * As a consequence, as the user-space increases in size, the alignmment
+ * requirement also increases.
+ *
+ * This alignment requirement means that the largest user space FLASH region
+ * you can have will be 512KB at it would have to be positioned at
+ * 0x08800000. If you change this address, don't forget to change the
+ * CONFIG_NUTTX_USERSPACE configuration setting to match and to modify
+ * the check in kernel/userspace.c.
+ *
+ * For the same reasons, the maximum size of the SRAM mapping is limited to
+ * 4KB. Both of these alignment limitations could be reduced by using
+ * multiple regions to map the FLASH/SDRAM range or perhaps with some
+ * clever use of subregions.
+ *
+ * A detailed memory map for the 112KB SRAM region is as follows:
+ *
+ * 0x20000 0000: Kernel .data region. Typical size: 0.1KB
+ * ------- ---- Kernel .bss region. Typical size: 1.8KB
+ * 0x20000 0800: Kernel IDLE thread stack (approximate). Size is
+ * determined by CONFIG_IDLETHREAD_STACKSIZE and
+ * adjustments for alignment. Typical is 1KB.
+ * ------- ---- Padded to 4KB
+ * 0x20000 1000: User .data region. Size is variable.
+ * ------- ---- User .bss region Size is variable.
+ * 0x20000 2000: Beginning of kernel heap. Size determined by
+ * CONFIG_MM_KERNEL_HEAPSIZE.
+ * ------- ---- Beginning of user heap. Can vary with other settings.
+ * 0x20001 c000: End+1 of CPU RAM
+ */
+
+MEMORY
+{
+ /* 1024Kb FLASH */
+
+ kflash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+ uflash (rx) : ORIGIN = 0x08020000, LENGTH = 128K
+ xflash (rx) : ORIGIN = 0x08040000, LENGTH = 768K
+
+ /* 112Kb of contiguous SRAM */
+
+ ksram (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
+ usram (rwx) : ORIGIN = 0x20001000, LENGTH = 4K
+ xsram (rwx) : ORIGIN = 0x20002000, LENGTH = 104K
+}
diff --git a/configs/axoloti/scripts/user-space.ld b/configs/axoloti/scripts/user-space.ld
new file mode 100644
index 00000000000..0197a91896a
--- /dev/null
+++ b/configs/axoloti/scripts/user-space.ld
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * configs/axoloti/scripts/user-space.ld
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/* NOTE: This depends on the memory.ld script having been included prior to
+ * this script.
+ */
+
+/* Make sure that the critical memory management functions are in user-space.
+ * the user heap memory manager will reside in user-space but be usable both
+ * by kernel- and user-space code
+ */
+
+EXTERN(umm_initialize)
+EXTERN(umm_addregion)
+EXTERN(umm_trysemaphore)
+EXTERN(umm_givesemaphore)
+
+EXTERN(malloc)
+EXTERN(realloc)
+EXTERN(zalloc)
+EXTERN(free)
+
+OUTPUT_ARCH(arm)
+SECTIONS
+{
+ .userspace : {
+ *(.userspace)
+ } > uflash
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > uflash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > uflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > uflash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > uflash
+
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ _edata = ABSOLUTE(.);
+ } > usram AT > uflash
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ _ebss = ABSOLUTE(.);
+ } > usram
+
+ /* 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) }
+}
diff --git a/configs/axoloti/src/.gitignore b/configs/axoloti/src/.gitignore
new file mode 100644
index 00000000000..726d936e1e3
--- /dev/null
+++ b/configs/axoloti/src/.gitignore
@@ -0,0 +1,2 @@
+/.depend
+/Make.dep
diff --git a/configs/axoloti/src/Makefile b/configs/axoloti/src/Makefile
new file mode 100644
index 00000000000..fad7ec90952
--- /dev/null
+++ b/configs/axoloti/src/Makefile
@@ -0,0 +1,67 @@
+############################################################################
+# configs/axoloti/src/Makefile
+#
+# Copyright (C) 2019 Gregory Nutt. All rights reserved.
+# Author: Jason T. Harris
+#
+# 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 = stm32_boot.c stm32_bringup.c
+
+ifeq ($(CONFIG_STM32_FMC),y)
+CSRCS += stm32_extmem.c
+endif
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += stm32_autoleds.c
+else
+CSRCS += stm32_userleds.c
+endif
+
+ifeq ($(CONFIG_AUDIO_ADAU1961),y)
+CSRCS += stm32_adau1961.c
+endif
+
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += stm32_buttons.c
+endif
+
+ifeq ($(CONFIG_STM32_SDIO),y)
+CSRCS += stm32_sdio.c
+endif
+
+ifeq ($(CONFIG_USBHOST),y)
+CSRCS += stm32_usbhost.c
+endif
+
+include $(TOPDIR)/configs/Board.mk
diff --git a/configs/axoloti/src/axoloti.h b/configs/axoloti/src/axoloti.h
new file mode 100644
index 00000000000..7e01355129f
--- /dev/null
+++ b/configs/axoloti/src/axoloti.h
@@ -0,0 +1,251 @@
+/****************************************************************************
+ * configs/axoloti/src/axoloti.h
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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_AXOLOTI_SRC_AXOLOTI_H
+#define __CONFIGS_AXOLOTI_SRC_AXOLOTI_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+#include
+#include
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * configuration
+ */
+
+/* Assume that we have everything */
+
+#define HAVE_USBDEV 1
+#define HAVE_USBHOST 1
+#define HAVE_SDIO 1
+#define HAVE_ADAU1961 1
+#define HAVE_SDRAM 1
+
+/* Can't support USB host if USB OTG HS is not enabled */
+
+#if !defined(CONFIG_STM32_OTGHS) || !defined(CONFIG_USBHOST)
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device if USB OTG FS is not enabled */
+
+#if !defined(CONFIG_STM32_OTGFS) || !defined(CONFIG_USBDEV)
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support MMC/SD features if mountpoints or SDIO support are disabled */
+
+#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO)
+# undef HAVE_SDIO
+#endif
+
+/* The ADAU1961 depends on the ADAU1961 driver, I2C3, and SAI1 support */
+
+#if !defined(CONFIG_AUDIO_ADAU1961) || !defined(CONFIG_STM32_I2C3) || \
+ !defined(CONFIG_STM32_SAI1)
+# undef HAVE_ADAU1961
+#endif
+
+/* Can't support SDRAM if the memory controller is disabled */
+
+#if !defined(CONFIG_STM32_FMC)
+# undef HAVE_SDRAM
+#endif
+
+/****************************************************************************
+ * Audio Configuration
+ */
+
+#define ADAU1961_I2C_BUS 3 /* i2c3 */
+#define ADAU1961_I2C_ADDRESS 0x38
+#define ADAU1961_SAI_BUS SAI1_BLOCK_A
+
+/****************************************************************************
+ * SDIO Configuration
+ */
+
+#define SDIO_MINOR CONFIG_NSH_MMCSDMINOR
+#define SDIO_SLOTNO CONFIG_NSH_MMCSDSLOTNO
+
+/* SD Slot Card detect */
+
+#define GPIO_SDIO_NCD (GPIO_INPUT|GPIO_FLOAT|GPIO_EXTI|GPIO_PORTD|GPIO_PIN13)
+
+/****************************************************************************
+ * PROC File System Configuration
+ */
+
+#ifdef CONFIG_FS_PROCFS
+# ifdef CONFIG_NSH_PROC_MOUNTPOINT
+# define STM32_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
+# else
+# define STM32_PROCFS_MOUNTPOINT "/proc"
+# endif
+#endif
+
+/****************************************************************************
+ * LEDs
+ */
+
+#define GPIO_LED1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz| \
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN6)
+
+#define GPIO_LED2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz| \
+ GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN6)
+
+/****************************************************************************
+ * Buttons
+ */
+
+#define MIN_IRQBUTTON BUTTON_USER
+#define MAX_IRQBUTTON BUTTON_USER
+#define NUM_IRQBUTTONS 1
+#define GPIO_BTN_USER (GPIO_INPUT|GPIO_PULLDOWN|GPIO_EXTI|GPIO_PORTA|GPIO_PIN10)
+
+/****************************************************************************
+ * USB Host (OTG High Speed)
+ */
+
+#define GPIO_OTGHS_PWRON (GPIO_OUTPUT|GPIO_OUTPUT_SET|GPIO_FLOAT| \
+ GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN7)
+
+#define GPIO_OTGHS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT| \
+ GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN13)
+
+/* #define GPIO_OTGHS_VBUS no vbus monitoring.... */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y :
+ * Called from board_late_initialize().
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void);
+
+/****************************************************************************
+ * Name: stm32_sdio_initialize
+ *
+ * Description:
+ * Initialize SDIO-based MMC/SD card support
+ *
+ ****************************************************************************/
+
+#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_STM32_SDIO)
+int stm32_sdio_initialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in initialization to setup
+ * USB-related GPIO pins for the STM32F4Discovery board.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32_OTGHS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host
+ * functionality. This function will start a thread that will monitor for
+ * device connection/disconnection events.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_STM32_OTGHS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_adau1961_initialize
+ *
+ * Description:
+ * Called from stm32_bringup to initialize the adau1961 audio driver.
+ *
+ ****************************************************************************/
+
+#if defined(HAVE_ADAU1961)
+int stm32_adau1961_initialize(int minor);
+#endif
+
+/****************************************************************************
+ * Name: stm32_sdram_initialize
+ *
+ * Description:
+ * Called from stm32_bringup to initialize external SDRAM access.
+ *
+ ****************************************************************************/
+
+#if defined(HAVE_SDRAM)
+int stm32_sdram_initialize(void);
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_AXOLOTI_SRC_AXOLOTI_H */
diff --git a/configs/axoloti/src/stm32_adau1961.c b/configs/axoloti/src/stm32_adau1961.c
new file mode 100644
index 00000000000..a6cfc7714d0
--- /dev/null
+++ b/configs/axoloti/src/stm32_adau1961.c
@@ -0,0 +1,221 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_adau1961.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "stm32.h"
+#include "axoloti.h"
+
+#ifdef HAVE_ADAU1961
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct stm32_mwinfo_s
+{
+ /* Standard ADAU1961 interface */
+
+ struct adau1961_lower_s lower;
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static int adau1961_attach(FAR const struct adau1961_lower_s *lower,
+ adau1961_handler_t isr, FAR void *arg)
+{
+ audinfo("TODO\n");
+ return 0;
+}
+
+static bool adau1961_enable(FAR const struct adau1961_lower_s *lower,
+ bool enable)
+{
+ audinfo("TODO\n");
+ return 0;
+}
+
+static void adau1961_hw_reset(FAR const struct adau1961_lower_s *lower)
+{
+ audinfo("TODO\n");
+}
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* A reference to a structure of this type must be passed to the ADAU1961
+ * driver. This structure provides information about the configuration
+ * of the ADAU1961 and provides some board-specific hooks.
+ *
+ * Memory for this structure is provided by the caller. It is not copied
+ * by the driver and is presumed to persist while the driver is active.
+ */
+
+static struct stm32_mwinfo_s g_adau1961info =
+{
+ .lower =
+ {
+ .address = ADAU1961_I2C_ADDRESS,
+ .frequency = I2C_SPEED_FAST, /* 400 kHz */
+ .mclk = STM32_HSE_FREQUENCY, /* see MCO1 configuration */
+ .attach = adau1961_attach,
+ .enable = adau1961_enable,
+ .reset = adau1961_hw_reset,
+ }
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_adau1961_initialize
+ *
+ * Description:
+ * This function is called by platform-specific, setup logic to configure
+ * and register the ADAU1961 device. This function will register the driver
+ * as /dev/audio/pcm[x] where x is determined by the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int stm32_adau1961_initialize(int minor)
+{
+ FAR struct audio_lowerhalf_s *adau1961;
+ FAR struct i2c_master_s *i2c;
+ FAR struct i2s_dev_s *i2s;
+ static bool initialized = false;
+ char devname[12];
+ int ret;
+
+ audinfo("minor %d\n", minor);
+ DEBUGASSERT(minor >= 0 && minor <= 25);
+
+ /* Initialize the CODEC if we have not already done so */
+
+ if (!initialized)
+ {
+ /* Configure MC01 to drive the master clock of the CODEC at 8MHz */
+
+ stm32_configgpio(GPIO_MCO1);
+ stm32_mco1config(RCC_CFGR_MCO1_HSE, RCC_CFGR_MCO1PRE_NONE);
+
+ /* Get an instance of the I2C interface for the CODEC */
+
+ i2c = stm32_i2cbus_initialize(ADAU1961_I2C_BUS);
+ if (!i2c)
+ {
+ auderr("stm32_i2cbus_initialize failed\n");
+ ret = -ENODEV;
+ goto error;
+ }
+
+ /* Get an instance of the I2S interface for the CODEC data streams */
+
+ i2s = stm32_sai_initialize(ADAU1961_SAI_BUS);
+ if (!i2s)
+ {
+ auderr("stm32_sai_initialize failed\n");
+ ret = -ENODEV;
+ goto error;
+ }
+
+ /* Now we can use these I2C and I2S interfaces to initialize the
+ * CODEC which will return an audio interface.
+ */
+
+ adau1961 = adau1961_initialize(i2c, i2s, &g_adau1961info.lower);
+ if (!adau1961)
+ {
+ auderr("adau1961_initialize failed\n");
+ ret = -ENODEV;
+ goto error;
+ }
+
+ /* Create a device name */
+
+ snprintf(devname, 12, "pcm%d", minor);
+
+ /* Finally, we can register the ADAU1961/I2C/I2S audio device. */
+
+ ret = audio_register(devname, adau1961);
+ if (ret < 0)
+ {
+ auderr("failed to register /dev/%s device: %d\n", devname, ret);
+ goto error;
+ }
+
+ /* Now we are initialized */
+
+ initialized = true;
+ }
+
+ return OK;
+
+ /* Error exits. Unfortunately there is no mechanism in place now to
+ * recover resources from most errors on initialization failures.
+ */
+
+error:
+ return ret;
+}
+
+#endif /* HAVE_ADAU1961 */
diff --git a/configs/axoloti/src/stm32_boot.c b/configs/axoloti/src/stm32_boot.c
new file mode 100644
index 00000000000..8f2fa7e9152
--- /dev/null
+++ b/configs/axoloti/src/stm32_boot.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_boot.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+
+#include
+#include
+
+#include "up_arch.h"
+#include "itm.h"
+
+#include "stm32.h"
+#include "axoloti.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point. This
+ * entry point is called early in the initialization -- after all memory
+ * has been configured and mapped but before any devices have been
+ * initialized.
+ *
+ ****************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+#ifdef CONFIG_SCHED_CRITMONITOR
+ /* Make sure the high speed cycle counter is running. It will be started
+ * automatically only if a debugger is connected.
+ */
+
+ putreg32(0xc5acce55, ITM_LAR);
+ modifyreg32(DWT_CTRL, 0, DWT_CTRL_CYCCNTENA_MASK);
+#endif
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || \
+ defined(CONFIG_STM32_SPI3)
+ stm32_spidev_initialize();
+#endif
+
+#if defined(CONFIG_STM32_OTGHS) || defined(CONFIG_STM32_OTGFS)
+ stm32_usbinitialize();
+#endif
+}
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ * initialization call will be performed in the boot-up sequence to a
+ * function called board_late_initialize(). board_late_initialize() will be
+ * called immediately after up_initialize() is called and just before the
+ * initial application is started. This additional initialization phase
+ * may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+ (void)stm32_bringup();
+}
+#endif
diff --git a/configs/axoloti/src/stm32_bringup.c b/configs/axoloti/src/stm32_bringup.c
new file mode 100644
index 00000000000..8e80bd0b209
--- /dev/null
+++ b/configs/axoloti/src/stm32_bringup.c
@@ -0,0 +1,191 @@
+/****************************************************************************
+ * config/axoloti/src/stm32_bringup.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_USBMONITOR
+# include
+#endif
+
+#include "stm32.h"
+
+#ifdef CONFIG_STM32_OTGHS
+# include "stm32_usbhost.h"
+#endif
+
+#ifdef CONFIG_BUTTONS
+# include
+#endif
+
+#ifdef CONFIG_USERLED
+# include
+#endif
+
+#include "axoloti.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y :
+ * Called from board_late_initialize().
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void)
+{
+#ifdef HAVE_RTC_DRIVER
+ FAR struct rtc_lowerhalf_s *lower;
+#endif
+ int ret = OK;
+
+#ifdef HAVE_SDRAM
+ /* Initialize access to the SDRAM device */
+
+ ret = stm32_sdram_initialize();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR, "stm32_sdram_initialize failed %d\n", ret);
+ return ret;
+ }
+#endif
+
+#ifdef HAVE_SDIO
+ /* Initialize the SDIO block driver */
+
+ ret = stm32_sdio_initialize();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR, "stm32_sdio_initialize failed %d\n", ret);
+ return ret;
+ }
+#endif
+
+#ifdef HAVE_USBHOST
+ /* Initialize USB host operation. stm32_usbhost_initialize() starts a
+ * thread will monitor for USB connection and disconnection events.
+ */
+
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR, "stm32_usbhost_initialize failed %d\n", ret);
+ return ret;
+ }
+#endif
+
+#ifdef HAVE_USBMONITOR
+ /* Start the USB Monitor */
+
+ ret = usbmonitor_start();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR, "usbmonitor_start failed %d\n", ret);
+ return ret;
+ }
+#endif
+
+#ifdef CONFIG_BUTTONS
+ /* Register the BUTTON driver */
+
+ ret = btn_lower_initialize("/dev/buttons");
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "btn_lower_initialize failed %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_INPUT_REI2C
+ /* Register the rei2c driver */
+
+ ret = rei2c_initialize("/dev/re0");
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "rei2c_initialize failed %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_USERLED
+ /* Register the LED driver */
+
+ ret = userled_lower_initialize("/dev/userleds");
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "userled_lower_initialize failed %d\n", ret);
+ }
+#endif
+
+#ifdef HAVE_ADAU1961
+ /* Configure ADAU1961 audio */
+
+ ret = stm32_adau1961_initialize(1);
+ if (ret != OK)
+ {
+ syslog(LOG_ERR, "stm32_adau1961_initialize failed %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_FS_PROCFS
+ /* Mount the procfs file system */
+
+ ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "failed to mount procfs at %s %d\n",
+ STM32_PROCFS_MOUNTPOINT, ret);
+ }
+#endif
+
+ return ret;
+}
diff --git a/configs/axoloti/src/stm32_buttons.c b/configs/axoloti/src/stm32_buttons.c
new file mode 100644
index 00000000000..ade97cfd88b
--- /dev/null
+++ b/configs/axoloti/src/stm32_buttons.c
@@ -0,0 +1,162 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_buttons.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include "stm32.h"
+#include "axoloti.h"
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Pin configuration for each axoloti button. This array is indexed by
+ * the BUTTON_* definitions in board.h
+ */
+
+static const uint32_t g_buttons[NUM_BUTTONS] =
+{
+ GPIO_BTN_USER,
+};
+
+/****************************************************************************
+ * 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 inputs.
+ * EXTI interrupts are configured for all pins.
+ */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ stm32_configgpio(g_buttons[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+ uint32_t ret = 0;
+ int i;
+
+ /* Check that state of each key */
+
+ for (i = 0; i < NUM_BUTTONS; i++)
+ {
+ /* A HI value means that the key is pressed. */
+
+ bool pressed = stm32_gpioread(g_buttons[i]);
+
+ /* Accumulate the set of depressed (not released) keys */
+
+ if (pressed)
+ {
+ ret |= (1 << i);
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * 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.
+ *
+ * After board_button_initialize() has been called, board_buttons() may be
+ * called to collect the state of all buttons. board_buttons() returns an
+ * 32-bit bit set with each bit associated with a button. See the
+ * BUTTON_*_BIT definitions in board.h for the meaning of each bit.
+ *
+ * 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 BUTTON_* definitions in board.h for the meaning of enumeration
+ * value.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
+{
+ int ret = -EINVAL;
+
+ /* The following should be atomic */
+
+ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
+ {
+ ret =
+ stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
+ }
+
+ return ret;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */
diff --git a/configs/axoloti/src/stm32_extmem.c b/configs/axoloti/src/stm32_extmem.c
new file mode 100644
index 00000000000..e8ac1273a62
--- /dev/null
+++ b/configs/axoloti/src/stm32_extmem.c
@@ -0,0 +1,323 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_extmem.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+
+#include "chip.h"
+#include "up_arch.h"
+
+#include "stm32.h"
+#include "axoloti.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_STM32_FMC
+#warning "FMC is not enabled"
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Axoloti SDRAM GPIO configuration */
+
+static const uint32_t g_sdram_config[] =
+{
+ /* Data lines */
+
+ GPIO_FMC_D0, GPIO_FMC_D1, GPIO_FMC_D2, GPIO_FMC_D3,
+ GPIO_FMC_D4, GPIO_FMC_D5, GPIO_FMC_D6, GPIO_FMC_D7,
+ GPIO_FMC_D8, GPIO_FMC_D9, GPIO_FMC_D10, GPIO_FMC_D11,
+ GPIO_FMC_D12, GPIO_FMC_D13, GPIO_FMC_D14, GPIO_FMC_D15,
+
+ /* Address lines */
+
+ GPIO_FMC_A0, GPIO_FMC_A1, GPIO_FMC_A2, GPIO_FMC_A3,
+ GPIO_FMC_A4, GPIO_FMC_A5, GPIO_FMC_A6, GPIO_FMC_A7,
+ GPIO_FMC_A8, GPIO_FMC_A9, GPIO_FMC_A10, GPIO_FMC_A11,
+ GPIO_FMC_A12,
+
+ /* Control lines */
+
+ GPIO_FMC_BA0, /* ba0 */
+ GPIO_FMC_BA1, /* ba1 */
+ GPIO_FMC_NBL0, /* ldqm */
+ GPIO_FMC_NBL1, /* udqm */
+ GPIO_FMC_SDCLK, /* clk */
+ GPIO_FMC_SDCKE0_1, /* cke */
+ GPIO_FMC_SDNWE_2, /* we */
+ GPIO_FMC_SDNCAS, /* cas */
+ GPIO_FMC_SDNRAS, /* ras */
+ GPIO_FMC_SDNE0_1, /* cs0 */
+ GPIO_FMC_SDNE1_2, /* cs1 */
+};
+
+#define NUM_SDRAM_GPIOS (sizeof(g_sdram_config) / sizeof(uint32_t))
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_sdram_memtest
+ *
+ * Description:
+ * Test the SDRAM.
+ *
+ ****************************************************************************/
+
+#define RAND_A 22695477
+#define RAND_C 1
+#define TEST_ITERATIONS 16
+
+int stm32_sdram_memtest(void *base, uint32_t size)
+{
+ volatile int iter;
+ volatile int i;
+
+ /* Linear write with linear congruential generator values */
+
+ for (iter = 0; iter < TEST_ITERATIONS; iter++)
+ {
+ uint32_t x = iter;
+
+ /* Write */
+
+ for (i = 0; i < size / 4; i++)
+ {
+ x = (RAND_A * x) + RAND_C;
+ ((volatile uint32_t *)base)[i] = x;
+ }
+
+ /* Read/verify */
+
+ x = iter;
+ for (i = 0; i < size / 4; i++)
+ {
+ x = (RAND_A * x) + RAND_C;
+ if (((volatile uint32_t *)base)[i] != x)
+ {
+ return -1;
+ }
+ }
+ }
+
+ /* Scattered byte write at linear congruential generator addresses */
+
+ for (iter = 0; iter < TEST_ITERATIONS; iter++)
+ {
+ uint32_t x = iter;
+
+ /* Write */
+
+ for (i = 0; i < 1024 * 1024; i++)
+ {
+ x = (RAND_A * x) + RAND_C;
+ ((volatile uint8_t *)base)[x & (size - 1)] = (uint8_t) i;
+ }
+
+ /* Read/verify */
+
+ x = iter;
+ for (i = 0; i < 1024 * 1024; i++)
+ {
+ x = (RAND_A * x) + RAND_C;
+ if (((volatile uint8_t *)base)[x & (size - 1)] != (uint8_t) i)
+ {
+ return -1;
+ }
+ }
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: stm32_sdram_initialize
+ *
+ * Description:
+ * Called from stm32_bringup to initialize external SDRAM access.
+ * The Axoloti uses an Alliance Memory AS4C4M16SA SDRAM.
+ *
+ ****************************************************************************/
+
+int stm32_sdram_initialize(void)
+{
+ uint32_t val;
+ int i;
+
+ /* Configure SDRAM GPIOs */
+
+ for (i = 0; i < NUM_SDRAM_GPIOS; i++)
+ {
+ stm32_configgpio(g_sdram_config[i]);
+ }
+
+ /* Enable the FMC */
+
+ stm32_fmc_enable();
+
+ /* Go through the SDRAM initialization steps per the reference manual.
+ * The sdclk period is set to 2 x hclk. That is: 168 /2 = 84 MHz
+ * This gives a clock period of about 11.9 ns
+ */
+
+ /* Step 1:
+ * Program the memory device features into the FMC_SDCRx register. The
+ * SDRAM clock frequency, RBURST and RPIPE must be programmed in the
+ * FMC_SDCR1 register.
+ */
+
+ val = FMC_SDCR_RPIPE_1 | /* rpipe = 1 hclk */
+ FMC_SDCR_READBURST | /* read burst enabled */
+ FMC_SDCR_SDCLK_2X | /* sdclk = 2 hclk */
+ FMC_SDCR_CAS_LATENCY_2 | /* cas latency = 2 cycles */
+ FMC_SDCR_NBANKS_4 | /* 4 internal banks */
+ FMC_SDCR_WIDTH_16 | /* width = 16 bits */
+ FMC_SDCR_ROWS_12 | /* numrows = 12 */
+ FMC_SDCR_COLS_8; /* numcols = 8 bits */
+ stm32_fmc_sdram_set_control(1, val);
+
+ /* Step 2:
+ * Program the memory device timing into the FMC_SDTRx register. The
+ * TRP and TRC timings must be programmed in the FMC_SDTR1 register.
+ */
+
+ val = FMC_SDTR_TRCD(2) | /* ras to cas delay 21ns => 2x11.90ns */
+ FMC_SDTR_TRP(2) | /* row precharge 21ns => 2x11.90ns */
+ FMC_SDTR_TRC(6) | /* row cycle time 63ns => 6x11.9ns */
+ FMC_SDTR_TRAS(4) | /* row active time 42ns = >4x11.9ns */
+ FMC_SDTR_TWR(4) | /* write to precharge 42ns => 4x11.9ns */
+ FMC_SDTR_TXSR(6) | /* exit self refresh 65ns => 6x11.9ns */
+ FMC_SDTR_TMRD(2); /* load mode register to active 2 clks */
+ stm32_fmc_sdram_set_timing(1, val);
+
+ /* Step 3:
+ * Set MODE bits to ‘001’ and configure the Target Bank bits (CTB1
+ * and/or CTB2) in the FMC_SDCMR register to start delivering the clock
+ * to the memory (SDCKE is driven high).
+ */
+
+ val = FMC_SDCMR_BANK_1 | FMC_SDCMR_CMD_CLK_ENABLE;
+ stm32_fmc_sdram_command(val);
+
+ /* Step 4:
+ * Wait during the prescribed delay period. Typical delay is around 100
+ * μs (refer to the SDRAM datasheet for the required delay after power-up).
+ */
+
+ nxsig_usleep(1000);
+
+ /* Step 5:
+ * Set MODE bits to ‘010’ and configure the Target Bank bits (CTB1
+ * and/or CTB2) in the FMC_SDCMR register to issue a “Precharge All”
+ * command.
+ */
+
+ val = FMC_SDCMR_BANK_1 | FMC_SDCMR_CMD_PALL;
+ stm32_fmc_sdram_command(val);
+
+ /* Step 6:
+ * Set MODE bits to ‘011’, and configure the Target Bank bits (CTB1
+ * and/or CTB2) as well as the number of consecutive Auto-refresh
+ * commands (NRFS) in the FMC_SDCMR register. Refer to the SDRAM
+ * datasheet for the number of Auto-refresh commands that should be
+ * issued. Typical number is 8.
+ */
+
+ val = FMC_SDCMR_NRFS(5) | FMC_SDCMR_BANK_1 | FMC_SDCMR_CMD_AUTO_REFRESH;
+ stm32_fmc_sdram_command(val);
+
+ /* Step 7:
+ * Configure the MRD field according to your SDRAM device, set the MODE
+ * bits to '100', and configure the Target Bank bits (CTB1 and/or CTB2)
+ * in the FMC_SDCMR register to issue a "Load Mode Register" command in
+ * order to program the SDRAM. In particular:
+ * a) The CAS latency must be selected following configured value in
+ * FMC_SDCR1/2 registers
+ * b) The Burst Length (BL) of 1 must be selected by configuring the
+ * M[2:0] bits to 000 in the mode register (refer to the SDRAM
+ * datasheet). If the Mode Register is not the same for both SDRAM
+ * banks, this step has to be repeated twice, once for each bank,
+ * and the Target Bank bits set accordingly.
+ */
+
+ val = FMC_SDCMR_MDR_BURST_LENGTH_2 |
+ FMC_SDCMR_MDR_BURST_TYPE_SEQUENTIAL |
+ FMC_SDCMR_MDR_CAS_LATENCY_2 |
+ FMC_SDCMR_MDR_MODE_NORMAL |
+ FMC_SDCMR_MDR_WBL_SINGLE | FMC_SDCMR_BANK_1 | FMC_SDCMR_CMD_LOAD_MODE;
+ stm32_fmc_sdram_command(val);
+
+ /* Step 8:
+ * Program the refresh rate in the FMC_SDRTR register
+ * The refresh rate corresponds to the delay between refresh cycles. Its
+ * value must be adapted to SDRAM devices.
+ */
+
+ stm32_fmc_sdram_set_refresh_rate(1292); /* (64ms/4096rows) x 84MHz) - 20 */
+
+ /* Step 9:
+ * For mobile SDRAM devices, to program the extended mode register it
+ * should be done once the SDRAM device is initialized: First, a dummy
+ * read access should be performed while BA1=1 and BA=0 (refer to SDRAM
+ * address mapping section for BA[1:0] address mapping) in order to select
+ * the extended mode register instead of Load mode register and then
+ * program the needed value.
+ */
+
+ /* Setting EMRS is optional and we're not bothering ... */
+
+ /* Enable memory writes for bank 1 */
+
+ stm32_fmc_sdram_write_protect(1, false);
+
+ /* Wait for the controller to be ready */
+
+ stm32_fmc_sdram_wait();
+ return OK;
+}
diff --git a/configs/axoloti/src/stm32_sdio.c b/configs/axoloti/src/stm32_sdio.c
new file mode 100644
index 00000000000..9eadf24dd55
--- /dev/null
+++ b/configs/axoloti/src/stm32_sdio.c
@@ -0,0 +1,172 @@
+/****************************************************************************
+ * config/axoloti/src/stm32_sdio.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "stm32.h"
+#include "axoloti.h"
+
+#ifdef HAVE_SDIO
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Card detections requires card support and a card detection GPIO */
+
+#define HAVE_NCD 1
+#if !defined(HAVE_SDIO) || !defined(GPIO_SDIO_NCD)
+#undef HAVE_NCD
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static FAR struct sdio_dev_s *g_sdio_dev;
+#ifdef HAVE_NCD
+static bool g_sd_inserted = 0xff; /* Impossible value */
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ncd_interrupt
+ *
+ * Description:
+ * Card detect interrupt handler.
+ *
+ ****************************************************************************/
+
+#ifdef HAVE_NCD
+static int stm32_ncd_interrupt(int irq, FAR void *context, FAR void *arg)
+{
+ bool present;
+
+ present = !stm32_gpioread(GPIO_SDIO_NCD);
+ if (present != g_sd_inserted)
+ {
+ sdio_mediachange(g_sdio_dev, present);
+ g_sd_inserted = present;
+ }
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_sdio_initialize
+ *
+ * Description:
+ * Initialize SDIO-based MMC/SD card support
+ *
+ ****************************************************************************/
+
+int stm32_sdio_initialize(void)
+{
+ int ret;
+
+#ifdef HAVE_NCD
+ bool cd_status;
+
+ /* Configure the card detect GPIO */
+
+ stm32_configgpio(GPIO_SDIO_NCD);
+
+ /* Register an interrupt handler for the card detect pin */
+
+ (void)stm32_gpiosetevent(GPIO_SDIO_NCD, true, true, true,
+ stm32_ncd_interrupt, NULL);
+
+#endif
+
+ /* Mount the SDIO-based MMC/SD block driver.
+ * First, get an instance of the SDIO interface
+ */
+
+ finfo("Initializing SDIO slot %d\n", SDIO_SLOTNO);
+ g_sdio_dev = sdio_initialize(SDIO_SLOTNO);
+ if (!g_sdio_dev)
+ {
+ ferr("ERROR: Failed to initialize SDIO slot %d\n", SDIO_SLOTNO);
+ return -ENODEV;
+ }
+
+ /* Now bind the SDIO interface to the MMC/SD driver */
+
+ finfo("Bind SDIO to the MMC/SD driver, minor=%d\n", SDIO_MINOR);
+ ret = mmcsd_slotinitialize(SDIO_MINOR, g_sdio_dev);
+ if (ret != OK)
+ {
+ ferr("ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret);
+ return ret;
+ }
+
+ finfo("Successfully bound SDIO to the MMC/SD driver\n");
+
+#ifdef HAVE_NCD
+ /* Use SD card detect pin to check if a card is g_sd_inserted */
+
+ cd_status = !stm32_gpioread(GPIO_SDIO_NCD);
+ finfo("Card detect : %d\n", cd_status);
+ sdio_mediachange(g_sdio_dev, cd_status);
+#else
+ /* Assume that the SD card is inserted. What choice do we have? */
+
+ sdio_mediachange(g_sdio_dev, true);
+#endif
+
+ return OK;
+}
+
+#endif /* HAVE_SDIO */
diff --git a/configs/axoloti/src/stm32_usbhost.c b/configs/axoloti/src/stm32_usbhost.c
new file mode 100644
index 00000000000..9ca099c949b
--- /dev/null
+++ b/configs/axoloti/src/stm32_usbhost.c
@@ -0,0 +1,279 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_usbhost.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "up_arch.h"
+#include "stm32.h"
+#include "stm32_otghs.h"
+#include "axoloti.h"
+
+#ifdef CONFIG_STM32_OTGHS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+#define HAVE_USB 1
+#else
+#warning "CONFIG_STM32_OTGHS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+#undef HAVE_USB
+#endif
+
+#ifndef CONFIG_AXOLOTI_USBHOST_PRIO
+#define CONFIG_AXOLOTI_USBHOST_PRIO 100
+#endif
+
+#ifndef CONFIG_AXOLOTI_USBHOST_STACKSIZE
+#define CONFIG_AXOLOTI_USBHOST_STACKSIZE 1024
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_connection_s *g_usbconn;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ struct usbhost_hubport_s *hport;
+ uinfo("Running\n");
+
+ for (; ; )
+ {
+ /* Wait for the device to change state */
+
+ DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
+ uinfo("%s\n", hport->connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (hport->connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ (void)CONN_ENUMERATE(g_usbconn, hport);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup
+ * USB-related GPIO pins for the Axoloti board.
+ *
+ ****************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+#ifdef CONFIG_STM32_OTGHS
+ stm32_configgpio(GPIO_OTGHS_PWRON);
+ stm32_configgpio(GPIO_OTGHS_OVER);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be provided
+ * be each platform that implements the STM32 OTG HS host interface
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface. Should
+ * be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+ if (enable)
+ {
+ /* Enable the Power Switch by driving the enable pin low */
+
+ stm32_gpiowrite(GPIO_OTGHS_PWRON, false);
+ }
+ else
+ {
+ /* Disable the Power Switch by driving the enable pin high */
+
+ stm32_gpiowrite(GPIO_OTGHS_PWRON, true);
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent condition
+ * is detected.
+ *
+ * Input Parameters:
+ * handler - New overcurrent interrupt handler
+ * arg - The argument provided for the interrupt handler
+ *
+ * Returned Value:
+ * Zero (OK) is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_setup_overcurrent(xcpt_t handler, void *arg)
+{
+ return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, arg);
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host
+ * functionality. This function will start a thread that will monitor for
+ * device connection/disconnection events.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+ int ret;
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+ uinfo("Register class drivers\n");
+
+#ifdef CONFIG_USBHOST_MSC
+ /* Register the USB mass storage class class */
+
+ ret = usbhost_msc_initialize();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_HIDKBD
+ /* Initialize the HID keyboard class */
+
+ ret = usbhost_kbdinit();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the HID keyboard class\n");
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_HIDMOUSE
+ /* Initialize the HID mouse class */
+
+ ret = usbhost_mouse_init();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the HID mouse class\n");
+ }
+#endif
+
+ /* Then get an instance of the USB host interface */
+
+ uinfo("Initialize USB host\n");
+ g_usbconn = stm32_otghshost_initialize(0);
+ if (g_usbconn)
+ {
+ /* Start a thread to handle device connection. */
+
+ uinfo("Start usbhost_waiter\n");
+ pid =
+ kthread_create("usbhost", CONFIG_AXOLOTI_USBHOST_PRIO,
+ CONFIG_AXOLOTI_USBHOST_STACKSIZE,
+ (main_t) usbhost_waiter, (FAR char *const *)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGHS */
diff --git a/configs/axoloti/src/stm32_userleds.c b/configs/axoloti/src/stm32_userleds.c
new file mode 100644
index 00000000000..da60ac09979
--- /dev/null
+++ b/configs/axoloti/src/stm32_userleds.c
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * configs/axoloti/src/stm32_userleds.c
+ *
+ * Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ * Author: Jason T. Harris
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include "chip.h"
+#include "up_arch.h"
+#include "up_internal.h"
+
+#include "stm32.h"
+#include "axoloti.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This array maps an LED number to GPIO pin configuration */
+
+static uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED1, GPIO_LED2,
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_userled_initialize
+ ****************************************************************************/
+
+void board_userled_initialize(void)
+{
+ /* Configure LED1-2 GPIOs for output */
+
+ stm32_configgpio(GPIO_LED1);
+ stm32_configgpio(GPIO_LED2);
+}
+
+/****************************************************************************
+ * Name: board_userled
+ ****************************************************************************/
+
+void board_userled(int led, bool ledon)
+{
+ if ((unsigned)led < BOARD_NLEDS)
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: board_userled_all
+ ****************************************************************************/
+
+void board_userled_all(uint8_t ledset)
+{
+ stm32_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
+ stm32_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
+}
+
+#endif /* !CONFIG_ARCH_LEDS */