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.

RTOS/CC2650STK: How can i use big buffer?

Part Number: CC2650STK
Other Parts Discussed in Thread: CC2650

Tool/software: TI-RTOS

Hello, Ti dev team.

I using main board CC2650 and we company make in board.

make board in spi nand flash, Spi communication is ok (Read Company id and register etc...)

but we have problem read/write Page... spi nand flash page size for 2048.

Memory is sufficient before declaring an array.

Declaring an array 'uint8_t flash_buffer[2048];'  

CCS project  build ok but not working board


Before declaring available memory is 3463 Byte.

declaring 2048byte available memory is 1415 Byte.


I tried many things.

1. change predefine symbol 'HEAPMGR_SIZE=0 ' -> 'HEAPMGR_SIZE=2100'

2.  change app_ble.cfg file change BIOS.heapSize = 1668 -> 3716

3. change app_ble.cfg file change heapMinParams.size = 1668; -> 3716

4. try to 'Memory_alloc' function SYS/BIOS (TI-RTOS Kernel) v6.46 User guide '7.7.3 Using the xdc.runtime.Memory Module' 

All failed.

How can i use big buffer?

in ccs project in c source include 

/*********************************************************************
 * LOCAL VARIABLES
 */
uint32_t udAddr = 0;
uint8_t flash_buf[PAGE_DATA_SIZE] = {0,}; //edit kevin.ko test Nandflash page size 2048;
//uint8_t *flash_buf;

while (true) // in _TaskFxn task...
{
if (file_transfer_Config == ST_CFG_SENSOR_ENABLE)
{
Log_info0("file_transfer_TaskFxn");
// for(int i=0; i<PAGE_DATA_SIZE; i++)
// {
// flash_buf[i] = i%16;
// Log_info2("flash_buf[%d][%d]",i,flash_buf[i]);
// }
// Error_Block eb;
// flash_buf = Memory_alloc(NULL, 128, 0, &eb);
// if (flash_buf == NULL) {
// Log_info0("Memory allocation for buf1 failed");
// }
// Log_info0("Memory allocation for buf1 not failed");
// for(int i=0; i<512; i++)
// *(flash_buf+i) = i%16;
// for(int i=0; i<PAGE_DATA_SIZE; i++)
// *(flash_buf+i) = i%16;
// ExtNandFlash_PageProgram(udAddr,flash_buf,PAGE_DATA_SIZE);
// memset(flash_buf,0x00,PAGE_DATA_SIZE);
// ExtNandFlash_PageRead(udAddr,flash_buf);
// for(int i=0; i<PAGE_DATA_SIZE; i++)
// Log_info1("flash_buf[i]=[0x%02x]",*(flash_buf+i));
//
// memset(flash_buf,0x00,PAGE_DATA_SIZE);
// Memory_free(NULL, flash_buf, 512);


// for(int i=0; i<PAGE_DATA_SIZE; i++)
// flash_buf[i] = i%16;
// ExtNandFlash_PageProgram(udAddr,flash_buf,PAGE_DATA_SIZE);
// memset(flash_buf,0x00,PAGE_DATA_SIZE);
// ExtNandFlash_PageRead(udAddr,flash_buf);
// for(int i=0; i<PAGE_DATA_SIZE; i++)
// Log_info1("flash_buf[i]=[0x%02x]",flash_buf[i]);
// memset(flash_buf,0x00,PAGE_DATA_SIZE);


DELAY_MS(SENSOR_DEFAULT_PERIOD);
}

ccs project is not build.

  • Hi Kevin,

    I'm not sure what you're wanting to do here.  Do you want flash_buf[] to be in your last page of flash memory?  If so, you can try the following:

    1. Declare a memory section to go into FLASH_LAST_PAGE in the SECTIONS directive of your linker command file.  For example:

    #define FLASH_LAST_PAGE_BASE                0x1F000

    SECTIONS
    {
       ...

        .flash_buf     :    run > FLASH_LAST_PAGE_BASE, type = NOLOAD

        ...

    }

    2. In your .c file, declare the buffer flash_buf[] with a #pragma directive to allocate it in the .flash_buf memory section.  For example:

    #pragma DATA_SECTION(flash_buf, ".flash_buf")

    /*
     *  Set the block size to 4KB (0x1000), the size of an erase page on the
     *  CC2650.
     */
    #define FLASH_BUF_SIZE 0x1000
    char flash_buf[FLASH_BUF_SIZE];

    Best regards,

    Janet