RTOS in Spartan 3
Posted by chuck12
on December 18, 2007
The demo for microblaze included in the RTOS file, is for another board, not for spartan 3 revision e(the board that i'm using). Does anyone was able to put it in my board? what changes do i have to make to work properly? tks in advance
RE: RTOS in Spartan 3
Posted by Richard
on December 18, 2007
I am not familiar with your board, but I would suggest the following approach.
1) Start from the existing demo - first take a look at prvSetupHardware() in main.c to see if any changes are required for your hardware.
2) Next edit partest.c so that it control the LED's (or any other measurable output) on your hardware.
3) In main(), before the call to start the scheduler, add some very simple code that just toggles the LED's to check you changes to partest.c are correct. For example:
volatile unsigned long ul;
for( ;; )
____for( ul = 0; ul < 0xfffff; ul++ ); // Basic delay.
____vParTestToggleLED( 0 );
____vParTestToggleLED( 1 );
____vParTestToggleLED( 2 );
____vParTestToggleLED( 3 );
4) Next you need to check the tick timer functionality. Look in port.c, prvSetupTimerInterrupt(), and make any changes necessary for your hardware configuration. This routine sets up the tick interrupt at the required frequency using one of the peripheral timers.
5) Check the timer operation by writing a very simple interrupt handler that does nothing but toggles an LED - remove any RTOS specific code so just write the handler as if it were a normal ISR. You might want to toggle an LED every 1000 ticks, so you can visually see the behaviour and take some crude timing measurements by watching the LED. Also, you might want to toggle the LED directly rather than use the partest.c functions as the partest.c functions use critical sections that might mess up your ISR.
6) Once you have the LED's and timer running you are ready to get the whole system up and running. Put the timer interrupt routine back to its original code, and install it in exactly the same manner as per the example. Then cut down the number of tasks that are created, start with just the flash tasks. main() will then look something like this:
int main (void)
____/* Start the standard demo application tasks. */
____vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
____/* Finally start the scheduler. */
____/* Should not get here as the processor is now under
____control of the scheduler! */
Once this is working then add back in the other demo tasks. Take care about your RAM usage, I don't know how much you have available on your hardware.
Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd..
See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.