imx rt 1020 Nor Flash and freertos?

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

imx rt 1020 Nor Flash and freertos?

Jump to solution
757 Views
bp1979
Senior Contributor I

Hi,

I have an imx rt 1020 evk board which has external flash. The external flash does not support RWW. So I have learned to put my code in RAM to prevent reading from flash (executing program code) while writing to flash (erasing/programming).

This went fine, until I started to integrate my prototype in my actual application, which runs in a freertos environment. 

Now I can make a simple test which consists of the following steps:

- initialize flash,

- erase a sector

- program some bytes

When I execute this test sequence before the freertos scheduler starts, all is good.

But, when I run this test sequence in a task, I get guaranteed hardfaults. I guess the reason is that while erasing/programming task switches happen, thus code gets executed which is stored in flash and boom, I'm screwed.

What is the best way to cope with this? I have 64K of ITC memory, but my application is 120K in debug (and still 80K in release build). So I am not really able to store my entire app in flash.

Can you please advise how to deal with this?

many thanks.

0 Kudos
1 Solution
751 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I'd like to suggest you implement critical section protection for a variety of flash operations.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

2 Replies
752 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I'd like to suggest you implement critical section protection for a variety of flash operations.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

738 Views
bp1979
Senior Contributor I

I thought it would be a bit drastic to disable interrupts during erasing, but it works perfectly. Thanks, simple and works like a charm

0 Kudos