MQX 4.1 flashx driver hard fault on erase sector

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX 4.1 flashx driver hard fault on erase sector

733 Views
erickcastillo
Contributor II

Hello,

I am currently trying to use the flashx driver to load a second firmware image to the second half of a 1MB flash only flavor of a K61. Everything through the driver seems to go fine until I enter the "ftfe_flash_command_sequence()" function. Right where this function tries to jump to RAM to execute the "ftfe_ram_function()", via a function pointer, I get an immediate hard fault. I have the following questions.

1. Since I'm programming a completely different bank from the one I'm currently executing in, I don't need to trigger the command from RAM right? (Also, it appears the driver is forcing the jump to ram since FLASH_IOCTL_WRITE_ERASE_CMD_FROM_FLASH_ENABLE does not seem to be a supported IOCTL command in this version of the driver).


2. Is there something I need to enable/disable before I attempt to execute a function in RAM? Is MQX getting upset?


My set-up is as follows:


Chip :K61F120M

Flash Configuration: 1MB (4 Banks)

MQX Version: 4.1

Compiler: Keil armcc

Thanks!

--Erick

0 Kudos
2 Replies

503 Views
erickcastillo
Contributor II

It seems the issue has everything to do with trying to jump to the function in ram. I've simply added the FLASH_IOCTL_WRITE_ERASE_CMD_FROM_FLASH_ENABLE feature to the flashx driver and since I'm able to flash to banks other than the one I'm currently in, this gets me going.

If anyone has any thoughts on why I can't execute code from RAM, or how to determine why it's failing on that jump, I'd appreciate it.

Cheers!

0 Kudos

503 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

There is an application note describes the swap feature for Kinetis.

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4533.pdf


Have a nice day,
Daniel

0 Kudos