c# '.bss'不在区域'ram'内错误-esp 32 ulp risv-v

2ledvvac  于 2022-12-25  发布在  C#
关注(0)|答案(2)|浏览(419)

我正在尝试将数组元素从一个数组复制到另一个数组。其中一个数组使用int32_t索引来跟踪当前索引。

int32_t pres_log_last_5_readings_raw[5];
int32_t final_arr_pressure[100];
int32_t final_array_index = 0;
for (int i = 0; i < 4; i++)
        {
            final_arr_pressure[final_array_index] = pres_log_last_5_readings_raw[i]; // This line will compile without error if the next line is commented
            final_array_index++;

            

        }

如果该行处于活动状态,我将收到此错误:

/Users/user/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld: address 0x10dc of ulp_main section `.bss' is not within region `ram'
/Users/user/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld: address 0x10dc of ulp_main section `.bss' is not within region `ram'
collect2: error: ld returned 1 exit status

我尝试了许多变体,但似乎都不起作用,我不确定问题是出在我的C技能上还是出在esp idf编译器上。

**

  • 已解决:
    **The right answer is indeed me running out if memory, reducing the size of the arrays to 50 fixed the problem. I do need to mention that I should have increased the memory allocation for slow rtc memory from 4kb to 8kb in idf.py menuconfig! This would solve the problem without changing the size to 50 (in my case). Thanks everyone
carvr3hs

carvr3hs1#

此错误消息指出未初始化的静态存储数据(存储在.bss部分)太大。基本上,您用完了RAM。您需要减少变量的数量和大小。

ujv3wf0j

ujv3wf0j2#

从错误看,您似乎正在尝试访问超出边界的元素。您需要确保final_array_index < 100在赋值给final_arr_pressure之前。

for (int i = 0; (i < 4) && (final_array_index < 100); ++i, ++final_array_index)
{
   final_arr_pressure[final_array_index] = pres_log_last_5_readings_raw[i];
}

相关问题