This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Binary made by msp430-elf-g++ does not work when the BSS is too big.

Other Parts Discussed in Thread: MSP430FR5969

Hi,

I don't know here is correct place to ask a question about msp430-elf-g++.

I also asked same question to https://sourceforge.net/p/mspgcc/mailman/mspgcc-users/, but there were no answers.

I’m a user of msp430-elf-g++.
I experienced a problem that binary made by msp430-elf-g++ does not work when its BSS is too big.
So I tested again by using sample code included in GCC package.
Here is my code.
blink.c
#include <msp430.h>
 
char buf[2945];
 
int main(void) {
    WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
    P4DIR |= 0x01;                          // Set P1.0 to output direction
 
    for(;;) {
        volatile unsigned int i;            // volatile to prevent optimization
 
if (buf)
  P4OUT ^= 0x01;                      // Toggle P1.0 using exclusive-OR
 
        i = 10000;                          // SW Delay
        do i--;
        while(i != 0);
    }
 
    return 0;
}

And here is my Makefile.
OBJECTS=blink.o
 
GCC_DIR =  ../../../bin
SUPPORT_FILE_DIRECTORY = ../../../include
 
DEVICE  = msp430f5438a
CC      = $(GCC_DIR)/msp430-elf-gcc
CXX     = $(GCC_DIR)/msp430-elf-g++
GDB     = $(GCC_DIR)/msp430-elf-gdb
OBJCOPY = $(GCC_DIR)/msp430-elf-objcopy
 
CFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -mmcu=$(DEVICE) -O2 -g
CXXFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -mmcu=$(DEVICE) -O2 -g
LFLAGS = -L $(SUPPORT_FILE_DIRECTORY) -Wl,-Map,$(DEVICE).map,--cref
 
all: ${OBJECTS}
$(CXX) $(CXXFLAGS) $? $(LFLAGS) -o $(DEVICE).out
$(OBJCOPY) -O ihex $(DEVICE).out $(DEVICE).hex
 
debug: all
$(GDB) $(DEVICE).out

Since I’m using TI TrxEB, I modified msp430fr5969 code for TrxEB to blink LED1 (P4.0).
When setting the buf size to 2944, it works. But when setting it size greater than 2944, the board freezes.
I also checked building same code using msp430-elf-gcc C compiler, and it works.
So I think C++ initialization part seems to have a problem.
I tested it on TI MSP430 GCC 4.0.0.900 beta version. I checked same problem exists on 3.5.0.0 version.
Please, help me.
Regards,
Jongsoo