diff --git a/Documentation/README.html b/Documentation/README.html
index 4430ef211f..01a27ce644 100644
--- a/Documentation/README.html
+++ b/Documentation/README.html
@@ -8,7 +8,7 @@
NuttX README Files
- Last Updated: March 21, 2017
+ Last Updated: March 23, 2017
|
@@ -68,6 +68,8 @@ nuttx/
| | `- README.txt
| |- cc3200-launchpad/
| | `- README.txt
+ | |- clicker2-stm32/
+ | | `- README.txt
| |- cloudctrl/
| | `- README.txt
| |- demo9s12ne64/
diff --git a/README.txt b/README.txt
index 4bab1306ff..3db07e882a 100644
--- a/README.txt
+++ b/README.txt
@@ -1453,6 +1453,8 @@ nuttx/
| | `- README.txt
| |- cc3200-launchpad/
| | `- README.txt
+ | |- clicker2-stm32
+ | | `- README.txt
| |- cloudctrl
| | `- README.txt
| |- demo0s12ne64/
diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig
index 557f8434f0..eba911dfc5 100644
--- a/arch/arm/src/stm32/Kconfig
+++ b/arch/arm/src/stm32/Kconfig
@@ -6201,12 +6201,11 @@ config STM32_I2C_DUTY16_9
config STM32_I2C_DMA
bool "I2C DMA Support"
default n
- depends on STM32_I2C && STM32_STM32F40XX && STM32_DMA1
+ depends on STM32_I2C && STM32_STM32F40XX && STM32_DMA1 && !I2C_POLLED
---help---
This option enables the DMA for I2C transfers.
Note: The user can define CONFIG_I2C_DMAPRIO: a custom priority value for the
I2C dma streams, else the default priority level is set to medium.
- Note: This option is compatible with CONFIG_I2C_POLLED.
endmenu
diff --git a/arch/arm/src/stm32/stm32_flash.c b/arch/arm/src/stm32/stm32_flash.c
index 8ba48a8262..fb1e1cac22 100644
--- a/arch/arm/src/stm32/stm32_flash.c
+++ b/arch/arm/src/stm32/stm32_flash.c
@@ -128,6 +128,7 @@ static void flash_lock(void)
modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_LOCK);
}
+#if defined(CONFIG_STM32_FLASH_WORKAROUND_DATA_CACHE_CORRUPTION_ON_RWW)
static void data_cache_disable(void)
{
modifyreg32(STM32_FLASH_ACR, FLASH_ACR_DCEN, 0);
@@ -143,6 +144,7 @@ static void data_cache_enable(void)
modifyreg32(STM32_FLASH_ACR, 0, FLASH_ACR_DCEN);
}
+#endif /* defined(CONFIG_STM32_FLASH_WORKAROUND_DATA_CACHE_CORRUPTION_ON_RWW) */
/************************************************************************************
* Public Functions
@@ -288,6 +290,7 @@ ssize_t up_progmem_erasepage(size_t page)
#if !defined(CONFIG_STM32_STM32F40XX)
if (!(getreg32(STM32_RCC_CR) & RCC_CR_HSION))
{
+ sem_unlock();
return -EPERM;
}
#endif
diff --git a/arch/arm/src/stm32/stm32_i2c_alt.c b/arch/arm/src/stm32/stm32_i2c_alt.c
index 9112b08407..b115ce2795 100644
--- a/arch/arm/src/stm32/stm32_i2c_alt.c
+++ b/arch/arm/src/stm32/stm32_i2c_alt.c
@@ -1204,6 +1204,9 @@ static inline void stm32_i2c_enablefsmc(uint32_t ahbenr)
static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
{
+#ifndef CONFIG_I2C_POLLED
+ uint32_t regval;
+#endif
uint32_t status;
i2cinfo("I2C ISR called\n");
@@ -1867,7 +1870,6 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
#else
/* Clear all interrupts */
- uint32_t regval;
regval = stm32_i2c_getreg(priv, STM32_I2C_CR2_OFFSET);
regval &= ~I2C_CR2_ALLINTS;
stm32_i2c_putreg(priv, STM32_I2C_CR2_OFFSET, regval);
diff --git a/arch/arm/src/stm32/stm32f40xxx_i2c.c b/arch/arm/src/stm32/stm32f40xxx_i2c.c
index 3d7d5567f8..8d3a9fa84d 100644
--- a/arch/arm/src/stm32/stm32f40xxx_i2c.c
+++ b/arch/arm/src/stm32/stm32f40xxx_i2c.c
@@ -2015,7 +2015,6 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv)
#else
/* Clear all interrupts */
- uint32_t regval;
regval = stm32_i2c_getreg(priv, STM32_I2C_CR2_OFFSET);
regval &= ~I2C_CR2_ALLINTS;
stm32_i2c_putreg(priv, STM32_I2C_CR2_OFFSET, regval);
diff --git a/configs/clicker2-stm32/README.txt b/configs/clicker2-stm32/README.txt
new file mode 100644
index 0000000000..14046a208b
--- /dev/null
+++ b/configs/clicker2-stm32/README.txt
@@ -0,0 +1,199 @@
+README
+======
+
+ This is the README file for the port of NuttX to the Mikroe Clicker2 STM32
+ board based on the STMicro STM32F407VGT6 MCU.
+
+ Reference: https://shop.mikroe.com/development-boards/starter/clicker-2/stm32f4
+
+Contents
+========
+
+ o Serial Console
+ o LEDs
+ o Buttons
+ o Using JTAG
+ o Configurations
+
+Serial Console
+==============
+
+ The are no RS-232 drivers on-board. An RS-232 Click board is available:
+ https://shop.mikroe.com/click/interface/rs232 or you can cannot an off-
+ board TTL-to-RS-232 converter as follows:
+
+ USART2: mikroBUS1 PD6/RX and PD5/TX
+ USART3: mikroBUS2 PD9/RX and PD8TX
+
+ GND, 3.3V, and 5V. Are also available
+
+ By default, USART3 on mikroBUS2 is used as the serial console in each
+ configuration unless stated otherwise in the description of the
+ configuration.
+
+LEDs
+====
+
+ The Mikroe Clicker2 STM32 has two user controllable LEDs:
+
+ LD1/PE12, Active high output illuminates
+ LD2/PE15, Active high output illuminates
+
+ If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in any
+ way. If CONFIG_ARCH_LEDs is defined, then NuttX will control the 2 LEDs on
+ board the Clicker2 for STM32. The following definitions describe how NuttX
+ controls the LEDs:
+
+ SYMBOL Meaning LED state
+ LD1 LD2
+ ------------------- ----------------------- -------- --------
+ LED_STARTED NuttX has been started OFF OFF
+ LED_HEAPALLOCATE Heap has been allocated OFF OFF
+ LED_IRQSENABLED Interrupts enabled OFF OFF
+ LED_STACKCREATED Idle stack created ON OFF
+ LED_INIRQ In an interrupt N/C ON
+ LED_SIGNAL In a signal handler No change
+ LED_ASSERTION An assertion failed No change
+ LED_PANIC The system has crashed OFF Blinking
+ LED_IDLE STM32 is is sleep mode Not used
+
+ Thus is LD1 is illuminated, the Clicker2 has completed boot-up. IF LD2
+ is glowly softly, then interrupts are being taken; the level of illumination
+ depends amount of time processing interupts. If LD1 is off and LD2 is
+ blinking at about 2Hz, then the system has crashed.
+
+Buttons
+=======
+
+ The Mikroe Clicker2 STM32 has two buttons available to software:
+
+ T2/E0, Low sensed when pressed
+ T3/PA10, Low sensed when pressed
+
+Using JTAG
+==========
+
+ The Clicker2 comes with the mikroBootloader installed. That bootloader
+ has not been used and is possibly incompatible with the Clicker2-STM32
+ linker script at configs/clicker2-stm32/scripts/flash.ld. Often code must
+ be built to execute at an offset in to FLASH when a bootloader is used.
+ Certainly that is the case for the ST-Micro DFU bootloader but I am not
+ aware of the requirements for use with the mikroBootloader.
+
+ JTAG has been used in the development of this board support. The
+ Clicker2-STM32 board offers a 2x5 JTAG connector. You may use Dupont
+ jumpers to connect this port to JTAG as described here:
+
+ https://www.mikroe.com/how-to-use-st-link-v2-with-clicker-2-for-stm32-a-detailed-walkthrough/
+ http://www.playembedded.org/blog/en/2016/02/06/mikroe-clicker-2-for-stm32-and-stlink-v2/
+
+ NOTE that the FLASH is locked. You may need to follow the instructions at
+ the second link to unlock it (although I think you may be able to do this
+ with the ST-Micro ST-Link Utility as well).
+
+ You can avoid the mess of jumpers using the mikroProg to ST-Link v2 adapter
+ along with a 2x5, 10-wire ribbon cable connector:
+
+ https://shop.mikroe.com/add-on-boards/adapter/mikroprog-st-link-v2-adapter
+
+ OpenOCD can be used with the ST-Link to provide a debug environment. I suspect,
+ however, that adapter can be used with other JTAG debuggers such as J-Link,
+ but that remains to be verified.
+
+Configurations
+==============
+
+ Information Common to All Configurations
+ ----------------------------------------
+ Each Clicker2 configuration is maintained in a sub-directory and can be
+ selected as follow:
+
+ cd tools
+ ./configure.sh clicker2-stm32/
+ cd -
+ . ./setenv.sh
+
+ Before sourcing the setenv.sh file above, you should examine it and
+ perform edits as necessary so that TOOLCHAIN_BIN is the correct path
+ to the directory than holds your toolchain binaries.
+
+ And then build NuttX by simply typing the following. At the conclusion of
+ the make, the nuttx binary will reside in an ELF file called, simply, nuttx.
+
+ make oldconfig
+ make
+
+ The that is provided above as an argument to the tools/configure.sh
+ must be is one of the following.
+
+ NOTES:
+
+ 1. These configurations use the mconf-based configuration tool. To
+ change any of these configurations using that tool, you should:
+
+ a. Build and install the kconfig-mconf tool. See nuttx/README.txt
+ see additional README.txt files in the NuttX tools repository.
+
+ b. Execute 'make menuconfig' in nuttx/ in order to start the
+ reconfiguration process.
+
+ 2. Unless stated otherwise, all configurations generate console
+ output on USART3, channel 0) as described above under "Serial
+ Console". The relevant configuration settings are listed below:
+
+ CONFIG_STM32_USART3=y
+ CONFIG_STM32_USART3_SERIALDRIVER=y
+ CONFIG_STM32_USART=y
+
+ CONFIG_USART3_SERIALDRIVER=y
+ CONFIG_USART3_SERIAL_CONSOLE=y
+
+ CONFIG_USART3_RXBUFSIZE=256
+ CONFIG_USART3_TXBUFSIZE=256
+ CONFIG_USART3_BAUD=115200
+ CONFIG_USART3_BITS=8
+ CONFIG_USART3_PARITY=0
+ CONFIG_USART3_2STOP=0
+
+
+ 3. All of these configurations are set up to build under Linux using the
+ "GNU Tools for ARM Embedded Processors" that is maintained by ARM
+ (unless stated otherwise in the description of the configuration).
+
+ https://launchpad.net/gcc-arm-embedded
+
+ That toolchain selection can easily be reconfigured using
+ 'make menuconfig'. Here are the relevant current settings:
+
+ Build Setup:
+ CONFIG_HOST_LINUX =y : Linux environment
+
+ System Type -> Toolchain:
+ CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y : GNU ARM EABI toolchain
+
+ Configuration sub-directories
+ -----------------------------
+
+ nsh:
+
+ Configures the NuttShell (nsh) located at examples/nsh. This
+ configuration is focused on low level, command-line driver testing. It
+ has no network.
+
+ NOTES:
+
+ 1. Support for NSH built-in applications is provided:
+
+ Binary Formats:
+ CONFIG_BUILTIN=y : Enable support for built-in programs
+
+ Application Configuration:
+ CONFIG_NSH_BUILTIN_APPS=y : Enable starting apps from NSH command line
+
+ No built applications are enabled in the base configuration, however.
+
+ 2. C++ support for applications is enabled:
+
+ CONFIG_HAVE_CXX=y
+ CONFIG_HAVE_CXXINITIALIZE=y
+ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
diff --git a/configs/clicker2-stm32/nsh/defconfig b/configs/clicker2-stm32/nsh/defconfig
index 7ae63061f9..764b16372c 100644
--- a/configs/clicker2-stm32/nsh/defconfig
+++ b/configs/clicker2-stm32/nsh/defconfig
@@ -144,10 +144,10 @@ CONFIG_ARM_HAVE_MPU_UNIFIED=y
# CONFIG_ARMV7M_HAVE_ITCM is not set
# CONFIG_ARMV7M_HAVE_DTCM is not set
# CONFIG_ARMV7M_TOOLCHAIN_IARL is not set
-CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
+# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
-# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set
+CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y
# CONFIG_ARMV7M_OABI_TOOLCHAIN is not set
CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_STACKCHECK is not set
diff --git a/configs/clicker2-stm32/scripts/flash.ld b/configs/clicker2-stm32/scripts/flash.ld
index ca2e7eefcf..6bb3aabadd 100644
--- a/configs/clicker2-stm32/scripts/flash.ld
+++ b/configs/clicker2-stm32/scripts/flash.ld
@@ -42,8 +42,7 @@
*
* 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.
+ * the 0x0800:0000 address range.
*/
MEMORY