summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-10-06 09:57:26 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-07 01:29:33 +0000
commite541eeb2945ad81c8d89b343e2a70f8bce373fb5 (patch)
treedb8f602dad779aa8c48e99189ae85a7151420c83 /core
parentf0dc012cf75a02110f3ac98a4dbd1a395a70e794 (diff)
downloadchrome-ec-e541eeb2945ad81c8d89b343e2a70f8bce373fb5.tar.gz
cortex-m0: disallow rescheduling if task_start() has not yet run
Do not allow rescheduling tasks if task_start() has not been called. This fixes a bug in which if console input occurs between uart_init() and task_start(), the MCU crashes because uart_init() enables uart interrupts which attempts to wake up the console task when RX data is received, which then tries to task switch before we initialized task scheduling. BUG=chrome-os-partner:32561 BRANCH=samus TEST=add while(1) loop to adc_init() to simulate stalled ADC initialization. When stalled, send console character and observe that without this CL MCU crashes, and with this CL the MCU does not crash. Change-Id: I34418e88ebe0063acf1cc55ab5a57b5fddcd9d23 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221599 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m0/task.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 59a8e4d7d6..b30cab5c98 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -358,7 +358,8 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
/* The receiver might run again */
atomic_or(&tasks_ready, 1 << tskid);
#ifndef CONFIG_TASK_PROFILING
- need_resched_or_profiling = 1;
+ if (start_called)
+ need_resched_or_profiling = 1;
#endif
} else {
if (wait) {