Skip to content

Commit a93542b

Browse files
authored
Merge pull request #10683 from OpenNuvoton/nuvoton_wait-ns_weak
Export wait_ns to be overridable
2 parents 752101d + e9885fe commit a93542b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

platform/mbed_wait_api_no_rtos.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ static const uint16_t delay_loop_code[] = {
112112
/* Take the address of the code, set LSB to indicate Thumb, and cast to void() function pointer */
113113
#define delay_loop ((void(*)()) ((uintptr_t) delay_loop_code | 1))
114114

115-
void wait_ns(unsigned int ns)
115+
/* Some targets may not provide zero-wait-state flash performance. Export this function
116+
* to be overridable for targets to provide more accurate implementation like locating
117+
* 'delay_loop_code' in SRAM. */
118+
MBED_WEAK void wait_ns(unsigned int ns)
116119
{
117120
uint32_t cycles_per_us = SystemCoreClock / 1000000;
118121
// Note that this very calculation, plus call overhead, will take multiple

0 commit comments

Comments
 (0)