// +build esp32 esp32c3 package runtime import ( "device/esp" "machine" "unsafe" ) type timeUnit int64 func putchar(c byte) { machine.Serial.WriteByte(c) } func postinit() {} // 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.Pointer(uintptr(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(esp.TIMG_T0CONFIG_T0_EN | esp.TIMG_T0CONFIG_T0_INCREASE | 2<