Skip to content

Commit eab5558

Browse files
committed
Return immediately in main_entry if UVISOR_DISABLED
This ensures that applications can run in debug mode with uVisor disabled. Semihosting is still a requirement for applications that run with uVisor enabled.
1 parent 54fe069 commit eab5558

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/system/src/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ UVISOR_NOINLINE void uvisor_init_post(void)
5858

5959
void main_entry(void)
6060
{
61+
/* Return immediately if the magic is invalid or uVisor is disabled.
62+
* This ensures that no uVisor feature that could halt the system is
63+
* active in disabled mode (for example, printing debug messages to the
64+
* semihosting port). */
65+
if (__uvisor_config.magic != UVISOR_MAGIC || !__uvisor_config.mode || *(__uvisor_config.mode) == 0) {
66+
return;
67+
}
68+
6169
/* initialize uvisor */
6270
uvisor_init_pre();
6371

0 commit comments

Comments
 (0)