mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
enable posix flash (#1894)
This commit is contained in:
@@ -56,9 +56,7 @@ otError utilsFlashInit(void)
|
||||
char fileName[20];
|
||||
struct stat st;
|
||||
bool create = false;
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
const char *offset = getenv("PORT_OFFSET");
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
|
||||
@@ -67,7 +65,12 @@ otError utilsFlashInit(void)
|
||||
mkdir("tmp", 0777);
|
||||
}
|
||||
|
||||
snprintf(fileName, sizeof(fileName), "tmp/%d_%d.flash", NODE_ID, (uint32_t)tv.tv_usec);
|
||||
if (offset == NULL)
|
||||
{
|
||||
offset = "0";
|
||||
}
|
||||
|
||||
snprintf(fileName, sizeof(fileName), "tmp/%s_%d.flash", offset, NODE_ID);
|
||||
|
||||
if (access(fileName, 0))
|
||||
{
|
||||
|
||||
@@ -121,6 +121,8 @@ estatus=$?
|
||||
|
||||
# Return the offset
|
||||
rm -rf "${lock_path}.${OFFSET}.lock.d"
|
||||
# Remove the flash files
|
||||
rm -f tmp/${OFFSET}_*.flash
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
|
||||
Reference in New Issue
Block a user