summaryrefslogtreecommitdiff
path: root/core/cortex-m/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/cortex-m/timer.c')
-rw-r--r--core/cortex-m/timer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/cortex-m/timer.c b/core/cortex-m/timer.c
index 14e59c900f..994f9c1245 100644
--- a/core/cortex-m/timer.c
+++ b/core/cortex-m/timer.c
@@ -138,6 +138,13 @@ int timer_cancel(task_id_t tskid)
void usleep(unsigned us)
{
uint32_t evt = 0;
+
+ /* If task scheduling has not started, just delay */
+ if (!task_start_called()) {
+ udelay(us);
+ return;
+ }
+
ASSERT(us);
do {
evt |= task_wait_event(us);