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.

AUX_RAM size and usage example

I am working on a SBP based custom app and i am running out of RAM at link time. I would like to understand more about reducing RAM usage by ICall and profiles. I am including my module size information from the linker's map file below. As you can see, the profiles and ICall are the biggest consumers of RAM. I already disabled the Bond Manager. Any other suggestions on how to reduce RAM usage?

Thank you.

*******************************************************************************
*** MODULE SUMMARY
***

    Module                      ro code  ro data  rw data  rw data
                                                            (abs)
    ------                      -------  -------  -------  -------
C:\ti\simplelink\ble_cc26xx_2_01_00_44423\Projects\ble\fx12.2.sbp\CC26xx\IAR\Application\CC2640\FlashOnly_OAD_ST_ExtFlash\Obj: [1]
    Board.o                                  340      824
    GPTimerCC26XX.o                 672
    I2C.o                            88        1        4
    I2CCC26XX.o                   1 168       20       17
    ICall.o                       2 660        4    3 276
    ICallBleAPI.o                 2 292                10
    ICallCC2650.o                   466        2        8
    PINCC26XX.o                   1 232               220
    PWM2.o                           72
    PWMCC26XX.o                     600       32       16
    SPI.o                            68
    SPICC26XXDMA.o                1 924       28        1       64
    UDMACC26XX.o                    180
    altimeter.o                      36                10
    as5048B.o                        92
    bleUserConfig.o                           64       52
    bma280.o                        432                36
    bma2x2.o                      2 122        2        8
    bmp280.o                        256                44
    bmp280_bosch.o                1 000                 4
    bsp_i2c.o                       256                52
    bsp_spi.o                       212       21       72
    cc120x_spi.o                    128
    ccfg_appBLE.o                             88
    devinfoservice.o                532      178      497
    ext_flash.o                      18
    fram.o                          364        7       24
    fx_device_service.o             524       36      130
    fx_live_service.o               824      147      450
    fx_settings_service.o         1 872      244      774
    fx_telemetry_service.o          632       80      227
    gattPersistence.o               300
    gatt_uuid.o                      16
    gattservapp_util.o              546
    globals.o                       736        1      683
    hal_spi_rf_trxeb.o              224        7       24
    main.o                           56        9       28
    max-m8q.o                       372        7       24
    oad.o                         1 072      131      222
    oad_target_externalFlash.o      460                17
    peripheral.o                  2 410       85      804
    rf_impl.o                       132
    sensor.o                         64                32
    simpleBLEPeripheral.o         2 600       43      396
    task_Altimeter.o                900      101      336
    task_RF.o                       772       10      160
    task_Servos.o                   944       80      441
    task_Timer.o                  1 282                 7
    task_buzzer-led.o               208        9       32
    util.o                          296
    --------------------------------------------------------------
    Total:                       34 112    1 777    9 962       64

C:\ti\simplelink\ble_cc26xx_2_01_00_44423\Projects\ble\fx12.2.sbp\CC26xx\IAR\Application\CC2640\configPkg\package\cfg: [2]
    appBLE_prm3.orm3              1 464    1 753    6 242
    --------------------------------------------------------------
    Total:                        1 464    1 753    6 242

  • Hi there,

    You are correct that the formatting is pretty rough. Can you try again when the "Use rich formatting" option is available?

    As far as general pointers for reducing RAM usage is you can attempt to reduce the heap size assuming that you have some available (you can profile this using the heapmgr metrics). Additionally you can gain a few bytes by reducing some stack sizes depending on your call depth (again you will need to profile this to ensure it is safe for your system.

    Additionally, if you are not using the sensor controller you can reclaim the AUX_RAM that is reserved for the sensor controller. Please see the TRM for more information on this memory region.

    I would suggest to try them in this order:
    1. Profile heap usage, if you can trim the size of the heap, then try that
    2. Use AUX RAM.
    3. Profile stack depths and see if you can reduce any task stack sizes, etc
  • Sean,

    thank you for your suggestions. We will profile heap and see if this can free up some SRAM. meanwhile, the use of AUX RAM sounds interesting. Can you confirm that the following approach is the advisable?

    add the following to linker .icf file:

    define symbol AUX_RAM_SIZE  = 0x00001000;  // 4k?
    define symbol AUX_RAM_START = 0x400E0000;
    define symbol AUX_RAM_END   = 0x400E0FFF;
    define region AUX_RAM       = mem:[from AUX_RAM_START   to AUX_RAM_END];
    place in AUX_RAM            { readwrite section AUX_RAM_SECTION };

    use the placement pragma in IAR:

    #pragma default_variable_attributes = @ "AUX_RAM_SECTION"
    static TelemetrySample ringbuffer[NUM_RING_SAMPLES];
    #pragma default_variable_attributes = 

    Compliling and linking this does indeed place this buffer in AUX RAM:

    ringbuffer              0x400e0000  0x258  Data  Lc  globals.o [1]

    Assuming that this is the right approach, i have some questions:

    1. are there any considerations to be taken as to reading from and writing to AUX RAM vs. SRAM in terms of timing? If so, what TIRTOS synchronization/timing API's should be used?
    2. we are not using the sensor controller, i.e. we are not including any code for it nor do we upload and start any task on it from our app. is there anything else to turn the SC off and make sure it's not used and nothing else uses the AUX RAM?
    3. AUX RAM has the size of 4k, is that correct?

    Thank you.

  • Hi pixbroker,

    AUX RAM size should be 2KB, as stated in the datasheet.

    The swcu117 guide (section 17.2) says that the AUX RAM start address is 0x400E0000.
    Therefore, I guess the end address is 0x400E07FF.

    However, the guide only provides a table with a list of start addresses, as below:
    ...
    AUX_RAM 0x400E0000
    AUX_SCE 0x400E1000
    ...

    From such table, one could understand that AUX_RAM ends at address 0x400E0FFF (1 byte before the start of AUX_SCE), which would result in AUX RAM size of 4KB.

    Can anyone from TI clarify this?
    What is the end address of AUX RAM?

    Best,

    Pietro
  • Bump.

    Hoping someone from TI can answer some of the questions, especially regarding the AUX_RAM size claim of 2KB in contrast of the data sheet start-end addresses.

    Thanks.
  • The AUX_RAM is 2kB, so 0x400E0000 + 2kB yields an end address of 0x400E07FF.

    Please see 17.2 Memory Mapping in the CC26xx TRM (SWCU117) for an explanation of the 4kB memory space allocation.

    Best wishes