diff options
| author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-11-26 00:00:11 +0100 |
|---|---|---|
| committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-11-28 19:38:02 +0100 |
| commit | e99c036ed1b96abf0c4b196e5f58ef93b7effdfe (patch) | |
| tree | 0d5f487d19ece13a815e7fae12a91abfaaa11221 /utils/hwstub/tools/lua | |
| parent | 9439635aa27e7604d01dddb30a505a3402f3b4df (diff) | |
| download | rockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.zip rockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.tar.gz rockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.tar.bz2 rockbox-e99c036ed1b96abf0c4b196e5f58ef93b7effdfe.tar.xz | |
hwstub_shell: add support for call and jump
Change-Id: Ie09d0db21831b79255da858bada7382a08ff4eef
Reviewed-on: http://gerrit.rockbox.org/1052
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested: Marcin Bukat <marcin.bukat@gmail.com>
Diffstat (limited to 'utils/hwstub/tools/lua')
| -rw-r--r-- | utils/hwstub/tools/lua/hwlib.lua | 27 | ||||
| -rw-r--r-- | utils/hwstub/tools/lua/load.lua | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/hwlib.lua b/utils/hwstub/tools/lua/hwlib.lua new file mode 100644 index 0000000..5bbd1e2 --- /dev/null +++ b/utils/hwstub/tools/lua/hwlib.lua @@ -0,0 +1,27 @@ +HWLIB = {} + +local h = HELP:create_topic("HWLIB") +h:add("This table contains helper functions for use inside hwstub_shell") + +local hh = h:create_topic("load_blob") +hh:add("load_blob(filename, address) -- this function loads raw binary blob from the file filename") +hh:add(" at specified address in memory. No cache coherency is") +hh:add(" guaranteed") + +hh = h:create_topic("printf") +hh:add("printf(s,...) -- this function is simple wrapper around string.format to emulate") +hh:add(" C printf() function") + +function HWLIB.load_blob(filename, address) + local f = assert(io.open(filename, "rb")) + local bytes = f:read("*all") + for b in string.gmatch(bytes, ".") do + DEV.write8(address, string.byte(b)) + address = address + 1 + end + io.close(f) +end + +function HWLIB.printf(s,...) + return io.write(s:format(...)) +end diff --git a/utils/hwstub/tools/lua/load.lua b/utils/hwstub/tools/lua/load.lua index 86f01f7..f636360 100644 --- a/utils/hwstub/tools/lua/load.lua +++ b/utils/hwstub/tools/lua/load.lua @@ -10,4 +10,5 @@ elseif hwstub.dev.target.id == hwstub.dev.target.ATJ then require "atj" end +require "hwlib" require "dumper" |