1515 * the C standard library. For GCC, ARM_STD and IAR it is defined with a size of 2048 bytes
1616 * and for ARM_MICRO 512. Because of reduce RAM size some targets need a reduced stacksize.
1717 */
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- #elif defined(TARGET_EFR32)
31- #define STACK_SIZE 512
32- #else
33- #define STACK_SIZE DEFAULT_STACK_SIZE
34- #endif
18+ #define PARALLEL_STACK_SIZE 512
3519
3620using namespace utest ::v1;
3721
@@ -55,7 +39,7 @@ void increment_with_wait(counter_t* counter) {
5539}
5640
5741void increment_with_child (counter_t * counter) {
58- Thread child (counter, increment, osPriorityNormal, STACK_SIZE );
42+ Thread child (counter, increment);
5943 child.join ();
6044}
6145
@@ -64,7 +48,7 @@ void increment_with_murder(counter_t* counter) {
6448 // take ownership of the counter mutex so it prevent the child to
6549 // modify counter.
6650 LockGuard lock (counter->internal_mutex ());
67- Thread child (counter, increment, osPriorityNormal, STACK_SIZE );
51+ Thread child (counter, increment);
6852 child.terminate ();
6953 }
7054
@@ -81,7 +65,7 @@ void self_terminate(Thread *self) {
8165template <void (*F)(counter_t *)>
8266void test_single_thread () {
8367 counter_t counter (0 );
84- Thread thread (&counter, F, osPriorityNormal, STACK_SIZE );
68+ Thread thread (&counter, F);
8569 thread.join ();
8670 TEST_ASSERT_EQUAL (counter, 1 );
8771}
@@ -92,7 +76,7 @@ void test_parallel_threads() {
9276 Thread *threads[N];
9377
9478 for (int i = 0 ; i < N; i++) {
95- threads[i] = new Thread (&counter, F, osPriorityNormal, STACK_SIZE );
79+ threads[i] = new Thread (&counter, F, osPriorityNormal, PARALLEL_STACK_SIZE );
9680 }
9781
9882 for (int i = 0 ; i < N; i++) {
@@ -108,15 +92,15 @@ void test_serial_threads() {
10892 counter_t counter (0 );
10993
11094 for (int i = 0 ; i < N; i++) {
111- Thread thread (&counter, F, osPriorityNormal, STACK_SIZE );
95+ Thread thread (&counter, F);
11296 thread.join ();
11397 }
11498
11599 TEST_ASSERT_EQUAL (counter, N);
116100}
117101
118102void test_self_terminate () {
119- Thread *thread = new Thread (osPriorityNormal, STACK_SIZE );
103+ Thread *thread = new Thread (osPriorityNormal);
120104 thread->start (thread, self_terminate);
121105 thread->join ();
122106 delete thread;
0 commit comments