# CAPCAM macro for downloading image files FROM foscams and clones. # # Windows Installation: # Copy this text into your K95CUSTOM.INI file. # Tell K95 to "take \v(appdata)k95custom.ini" or restart K95. # Alternatively, store this in a separate file and add a TAKE # command for it to your K95CUSTOM.INI file. # Alternatively, just give a TAKE command for this file at the K-95> prompt. # # Usage: # You must already have a JTAG connection to the camera, and it must be at its # bootloader prompt. If necessary, use Alt-X (or the second toolbar button) # to go to K95's command screen. # At the K-95> prompt, type "CAPCAM ssss nnnn fname", where ssss # is the hexadecimal start address of the image, nnnn is the DECIMAL number of 256-byte # pages to transfer, and fname is the name of the # file you want to create locally of the capture. # The default timeout (maximum number of seconds for each page of the # capture to complete) is 120 seconds. After the capture, use # Alt-X or the second toolbar button to rerturn to bootloader. # # Bugs and limitations: # 1. The bootloader command prompt appears at the end of the captured file. # 2. Since there is no error checking the captured file might have errors # or gaps, especially on serial-port or modem connections. Use flow control. # 3. You can only capture text dumps of the image files this way. # 4. You can only capture one file at a time. # 5. Converting string representations of hex integers to decimal in Kermit scripts is # out of my league, so you must convert the "size" value to decimal, and divide it by # 256 to get the decimal number of pages. Round down if you get fractional pages. # 6. Timing variations on different machines may mangle the very first line of the capture. # This line is usually "bootloader > d -b HHHHHHHHHH", but sometimes in truncated or # duplicated. You are left to having to occasionally edit the first line by hand, # because the jEdit macro cannot find the right values there. This is probably just # another failure in the Kermit script because I'm not well enough versed in it. # # # define hostprompt "bootloader > " # ARM-7 bootloader command prompt define typecommand "d -b" # bootloader command to display the file define capturestart "0x7f020000" # beginning of capture space define capturesize 1 # decimal default value of size in pages define capturetimeout 120 define CAPCAM { if not def \%1 stop 1 "CAPCAM [target file] if not def \%2 stop 1 "CAPCAM [target file] # must have a transfer size if not def \%3 assign \%3 "CCcapfile.txt" # Local filename if none given assign capturesize \%2 assign capturestart \%1 if exist \%3 getok "OK to overwrite existing copy of \%3? " if fail end 1 clear input # Clear INPUT buffer output \13 # Send a carriage return input 5 "\m(hostprompt)" # Wait to see prompt if fail stop 1 CAPTURE: ERROR - FAILURE TO SEE BOOTLOADER PROMPT "\m(hostprompt)" log session \%3 # Open capture file if fail end 1 # Make sure it was opened. .%x = \%2 + 1 # page count for \%y 1 \%x 1 { if = \%y 1 { output \m(typecommand) \m(capturestart)\13 # Tell camera to display first page. } else { output \m(typecommand)\13 # Tell camera to display the next page. } input \m(capturetimeout) "\m(hostprompt)" # Wait for next DCL prompt if fail { echo "TIMEOUT \v(inwait) seconds - \%2 might be incomplete." echo "Check that the bootloader prompt definition agrees with the" echo "the actual camera's prompt. Hint: you can specify a longer" echo "timeout by changing the 'capturetimeout' definition or by" echo "specifying the time limit as a third agument." close session end 1 } } close session # Close the capture file echo "CAPTURE \%3 OK:" # Give messages directory \%3 end 0 }