Hello, On 08/18/2012 04:10 AM, Marcin Cieslak wrote: > On Fri, 17 Aug 2012, Erich Waelde wrote: >> I have made tests >> 1. compile avra from git >> commit a6e8b2957953810dae6467eeb4905bfc5ea6c33e >> Author: Marcin Cieslak<sa...@saper.info> >> Date: Wed Aug 8 17:01:30 2012 +0200 > <schnipp>
> > Generated jump goes one word too far (it is "jump 5 words forward" > and not "jump 4 words forward"). It can even be seen > that the length of a macro expansion is wrongly estimated > (it says the whole code is 7 words, while it is only 6). > > avrasm2 generally does not allow using not-yet-defind > labels in macros like this. > > There are two forward jumps in the code of amforth: > > 1. There is no problem with "jmp_ PFA_COLD" since the > distance to PFA_COLD does to depend on the size of the > macro expanded. > > 2. Only "jmp_ PFA_DOPLUSLOOP3" is problematic since the label > address depends on the size of the macro - and this can > change .. depending on the target address of the label. > > Amforth 4.4 works because it had "rjmp PFA_DOPLUSLOOP3" > hardcoded and not jmp_ macro. > > > So there are two workarounds for amforth: > > 1) revert to amforth 4.4 hardcoded "rjmp" since we can > assume the distance is pretty small here. I have included doplusloop.asm from amforth-4.4 into the build from amforth-4.5, and verified the difference in source. Result: amforth built with avrasm2 works, whereas amforth built with avra fails to connect via serial interface. So, while the above observation may still hold, it seems not to be the only problem. Since I would really appreciate avra being able to build amforth, is there anything else I can do? > > 2) add a nop after "rjmp" in the "jmp_" macro to keep > sizes of the macro expansion constant. > > > Solutions: > > 1) AVRA may disallow forward refences in the macros. > > 2) Detecting the impossibility to determine > the value. > > 3) ... > > //Marcin Cheers, Erich ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel