Verify on-target image

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Verify on-target image

Sam Voss
Hello,

I was wondering if it was possible to compare the hex file that is
currently on the chip to hex files on the host and determine which (if
any) were the flashed version?

Thanks for everything!

--
Sam Voss
Software Engineer
Rockwell Collins

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Verify on-target image

Stuart Longland
Hi,
On 11/04/17 08:03, Sam Voss wrote:
> I was wondering if it was possible to compare the hex file that is
> currently on the chip to hex files on the host and determine which (if
> any) were the flashed version?

From `man avrdude`:

>            -U memtype:op:filename[:format]
>                    Perform a memory operation as indi‐
>                    cated.  The memtype field specifies
>                    the memory type to operate on.  The
>                    available memory types are device-
>                    dependent, the actual configuration
>                    can be viewed with the part command in
>                    terminal mode.  Typically, a device's
>                    memory configuration at least contains
>                    the memory types flash and eeprom.

>                    v        read data from both the
>                             device and the specified file
>                             and perform a verify

In other words, -U flash:v:yourfile should do exactly as described.
--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Verify on-target image

David VanHorn-2
In reply to this post by Sam Voss
Usually yes if the chip isn't locked.  Sometimes complicated by saving data to flash.

On Apr 10, 2017 7:03 PM, "Sam Voss" <[hidden email]> wrote:
Hello,

I was wondering if it was possible to compare the hex file that is
currently on the chip to hex files on the host and determine which (if
any) were the flashed version?

Thanks for everything!

--
Sam Voss
Software Engineer
Rockwell Collins

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Verify on-target image

Stuart Longland (VK4MSL)-2
In reply to this post by Sam Voss
Hi,
On 11/04/17 08:03, Sam Voss wrote:
> I was wondering if it was possible to compare the hex file that is
> currently on the chip to hex files on the host and determine which (if
> any) were the flashed version?

From `man avrdude`:

>            -U memtype:op:filename[:format]
>                    Perform a memory operation as indi‐
>                    cated.  The memtype field specifies
>                    the memory type to operate on.  The
>                    available memory types are device-
>                    dependent, the actual configuration
>                    can be viewed with the part command in
>                    terminal mode.  Typically, a device's
>                    memory configuration at least contains
>                    the memory types flash and eeprom.

>                    v        read data from both the
>                             device and the specified file
>                             and perform a verify

In other words, -U flash:v:yourfile should do exactly as described.
--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Verify on-target image

Rolf Pfister-2
In reply to this post by Sam Voss
Am 11.04.17 um 00:03 schrieb Sam Voss:
> I was wondering if it was possible to compare the hex file that is
> currently on the chip to hex files on the host and determine which (if
> any) were the flashed version?
>
With avrdude you could do this:
avrdude -p m8 -c avr910 -P /dev/ttyUSB0 -U flash:r:flash.hex:i
This will write the content of the microcontroller to the file flash.hex.

But when compared the contents of flash.hex with your hex file
usally you will get a difference even the content is the same.
So it needs to convert to binary first to compare the two hex files.

Rolf


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Verify on-target image

Rogier Wolff
On Tue, Apr 11, 2017 at 07:54:34AM +0200, Rolf Pfister wrote:

> Am 11.04.17 um 00:03 schrieb Sam Voss:
> >I was wondering if it was possible to compare the hex file that is
> >currently on the chip to hex files on the host and determine which (if
> >any) were the flashed version?
> >
> With avrdude you could do this:
> avrdude -p m8 -c avr910 -P /dev/ttyUSB0 -U flash:r:flash.hex:i
> This will write the content of the microcontroller to the file flash.hex.
>
> But when compared the contents of flash.hex with your hex file
> usally you will get a difference even the content is the same.
> So it needs to convert to binary first to compare the two hex files.

That's not going to help.  The problem with a direct compare is that
the flash file that your compiler made only contains those bytes that
matter. The programmer leaves all other bytes at the default value of
0xff. When reading back from the chip you'll also see those "default
0xff" bytes in the hexfile.

Just compare the hexfiles with diff, and expect to see one file
ending, and the other continuing with 0xff....

        Roger.


--
** [hidden email] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Loading...