simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] Implementing device signatures


From: Petr Hluzín
Subject: Re: [Simulavr-devel] Implementing device signatures
Date: Sun, 29 Jan 2012 16:39:17 +0100

On 23 January 2012 21:03, ThomasK <address@hidden> wrote:
> Hi Petr,
>
> just a short answer. Do you've seen my code in branch devel-tomk? I've made
> something with signature, fuses and such. The change was on 2th june 2010:
> "Implement loading fuses, lock bits and signature from elf, check
> signature".

Oh well, I did not see your code. It appears you implemented the
signature detection in [1].

Have you considered merging it into trunk/master/whatever branch?

(I have spent several hours debugging a problem which existed just
because a program was compiled for different device than what
simulator was simulating. I expect users will be even more prone to
such mistake.)

>
> But there I start with another point ov view. (as I remember, I have to look
> for my own code, what I've done there ... ;-) ) I think, your point B, C and
> D is solved by this code. And I remember, that I discussed the case A,
> you've listed below. But I don't know, with whom and what's the result of
> this discussion? Maybe it's to find around june 2010 in simulavr list.
> (maybe this was Onno, I don't know)

Yes, your code solves B, C, D and E.

The case A requires some some more code. I would like to implement it
but that probably means to use your code which is still in a separate
branch. Also I would like to decide how to get the constants
(currently passed into AvrDevice constructor) into AvrFactory or
something, so the signatures are searchable when no device is created
yet.

The discussion is at
http://lists.nongnu.org/archive/html/simulavr-devel/2010-06/msg00000.html

> Am 22.01.2012 19:43, schrieb Petr Hluzín:
>
>> Hi folks
>>
>> User may include `#include<avr/signature.h>' in source code, this
>> will create a new ELF section. We can use that to detect which device
>> was user's program compiled for when the ELF file is loaded via --file
>> on command line or `load' via GDB [1], or by a script.
>>
>> The implementation will touch many files, mostly in a minor way.
>> However people may get upset on the style I chose. Therefore I ask:
>> how should I implement that?
>>
>> User visible stuff:
>> A: If user does not enter `--device=XYZ' and we support the ELF
>> signature, create the device
>> B: If user does enter `--device=XYZ' and and the ELF signature
>> matches, continue normally
>> C: If user does enter `--device=XYZ' and and the ELF signature does
>> not match and we do not support the signature, continue normally
>> D: If user does enter `--device=XYZ' and and the ELF signature does
>> not match and we do support the signature, then report error
>> E: If the ELF image does not contain a signature, then trust user or fail.
>>
>> The case C is needed to workaround limited set of devices supported by
>> simulavr. Other cases are pretty clear.
>> The implementation has to allow querying when no device is created (is
>> signature known, create from signature, ...) and when a device is
>> created (does that have this signature).
>>
>> Possibilities:
>> AvrFactory: add a map<signature,name>  or map
>> <signature,AvrDeviceCreator>, or some other map.
>> AVR_REGISTER: add a macro parameter or pass "well-know" name of
>> signature (member constant, #define)
>> AvrDevice: add a virtual function or a member variable
>> each device: implement AvrDevice's virtual function or set AvrDevice's
>> member variable
>>
>> There are several ways to do that, neither looks significantly better
>> to me. Someone may have an opinion, therefore I ask you.
>>
>> [1]
>> http://git.savannah.gnu.org/cgit/simulavr.git/commit/?id=4e38167e0464c360df9971192a6d4e4e01dc3998
>>
>
> _______________________________________________
> Simulavr-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/simulavr-devel

[1] 
http://git.savannah.gnu.org/cgit/simulavr.git/commit/?h=devel-tomk&id=526777eacce53b671a824fa2b764af28e425ce56

-- 
Petr Hluzin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]