首页 > 解决方案 > GCC 堆栈溢出负数

问题描述

我收到一个非常奇怪的错误消息。负 Flash 溢出。这怎么可能

我正在调用一个调试函数来多次打印出错误消息。此错误记录器功能如下所示

BOOLEAN C_Wrapper_Write_to_File(
const char *const p_ch_Log_File_Name,
const char *const p_ch_log_msg,
const char *const p_ch_File,
const int i_line);

我在这样的多个场合调用这个函数

C_Wrapper_Write_to_File("debug","a veeerrryyy lonnngggg error messssssagge", __FILE__,__LINE__);

结果:这个产生了16 字节的闪存溢出。

如果我减少字符串长度,我会得到一个闪溢出

C_Wrapper_Write_to_File("debug","tiny", __FILE__,__LINE__);
../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: ../../bin/3_zellen_2017.elf section `.data' will not fit in region `FLASH'
../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by -24 bytes

现在我很清楚所有 const char[] 数组都存储在闪存中。所以这对我来说非常有意义,当我缩短错误时,Flash 使用量会减少。

问题:

部分'.data'将不适合区域'FLASH'...区域'FLASH'溢出-24 字节

如何修复有关负数的错误消息?

标签: c++gccbufferoverflowflash-memory

解决方案


推荐阅读