summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <walsimou@walsimou.com>2009-03-25 11:47:59 +0100
committerAbdoulaye Walsimou Gaye <walsimou@walsimou.com>2009-03-25 11:47:59 +0100
commitdc6c6c49bf334cc2aaa6a948ec815a07626b7a70 (patch)
treedd5e0c73cd408e9879747a3ce32e1d9db70b33f0
parentbbdc1ffe544681c076dafc23f0956d4ca84a97ee (diff)
downloadfreertos-dc6c6c49bf334cc2aaa6a948ec815a07626b7a70.tar.gz
freertos-dc6c6c49bf334cc2aaa6a948ec815a07626b7a70.tar.bz2
freertos-dc6c6c49bf334cc2aaa6a948ec815a07626b7a70.tar.xz
Start begining more FreeRTOS coding style compatible
-rw-r--r--Demo/PIC18_SDCC/FreeRTOSConfig.h16
-rw-r--r--Demo/PIC18_SDCC/Makefile15
-rw-r--r--Demo/PIC18_SDCC/main.c32
-rw-r--r--Source/portable/SDCC/PIC18/port.c12
-rw-r--r--Source/portable/SDCC/PIC18/portmacro.h1
5 files changed, 18 insertions, 58 deletions
diff --git a/Demo/PIC18_SDCC/FreeRTOSConfig.h b/Demo/PIC18_SDCC/FreeRTOSConfig.h
index be910a44..4a0dba49 100644
--- a/Demo/PIC18_SDCC/FreeRTOSConfig.h
+++ b/Demo/PIC18_SDCC/FreeRTOSConfig.h
@@ -34,22 +34,6 @@
#define configTICK_RATE_HZ ((portTickType)1000)
#define configCPU_CLOCK_HZ ((unsigned portLONG)20000000)
#define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5)
-/*Since in main.c we define a hardwre stack to be 64bytes in size,
-a minimal software stack size must be:
- 64(software stack)
- +
- 2(task function parameters)
- +
- 16(hardware registers saved: W, STATUS,etc.)
- +
- 20(temp data(.registers in sdcc))
- +
- 2(address of top of .registers)
- +
- 3(pxCurrentTCB)
- +
- 1(number of return address in hardware stack)
- */
#define configMINIMAL_STACK_SIZE (109)
#define configTOTAL_HEAP_SIZE ((size_t)1024)
#define configMAX_TASK_NAME_LEN (4)
diff --git a/Demo/PIC18_SDCC/Makefile b/Demo/PIC18_SDCC/Makefile
index 488c64c3..6abddcc2 100644
--- a/Demo/PIC18_SDCC/Makefile
+++ b/Demo/PIC18_SDCC/Makefile
@@ -14,19 +14,20 @@
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
-###################################################################################
+#########################################################################################
#
# \file Makefile
# \brief Makefile of root project
# \author GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# \date February 2009
-###################################################################################
+#########################################################################################
-CC=/usr/src/walsimou/staging_dir/bin/sdcc
-AS=/usr/src/walsimou/staging_dir/bin/gpasm
-LD=/usr/src/walsimou/staging_dir/bin/gplink
+CC=sdcc
+AS=gpasm
+LD=gplink
DEVICE=18f452
ARCH=pic16
+PIC16_LIB_PATH=/usr/src/walsimou/staging_dir/share/sdcc/lib/pic16/
# Setup paths to source code
SOURCE_PATH=../../Source
@@ -37,7 +38,7 @@ SDCC_CFLAGS= -m$(ARCH) -p$(DEVICE) -I. -I$(SOURCE_PATH)/include -I$(PORT_PATH)
-I$(SOURCE_PATH) -I$(DEMO_PATH) -DSDCC_PIC18 --debug --mplab-comp --pstack-model=large
GPASM_CFLAGS= -g -I$(SOURCE_PATH) -I$(PORT_PATH)
-LDFLAGS= -s $(DEVICE).lkr --map -I/usr/src/walsimou/staging_dir/share/sdcc/lib/pic16/
+LDFLAGS= -s $(DEVICE).lkr --map -I$(PIC16_LIB_PATH)
LIBS= libdev$(DEVICE).lib crt0iz.o libc18f.lib libsdcc.lib libm18f.lib
#
@@ -65,6 +66,6 @@ $(SOURCE_OBJ) $(PORT_OBJ): %.o: %.asm
$(CC) -S $< -o $@ $(SDCC_CFLAGS)
clean:
- rm -rf *.o *.asm *.cod *.lst *.hex *.adb *.lib *.calltree *.p *.map *.cof
+ rm -rf *.o *.asm *.cod *.lst *.hex *.adb *.lib *.calltree *.p *.map *.cof *.coff
cleanAll: clean
diff --git a/Demo/PIC18_SDCC/main.c b/Demo/PIC18_SDCC/main.c
index 729101c9..30dc85c3 100644
--- a/Demo/PIC18_SDCC/main.c
+++ b/Demo/PIC18_SDCC/main.c
@@ -31,30 +31,12 @@
#include <malloc.h>
void panic(void);
-void init_pic(void);
+void prvSetupHardware(void);
void prvtask1_func(void *pvparam);
void prvtask2_func(void *pvparam);
void prvtask3_func(void *pvparam);
void prvtask4_func(void *pvparam);
-/*code unsigned char __at __CONFIG1H CONFIG1H=_OSC_HS_1H & _OSCS_OFF_1H & _OSC_HS_PLL_1H;
-
-code unsigned char __at __CONFIG2L CONFIG2L=_PUT_ON_2L & _BODEN_ON_2L & _BODENV_4_2V_2L;
-code unsigned char __at __CONFIG2H CONFIG2H=_WDT_OFF_2H;
-
-code unsigned char __at __CONFIG3H CONFIG3H;
-
-code unsigned char __at __CONFIG4L CONFIG4L=_BACKBUG_OFF_4L & _STVR_ON_4L & _LVP_OFF_4L;
-
-code unsigned char __at __CONFIG5H CONFIG5H;
-code unsigned char __at __CONFIG5L CONFIG5L= _CP_0_ON_5L & _CP_1_OFF_5L & _CP_2_OFF_5L & _CPD_OFF_5H;
-
-code unsigned char __at __CONFIG6H CONFIG6H= _WRTD_OFF_6H & _WRTB_OFF_6H & _WRTC_OFF_6H;
-code unsigned char __at __CONFIG6L CONFIG6L= _WRT_0_OFF_6L & _WRT_1_OFF_6L & _WRT_2_OFF_6L & _WRT_3_OFF_6L;
-
-code unsigned char __at __CONFIG7H CONFIG7H=_EBTRB_OFF_7H;
-code unsigned char __at __CONFIG7L CONFIG7L=_EBTR_0_OFF_7L & _EBTR_1_OFF_7L & _EBTR_2_OFF_7L & _EBTR_3_OFF_7L;*/
-
#define LED1_PORT PORTAbits.RA0
#define LED1_PORT_CONFIG TRISAbits.TRISA0
@@ -73,11 +55,10 @@ extern volatile __data unsigned char heap[configTOTAL_HEAP_SIZE];
#pragma stack 0x80 64
void main (void)
{
- int err=0;
- init_pic();
- err=xTaskCreate(prvtask1_func,"T1",configMINIMAL_STACK_SIZE,NULL,1,NULL);
- err=xTaskCreate(prvtask2_func,"T2",configMINIMAL_STACK_SIZE,NULL,1,NULL);
- err=xTaskCreate(prvtask3_func,"T3",configMINIMAL_STACK_SIZE,NULL,4,NULL);
+ prvSetupHardware();
+ xTaskCreate(prvtask1_func,"T1",configMINIMAL_STACK_SIZE,NULL,1,NULL);
+ xTaskCreate(prvtask2_func,"T2",configMINIMAL_STACK_SIZE,NULL,1,NULL);
+ xTaskCreate(prvtask3_func,"T3",configMINIMAL_STACK_SIZE,NULL,4,NULL);
vTaskStartScheduler();
}
@@ -122,8 +103,9 @@ void panic (void)
PANIC_PORT=PANIC_PORT^1;
}
}
-static void init_pic(void)
+static void prvSetupHardware(void)
{
+ /*Please do not remove the call of _initHeap unless you know what you're doing*/
_initHeap(heap,configTOTAL_HEAP_SIZE);
LED1_PORT=0;
LED1_PORT_CONFIG=0;
diff --git a/Source/portable/SDCC/PIC18/port.c b/Source/portable/SDCC/PIC18/port.c
index 86c41127..1e363831 100644
--- a/Source/portable/SDCC/PIC18/port.c
+++ b/Source/portable/SDCC/PIC18/port.c
@@ -75,19 +75,11 @@ static void prvSetupTimerInterrupt(void);
/*
* Reload Value of timer0 when a tick occures.
- * The configuration of timer0 done in prvSetupTimerInterrupt, gives users the
- * possibility to be able to choose configTICK_RATE_HZ in the range
- * [minHz;maxHz]
- * minHz=configCPU_CLOCK_HZ/(portTIMER_FOSC_SCALE*65536) (76Hz values in FreeRTOSConfig.h)
- * maxHz=configCPU_CLOCK_HZ/portTIMER_FOSC_SCALE (5MHz with values in FreeRTOSConfig.h)
- * When MR0ReloadValue=0 (65536 increments) configTICK_RATE_HZ=76Hz (with respect to values in FreeRTOSConfig.h)
- * When MR0ReloadValue=65535 (1 increment) configTICK_RATE_HZ=5MHz (with respect to values in FreeRTOSConfig.h)
- * This implies the bellow linear relation between configTICK_RATE_HZ and TMR0ReloadValue
- * TMR0ReloadValue=65536 - configCPU_CLOCK_HZ/(portTIMER_FOSC_SCALE*configTICK_RATE_HZ)
+ * The configuration of timer0 done in prvSetupTimerInterrupt,implies the bellow relation
+ * between configTICK_RATE_HZ and TMR0ReloadValue.
*/
const unsigned portSHORT TMR0ReloadValue=(65536 - configCPU_CLOCK_HZ/(configTICK_RATE_HZ*portTIMER_FOSC_SCALE));
-
/*
* ISR placed on the high priority vector.
*/
diff --git a/Source/portable/SDCC/PIC18/portmacro.h b/Source/portable/SDCC/PIC18/portmacro.h
index 013eb01a..b285905e 100644
--- a/Source/portable/SDCC/PIC18/portmacro.h
+++ b/Source/portable/SDCC/PIC18/portmacro.h
@@ -46,6 +46,7 @@
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
+#define portINT int
#define portSHORT short
#define portSTACK_TYPE __data unsigned char
#define portBASE_TYPE char