Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357
i have the following code snippet exported from HALCoGen Version 04.05.01:
from the sys_startup.c file:
/* Release the MibSPI1 modules from local reset.
* This will cause the MibSPI1 RAMs to get initialized along with the parity memory.
*/
mibspiREG1->GCR0 = 0x1U;
/**
.
.
other code (unrelated to SPI)
.
.
*/
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
while ((mibspiREG1->FLG & 0x01000000U) == 0x01000000U)
{
}/* Wait */
the line which makes the simple assignment for the nRESET bit in the GCR0 is assembeled as follows:
mibspiREG1->GCR0 = 0x1U; 0002a604: E5810000 str r0, [r1] 0002a608: E30F1800 movw r1, #0xf800 0002a60c: E34F1FF7 movt r1, #0xfff7
notice that there is no immediate value for the value 1 or anything. using a debugger reveals that surely the GCR0 register is not assigned the value 1 as instructed by the C-code!!!
this leads to the polling on the flag to be an infinite loop causing a system halt right on the startup code.
the same line compiled using TI_ARM_V20.2.5LTS gives the following assembly code:
mibspiREG1->GCR0 = 0x1U; 0002b0a8: E59F00C0 ldr r0, [pc, #0xc0] 0002b0ac: E3A0C001 mov r12, #1 0002b0b0: E580C000 str r12, [r0]
which actually loads an immediate value of 1 to the correct location and the application works fine!!!
so my question is:
this is just a very basic thing for a compiler to do, so is there any command line argument that can fix this or an attribute that should be applied on the struct? note that this is an exported code from HALCoGen so it's not a code that a developer has wrote, and it was working fine before!!