Jump to content

Jamie

EstablishedMember
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Jamie

  • Rank
    Newbrie
  • Birthday 08/14/1969

Contact Methods

  • MSN
    net_hog_@msn.com
  • Website URL
    http://it.toolbox.com/blogs/codesharp
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    Seattle, WA
  • Interests
    Electronics & Microcontrollers (guess I'm in the right forum eh?)
  1. Recursion will work but strange things may happen if you use function arguments and local variables as these will be modified on reentry as the same software stack locations are used (the software stack is static). It maybe that your code correctly handles the reentrency issues, so creating an error during the project build for this condition may not desirable. Regards Dave Hi Dave, I was seeing if you did anything special to handle recursion because of the nature of the static stack . You should be able to identify the bad cases by analysis. It's useful to analyze recursion to iden
  2. I was experimenting to see how the compiler handled recursion, and wrote the following simple problem: #include <system.h> unsigned char recur(unsigned char r, unsigned char x) { if(r > 0) { return recur (r-1, x+x) + x; } else { return x; } } void main() { unsigned char c = recur(3, 1); } This should give the value '15', but gives the value '32', consistent across all optimization levels as far as I can tell. Generated code (default optimization) is as follows: ;///////////////////////////////////////////////////////////////////////////////// ;// Code Generator: Bo
  3. New blog entry in my "Code Sharp" blog, showing how to use Novo for a Reaction Timer game. http://it.toolbox.com/blogs/codesharp/sour...novo-rtos-31978 Enjoy!
  4. This would suggest that if the two semaphores in above example were being waited on by two different threads, then only one of them would be moved to the wait queue? Or has the behavior chanced since this description was written? Looking at the source code its looks like the documentation is out of date. I remember once trying to implement at ultra lightweight SysSignalSemaphoreIsr function, but this caused too many other issues. Regards Dave This is good to know, thanks Dave!
  5. Both calls to SysSignalSemaphoreIsr(); are significant as they affect different semaphores. Even if they both operated on the same semaphore they would still be significant because the semaphores are of a counting type, so two calls to SysSignalSemaphoreIsr(hSem1); would cause the hSem1 value to be increased by 2. Regards Dave Hi Dave, I'm trying to understand the significance of the following in the documentation: This would suggest that if the two semaphores in above example were being waited on by two different threads, then only one of them would be moved to the wait que
  6. I'm drafting a blog/sample for Novo. Can you confirm that my following understanding of SysSignalSemaphoreIsr is correct? I believe the following code to be broken: void interrupt(void) { if ( /* int1 flag test */ ) { SysSignalSemaphoreIsr(hSem1); /* clear int1 flag */ } if ( /* int2 flag test */ ) { SysSignalSemaphoreIsr(hSem2); /* clear int2 flag */ } } Should int1 and int2 flags both be set, "SysSignalSemaphoreIsr(hSem1);" would effectively be ignored. If my understanding is correct, is there a trivial workaround?
×
×
  • Create New...