fix init_data detect flash api
This commit is contained in:
parent
52ca40b8ea
commit
e1f8b604a0
|
@ -321,7 +321,7 @@ bool flash_init_data_written(void)
|
||||||
// FLASH SEC - 4
|
// FLASH SEC - 4
|
||||||
uint32_t data[2] ICACHE_STORE_ATTR;
|
uint32_t data[2] ICACHE_STORE_ATTR;
|
||||||
#if defined(FLASH_SAFE_API)
|
#if defined(FLASH_SAFE_API)
|
||||||
if (SPI_FLASH_RESULT_OK == flash_safe_read((flash_rom_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, (uint32 *)data, sizeof(data)))
|
if (SPI_FLASH_RESULT_OK == flash_safe_read((flash_safe_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, (uint32 *)data, sizeof(data)))
|
||||||
#else
|
#else
|
||||||
if (SPI_FLASH_RESULT_OK == spi_flash_read((flash_rom_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, (uint32 *)data, sizeof(data)))
|
if (SPI_FLASH_RESULT_OK == spi_flash_read((flash_rom_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, (uint32 *)data, sizeof(data)))
|
||||||
#endif // defined(FLASH_SAFE_API)
|
#endif // defined(FLASH_SAFE_API)
|
||||||
|
|
|
@ -381,3 +381,18 @@ function TestDNSLeak()
|
||||||
tmr.alarm(1, 3000, 0, function() print("hack socket close, MEM: "..node.heap()) c:close() end) -- socket timeout hack
|
tmr.alarm(1, 3000, 0, function() print("hack socket close, MEM: "..node.heap()) c:close() end) -- socket timeout hack
|
||||||
print("MEM: "..node.heap())
|
print("MEM: "..node.heap())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
v="abc%0D%0Adef"
|
||||||
|
print(string.gsub(v, "%%(%x%x)", function(x) return string.char(tonumber(x, 16)) end))
|
||||||
|
|
||||||
|
function ex(x) string.find("abc%0Ddef","bc") return 's' end
|
||||||
|
string.gsub("abc%0Ddef", "%%(%x%x)", ex)
|
||||||
|
|
||||||
|
function ex(x) string.char(35) return 's' end
|
||||||
|
string.gsub("abc%0Ddef", "%%(%x%x)", ex) print("hello")
|
||||||
|
|
||||||
|
function ex(x) string.lower('Ab') return 's' end
|
||||||
|
string.gsub("abc%0Ddef", "%%(%x%x)", ex) print("hello")
|
||||||
|
|
||||||
|
v="abc%0D%0Adef"
|
||||||
|
pcall(function() print(string.gsub(v, "%%(%x%x)", function(x) return string.char(tonumber(x, 16)) end)) end)
|
Loading…
Reference in New Issue