Re: [Oopic-compiler-devel] OOpic firmware versions and code generation impact
Status: Planning
Brought to you by:
ndurant
From: Neil D. <nd...@us...> - 2004-06-05 14:21:32
|
D. Daniel McGlothin wrote: > > I think we should be able to use the same code generator. I would > > suggest that we pass in a parameter to the compiler to specify the > > firmware version, and the parser will throw an error if the input code > > includes stuff not allowed for that firmware version. Once the parser > > has successfully parsed the input code and generated an internal > > representation, the code generator should just be able to do its stuff, > > regardless of the firmware version (I think). It sounds to me as > > though the code generator should generate exactly the same code > > irrespective of firmware version setting, as long as the input code is > > legal on the respective firmware versions. > > > > If I'm right about this, all we need to do is put some conditional > > logic in the parser to disallow certain things, which I imagine would > > simply be the instantiation of VC objects that aren't supported on a > > given version. > > I think you are partly right. > > The parser will need to filter by firmware so as to not allow unsupported > objects. > > However, since the firmware commands (the op-codes) also vary by version, > won't the generator also need to be firmware aware? Yes, you're right, I wasn't thinking straight. We will need the code generator to know which op-codes are permissible for a given version of the firmware. I imagine most of the code generation will use "standard" instructions available on all firmware, but perhaps newer firmware supports instructions that allow more optimisations to be made etc. Looking at opcode 251, "CommandSet2", it looks like this might be where new instructions have been added from previous firmware versions. So it looks like each version of the firmware is backwards-compatible with the older instruction sets at least. I can confirm this because several times I have successfully run code on my 2+ which I'd accidentally compiled for an older version of the firmware. We only have the B.2.x+ instruction set documentation at the moment, so I guess that's all we can really target. We should ensure that both the parser and the code generator are capable of being aware of what input code is legal and what output instructions are legal, for a given firmware version. For maintainability, I suspect it would be best to do this with conditional logic, rather than having mutliple versions of the code generator. At some point it would be nice if we could get hold of documentation for the op-codes supported on older versions of the firmware. Neil -- Neil Durant <nd...@us...> |