Skip to main content
Associate III
March 11, 2024
Question

STM32CubeIDE: disable warning for large sized (>4095) array declaration

  • March 11, 2024
  • 1 reply
  • 4711 views

Dear @Khouloud ZEMMELI , @Imen.D  ,

Please connect me with someone to help resolve the below concern.

I have enabled all possible warnings in STM32CubeIDE.

I however just want to disable warning for one large sized constant array (possibly using #pragma <disable_large_size_Array_Warning> and then later enable it back after the constant array declaration is over).

 

 

arm-none-eabi-gcc "../User_Code/xxx.c" -mcpu=cortex-m7 -std=gnu18 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H753xx -c -I../User_Code -I../Core/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -I../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -Wextra -pedantic -Wmissing-include-dirs -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"User_Code/xxx.d" -MT"User_Code/xxx.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "User_Code/xxx.o"
../User_Code/xxx.c:209:1: warning: string length '4523' is greater than the length '4095' ISO C99 compilers are required to support [-Woverlength-strings]
 209 | "----------------------------------------------------------------------------------------\r\n";
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

 I believe the compiler should be able to provide correct address for the large array and allow its sizeof() to be calculated as well as allow its data to be transmitted over serial.

Please help!

Thanks!

Rajeev

This topic has been closed for replies.

1 reply

Andrew Neil
Super User
March 11, 2024

maybe look at

#pragma GCC diagnostic push
#pragma GCC diagnostic pop

https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html

maybe also 

#pragma push_macro("macro_name")

#pragma pop_macro("macro_name")

https://gcc.gnu.org/onlinedocs/gcc/Push_002fPop-Macro-Pragmas.html

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
March 12, 2024
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
March 20, 2024

@Andrew Neil 

 

Are you aware of the difference between the push_options ans the diagnostic push

I am unable to find a document which helps me use the options both with sTM32CubeIDE and MDK-ARM comiler version 6.

Hence, below is what I've added to the header file.

 

#pragma GCC push_options

 

#pragma GCC diagnostic push

 

#pragma GCC diagnostic ignored "-Wsign-conversion"

 

#include "stm32h7xx_hal.h"

 

#pragma GCC diagnostic pop

 

#pragma GCC pop_options

 

Regards,

Rajeev