1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

feat(core): implement wrapper for svc_shutdown

This commit is contained in:
Ondřej Vejpustek 2021-06-21 16:19:25 +02:00
parent 311288407e
commit 40b4f679f9
3 changed files with 17 additions and 0 deletions

View File

@ -354,6 +354,8 @@ SOURCE_TREZORHAL = [
'embed/trezorhal/vectortable.s',
]
CPPDEFINES_MOD += ['USE_SVC_SHUTDOWN']
if FEATURE_FLAGS["RDI"]:
CPPDEFINES_MOD += ['RDI']

View File

@ -25,6 +25,7 @@
#include "display.h"
#include "flash.h"
#include "rand.h"
#include "supervise.h"
#include "stm32f4xx_ll_utils.h"
@ -33,6 +34,18 @@ extern void shutdown_privileged(void);
#define COLOR_FATAL_ERROR RGB16(0x7F, 0x00, 0x00)
// from util.s
extern void shutdown_privileged(void);
void shutdown(void) {
#ifdef USE_SVC_SHUTDOWN
svc_shutdown();
#else
// It won't work properly unless called from the privileged mode
shutdown_privileged();
#endif
}
void __attribute__((noreturn))
__fatal_error(const char *expr, const char *msg, const char *file, int line,
const char *func) {

View File

@ -49,6 +49,8 @@
})
#endif
void shutdown(void);
void __attribute__((noreturn))
__fatal_error(const char *expr, const char *msg, const char *file, int line,
const char *func);