【问题标题】:.bss will not fit into region ram.bss 不适合区域内存
【发布时间】:2013-08-24 07:27:44
【问题描述】:

我一直在制作 LED 墙,但遇到了 RAM 问题。基本上我正在使用 teensy 3.0 并尝试加载以下脚本,但是,.bss 的脚本错误不适合区域“RAM” 请帮忙!任何信息将不胜感激!谢谢!

/*  
Nike NFL draft LED wall program

OctoWS2811 BasicTest.ino - Basic RGB LED Test
http://www.pjrc.com/teensy/td_libs_OctoWS2811.html
Copyright (c) 2013 Paul Stoffregen, PJRC.COM, LLC

*/

#include <OctoWS2811.h>

const int ledsPerStrip = 290;

DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];

const int config = WS2811_GRB | WS2811_800kHz;

OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);

#define ORANGE 0xE05800
#define WHITE  0xFFFFFF
#define BLACK 0x000000
#define BLACK2 0x1E1E1E

void setup() {
  leds.begin();
  leds.show();
}

static int widths[] = { 30, 30, 50, 90, 40, 60 };
static int speeds[] = { 5, 5, 10, 16, 11, 13 };
static int locations[] = { 0, 0, 0, 0, 0, 0 };
static int counter = 0;
//static int location = 0;
static boolean reverse = false;

int blend(int source      , float alpha) {
  int source_r = (source >> 16);
  int source_g = ((source >> 8) & 0x00FF);
  int source_b = (source & 0x0000FF);

  source_r = source_r * alpha;
  source_g = source_g * alpha;
  source_b = source_b * alpha;

  return source_b | (source_g << 8) | (source_r << 16);
}

void loop() {
  int microsec = 2000000 / leds.numPixels();  // change them all in 2 seconds

  int location;
  int offset;
  int width;
  int current;
  int min;
  int color;
  float alpha = 0.95; // Set brightness of head
  int head_width = 3; // Set width of head

  delay(20);

  int i;
  for(i = 0; i < 6; ++i) {
    location = locations[i];
    width = widths[i];
    color = 0xFFFFFF;
    offset = i*ledsPerStrip;

    location = location + speeds[i];

    if(location > ledsPerStrip + width) {
      location = 0;
    }

    locations[i] = location;

    if(location < width) {
      current = location;
      min = 0;
    } else if(location >= width) {
      current = location;
      min = location - width + 1;
    }

    for(current; current >= 0; --current) {
      if(current >= min) {
        if(current < ledsPerStrip) {
          if(!reverse) {
            leds.setPixel(current + offset, color);
          } else {
            leds.setPixel((ledsPerStrip - current) + offset, color);
          }
        }
        if(current < (location - head_width)) {
          color = blend(color, alpha);
        }
      } else {
        if(!reverse) {
          leds.setPixel(current + offset, BLACK);
        } else {
          leds.setPixel((ledsPerStrip - current) + offset, BLACK);
        }
      }
    }
  }

  leds.show();

  counter++;
}

以及返回的错误: 该报告将包含更多信息 “在编译期间显示详细输出” 在文件 > 首选项中启用。 Arduino:1.0.5(Windows 7),板:“Teensy 3.0” c:/程序文件/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm -none-eabi/bin/ld.exe:Nike_NFL_Program.cpp.elf 部分.bss' will not fit in regionRAM' c:/程序文件/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm -none-eabi/bin/ld.exe:区域“RAM”溢出 1028 字节 collect2.exe:错误:ld 返回 1 个退出状态

谢谢!

【问题讨论】:

    标签: arduino ram


    【解决方案1】:

    您只是内存不足。将其从 6 次编译缩小到 5 次编译。注意 3.0 有 16384 个 SRAM。每个倍数都会消耗有限的 16384 SRAM 中的一大块。

    【讨论】:

      【解决方案2】:

      我认为你应该把静态或变量的代码放到DRAM中。
      比如你提供的代码。

      发件人:

        const int ledsPerStrip = 290;
        DMAMEM int displayMemory[ledsPerStrip*6];
        int drawingMemory[ledsPerStrip*6];
        const int config = WS2811_GRB | WS2811_800kHz;
        static int widths[] = { 30, 30, 50, 90, 40, 60 };
        static int speeds[] = { 5, 5, 10, 16, 11, 13 };
        static int locations[] = { 0, 0, 0, 0, 0, 0 };
        static int counter = 0;
      

      收件人:

       #include "link_defs.h"
       __SECTION(dram.rodata) const int ledsPerStrip = 290;
       __SECTION(dram.bss)  DMAMEM int displayMemory[ledsPerStrip*6];
       __SECTION(dram.bss)  int drawingMemory[ledsPerStrip*6];
       __SECTION(dram.rodata) const int config = WS2811_GRB | WS2811_800kHz;
       __SECTION(dram.data)  static int widths[] = { 30, 30, 50, 90, 40, 60 };
       __SECTION(dram.data)  static int speeds[] = { 5, 5, 10, 16, 11, 13 };
       __SECTION(dram.data)  static int locations[] = { 0, 0, 0, 0, 0, 0 };
       __SECTION(dram.data)  static int counter = 0;
      

      【讨论】:

        猜你喜欢
        • 2017-06-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-14
        • 2022-12-14
        • 1970-01-01
        • 2013-04-21
        相关资源
        最近更新 更多