//go:build esp32 || esp32c3 package runtime import ( "device/esp" "machine" "unsafe" ) // Initialize .bss: zero-initialized global variables. // The .data section has already been loaded by the ROM bootloader. func clearbss() { ptr := unsafe.Pointer(&_sbss) for ptr != unsafe.Pointer(&_ebss) { *(*uint32)(ptr) = 0 ptr = unsafe.Add(ptr, 4) } } func initTimer() { // Configure timer 0 in timer group 0, for timekeeping. // EN: Enable the timer. // INCREASE: Count up every tick (as opposed to counting down). // DIVIDER: 16-bit prescaler, set to 2 for dividing the APB clock by two // (40MHz). // esp.TIMG0.T0CONFIG.Set(0 << esp.TIMG_T0CONFIG_T0_EN_Pos) esp.TIMG0.T0CONFIG.Set(esp.TIMG_T0CONFIG_EN | esp.TIMG_T0CONFIG_INCREASE | 2<