Part Number: MSP430FG6426
Dear Team,
I have a function (Function_1) that inturn calls another function (Function_2) and while the final leaf function is executed and return back to the caller function, the local function parameters are not restored. Manwhile i have some ISR's also running in parallel (Timer, SPI, ADC..)
I notice that the function parameters are stored in the register and thats where the problem comes in. If i try to move these parameters as global variables then i don't see a problem, but i cant do this now for my complete software and want to fix the problem at its root, as i see that the below example is a valid C usecase and expect this to work.
I do not notice this issue in my other smaller projects but when i start build big ones, and in my project case i reached 31kb of flash size, and now i start seeing this issue for the codes that earlier worked without issues.
Could you please help here if i can do something to get my project back running without this issue ?
CCS version - 9.2.1
Example:
Function_2(uint32_t Param3)
{
// Do something with Param3
}
Function_1(uint32_t param1, uint32_t param2, uint32_t param3)
{
//Note: The compiler saves these parameter values in the Register
for(i=1; i<10; i++)
{
param3 = param3 + param1 + param2; // Some calculation on parameter 3 variable based on param 1 and 2
Function_2(param3);
// Note: After this Function_2 is returned, the original values of the Param1,2,3 are not restored leading to malfunction
}
}
main()
{
while(1)
{
Function_1(1,2,3);
}
}

