2016-11-29 12:19 PM
Hello, I briefly.
How to implement critical section compatible with __monitor or __critical directives in other compilers? And how to pass the offset of stack of the local variables into inline assembler directives? And further. Who can explain it?...
112 ; 22 saved_cc = _asm (''push cc \n'' ''pop a \n''); 115 0006 8a push cc 116 0007 84 pop a 118 0008 01 rrwa x,a 119 0009 6b05 ld (OFST+0,sp),a 121 ; 24 backup = _current_task_; 123 000b ce0000 ldw x,__current_task_ ... Thanks in advance. #cosmic-critical-monitor #cosmic-critical2016-12-01 04:59 AM
Hello,
these directives you mention (__monitor and __critical) are probably specific to some toolchain you have been using in the past, but if you tell us what they do we can probably explain the best way to do the same in Cosmic. Same for the local variables address: please explain exactly what you want to do so that we can suggest the best possible solution. Regards, Luca2016-12-01 06:25 AM
Hello, Luca. Thanks for reply.
Prefix directives __monitor __task __noreturn __interrupt uses IAR now. Postfix directives __critical, __interrupt, __naked used SDCC. They have some equivalencies. The __interrupt it known and equivalent @interrupt of COSMIC. __monitor of IAR and __critical of SDCC have same sense and is describe function as critical section (with interrupts disabled). But into SDCC this directive implemented incorrectly. This directives allow insert preamble into code of function without writing special clauses. For example, can do as: { unsigned char saved_cc = (unsigned char)_asm(''push cc\n rim\n pop a''); /* function code */ _asm(''push a\n pop cc\n'', saved_cc); } That is equivalent the directive __monitor what applied to the function header. I hope what I was write understandable. All the same I am Russian. :) Viacheslav.