Hello,
I am using the PE FLASH_LDD for Kinetis in CW 10.5 and it throws a compiler warning when I turn on optimization.
IntFlashLdd1.c:550:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Here is the function that gets this warning:
static void SafeRoutineCaller(void)
{
LDD_FLASH_TSafeRoutine SaveRoutineStackSpace; LDD_FLASH_TSafeRoutinePtr SafeRoutinePtr; /* The safe routine must be aligned to 16bit word */
SafeRoutinePtr = (LDD_FLASH_TSafeRoutinePtr)(((uint32_t)&SaveRoutineStackSpace + 1U) & ~(uint32_t)1U); /* Copy the safe routine's code to a buffer on the stack */
*(LDD_FLASH_TSafeRoutine *)(void *)SafeRoutinePtr = *(LDD_FLASH_TSafeRoutine *)(void *)&SafeRoutine; /* {Default RTOS Adapter} Critical section begin, general PE function is used */
EnterCritical(); ((LDD_FLASH_TSafeRoutinePtr)((uint32_t)(SafeRoutinePtr) | 1U))(); /* Run the Safe routine */ /* {Default RTOS Adapter} Critical section end, general PE function is used */
ExitCritical();
}
I would assume since this is automatically generated that I found a PE bug. Can anyone help me?
thanks
clay
can you please upload your demo project and detail how to reproduce the problem with it? thanks!