port for A3300IS / what reference port to use? - page 3 - General Discussion and Assistance - CHDK Forum supplierdeeply

port for A3300IS / what reference port to use?

  • 289 Replies
  • 94776 Views
Re: port for A3300IS / what reference port to use?
« Reply #20 on: 28 / December / 2011, 14:44:04 »
Advertisements
Hey, was wondering if I am doing something wrong, I am trying to get my own dump from my a3300is, I cant get any of the dumpers to work, maybe I am adding the wrong scripts, I read there has to be extend.m and script.req, maybe I am misunderstanding what code in what script, I also tried the EOScard utilty to add the SCRIPT string to 1F0 address, also confirmed it with the hex editor,
So I assume you read and followed this : http://chdk.wikia.com/wiki/Canon_Basic, this http://chdk.wikia.com/wiki/Canon_Basic/Card_Setup and then this : http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper ?

Once you setup the card as directed,  did you copy the Canon BASIC code for the dumper from the second link to a file called  extend.m  and put that on the root directory of your SD card ?

As noted in the instructions,  sometimes the colors used don't let you see anything on the display even though the script worked.   Did you look at the SD card afterwards to see if there is a CDUMPER.LOG or PRIMARY.BIN file on the card ?

Quote
not sure if I am suppose to make it bootable or not for dumping, but tried both, I just cant get anything to happen,
It does not matter if its bootable or not.

Quote
could my cam be unhackable or something?
no

Quote
I got frustrated when I could not get no leds or anything to work on my cam while trying to port it, so I figured maybe the dump I got online was bad or wrong, I have a 100a version firmware, there is a 100d firmware online that looks like the real deal, but the 100a I am not sure is the real one, especially since my cam is not able to do anything while trying to port, I just want to see if I can even just dump my own firmware to make sure its right????
If you got your 1.00a dump from here : http://www.box.com/chdk then it should be okay - fe50 looks at them before he posts them and its pretty easy to be sure they are correct.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #21 on: 28 / December / 2011, 15:49:56 »
well, that might be where i messed up, which code is the extend.m?

