diff --git a/cores/common/base/lt_api.c b/cores/common/base/lt_api.c index d8af241..7259fd0 100644 --- a/cores/common/base/lt_api.c +++ b/cores/common/base/lt_api.c @@ -149,11 +149,17 @@ bool lt_flash_erase_block(uint32_t offset) { } uint32_t lt_flash_read(uint32_t offset, uint8_t *data, size_t length) { - return fal_partition_read(fal_root_part, offset, data, length); + int ret = fal_partition_read(fal_root_part, offset, data, length); + if (ret == -1) + return 0; + return ret; } uint32_t lt_flash_write(uint32_t offset, const uint8_t *data, size_t length) { - return fal_partition_write(fal_root_part, offset, data, length); + int ret = fal_partition_write(fal_root_part, offset, data, length); + if (ret == -1) + return 0; + return ret; } /*__ __ diff --git a/platform.json b/platform.json index e93ec23..4e21916 100644 --- a/platform.json +++ b/platform.json @@ -101,7 +101,7 @@ }, "tool-ltchiptool": { "type": "uploader", - "version": "https://github.com/libretuya/ltchiptool#v4.0.0a0", + "version": "https://github.com/libretuya/ltchiptool#v4.0.0a4", "version_prefix": true, "note": "This is used only for C/C++ code from ltchiptool." },