energia / msp430-lg-core

15 stars 12 forks source link

MSP430FR5994 — Large Arrays in FRAM Error #49

Open rei-vilo opened 6 years ago

rei-vilo commented 6 years ago

THE MSP430FR5994 provides 256 KB of FRAM, of which 262,144 bytes are continuous (Main: code memory 043FFFh–004000h, cf. MSP430FR5994 , 6.15 Memory Map Table 6-41. Memory Organization).

How to declare two arrays in R/W mode of 30,000 bytes each?

uint8_t frameOld[30000] __attribute__ ((section(".text"))); // PLACE_IN_FRAM;
uint8_t frameNew[30000] __attribute__ ((section(".text"))); // PLACE_IN_FRAM;

The previous code throws errors at linking, typical of memory overflow.

/Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.5/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_291843/FRAM_EPD.ino.elf section '.text' will not fit in region 'rom' /Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.5/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: section .vectors loaded at [000000000000ff80,000000000000ffff] overlaps section .text loaded at [0000000000004400,0000000000019e83] /Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.5/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: region 'rom' overflowed by 55586 bytes /Users/ReiVilo/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.5/bin/../lib/gcc/msp430/4.6.3/mcpu-430x/mmpy-16/libcrt0.a(_copy_data.o): In function '__do_copy_data': /Users/rwessels/mspgcc/BUILD/gcc/gcc/../../../gcc/gcc/config/msp430/crt0.S:195: relocation truncated to fit: R_MSP430_16_BYTE against symbol '__data_load_start' defined in ABS section in /var/folders/px/cyfvtr757lqg0yp_cv9j79jh0000gn/T/arduino_build_291843/FRAM_EPD.ino.elf ...

Does memory.x at ~/Library/Energia15/packages/energia/tools/msp430-gcc/4.6.5/msp430/lib/ldscripts/msp430fr5994/memory.x need to be customised, and how?

Thank you!

rei-vilo commented 6 years ago

Might be related to #63

rei-vilo commented 5 years ago

See Using FRAM above 0x00010000 on the 43oh forum.

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.