Skip to content

Commit

Permalink
[esp32img] Add phy_init_data.
Browse files Browse the repository at this point in the history
  • Loading branch information
OtherCrashOverride committed Oct 2, 2018
1 parent ba31df7 commit df059c7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tools/esp32img/main.c
Expand Up @@ -161,6 +161,29 @@ static void extract_partitions(FILE* fp)

//printf("erased RF data - offset=%#08x, size=%#08x\n",
// rf_part->pos.offset, rf_part->pos.size);


// Read the default RF data
FILE* rfdata = fopen("phy_init_data.bin", "rb");
if (!rfdata) abort();

fseek(rfdata, 0, SEEK_END);
size_t rffileSize = ftell(rfdata);
fseek(rfdata, 0, SEEK_SET);

if (rffileSize > rf_part->pos.size) abort();

void* rfptr = malloc(rffileSize);
if (!rfptr) abort();

size_t rf_count = fread(rfptr, 1, rffileSize, rfdata);
if (rf_count != rffileSize) abort();

// Write the default RF data
fseek(output, rf_part->pos.offset, SEEK_SET);
fwrite(rfptr, 1, rffileSize, output);

free(rfptr);
}

fclose(output);
Expand Down
Binary file added tools/esp32img/phy_init_data.bin
Binary file not shown.

0 comments on commit df059c7

Please sign in to comment.