Bläddra i källkod

Improve early startup hook for watchdog use (Ambroz Bizjak)

teensy4-core
PaulStoffregen 11 år sedan
förälder
incheckning
45b670580f
1 ändrade filer med 9 tillägg och 7 borttagningar
  1. +9
    -7
      teensy3/mk20dx128.c

+ 9
- 7
teensy3/mk20dx128.c Visa fil

@@ -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__)

Laddar…
Avbryt
Spara