2016-04-14 15:54:11 +00:00
|
|
|
import esp
|
|
|
|
import uctypes
|
2016-05-23 22:27:16 +00:00
|
|
|
import network
|
2016-05-16 20:40:29 +00:00
|
|
|
import lwip
|
2016-04-14 15:54:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
|
|
|
ROM = uctypes.bytearray_at(0x40200000, 16)
|
|
|
|
fid = esp.flash_id()
|
|
|
|
|
2016-05-16 20:40:29 +00:00
|
|
|
print("FlashROM:")
|
2020-02-27 04:36:53 +00:00
|
|
|
print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xFF, fid & 0xFF00 | fid >> 16))
|
2016-04-14 15:54:11 +00:00
|
|
|
|
|
|
|
print("Flash bootloader data:")
|
|
|
|
SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"}
|
2020-02-27 04:36:53 +00:00
|
|
|
FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xF: "80MHz"}
|
2016-04-14 15:54:11 +00:00
|
|
|
print("Byte @2: %02x" % ROM[2])
|
2020-02-27 04:36:53 +00:00
|
|
|
print(
|
|
|
|
"Byte @3: %02x (Flash size: %s Flash freq: %s)"
|
|
|
|
% (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xF))
|
|
|
|
)
|
2016-08-03 21:43:58 +00:00
|
|
|
print("Firmware checksum:")
|
|
|
|
print(esp.check_fw())
|
2016-04-14 15:54:11 +00:00
|
|
|
|
2016-05-16 20:40:29 +00:00
|
|
|
print("\nNetworking:")
|
2016-05-23 22:27:16 +00:00
|
|
|
print("STA ifconfig:", network.WLAN(network.STA_IF).ifconfig())
|
|
|
|
print("AP ifconfig:", network.WLAN(network.AP_IF).ifconfig())
|
2016-05-16 20:40:29 +00:00
|
|
|
print("Free WiFi driver buffers of type:")
|
2020-02-27 04:36:53 +00:00
|
|
|
for i, comm in enumerate(
|
|
|
|
("1,2 TX", "4 Mngmt TX(len: 0x41-0x100)", "5 Mngmt TX (len: 0-0x40)", "7", "8 RX")
|
|
|
|
):
|
2016-11-01 03:56:10 +00:00
|
|
|
print("%d: %d (%s)" % (i, esp.esf_free_bufs(i), comm))
|
2016-05-16 20:40:29 +00:00
|
|
|
print("lwIP PCBs:")
|
|
|
|
lwip.print_pcbs()
|
|
|
|
|
2016-04-14 15:54:11 +00:00
|
|
|
|
|
|
|
main()
|