OK, I have managed to solve this problem, even though this was not stated ANYWHERE before and is done implicitly in all examples I have seen (SDK and No SDK). By implicitly I mean, the code is written of course but there was no stressing on this fact and no mention of it in the application note AN11983.
The solution is to put command launching in a function and place this function in RAM as follows:
void launchCommand(void) __attribute__((section (".code_ram"))); //attribute place the function in RAM. No need to repeat for definition
void launchCommand(void)
{
/* Clear CCIF to launch command */
p_stgFTFCRegAccess->FTFC_FSTAT |= FTFC_FSTAT_CCIF_MSK;
while (0U == (p_stgFTFCRegAccess->FTFC_FSTAT & FTFC_FSTAT_CCIF_MSK));
}
Also enabling FTFC_IRQn before you partition the flash memory using pure software (i.e. flash not partitioned by PE Micro Debug configuration, like "Enable Device Partitioning" and "Preserve Memory Area")
Hope this helps anyone
BR,
Mahmoud