cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: CubeMX-generated code fails to compile...

I regenerated files with latest CubeMX and the generated code fails to compile. Regeneration was done to incorporate a few settings changes and the latest pack for this processor; previously code generated was OK. Errors below, and I've attached the IOC file and the offending "C" source generated by CubeMX.

Any ideas what's going on?

Anybody at STM?? @Nawres GHARBI​ ? @Sara BEN HADJ YAHYA​ ?

Are you able to rebuild the project from the IOC file and reproduce this bug?

Thanks!

Best Regards, Dave

arm-none-eabi-gcc "../FATFS/Target/sd_diskio.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DDEBUG -DSTM32F407xx -DSTM32_THREAD_SAFE_STRATEGY=5 -c -I../Core/Inc -I../Drivers/Custom -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../FATFS/Target -I../FATFS/App -I../Middlewares/Third_Party/FatFs/src -I../Core/ThreadSafe -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"FATFS/Target/sd_diskio.d" -MT"FATFS/Target/sd_diskio.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "FATFS/Target/sd_diskio.o"
../FATFS/Target/sd_diskio.c: In function 'BSP_SD_WriteCpltCallback':
../FATFS/Target/sd_diskio.c:645:53: warning: passing argument 3 of 'osMessageQueuePut' makes integer from pointer without a cast [-Wint-conversion]
  645 |    osMessageQueuePut(SDQueueID, (const void *)&msg, NULL, 0);
      |                                                     ^~~~
      |                                                     |
      |                                                     void *
In file included from ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h:155,
                 from ../FATFS/Target/ffconf.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:29,
                 from ../FATFS/Target/sd_diskio.c:29:
../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h:689:86: note: expected 'uint8_t' {aka 'unsigned char'} but argument is of type 'void *'
  689 | osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
      |                                                                              ~~~~~~~~^~~~~~~~
../FATFS/Target/sd_diskio.c: In function 'BSP_SD_ReadCpltCallback':
../FATFS/Target/sd_diskio.c:664:53: warning: passing argument 3 of 'osMessageQueuePut' makes integer from pointer without a cast [-Wint-conversion]
  664 |    osMessageQueuePut(SDQueueID, (const void *)&msg, NULL, 0);
      |                                                     ^~~~
      |                                                     |
      |                                                     void *
In file included from ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h:155,
                 from ../FATFS/Target/ffconf.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:29,
                 from ../FATFS/Target/sd_diskio.c:29:
../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h:689:86: note: expected 'uint8_t' {aka 'unsigned char'} but argument is of type 'void *'
  689 | osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
      |                                                                              ~~~~~~~~^~~~~~~~
../FATFS/Target/sd_diskio.c: In function 'BSP_SD_AbortCallback':
../FATFS/Target/sd_diskio.c:675:4: error: 'msg' undeclared (first use in this function)
  675 |    msg = RW_ABORT_MSG;
      |    ^~~
../FATFS/Target/sd_diskio.c:675:4: note: each undeclared identifier is reported only once for each function it appears in
../FATFS/Target/sd_diskio.c:675:10: error: 'RW_ABORT_MSG' undeclared (first use in this function)
  675 |    msg = RW_ABORT_MSG;
      |          ^~~~~~~~~~~~
../FATFS/Target/sd_diskio.c:676:53: warning: passing argument 3 of 'osMessageQueuePut' makes integer from pointer without a cast [-Wint-conversion]
  676 |    osMessageQueuePut(SDQueueID, (const void *)&msg, NULL, 0);
      |                                                     ^~~~
      |                                                     |
      |                                                     void *
In file included from ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h:155,
                 from ../FATFS/Target/ffconf.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff.h:29,
                 from ../Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:29,
                 from ../FATFS/Target/sd_diskio.c:29:
../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h:689:86: note: expected 'uint8_t' {aka 'unsigned char'} but argument is of type 'void *'
  689 | osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
      |                                                                              ~~~~~~~~^~~~~~~~
make: *** [FATFS/Target/subdir.mk:25: FATFS/Target/sd_diskio.o] Error 1

7 REPLIES 7
AScha.3
Chief

"regenerated..." not clear; so same code was working before

?

If you feel a post has answered your question, please click "Accept as Solution".

@AScha.3​  Clarified above: Regeneration was done to incorporate a few settings changes and the latest pack for this processor; previously code generated was OK.

C. Mart
Associate III

What version of FreeRTOS and CMSIS-RTOS are you using?

@CMArtínez​  CMSIS_V1 and CMSIS_V2 (selected in attached IOC) both fail.

FreeRTOS version as generated from CubeMX is 10.3.1

Piranha
Chief II

https://community.st.com/s/question/0D53W00000e0eAYSAY/why-does-a-fresh-cubeide-project-including-rtos-produce-50-compilation-warnings

Random "developers" writing things. What are the odds of creating something decent and reliable that way? 😉

Anybody at STM?? @Nawres GHARBI (ST Employee)​ ? @Sara BEN HADJ YAHYA (ST Employee)​ ?

Are you able to rebuild the project from the IOC file and reproduce this bug?

Thanks!

Semer CHERNI
ST Employee

Hello @Dave Nadler​ 

First let me thank you for posting.

I downloaded the *.ioc and the .c file and I have used them to generate a project using the CubeMx 6.6.1 and the CubeIDE 1.10.1.

The project compile without errors.

But I want to mention that the after looking at the compilation log you have provided I found that it is showing an error about some undeclared variables that are note present in the CubeMx generated code (perhaps they are from the code you added later)

../FATFS/Target/sd_diskio.c: In function 'BSP_SD_AbortCallback':

../FATFS/Target/sd_diskio.c:675:4: error: 'msg' undeclared (first use in this function)

 675 |  msg = RW_ABORT_MSG;

   |  ^~~

../FATFS/Target/sd_diskio.c:675:4: note: each undeclared identifier is reported only once for each function it appears in

../FATFS/Target/sd_diskio.c:675:10: error: 'RW_ABORT_MSG' undeclared (first use in this function)

 675 |  msg = RW_ABORT_MSG;

Try to check the "BSP_SD_AbortCallback" function.

I will be waiting for your feedback.

Kind regards,

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.