energia / msp430-lg-core

15 stars 12 forks source link

PLACE_IN_FRAM Error Message #70

Open rei-vilo opened 5 years ago

rei-vilo commented 5 years ago

Using PLACE_IN_FRAM against the MSP430FR5994 LaunchPad throws this error message:

/var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T//ccaCFwLd.s: Assembler messages:
/var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T//ccEVAsRJ.s:218: Warning: ignoring changed section attributes for .text

I'm using the latest release of msp430-lg-core/variants/MSP-EXP430FR5994LP/pins_energia.h

https://github.com/energia/msp430-lg-core/blob/0a245b29fc047d208982f383be1811a3ea1b25d8/variants/MSP-EXP430FR5994LP/pins_energia.h#L42

How to understand the error message and how to fix it?

See #49 and #31.

rei-vilo commented 5 years ago

Same with CCS.

The code

uint8_t frameNew[4096] __attribute__((section(".text")));

returns the message

Description Resource    Path    Location    Type
ignoring changed section attributes for .text   .ccsproject /FRAM_EPD_Controller    line 321, external location: C:\Users\ReiVilo\AppData\Local\Temp\ccC7kneT.s C/C++ Problem

It is not clear whether the message is a warning or an error.

StefanSch commented 5 years ago

Just made a quick test with below code but could not see an issue. Can you check with this again?

// most launchpads have a red LED
#define LED RED_LED

int i PLACE_IN_FRAM ;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);     
  i = 0;
}

// the loop routine runs over and over again forever:
void loop() {
  if (i++ == 10)
  { 
    i=0;

    digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);               // wait for a second
    digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);               // wait for a second
  }
}
rei-vilo commented 5 years ago

The above sketch still outputs the warning / error

C:\Users\ReiVilo\AppData\Local\Temp\cc6j4iC7.s: Assembler messages: C:\Users\ReiVilo\AppData\Local\Temp\cc6j4iC7.s:57: Warning: ignoring changed section attributes for .text

Configuration

StefanSch commented 5 years ago

just commited a fix and opened a pull request

rei-vilo commented 5 years ago

The FRAM space seems to be pretty limited, to 4096 bytes.

Having a look at msp430-gcc/4.6.4/msp430/lib/ldscripts/msp430fr5994/memory.x, PLACE_IN_FRAM seems to use leaRAM instead of larger rom or far_rom.

MEMORY {
  sfr              : ORIGIN = 0x0000, LENGTH = 0x0010 /* END=0x0010, size 16 */
  leaRAM (wx)      : ORIGIN = 0x2c00, LENGTH = 0x1000 /* END=0x3c00, size 4K */
  tinyram (wx)     : ORIGIN = 0x0006, LENGTH = 0x001a /* END=0x0020, size 26 */
  peripheral_8bit  : ORIGIN = 0x0010, LENGTH = 0x00f0 /* END=0x0100, size 240 */
  peripheral_16bit : ORIGIN = 0x0100, LENGTH = 0x0100 /* END=0x0200, size 256 */
  bsl              : ORIGIN = 0x1000, LENGTH = 0x0800 /* END=0x1800, size 2K as 4 512-byte segments */
  infomem          : ORIGIN = 0x1800, LENGTH = 0x0200 /* END=0x1a00, size 512 as 4 128-byte segments */
  infod            : ORIGIN = 0x1800, LENGTH = 0x0080 /* END=0x1880, size 128 */
  infoc            : ORIGIN = 0x1880, LENGTH = 0x0080 /* END=0x1900, size 128 */
  infob            : ORIGIN = 0x1900, LENGTH = 0x0080 /* END=0x1980, size 128 */
  infoa            : ORIGIN = 0x1980, LENGTH = 0x0080 /* END=0x1a00, size 128 */
  ram (wx)         : ORIGIN = 0x1c00, LENGTH = 0x1000 /* END=0x2c00, size 4K */
  rom (rx)         : ORIGIN = 0x4400, LENGTH = 0xbb80 /* END=0xff80, size 48000 */
  signature        : ORIGIN = 0xff80, LENGTH = 0x0010 /* END=0xff90, size 16 as 1 16-byte segments */
  vectors          : ORIGIN = 0xff80, LENGTH = 0x0080 /* END=0x10000, size 128 as 64 2-byte segments */
  far_rom          : ORIGIN = 0x00010000, LENGTH = 0x00034000 /* END=0x00044000, size 208K */
  /* Remaining banks are absent */
  ram2 (wx)        : ORIGIN = 0x0000, LENGTH = 0x0000
  ram_mirror (wx)  : ORIGIN = 0x0000, LENGTH = 0x0000
  usbram (wx)      : ORIGIN = 0x0000, LENGTH = 0x0000
}

So the question remains: how to get a large array in FRAM?

Linking everything together...
/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.6/bin/msp430-gcc -w -Os -fno-rtti -fno-exceptions -Wl,--gc-sections,-u,main -mmcu=msp430fr5994 -L/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.6/include -o /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_900645/sketch_oct15a.ino.elf /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_900645/sketch/sketch_oct15a.ino.cpp.o /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_900645/../arduino_cache_280907/core/core_energia_msp430_MSP-EXP430FR5994LP_d239225dee65edc9c234f02a76edfb50.a -L/var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_900645 -lm
/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.6/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_900645/sketch_oct15a.ino.elf section `.text#' will not fit in region `leaRAM'
/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.6/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: section .text loaded at [0000000000004400,00000000000045eb] overlaps section .text# loaded at [0000000000002c00,0000000000004bff]
/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.6/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: region `leaRAM' overflowed by 1 bytes
collect2: ld returned 1 exit status
exit status 1
Error compiling for board MSP-EXP430FR5994LP.
#define frameSize (uint16_t)(4097)
uint8_t frameNew[frameSize] __attribute__((section(".text#")));

void setup() {
    memset(frameNew, 0x00, frameSize);
}

void loop() {

}
rei-vilo commented 5 years ago

See https://github.com/energia/msp430-lg-core/blob/new_compiler/extras/readme.txt for support of MSP-GCC 7.3.1.24 with large arrays in FRAM.

Tested successfully on macOS with minor adaptations.