Skip to content

Commit 2f85a19

Browse files
committed
alif/modmachine: Implement machine.unique_id(), fix machine.reset().
They both use SE services. Signed-off-by: Damien George <damien@micropython.org>
1 parent 2a580b0 commit 2f85a19

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ports/alif/modmachine.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
// This file is never compiled standalone, it's included directly from
2828
// extmod/modmachine.c via MICROPY_PY_MACHINE_INCLUDEFILE.
2929

30+
#include "se_services.h"
31+
3032
#define MICROPY_PY_MACHINE_EXTRA_GLOBALS \
3133
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, \
3234
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&machine_timer_type) }, \
@@ -36,11 +38,13 @@ static void mp_machine_idle(void) {
3638
}
3739

3840
static mp_obj_t mp_machine_unique_id(void) {
39-
return mp_obj_new_bytes((const uint8_t *)"ABCD", 4);
41+
uint8_t id[5];
42+
se_services_get_unique_id(id);
43+
return mp_obj_new_bytes(id, sizeof(id));
4044
}
4145

4246
NORETURN static void mp_machine_reset(void) {
43-
NVIC_SystemReset();
47+
se_services_reset_soc();
4448
}
4549

4650
NORETURN void mp_machine_bootloader(size_t n_args, const mp_obj_t *args) {

0 commit comments

Comments
 (0)