File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
mbed_hal/stack_size_unification
targets/TARGET_NUVOTON/TARGET_NANO100/device/StdDriver Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,16 @@ using namespace utest::v1;
34
34
// (for more details about EVENTS_EVENT_SIZE see EventQueue constructor)
35
35
#define TEST_EQUEUE_SIZE (18 *EVENTS_EVENT_SIZE)
36
36
37
+ // By empirical, we take 80MHz CPU/2ms delay as base tolerance for time left test.
38
+ // For higher CPU frequency, tolerance is fixed to 2ms.
39
+ // For lower CPU frequency, tolerance is inversely proportional to CPU frequency.
40
+ // E.g.:
41
+ // 100MHz: 2ms
42
+ // 80MHz: 2ms
43
+ // 64MHz: 3ms
44
+ // 48MHz: 4ms
45
+ #define ALLOWED_TIME_LEFT_TOLERANCE_MS ((SystemCoreClock >= 80000000 ) ? 2 : ((80000000 * 2 + SystemCoreClock - 1 ) / SystemCoreClock))
46
+
37
47
// flag for called
38
48
volatile bool touched = false ;
39
49
@@ -283,7 +293,7 @@ int timeleft_events[2];
283
293
void check_time_left (EventQueue *queue, int index, int expected)
284
294
{
285
295
const int event_id = timeleft_events[index];
286
- TEST_ASSERT_INT_WITHIN (2 , expected, queue->time_left (event_id));
296
+ TEST_ASSERT_INT_WITHIN (ALLOWED_TIME_LEFT_TOLERANCE_MS , expected, queue->time_left (event_id));
287
297
touched = true ;
288
298
}
289
299
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ extern uint32_t mbed_stack_isr_size;
40
40
#define EXPECTED_ISR_STACK_SIZE (1024 )
41
41
#endif
42
42
43
- #if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_NANO100) || defined( TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
43
+ #if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
44
44
#define EXPECTED_MAIN_THREAD_STACK_SIZE (3072 )
45
45
#else
46
46
#define EXPECTED_MAIN_THREAD_STACK_SIZE (4096 )
Original file line number Diff line number Diff line change @@ -613,7 +613,7 @@ uint32_t CLK_WaitClockReady(uint32_t u32ClkMask)
613
613
{
614
614
int32_t i32TimeOutCnt ;
615
615
616
- i32TimeOutCnt = __HSI / 200 ; /* About 5ms */
616
+ i32TimeOutCnt = __HSI / 20 ; /* About 50ms */
617
617
618
618
while ((CLK -> CLKSTATUS & u32ClkMask ) != u32ClkMask ) {
619
619
if (i32TimeOutCnt -- <= 0 )
You can’t perform that action at this time.
0 commit comments