ports/rp2: Fix firmware.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
iabdalkader 2024-11-12 10:48:11 +01:00
parent 1855cd2f50
commit d17bafd1fa

View File

@ -45,6 +45,7 @@
#include "mpbthciport.h"
#include "mpnetworkport.h"
#include "genhdr/mpversion.h"
#include "pico/stdlib.h"
#include "pico/binary_info.h"
#include "pico/unique_id.h"
@ -53,6 +54,8 @@
#include "hardware/regs/intctrl.h"
#include "hardware/structs/rosc.h"
#include "pico/bootrom.h"
#include "pico/aon_timer.h"
#include "shared/timeutils/timeutils.h"
#include "omv_boardconfig.h"
#include "framebuffer.h"
@ -107,6 +110,19 @@ void pico_reset_to_bootloader(size_t n_args, const void *args_in) {
int main(int argc, char **argv) {
bool first_soft_reset = true;
// This is a tickless port, interrupts should always trigger SEV.
#if PICO_ARM
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
#endif
soft_timer_init();
// Set the MCU frequency and as a side effect the peripheral clock to 48 MHz.
set_sys_clock_khz(SYS_CLK_KHZ, false);
// Hook for setting up anything that needs to be super early in the bootup process.
MICROPY_BOARD_STARTUP();
#if MICROPY_HW_ENABLE_UART_REPL
bi_decl(bi_program_feature("UART REPL"))
setup_default_uart();
@ -127,17 +143,9 @@ int main(int argc, char **argv) {
#endif
// Start and initialise the RTC
datetime_t t = {
.year = 2021,
.month = 1,
.day = 1,
.dotw = 4, // 0 is Monday, so 4 is Friday
.hour = 0,
.min = 0,
.sec = 0,
};
rtc_init();
rtc_set_datetime(&t);
struct timespec ts = { 0, 0 };
ts.tv_sec = timeutils_seconds_since_epoch(2021, 1, 1, 0, 0, 0);
aon_timer_start(&ts);
mp_hal_time_ns_set_from_rtc();
// Set board unique ID from flash for USB debugging.