This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28377S Flash Programming

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I have been programming to RAM for testing purposes.  My program works as intended, but it will need to survive power cycling.  Ideally I would like to continue running the program from RAM because it's likely much faster that way (and I know it already works).  Is there a tool or tutorial on how I might the program contents to flash, but on boot-up move the program back into RAM and run the RAM program?

I've looked at the controlSUITE example for flash programming, but it just seems to program random values into memory and not much else.  Is there a simple, but comprehensive tutorial out there (hopefully more than just the datasheet)?

In reading spru513j.pdf it seems what I might be looking for is a bootloader, but I can't seem to find a low overhead/simple method of implementing this.

Thanks for any insight!

  • David,

    Code Composer Studio will automatically program the flash for any code which is allocated to the flash in your project's linker command file.

    This application note has not yet been updated for F28377S, but the concepts still apply: http://www.ti.com/lit/SPRA958

    Take a look and see if it helps.

    Lori
  • Thanks for the link. It is certainly more direct about what I need to be doing. From the looks of the document I need to take the following steps:

    1. Assign all functions to a pragma CODE_SECTION to be stored in flash. (Can this be done per file or by block or does every function need a separate pragma, like the examples? Should each have a different subsection so that I can try to keep track of their individual location?)
    2. Assign the aforementioned code section to flash memory in a custom user linker file. (Where does this get stored/referenced? Can I modify the auto-generated 28377S_FLASH_lnk.cmd file or does it need to be separate?)
    3. In the flash code entry point program a memcpy from the CODE_SECTION to RAM. (How do I keep a reference to the relative positions/pointers of each function I am copying over? Are pointers to the copied functions kept somewhere or do I need to figure out how to manage them? Will function calls inside other functions have their pointers updated to the RAM pointer from their previously assigned flash value when copied?)
    4. Move all interrupts into the PIE table in RAM from flash. (Easiest thing to do here is probably to create a separate CODE_SECTION and assign all interrupts simultaneously with a single memcpy I imagine.)
    5. Release the flash area of the program by invoking the RAM "main" function. (How does this get done?)

    Apologies for the sheer number of questions. I have never needed to modify linker files or even separately program a board other than select flash vs. RAM in the accompanying IDE.
  • David,

    I would like to bring your attention to an excerpt from F2837xS data manual.

    "The on-chip flash memory is tightly integrated to the CPU, allowing code execution directly from flash through 128-bit-wide prefetch reads and a pipeline buffer. Flash performance for sequential code is equal to execution from RAM. Factoring in discontinuities, most applications will run with an efficiency of approximately 80% relative to code executing from RAM. This flash efficiency lets designers realize a 2× improvement in performance when migrating from the previous generation Delfino MCUs. Note that an extra wait state is automatically added when code is fetched or data is read from Bank 1 (compared to that of Bank 0), even for prefetched data."

    As mentioned above, Flash execution performance is almost on par with that of RAM.  Even though you configure 3 wait-states for Flash at 200MHz, the 128-bit prefetch mechanism associated with 128-bit pipeline balances it out and gives you the best performance.  Why don't you try executing from Flash?  Controlsuite examples when imported in to CCS lets you configure the project for Flash as well (Right click on the project -> Build configurations -> Set Active -> Flash).  Please try it out.

    As mentioned in the excerpt above, there is an extra wait-state involved for Bank1 accesses but I don't think you will be using it since you said you can fit your entire application in RAM which is much smaller in size than that of Bank0. 

    Thanks and regards,

    Vamsi

  • I appreciate the assistance! I have gotten it to a reasonable working state in flash. Since the majority of my code is inside interrupt it should still be acceptable even if it were a bit slower. I think I may have made the problem a much more complicated/large one than it needed to be. Thanks!