AnsweredAssumed Answered

K82 : erase and write internal flash memory with User privileges

Question asked by Eugene Hiihtaja on Oct 11, 2018
Latest reply on Oct 15, 2018 by Eugene Hiihtaja

Hello !

 

I need to use routines for erase/write internal flash memory in Task what running with user privileges.

I have added executable rights for RAM buffer what used for poll flash operation complete status and add access in user mode to FMC and FTRA controllers by using AIPS registers.. All code is executable without Busfault ( MPU configured properly ) and other problems.

Also I should disable interrupts because some peripherals and Tick timer are interrupt driven.

 

But some code can't run in user mode and reason is unknown. It generate HardFault .

All lines looks quite safe and Status register can be read/write in user mode without problem.

Can it be something and not so documented about accesses to FTRA controller.

 

Look function : static status_t ftfx_command_sequence(ftfx_config_t *config) in file fsl_ftfx_controller.c

 

Code what run without problem:

 

SUPERVISOR_MODE_START();
asm volatile ("cpsid i");
callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&FTFx->FSTAT));
asm volatile ("cpsie i");
SUPERVISOR_MODE_END();

 

It is expected to run RAM code in user mode e.g :

 

SUPERVISOR_MODE_START();
asm volatile ("cpsid i");
SUPERVISOR_MODE_END();


callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&FTFx->FSTAT));


SUPERVISOR_MODE_START();
asm volatile ("cpsie i");
SUPERVISOR_MODE_END();

May be some other tricks should be used ?

 

Regards,

Eugene

Outcomes