diff --git a/README.md b/README.md index 7931bf7114..3631d6e45e 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ NXP: * [LPC1768](http://mbed.org/platforms/mbed-LPC1768/) (Cortex-M3) * [LPC1768](http://mbed.org/platforms/u-blox-C027/) (Cortex-M3) * [LPC11U24](http://mbed.org/platforms/mbed-LPC11U24/) (Cortex-M0) +* [LPC11U35](http://mbed.org/platforms/EA-LPC11U35/) (Cortex-M0) * LPC2368 (ARM7TDMI-S) * LPC810 (Cortex-M0+) * [LPC812](http://mbed.org/platforms/NXP-LPC800-MAX/) (Cortex-M0+) diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/lib_startup_stm32f030.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/lib_startup_stm32f030.s deleted file mode 100644 index 187f5d7742..0000000000 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/TOOLCHAIN_ARM_MICRO/lib_startup_stm32f030.s +++ /dev/null @@ -1,244 +0,0 @@ -;******************** (C) COPYRIGHT 2014 STMicroelectronics ******************** -;* File Name : startup_stm32f030.s -;* Author : MCD Application Team -;* Version : V1.3.1 -;* Date : 17-January-2014 -;* Description : STM32F030 devices vector table for MDK-ARM toolchain. -;* This module performs: -;* - Set the initial SP -;* - Set the initial PC == Reset_Handler -;* - Set the vector table entries with the exceptions ISR address -;* - Configure the system clock -;* - Branches to __main in the C library (which eventually -;* calls main()). -;* After Reset the CortexM0 processor is in Thread mode, -;* priority is Privileged, and the Stack is set to Main. -;* <<< Use Configuration Wizard in Context Menu >>> -;******************************************************************************* -; @attention -; -; Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); -; You may not use this file except in compliance with the License. -; You may obtain a copy of the License at: -; -; http://www.st.com/software_license_agreement_liberty_v2 -; -; Unless required by applicable law or agreed to in writing, software -; distributed under the License is distributed on an "AS IS" BASIS, -; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -; See the License for the specific language governing permissions and -; limitations under the License. -; -;******************************************************************************* -; -; Amount of memory (in bytes) allocated for Stack -; Tailor this value to your application needs -; Stack Configuration -; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Stack_Size EQU 0x00000400 - - AREA STACK, NOINIT, READWRITE, ALIGN=3 -Stack_Mem SPACE Stack_Size -__initial_sp - - -; Heap Configuration -; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Heap_Size EQU 0x00000200 - - AREA HEAP, NOINIT, READWRITE, ALIGN=3 -__heap_base -Heap_Mem SPACE Heap_Size -__heap_limit - - PRESERVE8 - THUMB - - -; Vector Table Mapped to Address 0 at Reset - AREA RESET, DATA, READONLY - EXPORT __Vectors - EXPORT __Vectors_End - EXPORT __Vectors_Size - -__Vectors DCD __initial_sp ; Top of Stack - DCD Reset_Handler ; Reset Handler - DCD NMI_Handler ; NMI Handler - DCD HardFault_Handler ; Hard Fault Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_Handler ; SVCall Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD PendSV_Handler ; PendSV Handler - DCD SysTick_Handler ; SysTick Handler - - ; External Interrupts - DCD WWDG_IRQHandler ; Window Watchdog - DCD 0 ; Reserved - DCD RTC_IRQHandler ; RTC through EXTI Line - DCD FLASH_IRQHandler ; FLASH - DCD RCC_IRQHandler ; RCC - DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1 - DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3 - DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15 - DCD 0 ; Reserved - DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 - DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3 - DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5 - DCD ADC1_IRQHandler ; ADC1 - DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation - DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare - DCD 0 ; Reserved - DCD TIM3_IRQHandler ; TIM3 - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD TIM14_IRQHandler ; TIM14 - DCD TIM15_IRQHandler ; TIM15 - DCD TIM16_IRQHandler ; TIM16 - DCD TIM17_IRQHandler ; TIM17 - DCD I2C1_IRQHandler ; I2C1 - DCD I2C2_IRQHandler ; I2C2 - DCD SPI1_IRQHandler ; SPI1 - DCD SPI2_IRQHandler ; SPI2 - DCD USART1_IRQHandler ; USART1 - DCD USART2_IRQHandler ; USART2 - -__Vectors_End - -__Vectors_Size EQU __Vectors_End - __Vectors - - AREA |.text|, CODE, READONLY - -; Reset handler routine -Reset_Handler PROC - EXPORT Reset_Handler [WEAK] - IMPORT __main - IMPORT SystemInit - LDR R0, =SystemInit - BLX R0 - LDR R0, =__main - BX R0 - ENDP - -; Dummy Exception Handlers (infinite loops which can be modified) - -NMI_Handler PROC - EXPORT NMI_Handler [WEAK] - B . - ENDP -HardFault_Handler\ - PROC - EXPORT HardFault_Handler [WEAK] - B . - ENDP -SVC_Handler PROC - EXPORT SVC_Handler [WEAK] - B . - ENDP -PendSV_Handler PROC - EXPORT PendSV_Handler [WEAK] - B . - ENDP -SysTick_Handler PROC - EXPORT SysTick_Handler [WEAK] - B . - ENDP - -Default_Handler PROC - - EXPORT WWDG_IRQHandler [WEAK] - EXPORT RTC_IRQHandler [WEAK] - EXPORT FLASH_IRQHandler [WEAK] - EXPORT RCC_IRQHandler [WEAK] - EXPORT EXTI0_1_IRQHandler [WEAK] - EXPORT EXTI2_3_IRQHandler [WEAK] - EXPORT EXTI4_15_IRQHandler [WEAK] - EXPORT DMA1_Channel1_IRQHandler [WEAK] - EXPORT DMA1_Channel2_3_IRQHandler [WEAK] - EXPORT DMA1_Channel4_5_IRQHandler [WEAK] - EXPORT ADC1_IRQHandler [WEAK] - EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] - EXPORT TIM1_CC_IRQHandler [WEAK] - EXPORT TIM3_IRQHandler [WEAK] - EXPORT TIM14_IRQHandler [WEAK] - EXPORT TIM15_IRQHandler [WEAK] - EXPORT TIM16_IRQHandler [WEAK] - EXPORT TIM17_IRQHandler [WEAK] - EXPORT I2C1_IRQHandler [WEAK] - EXPORT I2C2_IRQHandler [WEAK] - EXPORT SPI1_IRQHandler [WEAK] - EXPORT SPI2_IRQHandler [WEAK] - EXPORT USART1_IRQHandler [WEAK] - EXPORT USART2_IRQHandler [WEAK] - - -WWDG_IRQHandler -RTC_IRQHandler -FLASH_IRQHandler -RCC_IRQHandler -EXTI0_1_IRQHandler -EXTI2_3_IRQHandler -EXTI4_15_IRQHandler -DMA1_Channel1_IRQHandler -DMA1_Channel2_3_IRQHandler -DMA1_Channel4_5_IRQHandler -ADC1_IRQHandler -TIM1_BRK_UP_TRG_COM_IRQHandler -TIM1_CC_IRQHandler -TIM3_IRQHandler -TIM14_IRQHandler -TIM15_IRQHandler -TIM16_IRQHandler -TIM17_IRQHandler -I2C1_IRQHandler -I2C2_IRQHandler -SPI1_IRQHandler -SPI2_IRQHandler -USART1_IRQHandler -USART2_IRQHandler - - B . - - ENDP - - ALIGN - -;******************************************************************************* -; User Stack and Heap initialization -;******************************************************************************* - IF :DEF:__MICROLIB - - EXPORT __initial_sp - EXPORT __heap_base - EXPORT __heap_limit - - ELSE - - IMPORT __use_two_region_memory - EXPORT __user_initial_stackheap - -__user_initial_stackheap - - LDR R0, = Heap_Mem - LDR R1, =(Stack_Mem + Stack_Size) - LDR R2, = (Heap_Mem + Heap_Size) - LDR R3, = Stack_Mem - BX LR - - ALIGN - - ENDIF - - END - -;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE***** diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_msp_template.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_msp_template.c deleted file mode 100644 index 5becabc4d0..0000000000 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F401RE/stm32f4xx_hal_msp_template.c +++ /dev/null @@ -1,133 +0,0 @@ -/** - ****************************************************************************** - * @file stm32f4xx_hal_msp_template.c - * @author MCD Application Team - * @version V1.0.0RC2 - * @date 04-February-2014 - * @brief HAL MSP module. - * This file template is located in the HAL folder and should be copied - * to the user folder. - * - @verbatim - =============================================================================== - ##### How to use this driver ##### - =============================================================================== - [..] - This file is generated automatically by MicroXplorer and eventually modified - by the user - - @endverbatim - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * 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 of STMicroelectronics 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 HOLDER 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. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx_hal.h" - -/** @addtogroup STM32F4xx_HAL_Driver - * @{ - */ - -/** @defgroup HAL_MSP - * @brief HAL MSP module. - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -/* Private functions ---------------------------------------------------------*/ - -/** @defgroup HAL_MSP_Private_Functions - * @{ - */ - -/** - * @brief Initializes the Global MSP. - * @param None - * @retval None - */ -void HAL_MspInit(void) -{ - /* NOTE : This function is generated automatically by MicroXplorer and eventually - modified by the user - */ -} - -/** - * @brief DeInitializes the Global MSP. - * @param None - * @retval None - */ -void HAL_MspDeInit(void) -{ - /* NOTE : This function is generated automatically by MicroXplorer and eventually - modified by the user - */ -} - -/** - * @brief Initializes the PPP MSP. - * @param None - * @retval None - */ -void HAL_PPP_MspInit(void) -{ - /* NOTE : This function is generated automatically by MicroXplorer and eventually - modified by the user - */ -} - -/** - * @brief DeInitializes the PPP MSP. - * @param None - * @retval None - */ -void HAL_PPP_MspDeInit(void) -{ - /* NOTE : This function is generated automatically by MicroXplorer and eventually - modified by the user - */ -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c index 7b33e2edd0..04e21599bb 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c @@ -37,8 +37,15 @@ static int us_ticker_inited = 0; static uint32_t SlaveCounter = 0; -static uint32_t us_ticker_int_counter = 0; -static uint16_t us_ticker_int_remainder = 0; +static uint32_t oc_int_part = 0; +static uint16_t oc_rem_part = 0; + +void set_compare(uint16_t count) { + // Set new output compare value + TIM_SetCompare1(TIM_MST, count); + // Enable IT + TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); +} // Used to increment the slave counter static void tim_update_irq_handler(void) { @@ -50,27 +57,30 @@ static void tim_update_irq_handler(void) { // Used by interrupt system static void tim_oc_irq_handler(void) { + uint16_t cval = TIM_MST->CNT; + // Clear interrupt flag if (TIM_GetITStatus(TIM_MST, TIM_IT_CC1) == SET) { TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1); } - - if (us_ticker_int_counter > 0) { - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; - } else { - if (us_ticker_int_remainder > 0) { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; - } else { - // This function is going to disable the interrupts if there are - // no other events in the queue + + if (oc_rem_part > 0) { + set_compare(oc_rem_part); // Finish the remaining time left + oc_rem_part = 0; + } + else { + if (oc_int_part > 0) { + set_compare(0xFFFF); + oc_rem_part = cval; // To finish the counter loop the next time + oc_int_part--; + } + else { us_ticker_irq_handler(); } - } + } } -void us_ticker_init(void) { +void us_ticker_init(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; if (us_ticker_inited) return; @@ -89,13 +99,12 @@ void us_ticker_init(void) { // Configure interrupts TIM_ITConfig(TIM_MST, TIM_IT_Update, ENABLE); - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); - // For 32-bit counter + // Update interrupt used for 32-bit counter NVIC_SetVector(TIM_MST_UP_IRQ, (uint32_t)tim_update_irq_handler); NVIC_EnableIRQ(TIM_MST_UP_IRQ); - // For ouput compare + // Output compare interrupt used for timeout feature NVIC_SetVector(TIM_MST_OC_IRQ, (uint32_t)tim_oc_irq_handler); NVIC_EnableIRQ(TIM_MST_OC_IRQ); @@ -112,10 +121,10 @@ uint32_t us_ticker_read() { // value in the past. Avoid this by computing consecutive values of the timer until they // are properly ordered. counter = (uint32_t)(SlaveCounter << 16); - counter += (uint32_t)TIM_GetCounter(TIM_MST); + counter += TIM_MST->CNT; while (1) { counter2 = (uint32_t)(SlaveCounter << 16); - counter2 += (uint32_t)TIM_GetCounter(TIM_MST); + counter2 += TIM_MST->CNT; if (counter2 > counter) { break; } @@ -126,22 +135,21 @@ uint32_t us_ticker_read() { void us_ticker_set_interrupt(unsigned int timestamp) { int delta = (int)(timestamp - us_ticker_read()); + uint16_t cval = TIM_MST->CNT; if (delta <= 0) { // This event was in the past us_ticker_irq_handler(); - return; } else { - us_ticker_int_counter = (uint32_t)(delta >> 16); - us_ticker_int_remainder = (uint16_t)(delta & 0xFFFF); - if (us_ticker_int_counter > 0) { // means delta > 0xFFFF - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; + oc_int_part = (uint32_t)(delta >> 16); + oc_rem_part = (uint16_t)(delta & 0xFFFF); + if (oc_rem_part <= (0xFFFF - cval)) { + set_compare(cval + oc_rem_part); + oc_rem_part = 0; } else { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; + set_compare(0xFFFF); + oc_rem_part = oc_rem_part - (0xFFFF - cval); } - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c index a7f21b40a2..98f9b2c2c0 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c @@ -37,8 +37,15 @@ static int us_ticker_inited = 0; static uint32_t SlaveCounter = 0; -static uint32_t us_ticker_int_counter = 0; -static uint16_t us_ticker_int_remainder = 0; +static uint32_t oc_int_part = 0; +static uint16_t oc_rem_part = 0; + +void set_compare(uint16_t count) { + // Set new output compare value + TIM_SetCompare1(TIM_MST, count); + // Enable IT + TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); +} // Used to increment the slave counter static void tim_update_irq_handler(void) { @@ -50,27 +57,30 @@ static void tim_update_irq_handler(void) { // Used by interrupt system static void tim_oc_irq_handler(void) { + uint16_t cval = TIM_MST->CNT; + // Clear interrupt flag if (TIM_GetITStatus(TIM_MST, TIM_IT_CC1) == SET) { TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1); } - - if (us_ticker_int_counter > 0) { - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; - } else { - if (us_ticker_int_remainder > 0) { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; - } else { - // This function is going to disable the interrupts if there are - // no other events in the queue + + if (oc_rem_part > 0) { + set_compare(oc_rem_part); // Finish the remaining time left + oc_rem_part = 0; + } + else { + if (oc_int_part > 0) { + set_compare(0xFFFF); + oc_rem_part = cval; // To finish the counter loop the next time + oc_int_part--; + } + else { us_ticker_irq_handler(); } - } + } } -void us_ticker_init(void) { +void us_ticker_init(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; if (us_ticker_inited) return; @@ -89,13 +99,12 @@ void us_ticker_init(void) { // Configure interrupts TIM_ITConfig(TIM_MST, TIM_IT_Update, ENABLE); - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); - // For 32-bit counter + // Update interrupt used for 32-bit counter NVIC_SetVector(TIM_MST_UP_IRQ, (uint32_t)tim_update_irq_handler); NVIC_EnableIRQ(TIM_MST_UP_IRQ); - // For ouput compare + // Output compare interrupt used for timeout feature NVIC_SetVector(TIM_MST_OC_IRQ, (uint32_t)tim_oc_irq_handler); NVIC_EnableIRQ(TIM_MST_OC_IRQ); @@ -112,10 +121,10 @@ uint32_t us_ticker_read() { // value in the past. Avoid this by computing consecutive values of the timer until they // are properly ordered. counter = (uint32_t)(SlaveCounter << 16); - counter += (uint32_t)TIM_GetCounter(TIM_MST); + counter += TIM_MST->CNT; while (1) { counter2 = (uint32_t)(SlaveCounter << 16); - counter2 += (uint32_t)TIM_GetCounter(TIM_MST); + counter2 += TIM_MST->CNT; if (counter2 > counter) { break; } @@ -126,22 +135,21 @@ uint32_t us_ticker_read() { void us_ticker_set_interrupt(unsigned int timestamp) { int delta = (int)(timestamp - us_ticker_read()); + uint16_t cval = TIM_MST->CNT; if (delta <= 0) { // This event was in the past us_ticker_irq_handler(); - return; } else { - us_ticker_int_counter = (uint32_t)(delta >> 16); - us_ticker_int_remainder = (uint16_t)(delta & 0xFFFF); - if (us_ticker_int_counter > 0) { // means delta > 0xFFFF - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; + oc_int_part = (uint32_t)(delta >> 16); + oc_rem_part = (uint16_t)(delta & 0xFFFF); + if (oc_rem_part <= (0xFFFF - cval)) { + set_compare(cval + oc_rem_part); + oc_rem_part = 0; } else { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; + set_compare(0xFFFF); + oc_rem_part = oc_rem_part - (0xFFFF - cval); } - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/pwmout_api.c index faa6c57d7b..fa1258f298 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/pwmout_api.c @@ -79,9 +79,9 @@ void pwmout_write(pwmout_t* obj, float value) { TimHandle.Instance = (TIM_TypeDef *)(obj->pwm); - if (value < 0.0) { + if (value < (float)0.0) { value = 0.0; - } else if (value > 1.0) { + } else if (value > (float)1.0) { value = 1.0; } @@ -108,7 +108,7 @@ float pwmout_read(pwmout_t* obj) { if (obj->period > 0) { value = (float)(obj->pulse) / (float)(obj->period); } - return ((value > 1.0) ? (1.0) : (value)); + return ((value > (float)1.0) ? (float)(1.0) : (value)); } void pwmout_period(pwmout_t* obj, float seconds) { diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c index ff2cf4673e..8faa60812f 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c @@ -31,7 +31,6 @@ #include "stm32f4xx_hal.h" // Timer selection: - #define TIM_MST TIM1 #define TIM_MST_UP_IRQ TIM1_UP_TIM10_IRQn #define TIM_MST_OC_IRQ TIM1_CC_IRQn @@ -41,8 +40,15 @@ static TIM_HandleTypeDef TimMasterHandle; static int us_ticker_inited = 0; static uint32_t SlaveCounter = 0; -static uint32_t us_ticker_int_counter = 0; -static uint16_t us_ticker_int_remainder = 0; +static uint32_t oc_int_part = 0; +static uint16_t oc_rem_part = 0; + +void set_compare(uint16_t count) { + // Set new output compare value + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, count); + // Enable IT + __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); +} // Used to increment the slave counter static void tim_update_irq_handler(void) { @@ -55,24 +61,27 @@ static void tim_update_irq_handler(void) { // Used by interrupt system static void tim_oc_irq_handler(void) { + uint16_t cval = TIM_MST->CNT; + // Clear interrupt flag if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) { __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1); } - - if (us_ticker_int_counter > 0) { - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, 0xFFFF); - us_ticker_int_counter--; - } else { - if (us_ticker_int_remainder > 0) { - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, us_ticker_int_remainder); - us_ticker_int_remainder = 0; - } else { - // This function is going to disable the interrupts if there are - // no other events in the queue + + if (oc_rem_part > 0) { + set_compare(oc_rem_part); // Finish the remaining time left + oc_rem_part = 0; + } + else { + if (oc_int_part > 0) { + set_compare(0xFFFF); + oc_rem_part = cval; // To finish the counter loop the next time + oc_int_part--; + } + else { us_ticker_irq_handler(); } - } + } } void us_ticker_init(void) { @@ -89,31 +98,20 @@ void us_ticker_init(void) { TimMasterHandle.Init.ClockDivision = 0; TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP; TimMasterHandle.Init.RepetitionCounter = 0; - //HAL_TIM_Base_Init(&TimMasterHandle); HAL_TIM_OC_Init(&TimMasterHandle); - - /* - TIM_OC_InitTypeDef sConfig; - sConfig.OCMode = TIM_OCMODE_INACTIVE; - sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfig.Pulse = 0; - HAL_TIM_OC_ConfigChannel(&TimMasterHandle, &sConfig, TIM_CHANNEL_1); - */ - + // Configure interrupts __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_UPDATE); - __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); - // For 32-bit counter + // Update interrupt used for 32-bit counter NVIC_SetVector(TIM_MST_UP_IRQ, (uint32_t)tim_update_irq_handler); NVIC_EnableIRQ(TIM_MST_UP_IRQ); - // For ouput compare + // Output compare interrupt used for timeout feature NVIC_SetVector(TIM_MST_OC_IRQ, (uint32_t)tim_oc_irq_handler); NVIC_EnableIRQ(TIM_MST_OC_IRQ); // Enable timer - //HAL_TIM_Base_Start(&TimMasterHandle); HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_1); } @@ -140,22 +138,21 @@ uint32_t us_ticker_read() { void us_ticker_set_interrupt(unsigned int timestamp) { int delta = (int)(timestamp - us_ticker_read()); + uint16_t cval = TIM_MST->CNT; if (delta <= 0) { // This event was in the past us_ticker_irq_handler(); - return; } else { - us_ticker_int_counter = (uint32_t)(delta >> 16); - us_ticker_int_remainder = (uint16_t)(delta & 0xFFFF); - if (us_ticker_int_counter > 0) { // means delta > 0xFFFF - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, 0xFFFF); - us_ticker_int_counter--; + oc_int_part = (uint32_t)(delta >> 16); + oc_rem_part = (uint16_t)(delta & 0xFFFF); + if (oc_rem_part <= (0xFFFF - cval)) { + set_compare(cval + oc_rem_part); + oc_rem_part = 0; } else { - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, us_ticker_int_remainder); - us_ticker_int_remainder = 0; + set_compare(0xFFFF); + oc_rem_part = oc_rem_part - (0xFFFF - cval); } - __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c index 9cb17c8c88..1f722bfcad 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c @@ -36,10 +36,19 @@ static int us_ticker_inited = 0; static uint32_t SlaveCounter = 0; -static uint32_t us_ticker_int_counter = 0; -static uint16_t us_ticker_int_remainder = 0; +static uint32_t oc_int_part = 0; +static uint16_t oc_rem_part = 0; + +void set_compare(uint16_t count) { + // Set new output compare value + TIM_SetCompare1(TIM_MST, count); + // Enable IT + TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); +} static void tim_update_oc_irq_handler(void) { + uint16_t cval = TIM_MST->CNT; + // Update interrupt: increment the slave counter if (TIM_GetITStatus(TIM_MST, TIM_IT_Update) == SET) { TIM_ClearITPendingBit(TIM_MST, TIM_IT_Update); @@ -48,24 +57,26 @@ static void tim_update_oc_irq_handler(void) { // Output compare interrupt: used by interrupt system if (TIM_GetITStatus(TIM_MST, TIM_IT_CC1) == SET) { - TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1); - if (us_ticker_int_counter > 0) { - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; - } else { - if (us_ticker_int_remainder > 0) { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; - } else { - // This function is going to disable the interrupts if there are - // no other events in the queue - us_ticker_irq_handler(); - } + TIM_ClearITPendingBit(TIM_MST, TIM_IT_CC1); + } + + if (oc_rem_part > 0) { + set_compare(oc_rem_part); // Finish the remaining time left + oc_rem_part = 0; + } + else { + if (oc_int_part > 0) { + set_compare(0xFFFF); + oc_rem_part = cval; // To finish the counter loop the next time + oc_int_part--; + } + else { + us_ticker_irq_handler(); } } } -void us_ticker_init(void) { +void us_ticker_init(void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; if (us_ticker_inited) return; @@ -84,7 +95,6 @@ void us_ticker_init(void) { // Configure interrupts TIM_ITConfig(TIM_MST, TIM_IT_Update, ENABLE); - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); // For 32-bit counter and output compare NVIC_SetVector(TIM_MST_IRQ, (uint32_t)tim_update_oc_irq_handler); @@ -103,10 +113,10 @@ uint32_t us_ticker_read() { // value in the past. Avoid this by computing consecutive values of the timer until they // are properly ordered. counter = (uint32_t)(SlaveCounter << 16); - counter += (uint32_t)TIM_GetCounter(TIM_MST); + counter += TIM_MST->CNT; while (1) { counter2 = (uint32_t)(SlaveCounter << 16); - counter2 += (uint32_t)TIM_GetCounter(TIM_MST); + counter2 += TIM_MST->CNT; if (counter2 > counter) { break; } @@ -117,22 +127,21 @@ uint32_t us_ticker_read() { void us_ticker_set_interrupt(unsigned int timestamp) { int delta = (int)(timestamp - us_ticker_read()); + uint16_t cval = TIM_MST->CNT; if (delta <= 0) { // This event was in the past us_ticker_irq_handler(); - return; } else { - us_ticker_int_counter = (uint32_t)(delta >> 16); - us_ticker_int_remainder = (uint16_t)(delta & 0xFFFF); - if (us_ticker_int_counter > 0) { // means delta > 0xFFFF - TIM_SetCompare1(TIM_MST, 0xFFFF); - us_ticker_int_counter--; + oc_int_part = (uint32_t)(delta >> 16); + oc_rem_part = (uint16_t)(delta & 0xFFFF); + if (oc_rem_part <= (0xFFFF - cval)) { + set_compare(cval + oc_rem_part); + oc_rem_part = 0; } else { - TIM_SetCompare1(TIM_MST, us_ticker_int_remainder); - us_ticker_int_remainder = 0; + set_compare(0xFFFF); + oc_rem_part = oc_rem_part - (0xFFFF - cval); } - TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } } diff --git a/libraries/tests/mbed/pin_toggling/main.cpp b/libraries/tests/mbed/pin_toggling/main.cpp new file mode 100644 index 0000000000..5eb809a2ff --- /dev/null +++ b/libraries/tests/mbed/pin_toggling/main.cpp @@ -0,0 +1,10 @@ +#include "mbed.h" + +DigitalOut out(p5); + +int main() { + while (true) { + out = 1; + out = 0; + } +} diff --git a/workspace_tools/build_release.py b/workspace_tools/build_release.py index a454ab5b1c..995a2c9f94 100644 --- a/workspace_tools/build_release.py +++ b/workspace_tools/build_release.py @@ -26,20 +26,25 @@ from workspace_tools.build_api import build_mbed_libs from workspace_tools.targets import TARGET_MAP OFFICIAL_MBED_LIBRARY_BUILD = ( - ('KL25Z', ('ARM', 'GCC_ARM')), - ('LPC11U24', ('ARM', 'uARM')), - ('LPC1768', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')), - ('LPC2368', ('ARM',)), - ('LPC812', ('uARM',)), - ('LPC1347', ('ARM',)), - ('LPC4088', ('ARM', 'GCC_ARM', 'GCC_CR')), - ('LPC1114', ('uARM',)), - ('KL46Z', ('ARM', 'GCC_ARM')), + ('LPC11U24', ('ARM', 'uARM')), + ('LPC1768', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')), + ('UBLOX_C027', ('ARM', 'GCC_ARM', 'GCC_CR', 'GCC_CS', 'IAR')), + ('LPC2368', ('ARM',)), + ('LPC812', ('uARM',)), + ('LPC1347', ('ARM',)), + ('LPC4088', ('ARM', 'GCC_ARM', 'GCC_CR')), + ('LPC1114', ('uARM',)), ('LPC11U35_401', ('ARM', 'uARM')), - ('NUCLEO_F103RB', ('ARM',)), -# ('NUCLEO_L152RE', ('ARM',)), -# ('NUCLEO_F401RE', ('ARM',)), -# ('NUCLEO_F030R8', ('ARM',)), + + ('KL25Z', ('ARM', 'GCC_ARM')), + ('KL46Z', ('ARM', 'GCC_ARM')), + + ('NUCLEO_F103RB', ('ARM', 'uARM')), + ('NUCLEO_L152RE', ('ARM', 'uARM')), + ('NUCLEO_F401RE', ('ARM', 'uARM')), + ('NUCLEO_F030R8', ('ARM', 'uARM')), + + # ('NRF51822', ('ARM', )), ) diff --git a/workspace_tools/export/README.md b/workspace_tools/export/README.md index 05907068e9..34536c0fcd 100644 --- a/workspace_tools/export/README.md +++ b/workspace_tools/export/README.md @@ -6,6 +6,7 @@ Exporter Toolchain/Platform Support Code Red Code Sourcery + CoIDE DS-5 GCC ARM IAR @@ -19,11 +20,13 @@ Exporter Toolchain/Platform Support ✓ ✓ ✓ + ✓ NXP LPC11U24 + ✓ @@ -33,6 +36,7 @@ Exporter Toolchain/Platform Support NXP LPC812 + ✓ @@ -43,6 +47,7 @@ Exporter Toolchain/Platform Support ✓ + ✓ ✓ @@ -54,6 +59,7 @@ Exporter Toolchain/Platform Support + ✓ @@ -63,12 +69,34 @@ Exporter Toolchain/Platform Support + + ✓ + + + Freescale KL05Z + + + ✓ + + ✓ + + ✓ + + + Freescale KL20D5M + + + + + + ✓ Freescale KL25Z + ✓ ✓ @@ -79,8 +107,49 @@ Exporter Toolchain/Platform Support + ✓ ✓ + + ST Nucleo F030R8 + + + + + + + ✓ + + + ST Nucleo F103RB + + + + + + + ✓ + + + ST Nucleo F401RE + + + + + + ✓ + ✓ + + + ST Nucleo L152RE + + + + + + + ✓ + diff --git a/workspace_tools/export/uvision4_nucleo_f030r8.uvopt.tmpl b/workspace_tools/export/uvision4_nucleo_f030r8.uvopt.tmpl new file mode 100644 index 0000000000..99dc98af04 --- /dev/null +++ b/workspace_tools/export/uvision4_nucleo_f030r8.uvopt.tmpl @@ -0,0 +1,218 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + mbed NUCLEO_F030R8 + 0x4 + ARM-ADS + + 48000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 13 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + ST-LINKIII-KEIL_SWO + -U-O206 -O206 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32F030R8$Flash\STM32F0xx_64.FLM) + + + 0 + UL2CM3 + UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FN1 -FC1000 -FD20000000 -FF0STM32F0xx_64 -FL010000 -FS08000000 -FP0($$Device:STM32F030R8$Flash\STM32F0xx_64.FLM) + + + 0 + ULP2CM3 + -U -O207 -S8 -C0 -P00 -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L1xx_256 -FS08000000 -FL040000 + + + 0 + CMSIS_AGDI + -X"MBED CMSIS-DAP" -UA000000001 -O462 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -FO15 -FD20000000 -FC800 -FN1 -FF0MK_P128_48MHZ -FS00 -FL020000 + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + main.cpp + main.cpp + 0 + 0 + + + +
diff --git a/workspace_tools/export/uvision4_nucleo_f030r8.uvproj.tmpl b/workspace_tools/export/uvision4_nucleo_f030r8.uvproj.tmpl new file mode 100644 index 0000000000..373f47a1b1 --- /dev/null +++ b/workspace_tools/export/uvision4_nucleo_f030r8.uvproj.tmpl @@ -0,0 +1,438 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + mbed NUCLEO_F030R8 + 0x4 + ARM-ADS + + + STM32F030R8 + STMicroelectronics + IROM(0x08000000,0x10000) IRAM(0x20000000,0x2000) CPUTYPE("Cortex-M0") CLOCK(48000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32F030R8$Flash\STM32F0xx_64.FLM)) + 7309 + $$Device:STM32F030R8$Device\Include\stm32f0xx.h + + + + + + + + + + $$Device:STM32F030R8$SVD\STM32F030.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\ + {{name}} + 1 + 0 + 0 + 1 + 1 + .\build\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin -o build\{{name}}_NUCLEO_F030R8.bin build\{{name}}.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + + 0 + 13 + + + + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4103 + + 1 + STLink\ST-LINKIII-KEIL_SWO.dll + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 1 + 0x8000000 + 0x10000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x10000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + --gnu + {% for s in symbols %} {{s}}, {% endfor %} + + {% for path in include_paths %} {{path}}; {% endfor %} + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x10000000 + {{scatter_file}} + + + + {% for file in object_files %} + {{file}} + {% endfor %} + + + + + + + + {% for group,files in source_files %} + + {{group}} + + {% for file in files %} + + {{file.name}} + {{file.type}} + {{file.path}} + + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + + + {% endfor %} + + + {% endfor %} + + + + +
diff --git a/workspace_tools/export/uvision4_nucleo_f103rb.uvopt.tmpl b/workspace_tools/export/uvision4_nucleo_f103rb.uvopt.tmpl index a981409e16..2a24273e7b 100644 --- a/workspace_tools/export/uvision4_nucleo_f103rb.uvopt.tmpl +++ b/workspace_tools/export/uvision4_nucleo_f103rb.uvopt.tmpl @@ -76,23 +76,6 @@ 1 255 - - - 0 - Reference Manual - DATASHTS\ST\STM32F10xxx.PDF - - - 1 - Technical Reference Manual - datashts\arm\cortex_m3\r1p1\DDI0337E_CORTEX_M3_R1P1_TRM.PDF - - - 2 - Generic User Guide - datashts\arm\cortex_m3\r2p1\DUI0552A_CORTEX_M3_DGUG.PDF - - SARMCM3.DLL diff --git a/workspace_tools/export/uvision4_nucleo_f401re.uvopt.tmpl b/workspace_tools/export/uvision4_nucleo_f401re.uvopt.tmpl new file mode 100644 index 0000000000..e6898281be --- /dev/null +++ b/workspace_tools/export/uvision4_nucleo_f401re.uvopt.tmpl @@ -0,0 +1,218 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + mbed NUCLEO_F401RE + 0x4 + ARM-ADS + + 84000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\build\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 13 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + ST-LINKIII-KEIL_SWO + -U-O206 -O206 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_256.FLM -FS08000000 -FL040000 -FP0($$Device:STM32F401RC$Flash\STM32F4xx_256.FLM) + + + 0 + UL2CM3 + -S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_256 -FS08000000 -FL040000 -FP0($$Device:STM32F401RC$Flash\STM32F4xx_256.FLM)) + + + 0 + ULP2CM3 + -O2510 -S0 -C0 -FO15 -FN1 -FC800 -FD20000000 -FF0MK_P128_48MHZ -FL020000 -FS00 + + + 0 + CMSIS_AGDI + -X"MBED CMSIS-DAP" -UA000000001 -O462 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -FO15 -FD20000000 -FC800 -FN1 -FF0MK_P128_48MHZ -FS00 -FL020000 + + + + + 0 + + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + src + 1 + 0 + 0 + 0 + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + main.cpp + main.cpp + 0 + 0 + + + +
diff --git a/workspace_tools/export/uvision4_nucleo_f401re.uvproj.tmpl b/workspace_tools/export/uvision4_nucleo_f401re.uvproj.tmpl new file mode 100644 index 0000000000..5d3a335cff --- /dev/null +++ b/workspace_tools/export/uvision4_nucleo_f401re.uvproj.tmpl @@ -0,0 +1,438 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + mbed NUCLEO_F401RE + 0x4 + ARM-ADS + + + STM32F401RC + STMicroelectronics + IROM(0x08000000,0x40000) IRAM(0x20000000,0x10000) CPUTYPE("Cortex-M4") FPU2 CLOCK(84000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_256 -FS08000000 -FL040000 -FP0($$Device:STM32F401RC$Flash\STM32F4xx_256.FLM)) + 7383 + $$Device:STM32F401RC$Device\Include\stm32f4xx.h + + + + + + + + + + $$Device:STM32F401RC$SVD\STM32F40x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\build\ + {{name}} + 1 + 0 + 0 + 1 + 1 + .\build\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin -o build\{{name}}_NUCLEO_F401RE.bin build\{{name}}.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + + 0 + 13 + + + + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4103 + + 1 + STLink\ST-LINKIII-KEIL_SWO.dll + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x10000 + + + 1 + 0x8000000 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x10000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + --gnu + {% for s in symbols %} {{s}}, {% endfor %} + + {% for path in include_paths %} {{path}}; {% endfor %} + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x10000000 + {{scatter_file}} + + + + {% for file in object_files %} + {{file}} + {% endfor %} + + + + + + + + {% for group,files in source_files %} + + {{group}} + + {% for file in files %} + + {{file.name}} + {{file.type}} + {{file.path}} + + + 2 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + + + {% endfor %} + + + {% endfor %} + + + + +
diff --git a/workspace_tools/export/uvision4_nucleo_l152re.uvopt.tmpl b/workspace_tools/export/uvision4_nucleo_l152re.uvopt.tmpl index 5fba3232fd..a2bf47073d 100644 --- a/workspace_tools/export/uvision4_nucleo_l152re.uvopt.tmpl +++ b/workspace_tools/export/uvision4_nucleo_l152re.uvopt.tmpl @@ -25,7 +25,7 @@ 0x4 ARM-ADS - 8000000 + 32000000 1 1 @@ -76,32 +76,15 @@ 1 255 - - - 0 - Datasheet - DATASHTS\ST\STM32L151_152xE_DS.PDF - - - 1 - Technical Reference Manual - datashts\arm\cortex_m3\r1p1\DDI0337E_CORTEX_M3_R1P1_TRM.PDF - - - 2 - Generic User Guide - datashts\arm\cortex_m3\r2p1\DUI0552A_CORTEX_M3_DGUG.PDF - - SARMCM3.DLL - - DARMSTM.DLL - -pSTM32L152RE + -REMAP -MPU + DCM.DLL + -pCM3 SARMCM3.DLL - - TARMSTM.DLL - -pSTM32L152RE + -MPU + TCM.DLL + -pCM3 0 @@ -140,7 +123,7 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=-1,-1,-1,-1,0)(121=-1,-1,-1,-1,0)(122=-1,-1,-1,-1,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=-1,-1,-1,-1,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 @@ -155,17 +138,17 @@ 0 ST-LINKIII-KEIL_SWO - -U-O206 -O206 -S3 -C0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128 -FS08000000 -FL020000 + -U-O206 -O206 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_384.FLM -FS08000000 -FL060000 -FP0($$Device:STM32L152RD$Flash\STM32L1xx_384.FLM) 0 UL2CM3 - UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FN1 -FC800 -FD20000000 -FF0STM32F10x_128 -FL020000 -FS08000000 + UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FN1 -FC1000 -FD20000000 -FF0STM32L1xx_384 -FL060000 -FS08000000 -FP0($$Device:STM32L152RD$Flash\STM32L1xx_384.FLM) 0 ULP2CM3 - -O2510 -S0 -C0 -FO15 -FN1 -FC800 -FD20000000 -FF0MK_P128_48MHZ -FL020000 -FS00 + -U -O207 -S8 -C0 -P00 -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L1xx_256 -FS08000000 -FL040000 0 diff --git a/workspace_tools/export/uvision4_nucleo_l152re.uvproj.tmpl b/workspace_tools/export/uvision4_nucleo_l152re.uvproj.tmpl index 3c157f2112..a2f7863467 100644 --- a/workspace_tools/export/uvision4_nucleo_l152re.uvproj.tmpl +++ b/workspace_tools/export/uvision4_nucleo_l152re.uvproj.tmpl @@ -12,14 +12,14 @@ ARM-ADS - STM32L152RE + STM32L152RD STMicroelectronics - IRAM(0x20000000-0x20003FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3") + IROM(0x08000000,0x60000) IRAM(0x20000000,0xC000) CPUTYPE("Cortex-M3") CLOCK(32000000) ELITTLE - "STARTUP\ST\STM32L1xx\startup_stm32l1xx_hd.s" ("STM32L15xx High density Startup Code") - UL2CM3(-O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0STM32L15x_128 -FS08000000 -FL020000) - 5249 - stm32l1xx.h + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_384 -FS08000000 -FL060000 -FP0($$Device:STM32L152RD$Flash\STM32L1xx_384.FLM)) + 6512 + $$Device:STM32L152RD$Device\Include\STM32L1xx.h @@ -29,13 +29,14 @@ - SFD\ST\STM32L15x\STM32L15x.sfr + $$Device:STM32L152RD$SVD\STM32L15x.svd + 0 0 - ST\STM32L1xx\ - ST\STM32L1xx\ + + 0 0 @@ -97,16 +98,17 @@ 3 + 1 SARMCM3.DLL - - DARMSTM.DLL - -pSTM32L152RE + -REMAP -MPU + DCM.DLL + -pCM3 SARMCM3.DLL - - TARMSTM.DLL - -pSTM32L152RE + -MPU + TCM.DLL + -pCM3 @@ -163,12 +165,16 @@ 0 1 1 - 4104 + 4103 1 - BIN\CMSIS_AGDI.dll + STLink\ST-LINKIII-KEIL_SWO.dll "" () + + + + 0 @@ -268,12 +274,12 @@ 0 0x20000000 - 0x4000 + 0xc000 1 0x8000000 - 0x20000 + 0x60000 0 @@ -298,7 +304,7 @@ 1 0x8000000 - 0x20000 + 0x60000 1 @@ -323,7 +329,7 @@ 0 0x20000000 - 0x4000 + 0xc000 0 diff --git a/workspace_tools/make.py b/workspace_tools/make.py index 403576a0dc..95b5a9650a 100644 --- a/workspace_tools/make.py +++ b/workspace_tools/make.py @@ -167,20 +167,30 @@ if __name__ == '__main__': if options.disk: # Simple copy to the mbed disk copy(bin, options.disk) + if options.nrfjprog: #Convert bin to Hex and Program nrf chip via jlink - call(["nrfjprog","-e","--program",bin.replace(".bin", ".hex"),"--verify","-p"]) + call(["nrfjprog","-e","--program",bin.replace(".bin", ".hex"),"--verify"]) + if options.serial: # Import pyserial: https://pypi.python.org/pypi/pyserial from serial import Serial sleep(target.program_cycle_s()) + serial = Serial(options.serial, timeout = 1) if options.baud: serial.setBaudrate(options.baud) + serial.flushInput() serial.flushOutput() - serial.sendBreak() + + if options.nrfjprog: + call(["nrfjprog", "-r"]) + elif mcu.startswith('NUCLEO'): + call(["ST-LINK_CLI.exe", "-Rst"]) + else: + serial.sendBreak() while True: c = serial.read(512) diff --git a/workspace_tools/targets.py b/workspace_tools/targets.py index d60e404255..6eb622b7d3 100644 --- a/workspace_tools/targets.py +++ b/workspace_tools/targets.py @@ -77,6 +77,8 @@ class LPC1768(Target): class LPC11U24(Target): + ONLINE_TOOLCHAIN = "uARM" + def __init__(self): Target.__init__(self) @@ -151,6 +153,8 @@ class K20D5M(Target): class LPC812(Target): + ONLINE_TOOLCHAIN = "uARM" + def __init__(self): Target.__init__(self) @@ -164,6 +168,8 @@ class LPC812(Target): class LPC810(Target): + ONLINE_TOOLCHAIN = "uARM" + def __init__(self): Target.__init__(self) @@ -266,6 +272,7 @@ class STM32F407(Target): class NUCLEO_F103RB(Target): + ONLINE_TOOLCHAIN = "uARM" OUTPUT_NAMING = "8.3" def __init__(self): @@ -279,6 +286,7 @@ class NUCLEO_F103RB(Target): class NUCLEO_L152RE(Target): + ONLINE_TOOLCHAIN = "uARM" OUTPUT_NAMING = "8.3" def __init__(self): @@ -292,6 +300,7 @@ class NUCLEO_L152RE(Target): class NUCLEO_F401RE(Target): + ONLINE_TOOLCHAIN = "uARM" OUTPUT_NAMING = "8.3" def __init__(self): @@ -305,6 +314,7 @@ class NUCLEO_F401RE(Target): class NUCLEO_F030R8(Target): + ONLINE_TOOLCHAIN = "uARM" OUTPUT_NAMING = "8.3" def __init__(self): @@ -329,6 +339,8 @@ class LPC1347(Target): class LPC1114(Target): + ONLINE_TOOLCHAIN = "uARM" + def __init__(self): Target.__init__(self) @@ -351,6 +363,8 @@ class LPC11C24(Target): class LPC11U35_401(Target): + ONLINE_TOOLCHAIN = "uARM" + def __init__(self): Target.__init__(self) @@ -367,18 +381,18 @@ class UBLOX_C027(Target): self.core = "Cortex-M3" - self.extra_labels = ['NXP', 'LPC176X', 'UBLOX_C027'] + self.extra_labels = ['NXP', 'LPC176X'] - self.supported_toolchains = ["ARM", "uARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"] + self.supported_toolchains = ["ARM", "uARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"] class NRF51822(Target): + OUTPUT_EXT = '.hex' + EXPECTED_SOFTDEVICE = 's110_nrf51822_6.0.0_softdevice.hex' UICR_START = 0x10001000 APPCODE_OFFSET = 0x14000 - OUTPUT_EXT = '.hex' - def __init__(self): Target.__init__(self) diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 38219b3e58..ce11499964 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -422,7 +422,12 @@ TESTS = [ "source_dir": join(TEST_DIR, "mbed", "pwm_led"), "dependencies": [MBED_LIBRARIES], }, - + { + "id": "MBED_32", "description": "Pin toggling", + "source_dir": join(TEST_DIR, "mbed", "pin_toggling"), + "dependencies": [MBED_LIBRARIES], + }, + # CMSIS RTOS tests { "id": "CMSIS_RTOS_1", "description": "Basic", diff --git a/workspace_tools/toolchains/arm.py b/workspace_tools/toolchains/arm.py index a126ffea33..8f7e30c661 100644 --- a/workspace_tools/toolchains/arm.py +++ b/workspace_tools/toolchains/arm.py @@ -43,7 +43,7 @@ class ARM(mbedToolchain): main_cc = join(ARM_BIN, "armcc") common = ["-c", "--cpu=%s" % cpu, "--gnu", - "-Ospace", "--split_sections", "--apcs=interwork", + "-O3", "-Otime", "--split_sections", "--apcs=interwork", "--brief_diagnostics", "--restrict" ]