1
0
Fork 0
forked from len0rd/rockbox

hwstub: add code to dump STMP rom

Change-Id: I083024662f3c085f7bcd2f85b0a68de85725b0f3
This commit is contained in:
Amaury Pouly 2017-11-12 14:14:30 +01:00
parent dd6b8427f9
commit ec4fa0333c
2 changed files with 18 additions and 1 deletions

View file

@ -78,3 +78,4 @@ require "stmp/lcdif"
require "stmp/pwm"
require "stmp/clkctrl"
require "stmp/i2c"
require "stmp/rom"

View file

@ -0,0 +1,16 @@
---
--- ROM
---
STMP.rom = {}
-- if path is nil, create a generic path that depends on stmp version and rom version
function STMP.rom.dump(path)
local name = path
if name == nil then
name = string.format("stmp%04x_ta%d.bin", hwstub.dev.stmp.chipid, hwstub.dev.stmp.rev + 1)
end
local file = io.open(name, "wb")
file:write(DEV.read(0xffff0000, 0x10000))
file:close()
print("Dumping ROM to " .. name)
end