Quellcode durchsuchen

Improve early startup hook for watchdog use (Ambroz Bizjak)

teensy4-core
PaulStoffregen vor 10 Jahren
Ursprung
Commit
45b670580f
1 geänderte Dateien mit 9 neuen und 7 gelöschten Zeilen
  1. +9
    -7
      teensy3/mk20dx128.c

+ 9
- 7
teensy3/mk20dx128.c Datei anzeigen

@@ -349,11 +349,10 @@ const uint8_t flashconfigbytes[16] = {
extern void rtc_set(unsigned long t);



static void startup_unused_hook(void) {}
void startup_early_hook(void) __attribute__ ((weak, alias("startup_unused_hook")));
void startup_late_hook(void) __attribute__ ((weak, alias("startup_unused_hook")));

static void startup_default_early_hook(void) { WDOG_STCTRLH = WDOG_STCTRLH_ALLOWUPDATE; }
static void startup_default_late_hook(void) {}
void startup_early_hook(void) __attribute__ ((weak, alias("startup_default_early_hook")));
void startup_late_hook(void) __attribute__ ((weak, alias("startup_default_late_hook")));

__attribute__ ((section(".startup")))
void ResetHandler(void)
@@ -364,8 +363,11 @@ void ResetHandler(void)

WDOG_UNLOCK = WDOG_UNLOCK_SEQ1;
WDOG_UNLOCK = WDOG_UNLOCK_SEQ2;
WDOG_STCTRLH = WDOG_STCTRLH_ALLOWUPDATE;
startup_early_hook();
asm volatile ("nop");
asm volatile ("nop");
// programs using the watchdog timer or needing to initialize hardware as
// early as possible can implement startup_default_early_hook()
startup_default_early_hook();

// enable clocks to always-used peripherals
#if defined(__MK20DX128__)

Laden…
Abbrechen
Speichern