From c5ad7b4a75e3bb9f6885a64bc57b4c47f8a04645 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sat, 22 Oct 2022 23:03:19 +0300 Subject: [PATCH] pwm: zero-init things ourselves looks like bootloader implementation avoids static and bss zero-init does not solve the crashing, though --- code/espurna/esp8266_pwm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/espurna/esp8266_pwm.c b/code/espurna/esp8266_pwm.c index 0e7238c2..786284fa 100644 --- a/code/espurna/esp8266_pwm.c +++ b/code/espurna/esp8266_pwm.c @@ -70,18 +70,18 @@ struct pwm_phase { * pwm phase */ typedef struct pwm_phase (pwm_phase_array)[PWM_MAX_CHANNELS + 2]; -static pwm_phase_array pwm_phases[3]; +static pwm_phase_array pwm_phases[3] = {0}; static struct { struct pwm_phase* next_set; struct pwm_phase* current_set; uint8_t current_phase; } pwm_state; -static uint32_t pwm_period; -static uint32_t pwm_period_ticks; -static uint32_t pwm_duty[PWM_MAX_CHANNELS]; -static uint16_t gpio_mask[PWM_MAX_CHANNELS]; -static uint8_t pwm_channels; +static uint32_t pwm_period = 0; +static uint32_t pwm_period_ticks = 0; +static uint32_t pwm_duty[PWM_MAX_CHANNELS] = {0}; +static uint16_t gpio_mask[PWM_MAX_CHANNELS] = {0}; +static uint8_t pwm_channels = {0}; struct gpio_regs { uint32_t out; /* 0x60000300 */