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.

CCS/CC2640R2F: Available flash for On Chip OAD

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hy,

I need to figure out, if we will need an external memory for OAD in our project or not. Base of my firmware is the simple_peripheral_oad_onchip example. I created a copy, made some minor changes, compiled and run the project. Looks good so far.

But how can I see, how much flash will be available for my application?

The map files of the four component projects are:

OUTPUT FILE NAME:   <bim_oad_onchip_cc2640r2lp_app.out>
ENTRY POINT SYMBOL: "ResetISR"  address: 0001e9e3


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  FLASH_BIM             0001e000   00001f54  00000a74  000014e0  R  X
  FLASH_CERT            0001ff54   0000004c  00000000  0000004c  R  X
  FLASH_FNPTR           0001ffa0   00000004  00000000  00000004  R  X
  FLASH_CCFG            0001ffa8   00000058  00000058  00000000  R  X
  SRAM                  20000000   00004400  00000208  000041f8  RW X


  
  
OUTPUT FILE NAME:   <myproject_cc2640r2lp_app_oad_onchip_FlashROM_unsecure.out>
ENTRY POINT SYMBOL: "ResetISR"  address: 00006f65


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  FLASH_IMG_HDR         00000000   000000a8  00000050  00000058  R  X
  ENTRY                 000000a8   00000040  0000003c  00000004  R  X
  FLASH                 000000e8   00009f98  000094ea  00000aae  R  X
  SRAM                  20000000   00003fa0  00001ed3  000020cd  RW X
  
  
  

OUTPUT FILE NAME:   <myproject_cc2640r2lp_stack_oad_onchip_FlashROM_unsecure.out>
ENTRY POINT SYMBOL: "startup_entry"  address: 000119a9


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  FLASH                 00000000   00013000  00009000  0000a000  R  X
  SRAM                  20000000   00004400  0000045c  00003fa4  RW X



OUTPUT FILE NAME:   <persistent_app_cc2640r2lp_FlashOnly_unsecure.out>
ENTRY POINT SYMBOL: "ResetISR"  address: 000150ed


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  FLASH                 00000000   0001dfc0  0000a5d0  000139f0  R  X
  ENTRY                 0001dfc0   00000040  0000003c  00000004  R  X
  SRAM                  20000000   00003a00  000019c7  00002039  RW X

Where can I see, how much flash is used and how much will be available for my application?

Regards

Harald

  • Hi Harald,

    In CCS if you go to View > Memory Allocation after a compile it will display visually your flash and SRAM availability.

    One tip to make sure you build efficiently, is to make sure to set the following predefines to 0 in order to remove use of the display drivers etc. This helps save some space to get a more realistic idea of what flash is used.

    BOARD_DISPLAY_USE_UART=0
    BOARD_DISPLAY_USE_UART_ANSI=0
  • Hy Evan,

    thanks for your reply. I already noticed the memory view but don't understand it.

    I assume that there is 128k Flash available. In memory allocation view I see:

    Used Available
    BIM 2676 8020
    App 38146 40856
      img hdr 80 168
    stack 36864 77824
    persistent 42504 122816

    No matter how I sum up, I never reach 128k. Persistent app seems to have full flash available but is linked to an area where it can reside in Flash?

    Why would the stack have the most available flash space? I guess, that usually I will only change the app, getting larger with more functionality over project development, stack most probably stays the same all the time. So I would have expected, that the available flash space is as little as possible, giving more available flash to the app. Do I need to optimize this and how?

    What I need at this moment: We are about to decide, wether we need an external memory or not to ensure future development. When I see 2,710 bytes for app (available minus used) I would say, yes we need external memory. When I see 6,598 byte (that is all available flash minus sum of all used flash) or even 10,802 byte (that is 128k minus sum of all used) it might work out without external memory.

    How do I calculate this correctly?

    Best regards

    Harald

    AvailableFlash.xlsx Excel sheet with my calculations

  • Any response to my questions?

  • Harald,

    I'll have a good response to you by early next week. I did not see that you had replied, my apologies.

  • Hy Evan,

    thanks a lot for coming back. Do you have any news on this?

    Best regards

    Harald

  • Hey Harald,

    Thanks for the patience. In summary, the best you can do in terms of flash availability to the application is between the end of the OAD image header to ICALL_STACK0_ADDR (app + stack boundary). Visual available here:
    dev.ti.com/.../flash-layout-on-chip-split-image.html

    This is all the space available for the application. If you can't fit it there, you'll need to look at external flash. We do have some flash optimziation suggestions here:
    processors.wiki.ti.com/.../CC2640_OAD_User's_Guide

    In general though, on-chip OAD on the R2 won't work for most customers.

    I would also reference this doc when considering the tradeoffs for off chip/on chip: dev.ti.com/.../oad-types.html

    The best way that I've found to see the available flash memory that you can work with with your app is by compiling the simple_peripheral on chip app project and going to view>memory allocation and see what you have left in the flash section. out of the box on 2.20 i'm left with roughly 1.8kb. There are obviously things that can be stripped out of the example to improve the free flash such as stripping out the menu system and shrinking the gatt table etc.

    How much flash do you intend your application to take?
  • Hy Evan,

    thanks for your response. I will go through all of these documents and try to estimate the final flash requirement of my app. Just one question upfront:

    My memory allocation view of the stack says:

    so 40,960 bytes should be still available. Why can't I use this for application? Why does the stack allocate that much flash?

    Regards

    Harald

  • Harald,

    Your application is using what's free after the stack. That screen shot is showing the flash availability after the stack has been compiled.

    When you look at the app memory allocation view, you'll 39kb of roughly 41kb.

    That 41kb is approx calculated after the stack uses up the 36kb of the 77.8kb available and so on with the persistent app and bim. Some flash is utilized for the image headers and other stuff that makes it approx.

    I hope that makes sense how I've explained that.

    Basically what is taking up 39kb of the application is the logic needed for on chip OAD, the GAP, Icall, profiles/services and everything else you find in the oad on chip app project.

    Please let me know if you want me to further clarify.
  • I'm going to close this post due to inactivity. To reopen this thread, just post a follow up question. Otherwise, after 30-days of inactivity from this post, this thread will lock.