Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| RTL8720E<br>RTL8710ECF (AmebaLite) | Realtek | ✅ | ✅⁶ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❗️ |
| ECR6600 | ESWIN | ✅ | ✅ | ✅ | ✅ | ✅ | ✅⁸ | ❗️ | ❗️¹¹ | ✅ | ❌ | ❌ |
| TXW81X | Taixin | ❌ | ❗️ | ✅ | ❓ | ❌ | ❌ | ❌ | ❌ | ❓ | ❌ | ❌ |
| RDA5981 | RDA | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ➖ | ❌ |
| RDA5981 | RDA | ❌ | | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ➖ | ❌ |

✅ - Works<br>
❓ - Not tested<br>
Expand Down
2 changes: 1 addition & 1 deletion src/hal/rda5981/hal_flashConfig_rda5981.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/hal/rda5981/hal_flashVars_rda5981.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
25 changes: 12 additions & 13 deletions src/hal/rda5981/hal_ota_rda5981.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/littlefs/our_lfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading