Skip to content

Commit

Permalink
links
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Dec 9, 2024
1 parent 5599ec8 commit 1200886
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 25 deletions.
48 changes: 24 additions & 24 deletions ports/nordic/common-hal/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
}

mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) {
mcu_reset_reason_t r = RESET_REASON_UNKNOWN;
if (reset_reason_saved == 0) {
r = RESET_REASON_POWER_ON;
} else if (reset_reason_saved & POWER_RESETREAS_RESETPIN_Msk) {
r = RESET_REASON_RESET_PIN;
} else if (reset_reason_saved & POWER_RESETREAS_DOG_Msk) {
r = RESET_REASON_WATCHDOG;
} else if (reset_reason_saved & POWER_RESETREAS_SREQ_Msk) {
r = RESET_REASON_SOFTWARE;
#if CIRCUITPY_ALARM
// Our "deep sleep" is still actually light sleep followed by a software
// reset. Adding this check here ensures we treat it as-if we're waking
// from deep sleep.
if (sleepmem_wakeup_event != SLEEPMEM_WAKEUP_BY_NONE) {
r = RESET_REASON_DEEP_SLEEP_ALARM;
}
#endif
} else if ((reset_reason_saved & POWER_RESETREAS_OFF_Msk) ||
(reset_reason_saved & POWER_RESETREAS_LPCOMP_Msk) ||
(reset_reason_saved & POWER_RESETREAS_NFC_Msk) ||
(reset_reason_saved & POWER_RESETREAS_VBUS_Msk)) {
r = RESET_REASON_DEEP_SLEEP_ALARM;
}
return r;
// mcu_reset_reason_t r = RESET_REASON_UNKNOWN;
// if (reset_reason_saved == 0) {
// r = RESET_REASON_POWER_ON;
// } else if (reset_reason_saved & POWER_RESETREAS_RESETPIN_Msk) {
// r = RESET_REASON_RESET_PIN;
// } else if (reset_reason_saved & POWER_RESETREAS_DOG_Msk) {
// r = RESET_REASON_WATCHDOG;
// } else if (reset_reason_saved & POWER_RESETREAS_SREQ_Msk) {
// r = RESET_REASON_SOFTWARE;
// #if CIRCUITPY_ALARM
// // Our "deep sleep" is still actually light sleep followed by a software
// // reset. Adding this check here ensures we treat it as-if we're waking
// // from deep sleep.
// if (sleepmem_wakeup_event != SLEEPMEM_WAKEUP_BY_NONE) {
// r = RESET_REASON_DEEP_SLEEP_ALARM;
// }
// #endif
// } else if ((reset_reason_saved & POWER_RESETREAS_OFF_Msk) ||
// (reset_reason_saved & POWER_RESETREAS_LPCOMP_Msk) ||
// (reset_reason_saved & POWER_RESETREAS_NFC_Msk) ||
// (reset_reason_saved & POWER_RESETREAS_VBUS_Msk)) {
// r = RESET_REASON_DEEP_SLEEP_ALARM;
// }
// return r;
}
13 changes: 12 additions & 1 deletion supervisor/zephyr/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ void reset_cpu(void) {
}
}

void reset_port(void);
void reset_port(void) {

}

void port_wake_main_task(void) {
}
Expand Down Expand Up @@ -63,6 +65,9 @@ uint32_t port_get_saved_word(void) {
return 0;
}

uint64_t port_get_raw_ticks(uint8_t *subticks) {
return 0;
}

// Enable 1/1024 second tick.
void port_enable_tick(void) {
Expand All @@ -74,6 +79,12 @@ void port_disable_tick(void) {

}

void port_interrupt_after_ticks(uint32_t ticks) {
}

void port_idle_until_interrupt(void) {
}

void *port_malloc(size_t size, bool dma_capable) {
void *block = k_malloc(size);
return block;
Expand Down
2 changes: 2 additions & 0 deletions tools/cpbuild/build_circuitpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ async def build_circuitpython():
circuitpython_flags.append(f"-DCIRCUITPY_USB_HOST={1 if usb_host else 0}")
circuitpython_flags.append(f'-DCIRCUITPY_BOARD_ID=\\"{board}\\"')
circuitpython_flags.append(f"-DCIRCUITPY_TUSB_MEM_ALIGN={tusb_mem_align}")
circuitpython_flags.append("-DINTERNAL_FLASH_FILESYSTEM")
circuitpython_flags.append('-DFFCONF_H=\\"lib/oofatfs/ffconf.h\\"')
circuitpython_flags.extend(("-I", srcdir))
circuitpython_flags.extend(("-I", srcdir / "lib/tinyusb/src"))
Expand Down Expand Up @@ -301,6 +302,7 @@ async def build_circuitpython():
source_files.append(srcdir / "shared/timeutils/timeutils.c")
source_files.append(srcdir / "shared-module/time/__init__.c")
source_files.append(srcdir / "shared-module/os/__init__.c")
source_files.append(srcdir / "shared-module/supervisor/__init__.c")

assembly_files = []
assembly_files.append(srcdir / "ports/nordic/supervisor/cpu.s")
Expand Down

0 comments on commit 1200886

Please sign in to comment.