Home AMX User Forum NetLinx Studio

Using Compiled Code for Backup/Restore?

I have never worked on an AMX system before that I did not program from start to finish. Tomorrow I will be going to work on a system where I will be modifying the code on a controller that I have never touched before. I have a copy of the NetLinx workspace from the original programmer but I have no way to guarantee that this is the code working on the system. I'm told it is though. The change I'm making to the code is very minor but I am nervous that if I load my code that portions of it will not be the same as what was already on the controller.

If I retrieve the compiled source code from the controller can I later reload it and effectively restore the system to the state it was in before I got there? Thanks!

Comments

  • ericmedleyericmedley Posts: 4,177
    Two things.

    first, you can compare the code in the master with the compiled code you have. It's in the Debug Menu called Verify TKN on Netlinx Master. If it passes you should be good to go. However, if it fails, it doesn't necessarily mean you have the wrong code. If it does fail, you'll have to do a lot more homework. Or, if possible, download the source code from the master and rebuild the project yourself.
  • remeolbremeolb Posts: 79
    So am I able to put what was originally on the master back on the master after I make changes?
  • AuserAuser Posts: 506
    remeolb wrote: »
    If I retrieve the compiled source code from the controller can I later reload it and effectively restore the system to the state it was in before I got there? Thanks!

    The short answer is yes. Probably the easiest way to get the compiled program from the NetLinx is to issue the following from a DOS prompt (Windows command shell these days I s'pose):
    C:\windows\system32>ftp <<NetLinx URL/IP>>
    Connected to <<NetLinx URL/IP>>.
    220 VxWorks (VxWorks 6.3) FTP server ready
    User (<<NetLinx URL/IP>>:(none)): << user >>
    331 Password required
    Password: << password >>
    230 User logged in
    ftp> binary
    200 Type set to I, binary mode
    ftp> get ../prog.tkn <<path\file on your local machine>>
    200 Port set okay
    150 Opening BINARY mode data connection
    226 Transfer complete
    ftp: 37913 bytes received in 0.03Seconds 1223.00Kbytes/sec.
    ftp> quit
    221 Bye...see you later
    
    C:\windows\system32>
    

    Obviously, you want to replace anything inside "<< >>" blocks with what's appropriate in your circumstances. The default usernames and passwords that are available can be found in the NetLinx manual from the AMX website.

    Use the FTP "put" command to send the compiled program back to the master if you need to roll back.

    Caveats:

    - This does not retrieve the IR files from the box. It is well worth taking a backup of them in IREdit or NetLinx Studio before you begin.
    - This does not back up any other files which may be crucial to the operation of the program such as configuration files. You should have a snoop around the box with FTP and grab a copy of anything else which looks like it may be necessary before uploading new code.
    - This does not retrieve Duet .jar files. If the program is using Duet modules, I'd be grabbing a copy of the ones off the box to make sure you can roll back to exactly the same versions.
  • PhreaKPhreaK Posts: 966
    If the system is using any persistent variables you may have some issues trying to restore that way as well. The method I've used in the past is to take the CF card out and create an image of it before you do anything, grab any of the IR files off the device controller and take note of port settings (baud rate etc). That way if anything does go wrong you should be able to restore it to the original state.
  • remeolbremeolb Posts: 79
    Thanks for your help everyone! The code I had worked out great.
  • ericmedleyericmedley Posts: 4,177
    remeolb wrote: »
    Thanks for your help everyone! The code I had worked out great.

    I love it when stuff works!
Sign In or Register to comment.