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/CC1310: Store date into Flash memory

Part Number: CC1310


Tool/software: TI-RTOS

Hello,

I am using to Transmit and receive data using CC1310 chip in Frequency hopping mode. For that, I am using Collector example from simplelink_cc13x0_sdk_2_40_00_20. The attached image shows the memory allocation of my firmware.

I also need to store some data into Flash memory to use in my application. I am using the following code to store the data into the flash

#define SECTOR_SIZE                4096
#define SECTOR_TO_ERASE            30
#define SECTOR_TO_ERASE_START_ADDR (FLASHMEM_BASE + (SECTOR_TO_ERASE * SECTOR_SIZE))


#pragma NOINIT(flashDataAddr)
#pragma location = 0x1D400
char flashDataAddr[SECTOR_SIZE];

void writeToFlash(uint8_t buffer[])
{
    int32_t result;
    int32_t i;

    /* Disable the cache */
    VIMSModeSet(VIMS_BASE, VIMS_MODE_DISABLED);
    while(VIMSModeGet(VIMS_BASE) != VIMS_MODE_DISABLED);

    /* Make sure that sector isn't write protected. */
    result = FlashProtectionGet(SECTOR_TO_ERASE_START_ADDR);
    if(result == FLASH_WRITE_PROTECT)
    {
        while (1);
    }

    /* Disable all interrupts when accessing the flash */
    CPUcpsid();

    /* Erase a flash Page */
    result = FlashSectorErase(SECTOR_TO_ERASE_START_ADDR);

    if(result != FAPI_STATUS_SUCCESS)
    {
        while (1);
    }

    /* Program 128 bytes in chunks of 8 bytes */
    for( i = 0; i < 128; i += 8)
    {
        /* Write to flash */
        result = FlashProgram(&buffer[i], SECTOR_TO_ERASE_START_ADDR + i, 8);

        if(result != FAPI_STATUS_SUCCESS)
        {
            while (1);
        }
    }

    CPUcpsie();

    /* Re-enable the cache */
    VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
}

but while shoring the data into the flash my application is going into the Main_assertHandler