Skip to content

Commit 8b5bb18

Browse files
committed
Fix compile issue after merging.
1 parent cd7e83b commit 8b5bb18

4 files changed

Lines changed: 55 additions & 2 deletions

File tree

src/fw/drivers/sf32lb/stubs/rtc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ RtcTicks rtc_get_ticks(void) {
5959
// TODO
6060
RtcTicks rtc_interval_ticks = 1;
6161

62+
if (ints_enabled) {
63+
__enable_irq();
64+
}
65+
6266
return s_coarse_ticks + rtc_interval_ticks;
6367
}
6468

src/fw/drivers/task_watchdog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ static uint8_t s_ticks_since_successful_feed = 0;
8282
#if MICRO_FAMILY_NRF5
8383
#define WATCHDOG_FREERTOS_IRQn EGU5_SWI5_IRQn
8484
#define WATCHDOG_FREERTOS_IRQHandler EGU5_SWI5_IRQHandler
85+
#elif MICRO_FAMILY_SF32LB
86+
#define WATCHDOG_FREERTOS_IRQn 2
87+
#define WATCHDOG_FREERTOS_IRQHandler NMI_Handler2
8588
#else
8689
#define WATCHDOG_FREERTOS_IRQn CAN2_SCE_IRQn
8790
#define WATCHDOG_FREERTOS_IRQHandler CAN2_SCE_IRQHandler
@@ -337,6 +340,7 @@ void task_watchdog_init(void) {
337340
// configMAX_SYSCALL_INTERRUPT_PRIORITY or lower, it can at least call FreeRTOS ISR functions.
338341
#if MICRO_FAMILY_NRF5
339342
NVIC_SetPriority(WATCHDOG_FREERTOS_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY);
343+
#elif MICRO_FAMILY_SF32LB
340344
#else
341345
NVIC_InitStructure.NVIC_IRQChannel = WATCHDOG_FREERTOS_IRQn;
342346
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configMAX_SYSCALL_INTERRUPT_PRIORITY >> 4;

src/fw/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ static NOINLINE void prv_main_task_init(void) {
393393
static McuRebootReason s_mcu_reboot_reason;
394394
s_mcu_reboot_reason = watchdog_clear_reset_flag();
395395

396+
__asm("B .");
396397
#if PULSE_EVERYWHERE
397398
pulse_init();
398399
pulse_logging_init();

src/fw/system/bootbits.c

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <inttypes.h>
3131
#include <stdint.h>
3232

33-
#if MICRO_FAMILY_NRF5 || MICRO_FAMILY_SF32LB
33+
#if MICRO_FAMILY_NRF5
3434

3535
static uint32_t __attribute__((section(".retained"))) retained[256 / 4];
3636

@@ -99,7 +99,51 @@ uint32_t boot_version_read(void) {
9999
return retained_read(BOOTLOADER_VERSION_REGISTER);
100100
}
101101

102-
#else /* !nrf5 */
102+
#elif MICRO_FAMILY_SF32LB
103+
104+
static uint32_t _bootbits;
105+
106+
void boot_bit_init(void) {
107+
_bootbits = BOOT_BIT_INITIALIZED;
108+
}
109+
110+
void boot_bit_set(BootBitValue bit) {
111+
_bootbits |= bit;
112+
}
113+
114+
void boot_bit_clear(BootBitValue bit) {
115+
_bootbits &= ~bit;
116+
}
117+
118+
bool boot_bit_test(BootBitValue bit) {
119+
return _bootbits & bit;
120+
}
121+
122+
void boot_bit_dump(void) {
123+
PBL_LOG(LOG_LEVEL_DEBUG, "0x%"PRIx32, _bootbits);
124+
}
125+
126+
uint32_t boot_bits_get(void) {
127+
return _bootbits;
128+
}
129+
130+
void command_boot_bits_get(void) {
131+
char buffer[32];
132+
dbgserial_putstr_fmt(buffer, sizeof(buffer), "bootbits: 0x%"PRIu32, boot_bits_get());
133+
}
134+
135+
void boot_version_write(void) {
136+
if (boot_version_read() == TINTIN_METADATA.version_timestamp) {
137+
return;
138+
}
139+
/* RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, TINTIN_METADATA.version_timestamp); */
140+
}
141+
142+
uint32_t boot_version_read(void) {
143+
return 0xABCD1234;
144+
}
145+
146+
#else
103147

104148
void boot_bit_init(void) {
105149
rtc_init();

0 commit comments

Comments
 (0)