rda fix flash vars (#1817)

This commit is contained in:
NonPIayerCharacter 2025-09-29 12:43:47 +03:00 committed by GitHub
parent 843de0c0dd
commit 8136ebe8d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 20 deletions

View File

@ -25,7 +25,7 @@
| RTL8720E<br>RTL8710ECF (AmebaLite) | Realtek | ✅ | ✅⁶ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❗️ |
| ECR6600 | ESWIN | ✅ | ✅ | ✅ | ✅ | ✅ | ✅⁸ | ❗️ | ❗️¹¹ | ✅ | ❌ | ❌ |
| TXW81X | Taixin | ❌ | ❗️ | ✅ | ❓ | ❌ | ❌ | ❌ | ❌ | ❓ | ❌ | ❌ |
| RDA5981 | RDA | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | | ❌ |
| RDA5981 | RDA | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | | ❌ |
✅ - Works<br>
❓ - Not tested<br>

View File

@ -10,7 +10,7 @@ int HAL_Configuration_ReadConfigMemory(void* target, int dataLen)
int HAL_Configuration_SaveConfigMemory(void* src, int dataLen)
{
int ret = rda5981_erase_flash(0x180fc000, 0x1000);
rda5981_erase_flash(0x180fc000, 0x1000);
return rda5981_write_flash(0x180fc000, src, dataLen) == 0;
}

View File

@ -18,14 +18,14 @@ extern void InitEasyFlashIfNeeded();
static int ReadFlashVars(void* target, int dataLen)
{
g_loaded = rda5981_read_user_data(target, dataLen, BIT18) == 0;
g_loaded = rda5981_read_flash(0x180fd000, target, dataLen) == 0;
return dataLen;
}
static int SaveFlashVars(void* src, int dataLen)
{
rda5981_erase_user_data(BIT18);
rda5981_write_user_data(src, dataLen, BIT18);
rda5981_erase_flash(0x180fd000, 0x1000);
rda5981_write_flash(0x180fd000, src, dataLen);
return dataLen;
}

View File

@ -20,11 +20,7 @@ int http_rest_post_flash(http_request_t* request, int startaddr, int maxaddr)
int ret = 0;
if (request->contentLength > 0)
{
towrite = request->contentLength;
}
else
if (request->contentLength <= 0)
{
ret = -1;
ADDLOG_ERROR(LOG_FEATURE_OTA, "Content-length is 0");
@ -33,29 +29,32 @@ int http_rest_post_flash(http_request_t* request, int startaddr, int maxaddr)
startaddr = 0x1807E000;
// if compressed ota
//startaddr = 0x1809C000;
if(rda5981_write_partition_start(startaddr, towrite) != 0)
int ret1 = rda5981_write_partition_start(startaddr, towrite + (towrite % 4096));
if(ret1 != 0)
{
ret = -1;
ADDLOG_ERROR(LOG_FEATURE_OTA, "rda5981_write_partition_start failed");
goto update_ota_exit;
//ret = -1;
ADDLOG_ERROR(LOG_FEATURE_OTA, "rda5981_write_partition_start failed. %i", ret);
//goto update_ota_exit;
}
do
{
if(rda5981_write_partition(startaddr, (unsigned char*)writebuf, writelen) != 0)
ADDLOG_DEBUG(LOG_FEATURE_OTA, "Writelen %i at %i", writelen, total);
ret1 = rda5981_write_partition(startaddr, (unsigned char*)writebuf, writelen);
if(ret1 != 0)
{
ret = -1;
ADDLOG_ERROR(LOG_FEATURE_OTA, "rda5981_write_partition failed. %i", ret1);
goto update_ota_exit;
}
delay_ms(5);
ADDLOG_DEBUG(LOG_FEATURE_OTA, "Writelen %i at %i", writelen, total);
total += writelen;
startaddr += writelen;
towrite -= writelen;
if (towrite > 0)
{
writebuf = request->received;
writelen = recv(request->fd, writebuf, 2048, 0);
writelen = recv(request->fd, writebuf, 1024, 0);
if (writelen < 0)
{
ADDLOG_DEBUG(LOG_FEATURE_OTA, "recv returned %d - end of data - remaining %d", writelen, towrite);
@ -67,7 +66,7 @@ int http_rest_post_flash(http_request_t* request, int startaddr, int maxaddr)
int check = rda5981_write_partition_end();
if(check != 0)
{
ADDLOG_ERROR(LOG_FEATURE_OTA, "rda5981_write_partition_end failed");
ADDLOG_ERROR(LOG_FEATURE_OTA, "rda5981_write_partition_end failed, %i", check);
ret = -1;
}
update_ota_exit:

View File

@ -159,8 +159,8 @@
#elif PLATFORM_RDA5981
#define LFS_BLOCKS_START 0xFD000
#define LFS_BLOCKS_START_MIN 0xFD000
#define LFS_BLOCKS_START 0xFE000
#define LFS_BLOCKS_START_MIN 0xFE000
#define LFS_BLOCKS_END 0x100000
#else