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: NVOCOP_compactNV needs to be called in idle function ?

Part Number: CC1310

Tool/software: TI-RTOS

Hello,

I'm using the storage algrotihme but i rewritten it for an external flash. My question is the following one, do i need to call compactNV regularly in an idle function in this way :

void common_idle(void) {
    static uint32_t memo_time = 10000;
    uint32_t current_time = Clock_getTicks() * Clock_tickPeriod / 1000;
    if (current_time > memo_time) {
        pNV->compactNV(1024);
        memo_time = current_time + 10000;
    }
}

Regards,

Aurélien

  • Hi,

    Compaction is usually only needed if:
    you need to write a new data block AND no open, contiguous region of storage is large enough to hold that data.

    See NVOCTP_newItem in nvoctp.c for reference.



    Regards,
    Toby
  • Hi,
    Thank you very much for the reply. I wanted to call the compaction function because i have noticed that searching function in the NVM are taking more and more time along the life cycle of the product. As a result when i'm doing a firmware upgrade, this time when it is cumulated can be huge, that's why i wanted to call the compaction function every 30 min or 1 hour for example.
    Regards,

    Aurélien
  • Hi Mark,

    As Toby said, compaction usually only needs to be done when you need to write new data and there is not enough free space to hold the data. If you find you need to do it more often in your applications, you are free to do so but it is not something you "need" to do.
  • Hi,

    Thank you very much. I really need to keep the flash the more compact as possible to limite searching time and reduce the duration of my upgrade that need to continuously needs to get access to the NV part which is in external flash.

    Regards,

    Aurélien