I'm looking for some guidance regarding the execution of code from RAM instead of Flash memory.
Specifically, I’d like to understand the performance implications—are there measurable advantages in terms of execution time when running code from RAM as opposed to Flash?
Additionally, are there any technical documents or reference materials that detail the timing cycles or access speeds for RAM and Flash on MC56F84766VL?
I’m also interested in any recommendations or best practices to help optimize execution time on a DSC—especially techniques for reducing latency or improving instruction throughput.
Lastly, if anyone could share a simple example or code snippet demonstrating how to configure and execute code from RAM (e.g., using GCC and linker scripts), that would be greatly appreciated.
#MC56F84766VL CW-DSC MC56F84xxx CW-56800E-DSC
Can you please provide your thoughts about the other three questions?
"Specifically, I’d like to understand the performance implications—are there measurable advantages in terms of execution time when running code from RAM as opposed to Flash?Additionally, are there any technical documents or reference materials that detail the timing cycles or access speeds for RAM and Flash on MC56F84766VL?
I’m also interested in any recommendations or best practices to help optimize execution time on a DSC—especially techniques for reducing latency or improving instruction throughput."
Hello @bharathraj19 ,
Since it was the May Day holiday in the past few days, I'm sorry for the late reply.
[Q1] Specifically, I’d like to understand the performance implications—are there measurable advantages in terms of execution time when running code from RAM as opposed to Flash?
[A1] In general, the access speed of RAM is faster than that of Flash. When running code from RAM, the execution time is usually shorter because RAM can read and write data quickly, enabling the processor to obtain instructions and data rapidly and reducing the waiting time. On the other hand, the write speed of Flash is relatively slow, and its read speed is usually not as fast as that of RAM. For the DSC, due to its dual-ported RAM controller feature, its performance superiority should be more obvious.
[Q2] Additionally, are there any technical documents or reference materials that detail the timing cycles or access speeds for RAM and Flash on MC56F84766VL?
[A2] You can refer to the section "9.4.1 Flash electrical specifications" in the MC56F847XX Data Sheet.
[Q3] I’m also interested in any recommendations or best practices to help optimize execution time on a DSC—especially techniques for reducing latency or improving instruction throughput."
[A3] For reducing latency, it is recommended that you:
1) Allocate data and code to RAM and Flash reasonably. Place the frequently accessed code and data in RAM to reduce access to Flash.
2) Optimize the use of the instruction set. Select instructions with high execution efficiency and avoid using complex or time-consuming instruction combinations.
3) Utilize the cache of the DSC. If available, cache the commonly used data and instructions in the cache to improve the access speed.
4) Arrange the execution sequence of the program reasonably. Avoid unnecessary waiting and blocking and increase the parallelism of instructions.
5) You can mention some code optimization techniques, such as loop unrolling and function inlining, etc., to reduce the number of instruction executions and the overhead of jumps.
Hope it can help you.
BRs,
Celeste
Hello @bharathraj19 ,
Thanks for your post.
We have some constants and initialized global data in ROM and copy them to RAM when DSC startup, please refer to section "7.2.8 ROM to RAM Copying" of CWMCUDSCCMPREF for how to implement it in Link Command File:
In fact, when creating a new project from a new bareboard for 56F84xxx, this code for ROM to RAM copying is already included in link command file.
You can also refer to the Relocate Subroutines to PRAM for MC56F827xx DSC(AN5143). We have the corresponding AN5143SW(https://www.nxp.com/docs/en/application-note-software/AN5143SW.zip) for your reference.
Although they are based on the MC56F82XXX, they are also applicable to the MC56F84XXX.
Hope this can help you!
BRs,
Celeste
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
-----------------------------------------------------------------------------------------------------------------------