#!/bin/bash
#Enable powershot basic scripting on a memory card
if [ $# -ne 1 ] ; then
  echo
  echo "Usage : ./makeScriptCard.sh [ device ]"
  echo
  echo " [ device ] is a fat32 / fat16 partition on the memory card"
  echo " example : ./makeScriptCard.sh /dev/sdb1"
  echo "NOTE: please run as root"
  exit 112
fi
#TAG on boot sector
echo -n SCRIPT | dd bs=1 count=6 seek=496 of=$1
#mount card
umount /mnt
mount $1 /mnt
#create script request file
echo "for DC_scriptdisk" > /mnt/script.req
#Example script
echo 'private sub sayHello()
  a=LCDMsg_Create()
  LCDMsg_SetStr(a,"Hello World!")
end sub
private sub Initialize()
  UI.CreatePublic()
  sayHello()
end sub
'>/mnt/extend.m
#Done !
echo "Please check /mnt for files extend.m and script.req"


or is it this one?

--[[
@title prepare script disk
]]
 
f=io.open("A/SCRIPT.REQ","w")
if not f then
   error("file open failed")
end
f:write("for DC_scriptdisk")
f:close()
 
if call_event_proc("SystemEventInit") == -1 then
   call_event_proc("System.Create")
end
call_event_proc("MakeScriptDisk",0)
 
--


and if im correct the script.req is this one???

' dump ROM to A/PRIMARY.BIN
' log to A/CBDUMPER.LOG
 
DIM startaddr=0
DIM os="unk"
DIM lcdmsg=0
DIM msgstr=0
 
' detect start address and OS
' order must be from highest to lowest, since accessing outside of ROM may trigger an exception
private sub GetStart()
   if memcmp(0xFFC00004,"gaonisoy",8) = 0 then
      startaddr = 0xFFC00000
      os = "dry"
      exit sub
   end if
   if memcmp(0xFFC00008,"Copyrigh",8) = 0 then
      startaddr = 0xFFC00000
      os = "vx"
      exit sub
   end if
   if memcmp(0xFF810004,"gaonisoy",8) = 0 then
      startaddr = 0xFF810000
      os = "dry"
      exit sub
   end if
   if memcmp(0xFF810008,"Copyrigh",8) = 0 then
      startaddr = 0xFF810000
      os = "vx"
      exit sub
   end if
   if memcmp(0xFF000004,"gaonisoy",8) = 0 then
      startaddr = 0xFF000000
      os = "dry"
      exit sub
   end if
end sub
 
private sub RegisterProcs()
   ' Newest cams (Dryos rel 43 and later) only have System.Create()
   ' on older dryos cams SystemEventInit is an alias for System.Create()
   ' ExecuteEventProcedure does is not registered by default on vx,
   ' but calling an unregistered is not fatal
   if System.Create() = -1 then
      SystemEventInit()
   end if
   if ExecuteEventProcedure("UI_RegistDebugEventProc") = -1 then
      ExecuteEventProcedure("UI.CreatePublic")
   end if
end sub
 
private sub InitMsg()
   lcdmsg = ExecuteEventProcedure("LCDMsg_Create")
   msgstr = AllocateMemory(80)
   ' truncate log
   msgfile = Fopen_Fut("A/CBDUMPER.LOG","w")
   if msgfile <> 0 then
      Fclose_Fut(msgfile)
   end if
end sub
 
private sub PutMsg(msg)
   if lcdmsg >= 0 then
      LCDMsg_SetStr(lcdmsg,msg)
   end if
   msgfile = Fopen_Fut("A/CBDUMPER.LOG","a")
   if msgfile <> 0 then
      Fwrite_Fut(msg,strlen(msg),1,msgfile)
      Fwrite_Fut("\n",1,1,msgfile)
      Fclose_Fut(msgfile)
   end if
end sub
 
private sub Initialize()
   RegisterProcs()
   InitMsg()
   PutMsg("Started")
 
   GetStart()
 
   if startaddr <> 0 then
      sprintf(msgstr,"%0X %s",startaddr,os)
      PutMsg(msgstr)
      romsize = 0xFFFFFFFC - startaddr
      dumpfile = Fopen_Fut("A/PRIMARY.BIN","w")
      if dumpfile <> 0 then
         Fwrite_Fut(startaddr,romsize,1,dumpfile)
         Fclose_Fut(dumpfile)
         Wait(500)
         PutMsg("done")
      else
         PutMsg("file error")
      end if
   else
      PutMsg("not found!")
   end if
   FreeMemory(msgstr)
end sub

Re: port for A3300IS / what reference port to use?
« Reply #22 on: 28 / December / 2011, 16:00:33 »
well, that might be where i messed up, which code is the extend.m?
....
and if im correct the script.req is this one???
Did you actually read http://chdk.wikia.com/wiki/Canon_Basic#Format_of_the_SD_card like I suggested ??  ::)

Especially the part where it says : The file "script.req" must exist on the card's root directory, and must only contain the string "for DC_scriptdisk\n" (where the \n represents a newline character)

and the part where it says : The file "extend.m" must exist on the root directory. This file must contain the Canon BASIC script to execute.

So like it says, put "for DC_scriptdisk\n" in the script.req file and put this into extend.m

Code: [Select]
' dump ROM to A/PRIMARY.BIN
' log to A/CBDUMPER.LOG
 
DIM startaddr=0
DIM os="unk"
DIM lcdmsg=0
DIM msgstr=0
 
' detect start address and OS
' order must be from highest to lowest, since accessing outside of ROM may trigger an exception
private sub GetStart()
if memcmp(0xFFC00004,"gaonisoy",8) = 0 then
startaddr = 0xFFC00000
os = "dry"
exit sub
end if
if memcmp(0xFFC00008,"Copyrigh",8) = 0 then
startaddr = 0xFFC00000
os = "vx"
exit sub
end if
if memcmp(0xFF810004,"gaonisoy",8) = 0 then
startaddr = 0xFF810000
os = "dry"
exit sub
end if
if memcmp(0xFF810008,"Copyrigh",8) = 0 then
startaddr = 0xFF810000
os = "vx"
exit sub
end if
if memcmp(0xFF000004,"gaonisoy",8) = 0 then
startaddr = 0xFF000000
os = "dry"
exit sub
end if
end sub
 
private sub RegisterProcs()
' Newest cams (Dryos rel 43 and later) only have System.Create()
' on older dryos cams SystemEventInit is an alias for System.Create()
' ExecuteEventProcedure does is not registered by default on vx,
' but calling an unregistered is not fatal
if System.Create() = -1 then
SystemEventInit()
end if
if ExecuteEventProcedure("UI_RegistDebugEventProc") = -1 then
ExecuteEventProcedure("UI.CreatePublic")
end if
end sub
 
private sub InitMsg()
lcdmsg = ExecuteEventProcedure("LCDMsg_Create")
msgstr = AllocateMemory(80)
' truncate log
msgfile = Fopen_Fut("A/CBDUMPER.LOG","w")
if msgfile <> 0 then
Fclose_Fut(msgfile)
end if
end sub
 
private sub PutMsg(msg)
if lcdmsg >= 0 then
LCDMsg_SetStr(lcdmsg,msg)
end if
msgfile = Fopen_Fut("A/CBDUMPER.LOG","a")
if msgfile <> 0 then
Fwrite_Fut(msg,strlen(msg),1,msgfile)
Fwrite_Fut("\n",1,1,msgfile)
Fclose_Fut(msgfile)
end if
end sub
 
private sub Initialize()
RegisterProcs()
InitMsg()
PutMsg("Started")
 
GetStart()
 
if startaddr <> 0 then
sprintf(msgstr,"%0X %s",startaddr,os)
PutMsg(msgstr)
romsize = 0xFFFFFFFC - startaddr
dumpfile = Fopen_Fut("A/PRIMARY.BIN","w")
if dumpfile <> 0 then
Fwrite_Fut(startaddr,romsize,1,dumpfile)
Fclose_Fut(dumpfile)
Wait(500)
PutMsg("done")
else
PutMsg("file error")
end if
else
PutMsg("not found!")
end if
FreeMemory(msgstr)
end sub
« Last Edit: 28 / December / 2011, 16:02:19 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #23 on: 28 / December / 2011, 17:03:02 »
well, that might be where i messed up, which code is the extend.m?
....
and if im correct the script.req is this one???
Did you actually read http://chdk.wikia.com/wiki/Canon_Basic#Format_of_the_SD_card like I suggested ??  ::)

Especially the part where it says : The file "script.req" must exist on the card's root directory, and must only contain the string "for DC_scriptdisk\n" (where the \n represents a newline character)

and the part where it says : The file "extend.m" must exist on the root directory. This file must contain the Canon BASIC script to execute.

So like it says, put "for DC_scriptdisk\n" in the script.req file and put this into extend.m

Code: [Select]
' dump ROM to A/PRIMARY.BIN
' log to A/CBDUMPER.LOG
 
DIM startaddr=0
DIM os="unk"
DIM lcdmsg=0
DIM msgstr=0
 
' detect start address and OS
' order must be from highest to lowest, since accessing outside of ROM may trigger an exception
private sub GetStart()
if memcmp(0xFFC00004,"gaonisoy",8) = 0 then
startaddr = 0xFFC00000
os = "dry"
exit sub
end if
if memcmp(0xFFC00008,"Copyrigh",8) = 0 then
startaddr = 0xFFC00000
os = "vx"
exit sub
end if
if memcmp(0xFF810004,"gaonisoy",8) = 0 then
startaddr = 0xFF810000
os = "dry"
exit sub
end if
if memcmp(0xFF810008,"Copyrigh",8) = 0 then
startaddr = 0xFF810000
os = "vx"
exit sub
end if
if memcmp(0xFF000004,"gaonisoy",8) = 0 then
startaddr = 0xFF000000
os = "dry"
exit sub
end if
end sub
 
private sub RegisterProcs()
' Newest cams (Dryos rel 43 and later) only have System.Create()
' on older dryos cams SystemEventInit is an alias for System.Create()
' ExecuteEventProcedure does is not registered by default on vx,
' but calling an unregistered is not fatal
if System.Create() = -1 then
SystemEventInit()
end if
if ExecuteEventProcedure("UI_RegistDebugEventProc") = -1 then
ExecuteEventProcedure("UI.CreatePublic")
end if
end sub
 
private sub InitMsg()
lcdmsg = ExecuteEventProcedure("LCDMsg_Create")
msgstr = AllocateMemory(80)
' truncate log
msgfile = Fopen_Fut("A/CBDUMPER.LOG","w")
if msgfile <> 0 then
Fclose_Fut(msgfile)
end if
end sub
 
private sub PutMsg(msg)
if lcdmsg >= 0 then
LCDMsg_SetStr(lcdmsg,msg)
end if
msgfile = Fopen_Fut("A/CBDUMPER.LOG","a")
if msgfile <> 0 then
Fwrite_Fut(msg,strlen(msg),1,msgfile)
Fwrite_Fut("\n",1,1,msgfile)
Fclose_Fut(msgfile)
end if
end sub
 
private sub Initialize()
RegisterProcs()
InitMsg()
PutMsg("Started")
 
GetStart()
 
if startaddr <> 0 then
sprintf(msgstr,"%0X %s",startaddr,os)
PutMsg(msgstr)
romsize = 0xFFFFFFFC - startaddr
dumpfile = Fopen_Fut("A/PRIMARY.BIN","w")
if dumpfile <> 0 then
Fwrite_Fut(startaddr,romsize,1,dumpfile)
Fclose_Fut(dumpfile)
Wait(500)
PutMsg("done")
else
PutMsg("file error")
end if
else
PutMsg("not found!")
end if
FreeMemory(msgstr)
end sub
yes, i read it numerous times and i guess was so frustrated with it not working no matter what way i tried it, i guess i misunderstood, ill try it with the one string in script.req, thanks for the help i will let u know if it finally works.


Re: port for A3300IS / what reference port to use?
« Reply #24 on: 28 / December / 2011, 18:04:15 »
Ok, that was it, geez, something so dumb, i was totally missing the part of just that string and kept adding the whole code they showed, but that worked thanks again.

Re: port for A3300IS / what reference port to use?
« Reply #25 on: 28 / December / 2011, 18:33:04 »
Also, one thing that made me not sure about the 100a version i found online is anytime i put the PRIMARY.BIN in the sub folder to compile it I would get a sig crash with the chdk_shell, but now it seems fine and it actually generated a stubs_entry file, so that makes me feel better, would it be good for me to upload my dump?

Re: port for A3300IS / what reference port to use?
« Reply #26 on: 28 / December / 2011, 19:35:32 »
Also, one thing that made me not sure about the 100a version i found online is anytime i put the PRIMARY.BIN in the sub folder to compile it I would get a sig crash with the chdk_shell, but now it seems fine and it actually generated a stubs_entry file, so that makes me feel better, would it be good for me to upload my dump?
Did you try comparing the files ?  Or putting the online primary.bin back and seeing if it still crashes ?

If you are convinced yours is better / correct then post it here http://chdk.setepontos.com/index.php?topic=288.msg78538#new with a note that it works better than the version current available.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #27 on: 29 / December / 2011, 09:56:36 »
is the cycling code for leds any good for newer cams, i cant seem to get any leds to lite up, i only have the power and af light on this cam, I tried adding it to main.c but no luck, I cant find anything in dump other then leddrv and ledcon, cam still not booting, so i am trying to get an led going first. Can I make an led lite using the extend.m file, if so, do I need to change the script.req file, or just leave that 1 string in there?


Re: port for A3300IS / what reference port to use?
« Reply #28 on: 29 / December / 2011, 10:04:03 »
is the cycling code for leds any good for newer cams
You just need to find the right address for the LED but AFAIK every camera so far uses the same code for turning on & off the LED's  ( i.e.    *p = 0x46;  // led on )

Quote
Can I make an led lite using the extend.m file,
Yes.

Quote
if so, do I need to change the script.req file, or just leave that 1 string in there?
No change - leave the 1 string in there.

Here's a simple Canon BASIC script you can put into extend.m to try each LED address.  You may have to play with the value for  LCDMsg_ChangeColor.

Code: [Select]
private sub Initialize()

    System.Create()
    Driver.Create()
    UI.CreatePublic()

    a=LCDMsg_Create()
    LCDMsg_SetStr(a,"LED Test")
    LCDMsg_Move(a,100,100)
    LCDMsg_ChangeColor(a,5)

    b=LCDMsg_Create()

    for c=0 to 15 
        LCDMsg_SetNum(b,c)
        LCDMsg_Move(b,100,200)
        LCDMsg_ChangeColor(b,2)
        BeepDrive(3)
        Wait(500)
        LEDDrive(c,0)
        Wait(2000)
        LEDDrive(c,1)
    next
 
    Wait(2000)
    LCDMsg_SetStr(a,"Test End")

end sub
private sub terminate( )
' Ending code
end sub


Unfortunately,  it does not give you the actual hex address - just confirms you can blink them.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #29 on: 29 / December / 2011, 11:10:25 »
Ok, thanks, and I did happen to find the LED test in the debugging page, pretty cool to see something at least happening, I tried it and had to change color to orange to see it, but it worked and power came on at 0 and AF came on at 9, 10, and 11 plus I heard the beep of coarse.

 

Related Topics