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.

mspgcc MSPGCC 3_02_02_00 global variables initialization bug



Hi,

I am very interested in the effort contributed by TI and RedHat in order to get MSPGCC integrated in code composer, so first of all, my thanks to all the contributors.

However I have some concerns with the current status of the toolchain (version ,MSPGCC  3_02_02_00)  which is labeled as "Production release" in TI download page . This compiler is seen as gcc_msp430_4.9.14r1_98 in the CCS compiler  folder (C:\ti\ccsv6\tools\compiler)

In this version, after having a lot of trouble and headaches with a quite complex project, I discovered that for some reason initialized global variables are corrupted when not in debug mode.

After suspecting what was goin on, I tested ths simple code to discard any other problem:

#include <msp430f5529.h>

int test=10; //

int main(void)
{
	WDTCTL = WDTPW + WDTHOLD;
	P1DIR |= BIT0;
	P1REN |= BIT1;
	P1OUT |= BIT1;

	while (test--)
	{
		P1OUT ^= BIT0;   //Blink the Red led
		__delay_cycles(1000000);
	}

	while (1);
}

This, when loaded with the debugger, flash the led 5 times, as expected. However, when i stop the debugger and reset the board (or switch on/switch off), performs an arbitrary number of flashes before stopping. This did not happen for the previoud Gcc version (This compiler is seen as gcc_msp430_4.9.14r1_10 in the CCS compiler  folder), which worked  fine.

I noticed that the reason for this is that in the linker script for this compiler, the .data section placement is specified as " > RAM", whereas before, in the older version the placement was " > RAM AT > ROM", in order to store the variables in ram and their initial values in ROM, as should be.

However if I try to fix this by changing this in the linker script, now the problem is even worst, the globa variable "test" is also corrupted when loading the code in the debugger, so clearly there was quite a good reason to remove the "AT > ROM" from the linker script.

But apparently then, the initialized global variables are setup to their values by the debugger when loading or reseting the program, but when the debugger is detached, they are not properly initialized because the initial values are not loaded from the FLASH ROM. But of course this is completely invalid for a production system.

Please, do anyone know to whom or where should I report this bug? I would like to help to get the msp gcc toolchain for CCS a bit more stable as it is now.

Regards,

Jose

  • I have also posted the question in the CCS forum ( http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/395383 ) and someone pointed me to a related post in which it is answered that this bug is already known ( http://e2e.ti.com/support/development_tools/compiler/f/343/t/391131 ) so I mark my question as "replied"

**Attention** This is a public forum