10/7/2009 11:43PM by Dr. Aleksander Malinowski, http://gdansk.bradley.edu/olekmali/ 0. Note that: FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 1. Unpack the latest version of FreeRTOS to folder D:\PROJECTS\EECES with an option to preserve folders Note: adapt this location to your needs Preferably avoid spaces in the path 2. In folder D:\PROJECTS\EECES\FreeRTOS\Demo\Cygnal 3. In file sdcc.wsp file replace E:\Dev\FreeRTOS\ with one that you actually use, e.g. D:\PROJECTS\EECES\FreeRTOS\ 4. In file main.c find the function implementation: static void vRegisterCheck( void *pvParameters ) and change the beginning to: static void vRegisterCheck( void *pvParameters ) { unsigned portCHAR curSTACK; ( void ) pvParameters; curSTACK = SP; // <-- this line chages for( ;; ) { if( SP != curSTACK /* configSTACK_START */ ) { mainLATCH_ERROR(); } and code at its end to: // The value of 0x00 denotes type of pointer inside of an // universal pointer and may be compiler version specific if( B != 0x00 ) // <- this line changes { mainLATCH_ERROR(); } 5. Either compile libarary for large-stack-auto or download the precompiled files 6. in Makefile -- correct the rule to make sure that the project is recompiled when the config file FreeRTOSConfig.h changes: main : FreeRTOSConfig.h main.c Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h $(OBJ) $(CC) $(CFLAGS) main.c $(OBJ) %.rel : %.c FreeRTOSConfig.h Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h $(CC) -c $(CFLAGS) -o$< $< 7. (Install if necessary and) Run make 8. See file main.mem, it should have stack SP set at... 0x21 because of the following line in file main.mem Stack starts at: 0x21 (sp set to 0x20) with 223 bytes available. ^^^^^^ this value plus one Edit file FreeRTOSConfig.c, and update the line #define configSTACK_START ( 0x0e ) to #define configSTACK_START ( 0x20 ) 9. Run make again and verify the that the value (0x20) is unchanged A. Load the compiled bianry file to the board using SiLabs user interface B. In RS232 DB-9 port on the Silabs board connect pins 2 and 3 C. Run the program, observe the board LED flash at about 5Hz freqency When you remove the connection between pins 2 and 3, or something else goes wrong it should flash quickly D. When you connect RS232 to console (use USB to serial adapter if necessary) you will see characters A..Z printed in an infinite loop and observe quick LED flashing E. In SiLabs IDE open the project and edit: in Project / Tool Chain Integration: - select tool chain SDCC - set assembler command line to: -plosgff - set compiler command line to: -c --model-large --stack-auto --int-long-reent --float-reent -DSDCC_CYGNAL --xram-size 8448 --no-peep --debug --use-stdout -V -ID:\PROJECTS\EECES\SILABS\RTOS\r01_original -ID:\PROJECTS\EECES\SILABS\RTOS\r01_original\Common\include -ID:\PROJECTS\EECES\SILABS\RTOS\Source\include but do change the include directories above to the ones actually used - set linker command line to: --model-large --stack-auto --int-long-reent --float-reent -DSDCC_CYGNAL --xram-size 8448 --no-peep --debug --use-stdout -V Save the project Note: If you have space in your path use ""s around -I option, I.e.: "-IDxxxx yyyy zzzz" F. D.o.n.e.