2006-09-08 09:12 AM
2006-09-07 11:36 PM
Hi,
I'm having problems writing some basic inline assembly. Or better put, the compiler seems to have problems with my assembly code. The code concerned is:_asm(''BitTest: BTJF 0x34, #7, BitTest'');
When I compile the file containing the above in ''debug'' mode, there is no problem. But when I switch to ''release'' mode, the problem arises. In both cases, I use the Cosmic toolchain. The compiler start complaining, giving me an error message like:cost7: bad branch label 0x34, #7, BitTest
Any ideas on why the compiler generates this message? Ofcourse the same could be achieved using a simple while loop, but doing it this way seems to be somewhat faster. Hope you can help!2006-09-08 03:17 AM
Hi,
note that you can achieve exactly the same in C using the sequenceCode:
volatile char TESTREG @0x34; _Bool TESTREG_7 @TESTREG:7; while (!TESTREG_7); this will translate exactly in your asm sequence if optimizations are turned on (that is, in mode RELEASE; Cosmic suggest to never use the mode debug for st7, because it's basically useless) I'll check why the asm does not work as expected and let you know asap. Regards, Luca (Cosmic)2006-09-08 04:18 AM
2006-09-08 09:12 AM
Thanks for your reply.
I have been able to solve this issue in a different way, namely bij replacing the address 0x34 with it's named alternative _ADCCSR (the AD converter control register). That way the code compiled just fine. And actually about 5-10% faster than the standard while solution...