Skip to content

Commit

Permalink
imxrt-multi: CM4_RUN_CORE returns EALREADY if core is running
Browse files Browse the repository at this point in the history
Useful when we need to run new code on an already running M4 core.
The error code EALREADY allows us to detect this situation, in which
case the new code should be started by resetting the M4 core.

DONE: NIL-441
  • Loading branch information
ziemleszcz committed Nov 15, 2024
1 parent 407a22e commit 27ddfed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions multi/imxrt-multi/cm4.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ static int runCore(unsigned int offset)
platformctl_t pctl;
unsigned int vectors = (unsigned int)CM4_MEMORY_START + offset;

if ((*(m4_common.src + src_scr) & 1) != 0) {
/* Core is already running */
return -EALREADY;
}

/* Set CM4's VTOR to the start of it's memory */
pctl.action = pctl_set;
pctl.type = pctl_iolpsrgpr;
Expand Down

0 comments on commit 27ddfed

Please sign in to comment.