Extract .s19 from module
Extract .s19 from module
Is there a means to extract the .s19 off of a MOD5272? We are trying to determine the exact version of the .s19 binary that we loaded onto it.
- Chris Ruff
- Posts: 222
- Joined: Thu Apr 24, 2008 4:09 pm
- Location: topsail island, nc
- Contact:
Re: Extract .s19 from module
no.
You can, however, calculate a checksum or CRC of the resultant FLASH image- load each of your previous versions into an dentical board and get the flash checksums or CRCs in a list.
Then whichever version matches the one in your device- is the version you have loaded in there.
Chris
You can, however, calculate a checksum or CRC of the resultant FLASH image- load each of your previous versions into an dentical board and get the flash checksums or CRCs in a list.
Then whichever version matches the one in your device- is the version you have loaded in there.
Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
Re: Extract .s19 from module
If you have the s19 and you want to know what one you have....
Boot to the monitor 'A' to abort... etc...
From the monitor command prompt (Mod5272 specific addresses)
type md.l ffc08000
This will dump out some bytes....
Now load your canidate version into a different MOD5272 and do the same test...
when the number are the same you found the correct image....
Boot to the monitor 'A' to abort... etc...
From the monitor command prompt (Mod5272 specific addresses)
type md.l ffc08000
This will dump out some bytes....
Now load your canidate version into a different MOD5272 and do the same test...
when the number are the same you found the correct image....
Re: Extract .s19 from module
I have some tools that I can sometimes extract an _APP.S19 from a module, but
I would have to have physical possession of the module and I will only use these if you can
really convince me that you have legitimate rights to the code you are trying to extract.
We deliberately make this a bit hard to do so we can protect the developers that use our environment from having their code stolen.
Paul
I would have to have physical possession of the module and I will only use these if you can
really convince me that you have legitimate rights to the code you are trying to extract.
We deliberately make this a bit hard to do so we can protect the developers that use our environment from having their code stolen.
Paul
Re: Extract .s19 from module
Thanks for the suggestions. I think I can work some "Monitor" memory commands to get a good feel for which binary is which. Some microcontroller make it easy to read-back the binary until you blow a "lock-bit" fuse or some other gimmick, and then it will protect your IP, so I was just having wishful thinking on the NB.
I wouldn't suppose there is any auto-version rolling option in NB Eclipse? It'd be nice in the future to have every compilation have a unique number that can be queried from a console. We currently do that with a manual version string, but of course people tend to forget to roll it.
Actually, maybe I should just combine your ideas and calculate a CRC for the entire memory space and report that back.
I wouldn't suppose there is any auto-version rolling option in NB Eclipse? It'd be nice in the future to have every compilation have a unique number that can be queried from a console. We currently do that with a manual version string, but of course people tend to forget to roll it.
Actually, maybe I should just combine your ideas and calculate a CRC for the entire memory space and report that back.
Re: Extract .s19 from module
The compcode step can caluclate a SHA-1 checksum of the image.
-D
I need to dig it up but I have code to calculate this same value from within the app...
so you can verify....
Mostly I just use the DATE and TIME macros when compiling...
-D
I need to dig it up but I have code to calculate this same value from within the app...
so you can verify....
Mostly I just use the DATE and TIME macros when compiling...
Re: Extract .s19 from module
I got the original code from somewhere, but now it has been added as a menu option from the diagnostic menu that is available in my code. Because of regulation agencies require ability to randomly select one of our products and require us to be able to verify it is running the exact code that we told them it was. Below is the function that is called from the menu option, and hasn't failed the check yet. It writes from flash to the SD card, which then can be removed and checked for comparison with the .S19 file they have secured. It was designed for a MOD5270 with SD card wired like the development board.
Hope this helps, figured it might be close to what you are looking for.
Code: Select all
// Used to read from the flash, the current running software and write it to a file
void write_app_file(int fd)
{
char write_buf[WRITE_BUFSIZE];
FlashStartUpStruct *psu = ( FlashStartUpStruct * ) &FlashAppBase;
int out_len = psu->dwSrcBlockSize + sizeof( FlashStartUpStruct );
unsigned long cur_addr =(DWORD)&FlashAppBase;
unsigned char * cp = ( unsigned char * ) &FlashAppBase;
sprintf (write_buf, "\r\n***** OPENING FILE FOR STREAM *****\r\n" );
writestring(fd, write_buf);
f_enterFS();
InitSD(); // SD card initialization script
F_FILE* fp;
fp = f_open( APP_FILE, "a" );
if ( fp )
{
siprintf( write_buf, "S0%s\r\n", PlatformName );
f_write( write_buf, 1, strlen( write_buf ), fp );
while ( out_len )
{
int mklen;
if ( out_len > 16 )
{
mklen = 16;
}
else
{
mklen = out_len;
}
WriteS3_SD( fp, cur_addr, cp, mklen );
out_len -= mklen;
}
siprintf( write_buf, "S70502000000F8\r\n" );
f_write( write_buf, 1, strlen( write_buf ), fp );
f_close(fp);
}
else
{
sprintf (write_buf, "\r\n*** Error opening file \"%s\", fp = %d\r\n", APP_FILE, (int)fp );
writestring(fd, write_buf);
}
UnmountSD(); // quick unmount script.
f_releaseFS();
sprintf (write_buf, "\r\n***** FILE SAVE COMPLETE *****\r\n" );
writestring(fd, write_buf);
}