/* If the PLATFORM_RCR_PT record doesn't exist then the PHY_DATA partition might not have been initialised. This must be set to the proper default init data otherwise the SDK will halt on the "rf_cal !=0x05,is 0xFF" error.  */
static void phy_data_setup(partition_item_t *pt, uint32_t n)
/* If the PLATFORM_RCR_PT record doesn't exist then the PHY_DATA partition might not have been initialised. This must be set to the proper default init data otherwise the SDK will halt on the "rf_cal !=0x05,is 0xFF" error.  */
static void phy_data_setup(partition_item_t *pt, uint32_t n)
{0};
    int i;
    for (i = 0; i < n; i++) {
        if (pt[i].type == SYSTEM_PARTITION_PHY_DATA) {
            uint32_t addr = pt[i].addr;
            platform_s_flash_read(header, addr, sizeof(header));
            if (header[0] != 0x05) {
                uint32_t sector = pt[i].addr/INTERNAL_FLASH_SECTOR_SIZE;
                if (platform_flash_erase_sector(sector) == PLATFORM_OK) {
                    os_printf("Writing Init Data to 0x%08x\n",addr);
                    platform_s_flash_write(init_data, addr, INIT_DATA_SIZE);
                }
            }
            platform_rcr_write(PLATFORM_RCR_PHY_DATA, &addr, 0);
            return;
        }
    }
}