Dump RAM from lua script - LUA Scripting - CHDK Forum
supplierdeeply

Dump RAM from lua script

  • 4 Replies
  • 3004 Views
Dump RAM from lua script
« on: 15 / December / 2011, 16:50:24 »
Advertisements
Hello.
I want to insert in to script RAM dumping. Something like dumpRAM(file,start,length). Output can be binary or text. It could also call same RAM duping that I get using +/- button. How I can do it?

Re: Dump RAM from lua script
« Reply #1 on: 15 / December / 2011, 19:22:54 »
If you don't need a big dump (small length) you could use poke inside a loop and write results to file. I do not know other methods. I did some pokes in a loop some time ago and it and as far as I remember it was quite fast. But if you need to dump whole memory it take some time.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Dump RAM from lua script
« Reply #2 on: 15 / December / 2011, 19:24:47 »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Dump RAM from lua script
« Reply #3 on: 15 / December / 2011, 19:25:18 »
Ah! True;)
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


*

Offline reyalp

  • ******
  • 13434
Re: Dump RAM from lua script
« Reply #4 on: 16 / December / 2011, 00:40:10 »
You can do this easily with eventprocs http://chdk.wikia.com/wiki/Event_Procedure

Here's a script I used to grab the live view buffer on D10
Code: [Select]
if (call_event_proc("SystemEventInit") == -1) then
    -- Newest cams (DryOS rel 43 and later) only have System.Create()
    -- on older dryos cams SystemEventInit is an alias for System.Create()
    if (call_event_proc("System.Create") == -1) then
        error("ERROR: SystemEventInit and System.Create failed")
    end
end

DUMPFILE="A/LIVE.BIN"
addr=0x40A05158
size=(720*240*12)/8
f=call_event_proc("Fopen_Fut",DUMPFILE,"wb")
if (f==0 or f==-1) then
errf("Fopen_Fut %s failed %d",DUMPFILE,f)
end
r=call_event_proc("Fwrite_Fut",addr,size,1,f)
if (r ~= 1) then
printf("Fwrite_Fut return %d expect 1",size)
end
call_event_proc("Fclose_Fut",f)
This will be much faster than doing it a word at a time with peek()
Don't forget what the H stands for.

 

Related Topics