mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2496 from openmv/rp2_build_fix
ports/rp2: Fix firmware.
This commit is contained in:
commit
38f629c650
@ -45,6 +45,7 @@
|
|||||||
#include "mpbthciport.h"
|
#include "mpbthciport.h"
|
||||||
#include "mpnetworkport.h"
|
#include "mpnetworkport.h"
|
||||||
#include "genhdr/mpversion.h"
|
#include "genhdr/mpversion.h"
|
||||||
|
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "pico/binary_info.h"
|
#include "pico/binary_info.h"
|
||||||
#include "pico/unique_id.h"
|
#include "pico/unique_id.h"
|
||||||
@ -53,6 +54,8 @@
|
|||||||
#include "hardware/regs/intctrl.h"
|
#include "hardware/regs/intctrl.h"
|
||||||
#include "hardware/structs/rosc.h"
|
#include "hardware/structs/rosc.h"
|
||||||
#include "pico/bootrom.h"
|
#include "pico/bootrom.h"
|
||||||
|
#include "pico/aon_timer.h"
|
||||||
|
#include "shared/timeutils/timeutils.h"
|
||||||
|
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "framebuffer.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) {
|
int main(int argc, char **argv) {
|
||||||
bool first_soft_reset = true;
|
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
|
#if MICROPY_HW_ENABLE_UART_REPL
|
||||||
bi_decl(bi_program_feature("UART REPL"))
|
bi_decl(bi_program_feature("UART REPL"))
|
||||||
setup_default_uart();
|
setup_default_uart();
|
||||||
@ -127,17 +143,9 @@ int main(int argc, char **argv) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Start and initialise the RTC
|
// Start and initialise the RTC
|
||||||
datetime_t t = {
|
struct timespec ts = { 0, 0 };
|
||||||
.year = 2021,
|
ts.tv_sec = timeutils_seconds_since_epoch(2021, 1, 1, 0, 0, 0);
|
||||||
.month = 1,
|
aon_timer_start(&ts);
|
||||||
.day = 1,
|
|
||||||
.dotw = 4, // 0 is Monday, so 4 is Friday
|
|
||||||
.hour = 0,
|
|
||||||
.min = 0,
|
|
||||||
.sec = 0,
|
|
||||||
};
|
|
||||||
rtc_init();
|
|
||||||
rtc_set_datetime(&t);
|
|
||||||
mp_hal_time_ns_set_from_rtc();
|
mp_hal_time_ns_set_from_rtc();
|
||||||
|
|
||||||
// Set board unique ID from flash for USB debugging.
|
// Set board unique ID from flash for USB debugging.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user