Skip to content

Commit 0ea74f2

Browse files
committed
RTX2: Fix RTX config override
1 parent 2317ddf commit 0ea74f2

File tree

24 files changed

+67
-477
lines changed

24 files changed

+67
-477
lines changed

TESTS/mbedmicro-rtos-mbed/basic/main.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@
66
#error [NOT_SUPPORTED] test not supported
77
#endif
88

9-
/*
10-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
11-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
12-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
13-
*/
14-
#if defined(TARGET_STM32F070RB) && defined(TOOLCHAIN_GCC)
15-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
16-
#elif (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
17-
#define STACK_SIZE 512
18-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
19-
#define STACK_SIZE 768
20-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
21-
#define STACK_SIZE 1536
22-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
23-
#define STACK_SIZE 768
24-
#elif defined(TARGET_XDOT_L151CC)
25-
#define STACK_SIZE 1024
26-
#else
27-
#define STACK_SIZE DEFAULT_STACK_SIZE
28-
#endif
29-
309
#define SIGNAL_PRINT_TICK 0x01
3110

3211
DigitalOut led1(LED1);
@@ -44,7 +23,7 @@ void print_tick_thread() {
4423
int main() {
4524
GREENTEA_SETUP(total_ticks + 5, "timing_drift_auto");
4625

47-
Thread tick_thread(osPriorityNormal, STACK_SIZE);
26+
Thread tick_thread(osPriorityNormal);
4827
tick_thread.start(print_tick_thread);
4928

5029
for (int i = 0; i <= total_ticks; i++) {

TESTS/mbedmicro-rtos-mbed/isr/main.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,6 @@
1111
#define QUEUE_PUT_ISR_VALUE 128
1212
#define QUEUE_PUT_THREAD_VALUE 127
1313

14-
/*
15-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
16-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
17-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
18-
*/
19-
#if (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
20-
#define STACK_SIZE 512
21-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
22-
#define STACK_SIZE 768
23-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
24-
#define STACK_SIZE 1536
25-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
26-
#define STACK_SIZE 768
27-
#elif defined(TARGET_XDOT_L151CC)
28-
#define STACK_SIZE 1024
29-
#else
30-
#define STACK_SIZE DEFAULT_STACK_SIZE
31-
#endif
32-
3314
Queue<uint32_t, QUEUE_SIZE> queue;
3415

3516
DigitalOut myled(LED1);
@@ -50,7 +31,7 @@ void queue_thread(void const *argument) {
5031
int main (void) {
5132
GREENTEA_SETUP(20, "default_auto");
5233

53-
Thread thread(queue_thread, NULL, osPriorityNormal, STACK_SIZE);
34+
Thread thread(queue_thread, NULL, osPriorityNormal);
5435
Ticker ticker;
5536
ticker.attach(queue_isr, 1.0);
5637
int isr_puts_counter = 0;

TESTS/mbedmicro-rtos-mbed/mutex/main.cpp

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,6 @@
99
#define THREAD_DELAY 50
1010
#define SIGNALS_TO_EMIT 100
1111

12-
/*
13-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
14-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
15-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
16-
*/
17-
#if defined(TARGET_STM32F334R8) && defined(TOOLCHAIN_IAR)
18-
#define STACK_SIZE DEFAULT_STACK_SIZE/4
19-
#elif defined(TARGET_STM32F070RB)
20-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
21-
#elif defined(TARGET_STM32F072RB)
22-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
23-
#elif defined(TARGET_STM32F302R8) && defined(TOOLCHAIN_IAR)
24-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
25-
#elif defined(TARGET_STM32F303K8) && defined(TOOLCHAIN_IAR)
26-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
27-
#elif defined(TARGET_STM32L073RZ)
28-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
29-
#elif (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
30-
#define STACK_SIZE 512
31-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
32-
#define STACK_SIZE 768
33-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
34-
#define STACK_SIZE 1536
35-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
36-
#define STACK_SIZE 1024
37-
#elif defined(TARGET_XDOT_L151CC)
38-
#define STACK_SIZE 1024
39-
#else
40-
#define STACK_SIZE DEFAULT_STACK_SIZE
41-
#endif
42-
4312
void print_char(char c = '*') {
4413
printf("%c", c);
4514
fflush(stdout);
@@ -88,8 +57,8 @@ int main() {
8857
const int t1_delay = THREAD_DELAY * 1;
8958
const int t2_delay = THREAD_DELAY * 2;
9059
const int t3_delay = THREAD_DELAY * 3;
91-
Thread t2(test_thread, (void *)t2_delay, osPriorityNormal, STACK_SIZE);
92-
Thread t3(test_thread, (void *)t3_delay, osPriorityNormal, STACK_SIZE);
60+
Thread t2(test_thread, (void *)t2_delay, osPriorityNormal);
61+
Thread t3(test_thread, (void *)t3_delay, osPriorityNormal);
9362

9463
while (true) {
9564
// Thread 1 action

TESTS/mbedmicro-rtos-mbed/queue/main.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,6 @@ typedef struct {
1717
#define QUEUE_SIZE 16
1818
#define QUEUE_PUT_DELAY 100
1919

20-
/*
21-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
22-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
23-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
24-
*/
25-
#if (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
26-
#define STACK_SIZE 512
27-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
28-
#define STACK_SIZE 768
29-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
30-
#define STACK_SIZE 1536
31-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
32-
#define STACK_SIZE 768
33-
#elif defined(TARGET_XDOT_L151CC)
34-
#define STACK_SIZE 1024
35-
#else
36-
#define STACK_SIZE DEFAULT_STACK_SIZE
37-
#endif
38-
3920
MemoryPool<message_t, QUEUE_SIZE> mpool;
4021
Queue<message_t, QUEUE_SIZE> queue;
4122

@@ -56,7 +37,7 @@ void send_thread (void const *argument) {
5637
int main (void) {
5738
GREENTEA_SETUP(20, "default_auto");
5839

59-
Thread thread(send_thread, NULL, osPriorityNormal, STACK_SIZE);
40+
Thread thread(send_thread, NULL, osPriorityNormal);
6041
bool result = true;
6142
int result_counter = 0;
6243

TESTS/mbedmicro-rtos-mbed/semaphore/main.cpp

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,6 @@
1010
#define SEMAPHORE_SLOTS 2
1111
#define SEM_CHANGES 100
1212

13-
/*
14-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
15-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
16-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
17-
*/
18-
#if defined(TARGET_STM32F334R8) && (defined(TOOLCHAIN_GCC) || defined(TOOLCHAIN_IAR))
19-
#define STACK_SIZE DEFAULT_STACK_SIZE/4
20-
#elif defined(TARGET_STM32F103RB)
21-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
22-
#elif defined(TARGET_STM32F070RB)
23-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
24-
#elif defined(TARGET_STM32F072RB)
25-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
26-
#elif defined(TARGET_STM32F302R8) && defined(TOOLCHAIN_IAR)
27-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
28-
#elif defined(TARGET_STM32L073RZ)
29-
#define STACK_SIZE DEFAULT_STACK_SIZE/2
30-
#elif defined(TARGET_STM32F303K8) && defined(TOOLCHAIN_IAR)
31-
#define STACK_SIZE DEFAULT_STACK_SIZE/4
32-
#elif (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
33-
#define STACK_SIZE 512
34-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
35-
#define STACK_SIZE 768
36-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
37-
#define STACK_SIZE 1536
38-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
39-
#define STACK_SIZE 768
40-
#elif defined(TARGET_XDOT_L151CC)
41-
#define STACK_SIZE 1024
42-
#else
43-
#define STACK_SIZE DEFAULT_STACK_SIZE
44-
#endif
45-
4613
void print_char(char c = '*') {
4714
printf("%c", c);
4815
fflush(stdout);
@@ -79,9 +46,9 @@ int main (void) {
7946
const int t1_delay = THREAD_DELAY * 1;
8047
const int t2_delay = THREAD_DELAY * 2;
8148
const int t3_delay = THREAD_DELAY * 3;
82-
Thread t1(test_thread, (void *)t1_delay, osPriorityNormal, STACK_SIZE);
83-
Thread t2(test_thread, (void *)t2_delay, osPriorityNormal, STACK_SIZE);
84-
Thread t3(test_thread, (void *)t3_delay, osPriorityNormal, STACK_SIZE);
49+
Thread t1(test_thread, (void *)t1_delay, osPriorityNormal);
50+
Thread t2(test_thread, (void *)t2_delay, osPriorityNormal);
51+
Thread t3(test_thread, (void *)t3_delay, osPriorityNormal);
8552

8653
while (true) {
8754
if (change_counter >= SEM_CHANGES or sem_defect == true) {

TESTS/mbedmicro-rtos-mbed/signals/main.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@
1010
const int SIGNALS_TO_EMIT = 100;
1111
const int SIGNAL_HANDLE_DELEY = 25;
1212

13-
/*
14-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
15-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
16-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
17-
*/
18-
#if (defined(TARGET_EFM32HG_STK3400)) && !defined(TOOLCHAIN_ARM_MICRO)
19-
#define STACK_SIZE 512
20-
#elif (defined(TARGET_EFM32LG_STK3600) || defined(TARGET_EFM32WG_STK3800) || defined(TARGET_EFM32PG_STK3401)) && !defined(TOOLCHAIN_ARM_MICRO)
21-
#define STACK_SIZE 768
22-
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
23-
#define STACK_SIZE 1536
24-
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
25-
#define STACK_SIZE 768
26-
#elif defined(TARGET_XDOT_L151CC)
27-
#define STACK_SIZE 1024
28-
#else
29-
#define STACK_SIZE DEFAULT_STACK_SIZE
30-
#endif
31-
3213
DigitalOut led(LED1);
3314
int signal_counter = 0;
3415

@@ -44,7 +25,7 @@ void led_thread(void const *argument) {
4425
int main (void) {
4526
GREENTEA_SETUP(20, "default_auto");
4627

47-
Thread thread(led_thread, NULL, osPriorityNormal, STACK_SIZE);
28+
Thread thread(led_thread, NULL, osPriorityNormal);
4829
bool result = false;
4930

5031
printf("Handling %d signals...\r\n", SIGNALS_TO_EMIT);

TESTS/mbedmicro-rtos-mbed/threads/main.cpp

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,6 @@
1010
#error [NOT_SUPPORTED] test not supported
1111
#endif
1212

13-
/*
14-
* The stack size is defined in cmsis_os.h mainly dependent on the underlying toolchain and
15-
* the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
16-
* and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
17-
*/
18-
#if defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
19-
#define STACK_SIZE 512
20-
#elif defined(TARGET_STM32F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F103RB) || defined(TARGET_STM32F091RC)
21-
#define STACK_SIZE 512
22-
#elif defined(TARGET_STM32F410RB)
23-
#define STACK_SIZE 512
24-
#elif defined(TARGET_STM32L073RZ)
25-
#define STACK_SIZE 512
26-
#elif defined(TARGET_XDOT_L151CC)
27-
#define STACK_SIZE 1024
28-
#elif defined(TARGET_HI2110)
29-
#define STACK_SIZE 512
30-
#else
31-
#define STACK_SIZE DEFAULT_STACK_SIZE
32-
#endif
33-
3413
using namespace utest::v1;
3514

3615
// The counter type used accross all the tests
@@ -53,7 +32,7 @@ void increment_with_wait(counter_t* counter) {
5332
}
5433

5534
void increment_with_child(counter_t* counter) {
56-
Thread child(osPriorityNormal, STACK_SIZE);
35+
Thread child(osPriorityNormal);
5736
child.start(mbed::callback(increment, counter));
5837
child.join();
5938
}
@@ -63,7 +42,7 @@ void increment_with_murder(counter_t* counter) {
6342
// take ownership of the counter mutex so it prevent the child to
6443
// modify counter.
6544
LockGuard lock(counter->internal_mutex());
66-
Thread child(osPriorityNormal, STACK_SIZE);
45+
Thread child(osPriorityNormal);
6746
child.start(mbed::callback(increment, counter));
6847
child.terminate();
6948
}
@@ -81,7 +60,7 @@ void self_terminate(Thread *self) {
8160
template <void (*F)(counter_t *)>
8261
void test_single_thread() {
8362
counter_t counter(0);
84-
Thread thread(osPriorityNormal, STACK_SIZE);
63+
Thread thread(osPriorityNormal);
8564
thread.start(mbed::callback(F, &counter));
8665
thread.join();
8766
TEST_ASSERT_EQUAL(counter, 1);
@@ -93,7 +72,7 @@ void test_parallel_threads() {
9372
Thread *threads[N];
9473

9574
for (int i = 0; i < N; i++) {
96-
threads[i] = new Thread(osPriorityNormal, STACK_SIZE);
75+
threads[i] = new Thread(osPriorityNormal);
9776
threads[i]->start(mbed::callback(F, &counter));
9877
}
9978

@@ -110,7 +89,7 @@ void test_serial_threads() {
11089
counter_t counter(0);
11190

11291
for (int i = 0; i < N; i++) {
113-
Thread thread(osPriorityNormal, STACK_SIZE);
92+
Thread thread(osPriorityNormal);
11493
thread.start(mbed::callback(F, &counter));
11594
thread.join();
11695
}
@@ -119,7 +98,7 @@ void test_serial_threads() {
11998
}
12099

121100
void test_self_terminate() {
122-
Thread *thread = new Thread(osPriorityNormal, STACK_SIZE);
101+
Thread *thread = new Thread(osPriorityNormal);
123102
thread->start(mbed::callback(self_terminate, thread));
124103
thread->join();
125104
delete thread;

features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/sys_arch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef struct {
8383
typedef sys_thread_data_t* sys_thread_t;
8484

8585
#define SYS_THREAD_POOL_N 6
86-
#define SYS_DEFAULT_THREAD_STACK_DEPTH DEFAULT_STACK_SIZE
86+
#define SYS_DEFAULT_THREAD_STACK_DEPTH OS_STACK_SIZE
8787

8888
// === PROTECTION ===
8989
typedef int sys_prot_t;

platform/mbed_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ osMutexAttr_t env_mutex_attr;
3434

3535

3636
osThreadAttr_t _main_thread_attr;
37-
char _main_stack[DEFAULT_STACK_SIZE] __ALIGNED(8);
37+
char _main_stack[4096] __ALIGNED(8);
3838
char _main_obj[sizeof(os_thread_t)];
3939

4040
static void mbed_cpy_nvic(void)

0 commit comments

Comments
 (0)