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.

MSP430FR2355: DWARF error: line info data is bigger (0xfffffffc) than the space remaining in the section (0x50)

Part Number: MSP430FR2355

Tool/software:

When I compile a simple blinky program with msp430-gcc on the Linux command-line (Fedora FC41), it works like charm:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P3OUT &= ~BIT0; // LED Status (Red)
P3DIR |= BIT0;
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
while(1)
{
P3OUT ^= BIT0;
__delay_cycles(500000);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But as soon as I put initialization code into an include file:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <msp430.h>
#include "init.h"
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
init();
while(1)
{
P3OUT ^= BIT0;
__delay_cycles(500000);
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

init.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
#include <msp430.h>
#include "init.h"
void init(void)
{
P3OUT &= ~BIT0; // LED Status (Red)
P3DIR |= BIT0;
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

init.h:

Fullscreen
1
2
3
4
5
#ifndef ESM_H_
#define ESM_H_
#endif /* ESM_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

it gives the error message: 

../../msp430-elf/bin/ld: DWARF error: line info data is bigger (0xfffffffc) than the space remaining in the section (0x50)

What am I missing? (With CCS, it works, just not on the command-line). All  paths in the Makefile seem to be OK.

Here is my Makefile:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
OBJECTS = main.o
MAP = main.map
GCC_DIR = /opt/ti/msp430-gcc/bin
SUPPORT_FILE_DIRECTORY = /opt/ti/msp430-gcc/include
DEVICE = MSP430FR2355
CC = $(GCC_DIR)/msp430-elf-gcc
GDB = $(GCC_DIR)/msp430-elf-gdb
OBJCOPY = $(GCC_DIR)/msp430-elf-objcopy
CFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -I. -mmcu=$(DEVICE) -ffunction-sections -fdata-sections -Og -Wall -g -DDEPRECATED -v
LFLAGS = -L $(SUPPORT_FILE_DIRECTORY) -Wl,-Map,$(MAP),--gc-sections
.PHONY: all clean debug
all: $(DEVICE).out
$(DEVICE).out: $(OBJECTS)
$(CC) $(CFLAGS) $(LFLAGS) $^ -o $@
$(OBJCOPY) -O ihex $@ $(DEVICE).hex
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks a lot for your help!

  • There has to be more. For one, warnings.

    Usually you would include a function prototype of init() in init.h to keep the compiler from whining.

    But only listing main.o on the OBJECTS line of your makefile means that init.c isn't going to be compiled or linked. So init() will be missing and the linker should be complaining about that.

  • You can try to modify the init.h as below

    #ifndef ESM_H_
    #define ESM_H_

    void init(void);


    #endif /* ESM_H_ */

  • Apologies for that. Of course you are correct. My mistake. I am having prototypes in the init.h in my other program, just forgot it for this example. 

    However, unfortunately it doesn't solve the problem. Here is the full output:

    sage@fedora:~/workspace/fwTesting$ make
    /opt/ti/msp430-gcc/bin/msp430-elf-gcc -I /opt/ti/msp430-gcc/include -I. -mmcu=MSP430FR2355 -ffunction-sections -fdata-sections -Og -Wall -g -DDEPRECATED -v -L /opt/ti/msp430-gcc/include -Wl,-Map,main.map,--gc-sections main.o -o MSP430FR2355.out
    Using built-in specs.
    COLLECT_GCC=/opt/ti/msp430-gcc/bin/msp430-elf-gcc
    COLLECT_LTO_WRAPPER=/opt/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/9.3.1/lto-wrapper
    Target: msp430-elf
    Configured with: ../../gcc/configure --target=msp430-elf --enable-languages=c,c++ --disable-nls --enable-initfini-array --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --enable-target-optspace --enable-newlib-nano-formatted-io --with-pkgversion='Mitto Systems Limited - msp430-gcc 9.3.1.11'
    Thread model: single
    gcc version 9.3.1 (Mitto Systems Limited - msp430-gcc 9.3.1.11)
    COMPILER_PATH=/opt/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/9.3.1/:/opt/ti/msp430-gcc/bin/../libexec/gcc/:/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/
    LIBRARY_PATH=/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/:/opt/ti/msp430-gcc/bin/../lib/gcc/:/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/lib/
    COLLECT_GCC_OPTIONS='-I' '/opt/ti/msp430-gcc/include' '-I' '.' '-mmcu=msp430fr2355' '-ffunction-sections' '-fdata-sections' '-Og' '-Wall' '-g' '-D' 'DEPRECATED' '-v' '-L/opt/ti/msp430-gcc/include' '-o' 'MSP430FR2355.out' '-mdevices-csv-loc=/opt/ti/msp430-gcc/include/devices.csv' '-mdevices-csv-loc=/opt/ti/msp430-gcc/include/devices.csv' '-mcpu=msp430xv2'
    /opt/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/9.3.1/collect2 -plugin /opt/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/9.3.1/liblto_plugin.so -plugin-opt=/opt/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/9.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccQRlE87.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmul_f5 -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcrt -plugin-opt=-pass-through=-lnosys -plugin-opt=-pass-through=-lgcc -o MSP430FR2355.out /opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/lib/crt0.o /opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/crtbegin_no_eh.o -L/opt/ti/msp430-gcc/include -L/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1 -L/opt/ti/msp430-gcc/bin/../lib/gcc -L/opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/lib -Map main.map --gc-sections main.o -lgcc --start-group -lmul_f5 -lc -lgcc -lcrt -lnosys --end-group --script=msp430fr2355.ld -lgcc /opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/crtend_no_eh.o -lgcc
    /opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: /opt/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: DWARF error: line info data is bigger (0xfffffffc) than the space remaining in the section (0x50)
    main.o: in function `.Loc.8.1':
    main.c:(.text.main+0x8): undefined reference to `init'
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:20: MSP430FR2355.out] Error 1
    sage@fedora:~/workspace/fwTesting$

  • Focused on the warning and paid no attention to the error:

    "main.c:(.text.main+0x8): undefined reference to `init'"

  • My assumption is that the undefined reference to `init' is caused by the DWARF error. The linker stops linking right there. (Which we still have no clue why this DWARF error is happening). I found something about an older bug: sourceware.org/.../show_bug.cgi

    As a bug fix, the modification of the linker-script of the particular MSP430 (in my case msp430fr2355.ld) is proposed:

      .debug_line     0 : { *(.debug_line) }
    
    (It is probably near the end of the script).  Replace it with this line:
    
      .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }

    But in my linker script, its already like the lower line, so this had been fixed.
    Now I am running out of ideas...
  • Your makefile tells make that your program consists of a single object: main.o. When you split a project into multiple files, you have to describe that via the makefile.

    Change the first line from:

    OBJECTS = main.o

    to:

    OBJECTS = main.o init.o

    You also have a potential problem in that you haven't included init.h as a dependency for main.o.

  • OBJECTS = main.o init.o did the job.

    Thank you so much David! I was indeed blinded by that weird DWARF error.

**Attention** This is a public forum