mirror of https://github.com/ARMmbed/mbed-os.git
[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.pull/818/head
parent
11d7b0867a
commit
b9bef6b06e
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<uint32_t, QUEUE_SIZE> 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;
|
||||
|
|
|
@ -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_t, QUEUE_SIZE> 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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<message_t, QUEUE_SIZE> mpool;
|
||||
Queue<message_t, QUEUE_SIZE> 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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue