9 years, 8 months ago.

RTOS on ST Nucleo L152RE - supported devices

Hi,

Is the F103RB STM board supported with for RTOS? Tried to add the rtos to my project and it fails with

  1. error directive: "no target defined".

This is the same error as discussed here: https://mbed.org/questions/4216/I-Get-This-Exact-Error-While-Compiling-f/.

Will ST support rtos for this board?

thanks

Question relating to:

Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard. cmsis, rtos, RTX

Hi J.N. I will try to make a port of mbed-RTOS for ST Nucleo-F103RB board later when I have spare time. Once the testing is done, I will let you know, and will post the ported code on mbed.

Stanly.

posted by Stanly Chen 13 Sep 2014

1 Answer

9 years, 8 months ago.

Hello J.N., Please modify mdeb-rtos: RTX_Conf_CM.c, and RTX_CM_Lib.h, below is the example for adding support STM32L151. Inmport Modified mbed-rtos for STM32L151:

Import librarymbed-rtos

Add support new target: ST Nucleo-L152RE Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.

Modified RTX_Conf_CM.c: /media/uploads/stanly88/rtx_conf_cm.c

RTX_Conf_CM.c

#ifndef OS_TASKCNT
#  if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347)
#    define OS_TASKCNT         14
#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1114) || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_NUCLEO_L152RE)
#    define OS_TASKCNT         6
#  elif defined(TARGET_STM32L151RB) || defined(TARGET_STM32L151RBA) || defined(TARGET_STM32L151R8)
#    define OS_TASKCNT         12
#  endif
#endif

//   <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4>
#ifndef OS_SCHEDULERSTKSIZE
#  if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC1347)
#      define OS_SCHEDULERSTKSIZE    256
#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1114) || defined(TARGET_LPC812) || defined(TARGET_KL25Z) || defined(TARGET_NUCLEO_L152RE)
#      define OS_SCHEDULERSTKSIZE    128
#  elif defined(TARGET_STM32L151RB) || defined(TARGET_STM32L151RBA) || defined(TARGET_STM32L151R8)
#      define OS_SCHEDULERSTKSIZE    128
#  endif
#endif

// </h>
// <h>SysTick Timer Configuration
// ==============================
//
//   <o>Timer clock value [Hz] <1-1000000000>
//   <i> Defines the timer clock value.
//   <i> Default: 6000000  (6MHz)
#ifndef OS_CLOCK
#  if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
#    define OS_CLOCK       96000000

#  elif defined(TARGET_LPC1347)
#    define OS_CLOCK       72000000

#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401) || defined(TARGET_LPC1114) || defined(TARGET_KL25Z)
#    define OS_CLOCK       48000000
#
#  elif defined(TARGET_LPC812)
#    define OS_CLOCK       36000000
#
#  elif defined(TARGET_LPC4088)
#    define OS_CLOCK       120000000
#
#  elif defined(TARGET_NUCLEO_L152RE)
#    define OS_CLOCK        32000000

#  elif defined(TARGET_STM32L151RB) || defined(TARGET_STM32L151RBA) || defined(TARGET_STM32L151R8)
#    define OS_CLOCK        32000000
#  endif
#endif

Modified RTX_CM_Lib.h: /media/uploads/stanly88/rtx_cm_lib.h

RTX_CM_Lib.h

// This define should be probably moved to the CMSIS layer
#ifdef TARGET_LPC1768
#define INITIAL_SP            (0x10008000UL)

#elif defined(TARGET_LPC11U24)
#define INITIAL_SP            (0x10002000UL)

#elif defined(TARGET_LPC11U35_401)
#define INITIAL_SP            (0x10002000UL)

#elif defined(TARGET_LPC1114)
#define INITIAL_SP            (0x10001000UL)

#elif defined(TARGET_LPC812)
#define INITIAL_SP            (0x10001000UL)

#elif defined(TARGET_KL25Z)
#define INITIAL_SP            (0x20003000UL)

#elif defined(TARGET_LPC4088)
#define INITIAL_SP            (0x10010000UL)

#elif defined(TARGET_LPC1347)
#define INITIAL_SP            (0x10002000UL)

#elif defined(TARGET_NUCLEO_L152RE)
#define INITIAL_SP            (0x20004000UL)

#elif defined(TARGET_STM32L151R8)
#define INITIAL_SP            (0x20002800UL)

#elif defined(TARGET_STM32L151RB)
#define INITIAL_SP            (0x20004000UL)

#elif defined(TARGET_STM32L151RBA)
#define INITIAL_SP            (0x20008000UL)

#endif

If you need further help, please let me know.

Stanly

Accepted Answer

thanks,

it does compile, but there seems to be some othe glitch elsewhere. main runs, but the other threads won't.

as far as i can live without rtos until i do some circuitry, i hope st manage to put official nucleo rtos support there. Peter Drescher mentioned 5 months ago there is not official rtos for nuclo out yet http://mbed.org/questions/3106/multitaskingthreading/ . hopefully they are working on it.

--

i've included library you forked with ST Nucleo-L152RE support http://mbed.org/users/stanly88/code/mbed-rtos/file/2305dcd0c72e/rtos won't compile as there is an error.h is missing - now error.h is named mbed_error.h i've replaced in the lib locally, also checked RTX_Conf.h for TARGET_NUCLEO_L152RE OS_TASKCNT, ok OS_SCHEDULERSTKSIZE, ok OS_CLOCK, ok OS_SCHEDULERSTKSIZE, added it there with OS_SCHEDULERSTKSIZE 128

and then checked RTX_CM_lib.h for TARGET_NUCLEO_L152RE INITIAL_SP, ok

ie.

  1. include "mbed.h"
  2. include "rtos.h"

int foo_foo;

void lcd_redraw_wrapper(void const *args) {

while(true) {

foo_foo++; Thread::wait(500);

}

}

int main(void) { Thread thread_lcd_redraw_wrapper(lcd_redraw_wrapper); while(true) { printf("foo_foo: %d", foo_foo); } }

posted by j. n. 07 Sep 2014