posix simulator

alpha86 wrote on Friday, March 25, 2011:

Hi will appreciate if you guys could enlighten me on some doubts:

1) the windows and posix simulator runs expected on my computer (win7/linux) but when i run on debian (arm9) the freeRTOS does run but timing is weird. a delay of (500/ portTICK_RATE_MS)  will only be waken again after 2-3 sec instead of 500 milisec. any suggestion which part of the code/configuration to look out for? the settings are all default as the freertos posix demo. fyi, i’m cross compiling for the gnu arm. 

2) I have used the AsyncIO on the demo and it looks good. will like to know if it will be a good way to call read(2) from ISR(which is what the demo is doing) or wake a task from ISR where the task will do the read(2). I’m assuming reading lots of bytes.

3) related to q2, to do a posix write(2) to a uart device (baud 57600), is it okay to issue the write(2) command from a normal task? i’m assuming context switch will happen during a long write but the OS will takes care of it?

4) i’m thinking of modifying the AsyncIO UDP example to TCP. is there any consideration needed ?

thanks! any info will be of help.

williamdavy wrote on Monday, April 04, 2011:

Hi Alpha86,

Which Simulator are you using, I wrote the first one.

1. The tick is driven by ITIMER_REAL which is setup to generate a SIGALRM at the desired frequency. If the process doesn’t get enough time, then it is feasible to miss ticks and so lose time. There are a couple of things that can be done to change that. If you look at the comments (if they are still there) at the top of prvSetupSignalsAndSchedulerPolicy() then there is a little bit of code related to pthread_setschedparam() that may help. Or you could renice -1 the process.

2. There shouldn’t be a problem doing this though I would suggest that it is better to use the ISR to give a semaphore to a task which does it instead.

3. I believe so, just don’t let it be re-entrant.

4. Should be straight-forward.

Sorry for the slow reply.