I wrote a simple program Test.c using RTX-51 Tiny:
#include <AT89X52.H> #include <RTX51TNY.H> void test_task(void) _task_ 0x00 { while (1) { #pragma asm RLC A #pragma endasm os_wait(K_IVL, 100, 0); } }
#include <RTX51TNY.H> void dummy_task(void) _task_ 0x0F { while (1) { os_wait(K_SIG, 0, 0); } }
The assembler can't associate a function with a task number. To solve the problem, take the inline assembly and os_wait function out of the task 0 definition and put them into their own function (in a separate soruce file). Then, build that file with the SRC directive. In task 0 (which must be compiled in C) call this assembly function. Jon
Thanks a lot, I took only the assembly portion and put it in a function (in another source file). Then built this file with SRC directive. And it worked perfectly. But the aim of writing inline assemby was making program the fastest the possible (in my real project, a piece of code would be executed repeatively in a short time. Is there any other way to to avoid calling function instruction here. Thanks in advance,
"But the aim of writing inline assemby was making program the fastest the possible" <old scratched record> Simply writing in assembler does not necessarily give you faster code; in fact, it's quite possible that a good optimising 'C' compiler can give tighter code than a mediocre assembler programmer. </old scratched record> If you're using an RTOS, that kinda suggests that maybe absolute performance is not really to primary target? Have you checked whether the Compiled 'C' code, with maximum optimisation, actually meets your performance requirements?
I am using RTOS just for ease of time keeping (Round Robin task switch disabled). The current optimization level is 8. I have already checked with levels from 6 to 9 (favor speed) and analysed both size and speed of my prog. Level 8 gave best performance. By the way, I would like to shift a bit into a char from one side and get the bit which is shifted out from the other side. Any suggest for a C code replacement? _crol_ and _cror_ functions only shift bits around. Does << and >> operators do the correct thing?