I tried add watch expression in cooperative multitasking with press CTRL+W on buffer variable when debugging then I get message “buffer is out of scope/not declared.” Its bug?
Because buffer is a local stack based variable it is only in scope if you hit a breakpoint in that function and you cannot see it with a watch at any other time.
You could define it outside the function to make it non transient and set a watch on it then.
I’ve never used the cofunction/costate mechanism for multitasking with Dynamic C and have used uCOS || instead. Briefly looking at the manual, it seems the variables in a cofunction are similar but not identical to static variables with a storage class of instance. The main difference as far as I can see comes into play if the cofunction is an indexed one. I think the visibility on these for watch purposes is still only really within the given cofunction.