From ec4fa0333c41aebb16e7106b1e9f583eb54aa26c Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 12 Nov 2017 14:14:30 +0100 Subject: hwstub: add code to dump STMP rom Change-Id: I083024662f3c085f7bcd2f85b0a68de85725b0f3 --- utils/hwstub/tools/lua/stmp.lua | 3 ++- utils/hwstub/tools/lua/stmp/rom.lua | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 utils/hwstub/tools/lua/stmp/rom.lua (limited to 'utils/hwstub/tools/lua') diff --git a/utils/hwstub/tools/lua/stmp.lua b/utils/hwstub/tools/lua/stmp.lua index ea1cde9c6d..2af4d18525 100644 --- a/utils/hwstub/tools/lua/stmp.lua +++ b/utils/hwstub/tools/lua/stmp.lua @@ -77,4 +77,5 @@ require "stmp/pinctrl" require "stmp/lcdif" require "stmp/pwm" require "stmp/clkctrl" -require "stmp/i2c" \ No newline at end of file +require "stmp/i2c" +require "stmp/rom" diff --git a/utils/hwstub/tools/lua/stmp/rom.lua b/utils/hwstub/tools/lua/stmp/rom.lua new file mode 100644 index 0000000000..fbba75bb3c --- /dev/null +++ b/utils/hwstub/tools/lua/stmp/rom.lua @@ -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 -- cgit