STM32CubeF4 icon indicating copy to clipboard operation
STM32CubeF4 copied to clipboard

Warning in sd_diskio.c - osMessageQueuePut integer from pointer without a cast

Open fra87 opened this issue 3 years ago • 0 comments

Describe the set-up

  • STM32CubeIDE Version: 1.10.1
  • Project on STM32F407VGT6 with
    • FreeRtos (CMSIS_V2)
    • FatFs (on SD card)

Describe the bug A clean compilation on a freshly generated code has two identical warnings:

passing argument 3 of 'osMessageQueuePut' makes integer from pointer without a cast [-Wint-conversion]

(on file sd_diskio.c, lines 644 and 663).

In both cases the offending line is osMessageQueuePut(SDQueueID, (const void *)&msg, NULL, 0);, while the prototype of the function is osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout), so parameter 3 is implicitly converted from a pointer (NULL) to a uint8_t.

How To Reproduce

  1. Setup a project on any (I think) STM32F4
  2. Activate FATFS and FREERTOS (CMSIS_V2)
  3. Generate the code
  4. Build the code

Additional context Instead of using NULL use the appropriate priority (osPriorityNone, defined in cmsis_os2.h, as suggested in this post)

fra87 avatar Oct 08 '22 21:10 fra87