How to program data directly into flash at a fixed address

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

How to program data directly into flash at a fixed address

Jump to solution
1,255 Views
bcstewart
Contributor III

Target Processor:  K22F 1M flash, 64 pin.

Tools:  KDS and FRDM-K22F

Debugger Hardware:  Have them all.

I want to store large amounts of data to the upper regions of flash memory.  For example, audio wave data from 128K up to maximum of FRDM-K22F (512K).

Note that I do not want to use any flash programming function in my code.  I want to place it in upper memory as a static object.

I can do this with uVison and uLink by loading the .bin data file, setting the memory locations, and using the integrated uVision flash tool.  I then set my linker file to the end of code address of 128K-1 and I can load and debug the program without disturbing the data.

Now I want to do this with KDS and FRDM-K22F.  But don't know if this is possible. 

Please advise.

0 Kudos
1 Solution
886 Views
bcstewart
Contributor III

I have a solution.

  1. Install the JLink debugger onto the FRDM-K22F as explained in the Quick Start Guide.
  2. Download the program "J-Flash_Lite.exe" from Seggar.  Connect the FRDM-K22F and program a bin file directly to memory.  In my case, location 0x20000 (128K).
  3. Modify "ProcessorExpert.ld" script as shown:

MEMORY {
  m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000198
  m_text      (RX) : ORIGIN = 0x00000410, LENGTH = 0x0001FBF0 //was 0x0007FBF0
  m_data      (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
  m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
  m_cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}

View solution in original post

0 Kudos
8 Replies
886 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi BC Stewart,

   Please refer to this document, it will help you to solve you problems:

https://community.nxp.com/docs/DOC-104433

Wish it helps you!

Have a great day,
Kerry

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

0 Kudos
886 Views
bcstewart
Contributor III

You still don't understand my question.

I want to place binary data into the upper flash memory.  This data will

remain static.  The linker will be changed.

*How do I directly program binary data into flash? * Code Warrior used

to have a flash utility program.

0 Kudos
886 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi BC,

    If you just want to download the binary data to the flash, you don't need to use the KDS.

   After checking it with our KDS engineer, the KDS have the .bin file download problem.

   I suggest you generate the .bin file at first, then use the JLINK commander associated with JLINK debugger to download it.

  The JLINK commander can input this command to download the code:

pastedImage_1.png

 Wish it helps you!


Have a great day,
Kerry

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

0 Kudos
886 Views
bcstewart
Contributor III

Thank you.  That is a good solution.

Brad

0 Kudos
886 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Brad,

  If you still have question about it, please kindly let me know.

  If your question is solved, please help me to mark the correct answer, just to close this case, thank you!

Have a great day,
Kerry

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

0 Kudos
887 Views
bcstewart
Contributor III

I have a solution.

  1. Install the JLink debugger onto the FRDM-K22F as explained in the Quick Start Guide.
  2. Download the program "J-Flash_Lite.exe" from Seggar.  Connect the FRDM-K22F and program a bin file directly to memory.  In my case, location 0x20000 (128K).
  3. Modify "ProcessorExpert.ld" script as shown:

MEMORY {
  m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000198
  m_text      (RX) : ORIGIN = 0x00000410, LENGTH = 0x0001FBF0 //was 0x0007FBF0
  m_data      (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
  m_data_20000000 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000
  m_cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}

0 Kudos
886 Views
bcstewart
Contributor III

This only answers part of the question.

How do I program data directly to Flash memory from the flash programmer

in KDS?

Brad

0 Kudos
886 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Brad,

  As you know, if you want to use the KDS download the code to the flash, you need to download the whole project generated code to the flash, not just partial.

  So, you need to add modify the ld file, then defined the data to the defined flash area, then when you download the whole project to the flash, your data will be also downloaded to the specific flash address.

  In KDS, after build the code, configure the debug configuration, select the according debugger which you are using, then click debug button, you will download all the project code to the flash.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos