flash operations

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

flash operations

1,114 Views
RajPadmani
Contributor II

Why does the PFlash SDK example take more time to write to flash compared to the bootloader, even though both use the same functions for writing to flash?

0 Kudos
Reply
6 Replies

1,093 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @RajPadmani ,

Thanks for your post. To better support you, could you please provide me with more details? Specifically, I'd like to know the model of the MCU you are using, the IDE you've chosen, the version of the SDK, and the type of the bootloader.

Have a good day,

Celeste

0 Kudos
Reply

1,077 Views
RajPadmani
Contributor II
I am using KM34 MCU and use the pflash SDK example and SDK bootloader example. I am using latest SDK and Mcuxpresso ide
0 Kudos
Reply

1,029 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @RajPadmani ,

I couldn't find the bootloader example in the KM34 SDK.

Celeste_Liu_0-1739763611042.png

 

Could you describe the problem in more detail? Also, how did you conduct the tests? Based on the current information you've provided, we're unable to pinpoint the problem.

BRs,

Celeste

0 Kudos
Reply

1,017 Views
RajPadmani
Contributor II

There is no SDK example for the MKM34Z256VLQ7 bootloader, so I customized the MKM35 bootloader to run on the MKM34, and it worked perfectly.

In the bootloader, I read the application and write it using the "mem_write" function, which writes one sector significantly faster compared to the "flash_program" function from the "PFlash" SDK example for the MKM34Z256VLQ7.

Even after matching the clock speed with the bootloader code, the "PFlash" SDK example still takes longer for writing and erasing.

What could be the reason for this difference in performance?

0 Kudos
Reply

987 Views
Celeste_Liu
NXP Employee
NXP Employee

To clarify the differences between the "mem_write" function and the "flash_program" function, I need to understand their specific implementation methods. Given that you are using a customized bootloader, I'm not sure how "mem_write" is implemented, and I haven't been able to find relevant content in the API Reference Manual either.

Celeste_Liu_0-1739874198721.png


I wonder if you could send me this part of the code. If you have referred to any existing SDK projects or ANs, please let me know as well.

0 Kudos
Reply

984 Views
RajPadmani
Contributor II

RajPadmani_0-1739877157357.png

I am using this bootloader in the KM34 microcontroller. In the bootloader code, I only changed the memory addresses to make it compatible with the KM34.

The mem_write function is a wrapper that uses the flash_program function to write to flash. However, it executes faster than the flash_program function, which I used directly in my application.

You can find this function in "bl_context.c" 

RajPadmani_1-1739877456440.png


In this file, there is a structure named g_bootloaderContext, which contains a structure variable called memoryInterface. The value of g_memoryInterface is assigned to it, and within g_memoryInterface, you will find the mem_write function.

RajPadmani_2-1739877495177.png

I have attached the bootloader SDK example that I'm using.

0 Kudos
Reply