From 0ac123d48812fb73f556ab8d12cdf97683f9e9fe Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Tue, 23 Dec 2014 03:38:29 +0100 Subject: [PATCH 1/6] [DISCO/NUCLEO_L053xx] adding to RTOS --- .../TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s | 5 +++-- .../TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s | 7 ++++--- .../TARGET_DISCO_L053C8/PeripheralNames.h | 4 ++-- libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h | 3 +++ libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c | 7 +++++-- workspace_tools/tests.py | 16 ++++++++-------- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s index e67c07102e..35a6995038 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_DISCO_L053C8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s @@ -100,9 +100,10 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array + //bl __libc_init_array /* Call the application's entry point.*/ - bl main + //bl main + bl _start LoopForever: b LoopForever diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s index e67c07102e..688e623060 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L053R8/TOOLCHAIN_GCC_ARM/startup_stm32l053xx.s @@ -100,12 +100,13 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array + //bl __libc_init_array /* Call the application's entry point.*/ - bl main + //bl main + bl _start LoopForever: - b LoopForever + b LoopForever .size Reset_Handler, .-Reset_Handler diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h index 2a26ecb449..8761532795 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h @@ -50,8 +50,8 @@ typedef enum { LPUART_1 = (int)LPUART1_BASE } UARTName; -#define STDIO_UART_TX PA_2 -#define STDIO_UART_RX PA_3 +#define STDIO_UART_TX PA_9 +#define STDIO_UART_RX PA_10 #define STDIO_UART UART_2 typedef enum { diff --git a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h index c2b5baa475..542bccf0b0 100755 --- a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h +++ b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h @@ -286,6 +286,9 @@ osThreadDef_t os_thread_def_main = {(os_pthread)main, osPriorityNormal, 0, NULL} #elif defined(TARGET_STM32F429ZI) #define INITIAL_SP (0x20030000UL) +#elif defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) +#define INITIAL_SP (0x20002000UL) + #else #error "no target defined" diff --git a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c index 68a03c226e..d3f0452c2a 100755 --- a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c +++ b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c @@ -55,7 +55,7 @@ # define OS_TASKCNT 14 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ - || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) + || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) # define OS_TASKCNT 6 # else # error "no target defined" @@ -70,7 +70,7 @@ # define OS_SCHEDULERSTKSIZE 256 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ - || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) + || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) # define OS_SCHEDULERSTKSIZE 128 # elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) # define OS_SCHEDULERSTKSIZE 112 @@ -160,6 +160,9 @@ #elif defined(TARGET_STM32F302R8) # define OS_CLOCK 64000000 +#elif defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) +# define OS_CLOCK 32000000 + # else # error "no target defined" # endif diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 0ae014d048..5c5d448d91 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -583,7 +583,7 @@ TESTS = [ "duration": 15, "automated": True, "host_test": "wait_us_auto", - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_2", "description": "Mutex resource lock", @@ -591,7 +591,7 @@ TESTS = [ "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "duration": 20, "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_3", "description": "Semaphore resource lock", @@ -599,28 +599,28 @@ TESTS = [ "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "duration": 20, "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_4", "description": "Signals messaging", "source_dir": join(TEST_DIR, "rtos", "mbed", "signals"), "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_5", "description": "Queue messaging", "source_dir": join(TEST_DIR, "rtos", "mbed", "queue"), "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_6", "description": "Mail messaging", "source_dir": join(TEST_DIR, "rtos", "mbed", "mail"), "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_7", "description": "Timer", @@ -629,14 +629,14 @@ TESTS = [ "duration": 15, "automated": True, "host_test": "wait_us_auto", - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_8", "description": "ISR (Queue)", "source_dir": join(TEST_DIR, "rtos", "mbed", "isr"), "dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB], "automated": True, - "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8"], + "mcu": ["LPC1768", "LPC1549", "LPC11U24", "LPC812", "KL25Z", "KL05Z", "K64F", "KL46Z", "RZ_A1H", "DISCO_F407VG", "DISCO_F429ZI", "NUCLEO_F411RE", "NUCLEO_F401RE", "NUCLEO_F334R8", "DISCO_F334C8", "NUCLEO_F302R8", "NUCLEO_L053R8", "DISCO_L053C8"], }, { "id": "RTOS_9", "description": "SD File write-read", From 6fa0730f4779bea4b3401bb76c8c38246916a0b7 Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Tue, 30 Dec 2014 02:24:40 +0100 Subject: [PATCH 2/6] [DISCO/NUCLEO_L053xx] adding to RTOS - part2 Stack sizes has to be reduced because of the limited 8K RAM. --- libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c | 4 ++-- libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c index d3f0452c2a..11c8a05e3f 100755 --- a/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c +++ b/libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c @@ -70,9 +70,9 @@ # define OS_SCHEDULERSTKSIZE 256 # elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \ || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_STM32F100RB) || defined(TARGET_STM32F051R8) \ - || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) # define OS_SCHEDULERSTKSIZE 128 -# elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) +# elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) # define OS_SCHEDULERSTKSIZE 112 # else # error "no target defined" diff --git a/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h b/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h index 9f90ace987..d8fcf8edd0 100644 --- a/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h +++ b/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h @@ -121,7 +121,11 @@ used throughout the whole project. # define WORDS_STACK_SIZE 128 #endif -#define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4) +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) +# define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*1) +#else +# define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4) +#endif /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS. From 32f5b97aa756f7cd5e756413f73ad8501f0c9846 Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Tue, 30 Dec 2014 02:25:44 +0100 Subject: [PATCH 3/6] [DISCO_L053xx] wrong STDIO UART Correction of a wrong stdio uart - some tests failed because of this. --- .../hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h index 8761532795..6b544f1572 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/PeripheralNames.h @@ -52,7 +52,7 @@ typedef enum { #define STDIO_UART_TX PA_9 #define STDIO_UART_RX PA_10 -#define STDIO_UART UART_2 +#define STDIO_UART UART_1 typedef enum { SPI_1 = (int)SPI1_BASE, From ad6e208c7ef7279ee0b4b017385918d9fadc960f Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Tue, 30 Dec 2014 02:28:16 +0100 Subject: [PATCH 4/6] [DISCO_L053xx] RTC LSE/LSI problem The mcu STM32L053C8 seems to have a problem in the RCC - LSE hardware block. The Disco_L053 don't have a 32kHz crystal connected to LSE port pins in contrast to NUCLEO_L053. During initialization the HAL tests if it can start the LSE oscillator. The Flag LSERDY in RCC_CSR is set to 1 by RCC clock control when the oscillator runs stable. Without a crystal the flag shouldn't be set and the HAL trys to start the internal LSI oscillator. But the flag is always set to 1 also without a crystal. That's why the RTC doesn't start. --- .../hal/TARGET_STM/TARGET_DISCO_L053C8/rtc_api.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/rtc_api.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/rtc_api.c index 5ee468397f..4395fcd9f0 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/rtc_api.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_L053C8/rtc_api.c @@ -29,6 +29,14 @@ */ #include "rtc_api.h" +/* The mcu STM32L053C8 seems to have a problem in the RCC - LSE hardware block. The Disco_L053 don't have a 32kHz crystal connected to LSE port pins. + * During initialization the HAL tests if it can start the LSE oscillator. The Flag LSERDY in RCC_CSR should be set to 1 by RCC clock control when + * the oscillator runs stable. Without a crystal the flag shouldn't be set and the HAL trys to start the internal LSI oscillator. + * But the flag is also set to 1 without a crystal. That's why the RTC doesn't start. + * + */ +#define DONT_USE_LSE + #if DEVICE_RTC #include "mbed_error.h" @@ -61,12 +69,14 @@ void rtc_init(void) RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured! RCC_OscInitStruct.LSEState = RCC_LSE_ON; // External 32.768 kHz clock on OSC_IN/OSC_OUT +#ifndef DONT_USE_LSE if (HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK) { // Connect LSE to RTC __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSE); __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE); rtc_freq = LSE_VALUE; } else { +#endif // Enable LSI clock RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Mandatory, otherwise the PLL is reconfigured! @@ -79,8 +89,10 @@ void rtc_init(void) __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSI); __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI); // This value is LSI typical value. To be measured precisely using a timer input capture for example. - rtc_freq = 32000; + rtc_freq = 37000; +#ifndef DONT_USE_LSE } +#endif // Enable RTC __HAL_RCC_RTC_ENABLE(); From 11d7b0867ae37efe8286ba6ac8daa9ef67787c79 Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Tue, 30 Dec 2014 02:28:43 +0100 Subject: [PATCH 5/6] =?UTF-8?q?[DISCO=5FL053xx]=20exporter=20to=20=C2=B5Vi?= =?UTF-8?q?sion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workspace_tools/export/uvision4.py | 1 + .../export/uvision4_disco_l053c8.uvopt.tmpl | 208 +++++++++ .../export/uvision4_disco_l053c8.uvproj.tmpl | 438 ++++++++++++++++++ 3 files changed, 647 insertions(+) create mode 100644 workspace_tools/export/uvision4_disco_l053c8.uvopt.tmpl create mode 100644 workspace_tools/export/uvision4_disco_l053c8.uvproj.tmpl diff --git a/workspace_tools/export/uvision4.py b/workspace_tools/export/uvision4.py index 6592bbfaa7..6d2b09cdf1 100644 --- a/workspace_tools/export/uvision4.py +++ b/workspace_tools/export/uvision4.py @@ -59,6 +59,7 @@ class Uvision4(Exporter): 'ARCH_PRO', 'ARCH_BLE', 'DISCO_F407VG', + 'DISCO_L053C8', 'MTS_GAMBIT', 'ARCH_MAX', 'MTS_MDOT_F405RG', diff --git a/workspace_tools/export/uvision4_disco_l053c8.uvopt.tmpl b/workspace_tools/export/uvision4_disco_l053c8.uvopt.tmpl new file mode 100644 index 0000000000..36686cc10a --- /dev/null +++ b/workspace_tools/export/uvision4_disco_l053c8.uvopt.tmpl @@ -0,0 +1,208 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + mbed DISCO_L053C8 + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 0 + 1 + + + 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 + + 0 + + SARMCM3.DLL + -MPU + DARMCM1.DLL + -pCM0+ + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0+ + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 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)(1012=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + ULP2CM3 + -O207 -S8 -C0 -FO7 -F2000 -FN1 -FD20000000 -FF0STM32L0xx_64 -FL020000 -FS08000000 + + + 0 + ST-LINKIII-KEIL_SWO + -U-O207 -O207 -S8 -C0 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L0x_64 -FS08000000 -FL010000 + + + + + 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_disco_l053c8.uvproj.tmpl b/workspace_tools/export/uvision4_disco_l053c8.uvproj.tmpl new file mode 100644 index 0000000000..a78fdaf185 --- /dev/null +++ b/workspace_tools/export/uvision4_disco_l053c8.uvproj.tmpl @@ -0,0 +1,438 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + mbed DISCO_L053C8 + 0x4 + ARM-ADS + + + STM32L053C8 + STMicroelectronics + IRAM(0x20000000-0x20001FFF) IROM(0x8000000-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M0+") + + + ULP2CM3(-O207 -S8 -C0 -FO7 -FD20000000 -F2000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL020000) + 0 + + + + + + + + + + + + 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}}_DISCO_L053C8.bin build\{{name}}.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -MPU + DARMCM1.DLL + -pCM0+ + SARMCM3.DLL + -MPU + TARMCM1.DLL + -pCM0+ + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + 0 + 13 + + + + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\ULP2CM3.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 + 2 + 0 + 0 + + {% for flag in flags %}{{flag}} {% endfor %} + {% 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 + 0x08000000 + 0x20000000 + {{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 %} + + + + +
From b9bef6b06e5a76f7543b32b61f6fd679e58ea8c0 Mon Sep 17 00:00:00 2001 From: ohagendorf Date: Fri, 2 Jan 2015 14:52:39 +0100 Subject: [PATCH 6/6] [DISCO/NUCLEO_L053xx] adding to RTOS - part3 Reverting the DEFAULT_STACK_SIZE changes in cmsis.oh.h and adding changes to RTOS_x tests, to create threads with the neccessary reduced stack sizes for these targets. --- libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h | 6 +----- libraries/tests/rtos/mbed/basic/main.cpp | 13 ++++++++++++- libraries/tests/rtos/mbed/isr/main.cpp | 13 ++++++++++++- libraries/tests/rtos/mbed/mail/main.cpp | 13 ++++++++++++- libraries/tests/rtos/mbed/mutex/main.cpp | 15 +++++++++++++-- libraries/tests/rtos/mbed/queue/main.cpp | 13 ++++++++++++- libraries/tests/rtos/mbed/semaphore/main.cpp | 17 ++++++++++++++--- libraries/tests/rtos/mbed/signals/main.cpp | 13 ++++++++++++- 8 files changed, 88 insertions(+), 15 deletions(-) diff --git a/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h b/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h index d8fcf8edd0..9f90ace987 100644 --- a/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h +++ b/libraries/rtos/rtx/TARGET_CORTEX_M/cmsis_os.h @@ -121,11 +121,7 @@ used throughout the whole project. # define WORDS_STACK_SIZE 128 #endif -#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) -# define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*1) -#else -# define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4) -#endif +#define DEFAULT_STACK_SIZE (WORDS_STACK_SIZE*4) /// \note MUST REMAIN UNCHANGED: \b osFeature_xxx shall be consistent in every CMSIS-RTOS. diff --git a/libraries/tests/rtos/mbed/basic/main.cpp b/libraries/tests/rtos/mbed/basic/main.cpp index 8cd33bd692..f1cf79f573 100644 --- a/libraries/tests/rtos/mbed/basic/main.cpp +++ b/libraries/tests/rtos/mbed/basic/main.cpp @@ -1,6 +1,17 @@ #include "mbed.h" #include "rtos.h" +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) +#define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else +#define STACK_SIZE DEFAULT_STACK_SIZE +#endif + void print_char(char c = '*') { printf("%c", c); @@ -19,7 +30,7 @@ void led2_thread(void const *argument) { } int main() { - Thread thread(led2_thread); + Thread thread(led2_thread, NULL, osPriorityNormal, STACK_SIZE); while (true) { led1 = !led1; diff --git a/libraries/tests/rtos/mbed/isr/main.cpp b/libraries/tests/rtos/mbed/isr/main.cpp index 5b6b272f59..2855b7cede 100644 --- a/libraries/tests/rtos/mbed/isr/main.cpp +++ b/libraries/tests/rtos/mbed/isr/main.cpp @@ -7,6 +7,17 @@ #define QUEUE_PUT_ISR_VALUE 128 #define QUEUE_PUT_THREAD_VALUE 127 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + Queue queue; DigitalOut myled(LED1); @@ -25,7 +36,7 @@ void queue_thread(void const *argument) { } int main (void) { - Thread thread(queue_thread); + Thread thread(queue_thread, NULL, osPriorityNormal, STACK_SIZE); Ticker ticker; ticker.attach(queue_isr, 1.0); int isr_puts_counter = 0; diff --git a/libraries/tests/rtos/mbed/mail/main.cpp b/libraries/tests/rtos/mbed/mail/main.cpp index d1d9440f76..21aaf783bc 100644 --- a/libraries/tests/rtos/mbed/mail/main.cpp +++ b/libraries/tests/rtos/mbed/mail/main.cpp @@ -13,6 +13,17 @@ typedef struct { #define QUEUE_SIZE 16 #define QUEUE_PUT_DELAY 100 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + Mail mail_box; void send_thread (void const *argument) { @@ -29,7 +40,7 @@ void send_thread (void const *argument) { } int main (void) { - Thread thread(send_thread); + Thread thread(send_thread, NULL, osPriorityNormal, STACK_SIZE); bool result = true; int result_counter = 0; diff --git a/libraries/tests/rtos/mbed/mutex/main.cpp b/libraries/tests/rtos/mbed/mutex/main.cpp index 9983c4228c..7f8987800f 100644 --- a/libraries/tests/rtos/mbed/mutex/main.cpp +++ b/libraries/tests/rtos/mbed/mutex/main.cpp @@ -5,6 +5,17 @@ #define THREAD_DELAY 50 #define SIGNALS_TO_EMIT 100 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + void print_char(char c = '*') { printf("%c", c); @@ -52,8 +63,8 @@ int main() { const int t1_delay = THREAD_DELAY * 1; const int t2_delay = THREAD_DELAY * 2; const int t3_delay = THREAD_DELAY * 3; - Thread t2(test_thread, (void *)t2_delay); - Thread t3(test_thread, (void *)t3_delay); + Thread t2(test_thread, (void *)t2_delay, osPriorityNormal, STACK_SIZE); + Thread t3(test_thread, (void *)t3_delay, osPriorityNormal, STACK_SIZE); while (true) { // Thread 1 action diff --git a/libraries/tests/rtos/mbed/queue/main.cpp b/libraries/tests/rtos/mbed/queue/main.cpp index ec4e78ec77..cff0e071ff 100644 --- a/libraries/tests/rtos/mbed/queue/main.cpp +++ b/libraries/tests/rtos/mbed/queue/main.cpp @@ -13,6 +13,17 @@ typedef struct { #define QUEUE_SIZE 16 #define QUEUE_PUT_DELAY 100 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + MemoryPool mpool; Queue queue; @@ -31,7 +42,7 @@ void send_thread (void const *argument) { } int main (void) { - Thread thread(send_thread); + Thread thread(send_thread, NULL, osPriorityNormal, STACK_SIZE); bool result = true; int result_counter = 0; diff --git a/libraries/tests/rtos/mbed/semaphore/main.cpp b/libraries/tests/rtos/mbed/semaphore/main.cpp index 15cb8ce793..f474367303 100644 --- a/libraries/tests/rtos/mbed/semaphore/main.cpp +++ b/libraries/tests/rtos/mbed/semaphore/main.cpp @@ -6,6 +6,17 @@ #define SEMAPHORE_SLOTS 2 #define SEM_CHANGES 100 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + void print_char(char c = '*') { printf("%c", c); @@ -41,9 +52,9 @@ int main (void) { const int t1_delay = THREAD_DELAY * 1; const int t2_delay = THREAD_DELAY * 2; const int t3_delay = THREAD_DELAY * 3; - Thread t1(test_thread, (void *)t1_delay); - Thread t2(test_thread, (void *)t2_delay); - Thread t3(test_thread, (void *)t3_delay); + Thread t1(test_thread, (void *)t1_delay, osPriorityNormal, STACK_SIZE); + Thread t2(test_thread, (void *)t2_delay, osPriorityNormal, STACK_SIZE); + Thread t3(test_thread, (void *)t3_delay, osPriorityNormal, STACK_SIZE); while (true) { if (change_counter >= SEM_CHANGES or sem_defect == true) { diff --git a/libraries/tests/rtos/mbed/signals/main.cpp b/libraries/tests/rtos/mbed/signals/main.cpp index 6df01c1618..38c68daa26 100644 --- a/libraries/tests/rtos/mbed/signals/main.cpp +++ b/libraries/tests/rtos/mbed/signals/main.cpp @@ -6,6 +6,17 @@ #define SIGNAL_HANDLE_DELEY 25 #define SIGNAL_SET_VALUE 0x01 +/* + * The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and + * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes + * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize. + */ +#if defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) + #define STACK_SIZE DEFAULT_STACK_SIZE/4 +#else + #define STACK_SIZE DEFAULT_STACK_SIZE +#endif + DigitalOut led(LED1); volatile int signal_counter = 0; @@ -19,7 +30,7 @@ void led_thread(void const *argument) { } int main (void) { - Thread thread(led_thread); + Thread thread(led_thread, NULL, osPriorityNormal, STACK_SIZE); bool result = true; while (true) {