Page 1 of 1

missing initializer for field 'dier' of 'PWMConfig' Warning issue

Posted: Fri Oct 28, 2016 2:51 pm
by kb1gtt
When I follow the reference code at the below link,
http://www.chibios.org/dokuwiki/doku.ph ... overy_code

Which I have slightly modified to the below,

Code: Select all

/*
 * PWM configuration structure.
 * Cyclic callback enabled, channels 1 and 4 enabled without callbacks,
 * the active state is a logic one.
 * referenced code found here http://www.chibios.org/dokuwiki/doku.php?id=chibios:articles:stm32f4_discovery_code
 */
static PWMConfig pwmcfg = {
  8000000,                                    // 8MHz PWM clock frequency.
      400,                                    // PWM period in ticks 20KHz
  NULL,
  {
    {PWM_OUTPUT_ACTIVE_HIGH, NULL},// PWM CH1
    {PWM_OUTPUT_ACTIVE_HIGH, NULL},// PWM CH2
    {PWM_OUTPUT_DISABLED, NULL},
    {PWM_OUTPUT_DISABLED, NULL}
  },
  /* HW dependent part.*/
  0
};

I get "Description Resource Path Location Type missing initializer for field 'dier' of 'PWMConfig' [-Wmissing-field-initializers] main.c" as shown below.
Capture.PNG

Are there any suggestions on how to do this properly, such that it doesn't generate this warning? From what I'm seen on the interwebs, it appears I need to initialize it differently, but I don't know how. Here's my compiler line, which includes -Wall -Wextra.

Code: Select all

arm-none-eabi-gcc -c -ggdb -O0 -g3 -mcpu=cortex-m4 -falign-functions=16 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm -MMD -MP -MF .build/dep/fakethumbfile.o.d -I. -Iugfx -Iugfx/3rdparty/tinygl-0.4-ugfx/include -Iugfx/boards/base/STM32F429i-Discovery -Iugfx/drivers/gdisp/STM32LTDC -Ichibios_3.0.1/os/common/ports/ARMCMx/devices/STM32F4xx -Ichibios_3.0.1/os/ext/CMSIS/include -Ichibios_3.0.1/os/ext/CMSIS/ST -Ichibios_3.0.1/os/rt/include -Ichibios_3.0.1/os/rt/ports/ARMCMx -Ichibios_3.0.1/os/rt/ports/ARMCMx/compilers/GCC -Ichibios_3.0.1/os/hal/osal/rt -Ichibios_3.0.1/os/hal/include -Ichibios_3.0.1/os/hal/ports/common/ARMCMx -Ichibios_3.0.1/os/hal/ports/STM32/STM32F4xx -Ichibios_3.0.1/os/hal/ports/STM32/LLD -Ichibios_3.0.1/os/hal/ports/STM32/LLD/DACv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/GPIOv2 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/I2Cv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/OTGv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/RTCv2 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/SPIv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/TIMv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/USARTv1 -Ichibios_3.0.1/os/hal/ports/STM32/LLD/FSMCv1 -Ichibios_3.0.1/os/hal/boards/ST_STM32F429I_DISCOVERY -Ichibios_3.0.1/os/hal/lib/streams/ -Ichibios_3.0.1/os/various -DGFX_USE_OS_CHIBIOS=TRUE -DGFX_USE_OS_CHIBIOS=TRUE -DCORTEX_USE_FPU=TRUE -DUSE_FPU=hard -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB fakethumbfile.c -o .build/obj/fakethumbfile.o

Re: missing initializer for field 'dier' of 'PWMConfig' Warning issue

Posted: Fri Oct 28, 2016 3:04 pm
by kb1gtt
Seems that should be like this, Chibios must have added a field after that demo code was posted. I guess in my case it should be 0, but I don't know how to know what should be in there for a STM32F429.

Code: Select all

  /* HW dependent part.*/
  0,
  0
};

Re: missing initializer for field 'dier' of 'PWMConfig' Warning issue

Posted: Fri Oct 28, 2016 3:22 pm
by Giovanni
Hi,

Correct, the driver evolved, now another zero is required in the structure initialization.

Giovanni