From: RichardBarry Date: Mon, 26 Nov 2007 15:45:21 +0000 (+0000) Subject: Add PIC32 code. X-Git-Tag: V4.7.0~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=85127ba8baa6755ea15f82ad491f15b31ea94515;p=freertos Add PIC32 code. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@119 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h b/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h new file mode 100644 index 000000000..28b59f467 --- /dev/null +++ b/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h @@ -0,0 +1,87 @@ +/* + FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +#include + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + *----------------------------------------------------------*/ + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 72000000UL ) +#define configPERIPHERAL_CLOCK_HZ ( ( unsigned portLONG ) 36000000UL ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) +#define configMINIMAL_STACK_SIZE ( 230 ) +#define configISR_STACK_SIZE ( 130 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) 29000 ) +#define configMAX_TASK_NAME_LEN ( 8 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ + +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 0 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 + + +#define configKERNEL_INTERRUPT_PRIORITY 0x01 + + +#endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/PIC32MX_MPLAB/ParTest/ParTest.c b/Demo/PIC32MX_MPLAB/ParTest/ParTest.c new file mode 100644 index 000000000..e7ba1c50b --- /dev/null +++ b/Demo/PIC32MX_MPLAB/ParTest/ParTest.c @@ -0,0 +1,93 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +/* Scheduler includes. */ +#include "FreeRTOS.h" + +/* Demo app includes. */ +#include "partest.h" + +#define ptOUTPUT 0 +#define ptALL_OFF 0 + +/*----------------------------------------------------------- + * Simple parallel port IO routines. + *-----------------------------------------------------------*/ + +void vParTestInitialise( void ) +{ + /* All LEDs output. */ + TRISA = ptOUTPUT; + PORTA = ptALL_OFF; + + mJTAGPortEnable( 0 ); +} +/*-----------------------------------------------------------*/ + +void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) +{ +unsigned portBASE_TYPE uxLEDBit; + + /* Which port A bit is being modified? */ + uxLEDBit = 1 << uxLED; + + if( xValue ) + { + /* Turn the LED on. Use of the PORTASET register removes the need + to use a critical section. */ + PORTASET = uxLEDBit; + } + else + { + /* Turn the LED off. Use of the PORTACLR register removes the need + to use a critical section. */ + PORTACLR = uxLEDBit; + } +} +/*-----------------------------------------------------------*/ + +void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) +{ +unsigned portBASE_TYPE uxLEDBit; + + uxLEDBit = 1 << uxLED; + + /* Use of the PORTAINV register removes the need to use a critical section. */ + PORTAINV = uxLEDBit; +} + + + diff --git a/Demo/PIC32MX_MPLAB/RTOSDemo.mcp b/Demo/PIC32MX_MPLAB/RTOSDemo.mcp new file mode 100644 index 000000000..41ae67367 --- /dev/null +++ b/Demo/PIC32MX_MPLAB/RTOSDemo.mcp @@ -0,0 +1,94 @@ +[HEADER] +magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13} +file_version=1.0 +[PATH_INFO] +BuildDirPolicy=BuildDirIsProjectDir +dir_src= +dir_bin= +dir_tmp= +dir_sin=..\..\Source\portable\MPLAB\PIC32MX;. +dir_inc=.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include +dir_lib= +dir_lkr= +[CAT_FILTERS] +filter_src=*.s;*.c +filter_inc=*.h;*.inc +filter_obj=*.o +filter_lib=*.a +filter_lkr=*.ld +[OTHER_FILES] +file_000=no +file_001=no +file_002=no +file_003=no +file_004=no +file_005=no +file_006=no +file_007=no +file_008=no +file_009=no +file_010=no +file_011=no +file_012=no +file_013=no +file_014=no +file_015=no +file_016=no +file_017=no +file_018=no +file_019=no +file_020=no +file_021=no +file_022=no +file_023=no +file_024=no +file_025=no +file_026=no +file_027=no +file_028=no +file_029=no +file_030=yes +[FILE_INFO] +file_000=main.c +file_001=ParTest\ParTest.c +file_002=..\..\Source\portable\MPLAB\PIC32MX\port.c +file_003=..\..\Source\list.c +file_004=..\..\Source\queue.c +file_005=..\..\Source\tasks.c +file_006=..\..\Source\portable\MPLAB\PIC32MX\port_asm.S +file_007=RegisterTestTasks.s +file_008=..\..\Source\portable\MemMang\heap_2.c +file_009=..\Common\Minimal\flash.c +file_010=..\Common\Minimal\QPeek.c +file_011=..\Common\Minimal\semtest.c +file_012=..\Common\Minimal\GenQTest.c +file_013=..\Common\Minimal\integer.c +file_014=..\Common\Minimal\blocktim.c +file_015=lcd.c +file_016=serial\serial.c +file_017=..\Common\Minimal\comtest.c +file_018=serial\serial_isr.S +file_019=timertest.c +file_020=FreeRTOSConfig.h +file_021=..\..\Source\portable\MPLAB\PIC32MX\portmacro.h +file_022=..\..\Source\include\portable.h +file_023=..\..\Source\include\task.h +file_024=..\..\Source\include\croutine.h +file_025=..\..\Source\include\FreeRTOS.h +file_026=..\..\Source\include\list.h +file_027=..\..\Source\include\projdefs.h +file_028=..\..\Source\include\queue.h +file_029=..\..\Source\include\semphr.h +file_030=PIC32MX_MPLAB.map +[SUITE_INFO] +suite_guid={14495C23-81F8-43F3-8A44-859C583D7760} +suite_state= +[TOOL_SETTINGS] +TS{CB0AF4B8-4022-429D-8F99-8A56782B2C6D}=--keep-locals --gdwarf-2 +TS{9C698E0A-CBC9-4EFF-AE7D-B569F93E7322}=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TS{77F59DA1-3C53-4677-AC5F-A03EB0125170}=-o"$(BINDIR_)$(TARGETBASE).$(TARGETSUFFIX)" -Map="$(BINDIR_)$(TARGETBASE).map" +TS{0396C0A1-9052-4E4F-8B84-EF0162B1B4E9}= +[INSTRUMENTED_TRACE] +enable=0 +transport=0 +format=0 diff --git a/Demo/PIC32MX_MPLAB/RTOSDemo.mcs b/Demo/PIC32MX_MPLAB/RTOSDemo.mcs new file mode 100644 index 000000000..a44fd7f95 --- /dev/null +++ b/Demo/PIC32MX_MPLAB/RTOSDemo.mcs @@ -0,0 +1,271 @@ +[Header] +MagicCookie={0b13fe8c-dfe0-40eb-8900-6712719559a7} +Version=1.0 +[File000] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\main.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File001] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\ParTest.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File002] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\port.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File003] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\list.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File004] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\queue.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File005] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\tasks.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File006] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\port_asm.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={92E15EC6-5E91-4BF4-B5FA-C80AD2601AA7} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-as.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=--keep-locals --gdwarf-2 +TraceCmdString= +[File007] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\RegisterTestTasks.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={92E15EC6-5E91-4BF4-B5FA-C80AD2601AA7} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-as.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=--keep-locals --gdwarf-2 +TraceCmdString= +[File008] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\heap_2.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File009] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\flash.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File010] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\QPeek.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File011] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\semtest.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File012] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\GenQTest.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File013] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\integer.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File014] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\blocktim.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File015] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\lcd.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File016] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\serial.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File017] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\comtest.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File018] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\serial_isr.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={92E15EC6-5E91-4BF4-B5FA-C80AD2601AA7} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-as.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=--keep-locals --gdwarf-2 +TraceCmdString= +[File019] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\timertest.o +Folder=Intermediary +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={430F471F-7ECB-4852-A80D-DEF9A5C8E751} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-g -DMPLAB_PIC32MX_PORT -Wall -fomit-frame-pointer +TraceCmdString= +[File020] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\RTOSDemo.elf +Folder=Output +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={C68E5105-1196-4333-A0BF-3DC57271E614} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-ld.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-o"$(BINDIR_)$(TARGETBASE).$(TARGETSUFFIX)" -Map="$(BINDIR_)$(TARGETBASE).map" +TraceCmdString= +[File021] +Location=C:\Temp\RC\1\Demo\PIC32MX_MPLAB\RTOSDemo.hex +Folder=Output +DeviceName=PIC32MX360F512L +LanguageToolSuiteID={14495C23-81F8-43F3-8A44-859C583D7760} +LanguageToolID={C68E5105-1196-4333-A0BF-3DC57271E614} +LanguageToolLocation=C:\Devtools\Microchip\MPLAB C32\bin\pic32-ld.exe +PPAD=$(BINDIR)||$(TMPDIR)||$(AINDIR)|..\..\Source\portable\MPLAB\PIC32MX;.||$(INCDIR)|.;.;..\common\include;..\..\source\portable\mplab\pic32mx;..\..\source\include||$(LIBDIR)||$(LKRDIR)|| +SOLK=|main.c|ParTest\ParTest.c|..\..\Source\portable\MPLAB\PIC32MX\port.c|..\..\Source\list.c|..\..\Source\queue.c|..\..\Source\tasks.c|..\..\Source\portable\MPLAB\PIC32MX\port_asm.S|RegisterTestTasks.s|..\..\Source\portable\MemMang\heap_2.c|..\Common\Minimal\flash.c|..\Common\Minimal\QPeek.c|..\Common\Minimal\semtest.c|..\Common\Minimal\GenQTest.c|..\Common\Minimal\integer.c|..\Common\Minimal\blocktim.c|lcd.c|serial\serial.c|..\Common\Minimal\comtest.c|serial\serial_isr.S|timertest.c|||||||| +SuiteArgsString= +ToolArgsString=-o"$(BINDIR_)$(TARGETBASE).$(TARGETSUFFIX)" -Map="$(BINDIR_)$(TARGETBASE).map" +TraceCmdString= +[TOOL_LOC_STAMPS] +tool_loc{92E15EC6-5E91-4BF4-B5FA-C80AD2601AA7}=C:\Devtools\Microchip\MPLAB C32\bin\pic32-as.exe +tool_loc{430F471F-7ECB-4852-A80D-DEF9A5C8E751}=C:\Devtools\Microchip\MPLAB C32\bin\pic32-gcc.exe +tool_loc{C68E5105-1196-4333-A0BF-3DC57271E614}=C:\Devtools\Microchip\MPLAB C32\bin\pic32-ld.exe diff --git a/Demo/PIC32MX_MPLAB/RTOSDemo.mcw b/Demo/PIC32MX_MPLAB/RTOSDemo.mcw new file mode 100644 index 000000000..304a38142 Binary files /dev/null and b/Demo/PIC32MX_MPLAB/RTOSDemo.mcw differ diff --git a/Demo/PIC32MX_MPLAB/RegisterTestTasks.s b/Demo/PIC32MX_MPLAB/RegisterTestTasks.s new file mode 100644 index 000000000..55b5f524a --- /dev/null +++ b/Demo/PIC32MX_MPLAB/RegisterTestTasks.s @@ -0,0 +1,333 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + + +#include +#include + + .set nomips16 + .set noreorder + + + .global vRegTest1 + .global vRegTest2 + + +/* .section .FreeRTOS, ax, @progbits */ + .set noreorder + .set noat + .ent vRegTest1 + +/* Address of $4 ulStatus1 is held in A0, so don't mess with the value of $4 */ + +vRegTest1: + addiu $1, $0, 0x11 + addiu $2, $0, 0x12 + addiu $3, $0, 0x13 + addiu $5, $0, 0x15 + addiu $6, $0, 0x16 + addiu $7, $0, 0x17 + addiu $8, $0, 0x18 + addiu $9, $0, 0x19 + addiu $10, $0, 0x110 + addiu $11, $0, 0x111 + addiu $12, $0, 0x112 + addiu $13, $0, 0x113 + addiu $14, $0, 0x114 + addiu $15, $0, 0x115 + addiu $16, $0, 0x116 + addiu $17, $0, 0x117 + addiu $18, $0, 0x118 + addiu $19, $0, 0x119 + addiu $20, $0, 0x120 + addiu $21, $0, 0x121 + addiu $22, $0, 0x122 + addiu $23, $0, 0x123 + addiu $24, $0, 0x124 + addiu $25, $0, 0x125 + addiu $30, $0, 0x130 + + #if configUSE_PREEMPTION == 0 + syscall 0 + #endif + + addiu $1, $1, -0x11 + beq $1, $0, .+12 + nop + sw $0, 0($4) + addiu $2, $2, -0x12 + beq $2, $0, .+12 + nop + sw $0, 0($4) + addiu $3, $3, -0x13 + beq $3, $0, .+12 + nop + sw $0, 0($4) + addiu $5, $5, -0x15 + beq $5, $0, .+12 + nop + sw $0, 0($4) + addiu $6, $6, -0x16 + beq $6, $0, .+12 + nop + sw $0, 0($4) + addiu $7, $7, -0x17 + beq $7, $0, .+12 + nop + sw $0, 0($4) + addiu $8, $8, -0x18 + beq $8, $0, .+12 + nop + sw $0, 0($4) + addiu $9, $9, -0x19 + beq $9, $0, .+12 + nop + sw $0, 0($4) + addiu $10, $10, -0x110 + beq $10, $0, .+12 + nop + sw $0, 0($4) + addiu $11, $11, -0x111 + beq $11, $0, .+12 + nop + sw $0, 0($4) + addiu $12, $12, -0x112 + beq $12, $0, .+12 + nop + sw $0, 0($4) + addiu $13, $13, -0x113 + beq $13, $0, .+12 + nop + sw $0, 0($4) + addiu $14, $14, -0x114 + beq $14, $0, .+12 + nop + sw $0, 0($4) + addiu $15, $15, -0x115 + beq $15, $0, .+12 + nop + sw $0, 0($4) + addiu $16, $16, -0x116 + beq $16, $0, .+12 + nop + sw $0, 0($4) + addiu $17, $17, -0x117 + beq $17, $0, .+12 + nop + sw $0, 0($4) + addiu $18, $18, -0x118 + beq $18, $0, .+12 + nop + sw $0, 0($4) + addiu $19, $19, -0x119 + beq $19, $0, .+12 + nop + sw $0, 0($4) + addiu $20, $20, -0x120 + beq $20, $0, .+12 + nop + sw $0, 0($4) + addiu $21, $21, -0x121 + beq $21, $0, .+12 + nop + sw $0, 0($4) + addiu $22, $22, -0x122 + beq $22, $0, .+12 + nop + sw $0, 0($4) + addiu $23, $23, -0x123 + beq $23, $0, .+12 + nop + sw $0, 0($4) + addiu $24, $24, -0x124 + beq $24, $0, .+12 + nop + sw $0, 0($4) + addiu $25, $25, -0x125 + beq $25, $0, .+12 + nop + sw $0, 0($4) + addiu $30, $30, -0x130 + beq $30, $0, .+12 + nop + sw $0, 0($4) + jr $31 + nop + + .end vRegTest1 + + +/* .section .FreeRTOS, ax, @progbits */ + .set noreorder + .set noat + .ent vRegTest2 + +vRegTest2: + + addiu $1, $0, 0x10 + addiu $2, $0, 0x20 + addiu $3, $0, 0x30 + addiu $5, $0, 0x50 + addiu $6, $0, 0x60 + addiu $7, $0, 0x70 + addiu $8, $0, 0x80 + addiu $9, $0, 0x90 + addiu $10, $0, 0x100 + addiu $11, $0, 0x110 + addiu $12, $0, 0x120 + addiu $13, $0, 0x130 + addiu $14, $0, 0x140 + addiu $15, $0, 0x150 + addiu $16, $0, 0x160 + addiu $17, $0, 0x170 + addiu $18, $0, 0x180 + addiu $19, $0, 0x190 + addiu $20, $0, 0x200 + addiu $21, $0, 0x210 + addiu $22, $0, 0x220 + addiu $23, $0, 0x230 + addiu $24, $0, 0x240 + addiu $25, $0, 0x250 + addiu $30, $0, 0x300 + + #if configUSE_PREEMPTION == 0 + syscall 0 + #endif + + addiu $1, $1, -0x10 + beq $1, $0, .+12 + nop + sw $0, 0($4) + addiu $2, $2, -0x20 + beq $2, $0, .+12 + nop + sw $0, 0($4) + addiu $3, $3, -0x30 + beq $3, $0, .+12 + nop + sw $0, 0($4) + addiu $5, $5, -0x50 + beq $5, $0, .+12 + nop + sw $0, 0($4) + addiu $6, $6, -0x60 + beq $6, $0, .+12 + nop + sw $0, 0($4) + addiu $7, $7, -0x70 + beq $7, $0, .+12 + nop + sw $0, 0($4) + addiu $8, $8, -0x80 + beq $8, $0, .+12 + nop + sw $0, 0($4) + addiu $9, $9, -0x90 + beq $9, $0, .+12 + nop + sw $0, 0($4) + addiu $10, $10, -0x100 + beq $10, $0, .+12 + nop + sw $0, 0($4) + addiu $11, $11, -0x110 + beq $11, $0, .+12 + nop + sw $0, 0($4) + addiu $12, $12, -0x120 + beq $12, $0, .+12 + nop + sw $0, 0($4) + addiu $13, $13, -0x130 + beq $13, $0, .+12 + nop + sw $0, 0($4) + addiu $14, $14, -0x140 + beq $14, $0, .+12 + nop + sw $0, 0($4) + addiu $15, $15, -0x150 + beq $15, $0, .+12 + nop + sw $0, 0($4) + addiu $16, $16, -0x160 + beq $16, $0, .+12 + nop + sw $0, 0($4) + addiu $17, $17, -0x170 + beq $17, $0, .+12 + nop + sw $0, 0($4) + addiu $18, $18, -0x180 + beq $18, $0, .+12 + nop + sw $0, 0($4) + addiu $19, $19, -0x190 + beq $19, $0, .+12 + nop + sw $0, 0($4) + addiu $20, $20, -0x200 + beq $20, $0, .+12 + nop + sw $0, 0($4) + addiu $21, $21, -0x210 + beq $21, $0, .+12 + nop + sw $0, 0($4) + addiu $22, $22, -0x220 + beq $22, $0, .+12 + nop + sw $0, 0($4) + addiu $23, $23, -0x230 + beq $23, $0, .+12 + nop + sw $0, 0($4) + addiu $24, $24, -0x240 + beq $24, $0, .+12 + nop + sw $0, 0($4) + addiu $25, $25, -0x250 + beq $25, $0, .+12 + nop + sw $0, 0($4) + addiu $30, $30, -0x300 + beq $30, $0, .+12 + nop + sw $0, 0($4) + jr $31 + nop + + .end vRegTest2 diff --git a/Demo/PIC32MX_MPLAB/lcd.c b/Demo/PIC32MX_MPLAB/lcd.c new file mode 100644 index 000000000..6d20b543c --- /dev/null +++ b/Demo/PIC32MX_MPLAB/lcd.c @@ -0,0 +1,243 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +/* peripheral library include */ +#include + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +/* Demo includes. */ +#include "lcd.h" + +/* + * The LCD is written to by more than one task so is controlled by this + * 'gatekeeper' task. This is the only task that is actually permitted to + * access the LCD directly. Other tasks wanting to display a message send + * the message to the gatekeeper. + */ +static void vLCDTask( void *pvParameters ); + +/* + * Setup the peripherals required to communicate with the LCD. + */ +static void prvSetupLCD( void ); + +/* + * Move to the first (0) or second (1) row of the LCD. + */ +static void prvLCDGotoRow( unsigned portSHORT usRow ); + +/* + * Write a string of text to the LCD. + */ +static void prvLCDPutString( portCHAR *pcString ); + +/* + * Clear the LCD. + */ +static void prvLCDClear( void ); + +/*-----------------------------------------------------------*/ + +/* Brief delay to permit the LCD to catch up with commands. */ +#define lcdVERY_SHORT_DELAY ( 1 ) +#define lcdSHORT_DELAY ( 4 / portTICK_RATE_MS ) +#define lcdLONG_DELAY ( 15 / portTICK_RATE_MS ) + +/* LCD specific definitions. */ +#define LCD_CLEAR_DISPLAY_CMD 0x01 +#define LCD_CURSOR_HOME_CMD 0x02 +#define LCD_ENTRY_MODE_CMD 0x04 +#define LCD_ENTRY_MODE_INCREASE 0x02 +#define LCD_DISPLAY_CTRL_CMD 0x08 +#define LCD_DISPLAY_CTRL_DISPLAY_ON 0x04 +#define LCD_FUNCTION_SET_CMD 0x20 +#define LCD_FUNCTION_SET_8_BITS 0x10 +#define LCD_FUNCTION_SET_2_LINES 0x08 +#define LCD_FUNCTION_SET_LRG_FONT 0x04 +#define LCD_NEW_LINE 0xC0 +#define LCD_COMMAND_ADDRESS 0x00 +#define LCD_DATA_ADDRESS 0x01 + +/* The length of the queue used to send messages to the LCD gatekeeper task. */ +#define lcdQUEUE_SIZE 3 + +/*-----------------------------------------------------------*/ + +/* The queue used to send messages to the LCD task. */ +xQueueHandle xLCDQueue; + +/* LCD access functions. */ +static void prvLCDCommand( portCHAR cCommand ); +static void prvLCDData( portCHAR cChar ); + +/*-----------------------------------------------------------*/ + +xQueueHandle xStartLCDTask( void ) +{ + /* Create the queue used by the LCD task. Messages for display on the LCD + are received via this queue. */ + xLCDQueue = xQueueCreate( lcdQUEUE_SIZE, sizeof( xLCDMessage )); + + /* Start the task that will write to the LCD. The LCD hardware is + initialised from within the task itself so delays can be used. */ + xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); + + return xLCDQueue; +} +/*-----------------------------------------------------------*/ + +static void prvLCDGotoRow( unsigned portSHORT usRow ) +{ + if(usRow == 0) + { + prvLCDCommand( LCD_CURSOR_HOME_CMD ); + } + else + { + prvLCDCommand( LCD_NEW_LINE ); + } +} +/*-----------------------------------------------------------*/ + +static void prvLCDCommand( portCHAR cCommand ) +{ + PMPSetAddress( LCD_COMMAND_ADDRESS ); + PMPMasterWrite( cCommand ); + vTaskDelay( lcdSHORT_DELAY ); +} +/*-----------------------------------------------------------*/ + +static void prvLCDData( portCHAR cChar ) +{ + PMPSetAddress( LCD_DATA_ADDRESS ); + PMPMasterWrite( cChar ); + vTaskDelay( lcdVERY_SHORT_DELAY ); +} +/*-----------------------------------------------------------*/ + +static void prvLCDPutString( portCHAR *pcString ) +{ + /* Write out each character with appropriate delay between each. */ + while(*pcString) + { + prvLCDData(*pcString); + pcString++; + vTaskDelay(lcdSHORT_DELAY); + } +} +/*-----------------------------------------------------------*/ + +static void prvLCDClear(void) +{ + prvLCDCommand(LCD_CLEAR_DISPLAY_CMD); +} +/*-----------------------------------------------------------*/ + +static void prvSetupLCD(void) +{ + /* Wait for proper power up. */ + vTaskDelay( lcdLONG_DELAY ); + + /* Open the PMP port */ + mPMPOpen((PMP_ON | PMP_READ_WRITE_EN | PMP_CS2_CS1_EN | + PMP_LATCH_POL_HI | PMP_CS2_POL_HI | PMP_CS1_POL_HI | + PMP_WRITE_POL_HI | PMP_READ_POL_HI), + (PMP_MODE_MASTER1 | PMP_WAIT_BEG_4 | PMP_WAIT_MID_15 | + PMP_WAIT_END_4), + PMP_PEN_0, 0); + + /* Wait for the LCD to power up correctly. */ + vTaskDelay( lcdLONG_DELAY ); + vTaskDelay( lcdLONG_DELAY ); + vTaskDelay( lcdLONG_DELAY ); + + /* Set up the LCD function. */ + prvLCDCommand( LCD_FUNCTION_SET_CMD | LCD_FUNCTION_SET_8_BITS | LCD_FUNCTION_SET_2_LINES | LCD_FUNCTION_SET_LRG_FONT ); + + /* Turn the display on. */ + prvLCDCommand( LCD_DISPLAY_CTRL_CMD | LCD_DISPLAY_CTRL_DISPLAY_ON ); + + /* Clear the display. */ + prvLCDCommand( LCD_CLEAR_DISPLAY_CMD ); + vTaskDelay( lcdLONG_DELAY ); + + /* Increase the cursor. */ + prvLCDCommand( LCD_ENTRY_MODE_CMD | LCD_ENTRY_MODE_INCREASE ); + vTaskDelay( lcdLONG_DELAY ); + vTaskDelay( lcdLONG_DELAY ); + vTaskDelay( lcdLONG_DELAY ); +} +/*-----------------------------------------------------------*/ + +static void vLCDTask(void *pvParameters) +{ +xLCDMessage xMessage; +unsigned portSHORT usRow = 0; + + /* Initialise the hardware. This uses delays so must not be called prior + to the scheduler being started. */ + prvSetupLCD(); + + /* Welcome message. */ + prvLCDPutString( "www.FreeRTOS.org" ); + + for(;;) + { + /* Wait for a message to arrive that requires displaying. */ + while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); + + /* Clear the current display value. */ + prvLCDClear(); + + /* Switch rows each time so we can see that the display is still being + updated. */ + prvLCDGotoRow( usRow & 0x01 ); + usRow++; + prvLCDPutString( xMessage.pcMessage ); + + /* Delay the requested amount of time to ensure the text just written + to the LCD is not overwritten. */ + vTaskDelay( xMessage.xMinDisplayTime ); + } +} + + + + diff --git a/Demo/PIC32MX_MPLAB/lcd.h b/Demo/PIC32MX_MPLAB/lcd.h new file mode 100644 index 000000000..ba08a9641 --- /dev/null +++ b/Demo/PIC32MX_MPLAB/lcd.h @@ -0,0 +1,58 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +#ifndef LCD_INC_H +#define LCD_INC_H + +/* Create the task that will control the LCD. Returned is a handle to the queue +on which messages to get written to the LCD should be written. */ +xQueueHandle xStartLCDTask( void ); + +typedef struct +{ + /* The minimum amount of time the message should remain on the LCD without + being overwritten. */ + portTickType xMinDisplayTime; + + /* A pointer to the string to be displayed. */ + portCHAR *pcMessage; + +} xLCDMessage; + + +#endif /* LCD_INC_H */ + + diff --git a/Demo/PIC32MX_MPLAB/main.c b/Demo/PIC32MX_MPLAB/main.c new file mode 100644 index 000000000..4f68a7e8e --- /dev/null +++ b/Demo/PIC32MX_MPLAB/main.c @@ -0,0 +1,362 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +/* + * Creates all the demo application tasks, then starts the scheduler. The WEB + * documentation provides more details of the standard demo application tasks. + * In addition to the standard demo tasks, the following tasks and tests are + * defined and/or created within this file: + * + * "Fast Interrupt Test" - A high frequency periodic interrupt is generated + * using a free running timer to demonstrate the use of the + * configKERNEL_INTERRUPT_PRIORITY configuration constant. The interrupt + * service routine measures the number of processor clocks that occur between + * each interrupt - and in so doing measures the jitter in the interrupt timing. + * The maximum measured jitter time is latched in the ulMaxJitter variable, and + * displayed on the LCD display by the 'LCD' task as described below. The + * fast interrupt is configured and handled in the timertest.c source file. + * + * "LCD" task - the LCD task is a 'gatekeeper' task. It is the only task that + * is permitted to access the display directly. Other tasks wishing to write a + * message to the LCD send the message on a queue to the LCD task instead of + * accessing the LCD themselves. The LCD task just blocks on the queue waiting + * for messages - waking and displaying the messages as they arrive. + * + * "Check" task - This only executes every three seconds but has the highest + * priority so is guaranteed to get processor time. Its main function is to + * check that all the standard demo tasks are still operational. Should any + * unexpected behaviour within a demo task be discovered the check task will + * write an error to the LCD (via the LCD task). If all the demo tasks are + * executing with their expected behaviour then the check task writes the + * maximum jitter time to the LCD (as described above) - again via the LCD task. + * + * "Register test" tasks - These tasks are used in part to test the kernel port. + * They set each processor register to a known value, then check that the + * register still contains that value. Each of the tasks sets the registers + * to different values, and will get swapping in and out between setting and + * then subsequently checking the register values. Discovery of an incorrect + * value would be indicative of an error in the task switching mechanism. + */ + +/* Standard includes. */ +#include + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +/* Demo application includes. */ +#include "partest.h" +#include "integer.h" +#include "blocktim.h" +#include "flash.h" +#include "semtest.h" +#include "GenQTest.h" +#include "QPeek.h" +#include "lcd.h" +#include "comtest2.h" +#include "timertest.h" + +#pragma config FPLLMUL = MUL_18, FPLLIDIV = DIV_2, FPLLODIV = DIV_1, FWDTEN = OFF +#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2 + +/*-----------------------------------------------------------*/ + +/* The rate at which the LED controlled by the 'check' task will flash when no +errors have been detected. */ +#define mainNO_ERROR_PERIOD ( 3000 / portTICK_RATE_MS ) + +/* The rate at which the LED controlled by the 'check' task will flash when an +error has been detected. */ +#define mainERROR_PERIOD ( 500 ) + +/* The priorities of the various demo application tasks. */ +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) + +/* The LED controlled by the 'check' task. */ +#define mainCHECK_LED ( 7 ) + +/* The LED used by the comtest tasks. mainCOM_TEST_LED + 1 is also used. +See the comtest.c file for more information. */ +#define mainCOM_TEST_LED ( 4 ) + +/* Baud rate used by the comtest tasks. */ +#define mainCOM_TEST_BAUD_RATE ( 115200 ) + +/* Misc. */ +#define mainDONT_WAIT ( 0 ) + +/* Dimension the buffer used to hold the value of the maximum jitter time when +it is converted to a string. */ +#define mainMAX_STRING_LENGTH ( 20 ) + +/* The frequency at which the "fast interrupt test" interrupt will occur. */ +#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) + +/* The number of timer clocks we expect to occur between each "fast +interrupt test" interrupt. */ +#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( ( configCPU_CLOCK_HZ >> 1 ) / mainTEST_INTERRUPT_FREQUENCY ) + +/* The number of nano seconds between each core clock. */ +#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) ( configCPU_CLOCK_HZ >> 1 ) ) * 1000000000.0 ) ) + +/*-----------------------------------------------------------*/ + +/* + * Setup the processor ready for the demo. + */ +static void prvSetupHardware( void ); + +/* + * Implements the 'check' task functionality as described at the top of this + * file. + */ +static void prvCheckTask( void *pvParameters ) __attribute__((noreturn)); + +/* + * Tasks that test the context switch mechanism by filling the processor + * registers with known values, then checking that the values contained + * within the registers is as expected. The tasks are likely to get swapped + * in and out between setting the register values and checking the register + * values. */ +static void prvTestTask1( void *pvParameters ); +static void prvTestTask2( void *pvParameters ); + +/*-----------------------------------------------------------*/ + +/* The queue used to send messages to the LCD task. */ +static xQueueHandle xLCDQueue; + +/* Flag used by prvTestTask1() and prvTestTask2() to indicate their status +(pass/fail). */ +unsigned portLONG ulStatus1 = pdPASS; + +/* Variables incremented by prvTestTask1() and prvTestTask2() respectively on +each iteration of their function. This is used to detect either task stopping +their execution.. */ +unsigned portLONG ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; + +/*-----------------------------------------------------------*/ + + +/* + * Create the demo tasks then start the scheduler. + */ +int main( void ) +{ + /* Configure any hardware required for this demo. */ + prvSetupHardware(); + + /* Create the LCD task - this returns the queue to use when writing + messages to the LCD. */ + xLCDQueue = xStartLCDTask(); + + /* Create all the other standard demo tasks. */ + vStartLEDFlashTasks( tskIDLE_PRIORITY ); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Create the tasks defined within this file. */ + xTaskCreate( prvTestTask1, "Tst1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvTestTask2, "Tst2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* prvCheckTask uses sprintf so requires more stack. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE * 2, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Setup the high frequency, high priority, timer test. */ + vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); + + /* Finally start the scheduler. */ + vTaskStartScheduler(); + + /* Will only reach here if there is insufficient heap available to start + the scheduler. */ + return 0; +} +/*-----------------------------------------------------------*/ + +static void prvTestTask1( void *pvParameters ) +{ +extern void vRegTest1( unsigned long * ); + + for( ;; ) + { + /* Perform the register test function. */ + vRegTest1( &ulStatus1 ); + + /* Increment the counter so the check task knows we are still + running. */ + ulRegTest1Cycles++; + } +} +/*-----------------------------------------------------------*/ + +static void prvTestTask2( void *pvParameters ) +{ +extern void vRegTest2( unsigned long * ); + + for( ;; ) + { + /* Perform the register test function. */ + vRegTest2( &ulStatus1 ); + + /* Increment the counter so the check task knows we are still + running. */ + ulRegTest2Cycles++; + } +} +/*-----------------------------------------------------------*/ + +static void prvSetupHardware( void ) +{ + /* Set the system and peripheral bus speeds and enable the program cache*/ + SYSTEMConfigPerformance( configCPU_CLOCK_HZ ); + + /* Setup to use the external interrupt controller. */ + INTEnableSystemMultiVectoredInt(); + + portDISABLE_INTERRUPTS(); + + /* Setup the digital IO for the LED's. */ + vParTestInitialise(); +} +/*-----------------------------------------------------------*/ + +static void prvCheckTask( void *pvParameters ) +{ +unsigned portLONG ulLastRegTest1Value = 0, ulLastRegTest2Value = 0, ulTicksToWait = mainNO_ERROR_PERIOD; +portTickType xLastExecutionTime; + +/* Buffer into which the maximum jitter time is written as a string. */ +static portCHAR cStringBuffer[ mainMAX_STRING_LENGTH ]; + +/* The maximum jitter time measured by the fast interrupt test. */ +extern unsigned portLONG ulMaxJitter ; +xLCDMessage xMessage = { ( 200 / portTICK_RATE_MS ), cStringBuffer }; + + /* Initialise the variable used to control our iteration rate prior to + its first use. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ;; ) + { + /* Wait until it is time to run the tests again. */ + vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait ); + + /* Has either register check 1 or 2 task discovered an error? */ + if( ulStatus1 != pdPASS ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Reg test1"; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1Cycles ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Reg test2"; + } + ulLastRegTest1Value = ulRegTest1Cycles; + + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2Cycles ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Reg test3"; + } + ulLastRegTest2Value = ulRegTest2Cycles; + + + /* Have any of the standard demo tasks detected an error in their + operation? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Gen Q"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Q Peek"; + } + else if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: COM test"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Blck time"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Sem test"; + } + else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulTicksToWait = mainERROR_PERIOD; + xMessage.pcMessage = "Error: Int math"; + } + + /* Write the max jitter time to the string buffer. It will only be + displayed if no errors have been detected. */ + sprintf( cStringBuffer, "%dns max jitter", ( int ) ( ( ulMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK ) ); + + xQueueSend( xLCDQueue, &xMessage, mainDONT_WAIT ); + vParTestToggleLED( mainCHECK_LED ); + } +} +/*-----------------------------------------------------------*/ + +void vApplicationGeneralExceptionHandler( unsigned portLONG ulCause, unsigned portLONG ulStatus ) +{ + /* This overrides the definition provided by the kernel. Other exceptions + should be handled here. */ + for( ;; ); +} diff --git a/Demo/PIC32MX_MPLAB/serial/serial.c b/Demo/PIC32MX_MPLAB/serial/serial.c new file mode 100644 index 000000000..415c3551f --- /dev/null +++ b/Demo/PIC32MX_MPLAB/serial/serial.c @@ -0,0 +1,190 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + + +/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER. + +NOTE: This driver is primarily to test the scheduler functionality. It does +not effectively use the buffers or DMA and is therefore not intended to be +an example of an efficient driver. */ + +/* Standard include file. */ +#include +#include + +/* Scheduler include files. */ +#include "FreeRTOS.h" +#include "queue.h" +#include "task.h" + +/* Demo app include files. */ +#include "serial.h" + +/* Hardware setup. */ +#define serSET_FLAG ( 1 ) + +/* The queues used to communicate between tasks and ISR's. */ +static xQueueHandle xRxedChars; +static xQueueHandle xCharsForTx; + +/* Flag used to indicate the tx status. */ +static portBASE_TYPE xTxHasEnded; + +/*-----------------------------------------------------------*/ + +/* The UART interrupt handler. */ +void __attribute__( (interrupt(ipl1), vector(_UART2_VECTOR))) vU2InterruptWrapper( void ); + +/*-----------------------------------------------------------*/ + +xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) +{ +unsigned portSHORT usBRG; + + /* Create the queues used by the com test task. */ + xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) ); + xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) ); + + /* Configure the UART and interrupts. */ + usBRG = (unsigned portSHORT)(( (float)configPERIPHERAL_CLOCK_HZ / ( (float)16 * (float)ulWantedBaud ) ) - (float)0.5); + OpenUART2( UART_EN, UART_RX_ENABLE | UART_TX_ENABLE | UART_INT_TX | UART_INT_RX_CHAR, usBRG ); + ConfigIntUART2( configKERNEL_INTERRUPT_PRIORITY | UART_INT_SUB_PR0 | UART_TX_INT_EN | UART_RX_INT_EN ); + + xTxHasEnded = pdTRUE; + + /* Only a single port is implemented so we don't need to return anything. */ + return NULL; +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime ) +{ + /* Only one port is supported. */ + ( void ) pxPort; + + /* Get the next character from the buffer. Return false if no characters + are available or arrive before xBlockTime expires. */ + if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) ) + { + return pdTRUE; + } + else + { + return pdFALSE; + } +} +/*-----------------------------------------------------------*/ + +signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime ) +{ + /* Only one port is supported. */ + ( void ) pxPort; + + /* Return false if after the block time there is no room on the Tx queue. */ + if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) != pdPASS ) + { + return pdFAIL; + } + + /* A critical section should not be required as xTxHasEnded will not be + written to by the ISR if it is already 0 (is this correct?). */ + if( xTxHasEnded ) + { + xTxHasEnded = pdFALSE; + IFS1bits.U2TXIF = serSET_FLAG; + } + + return pdPASS; +} +/*-----------------------------------------------------------*/ + +void vSerialClose( xComPortHandle xPort ) +{ +} +/*-----------------------------------------------------------*/ + +void vU2InterruptHandler( void ) +{ +/* Declared static to minimise stack use. */ +static portCHAR cChar; +static portBASE_TYPE xYieldRequired; + + xYieldRequired = pdFALSE; + + /* Are any Rx interrupts pending? */ + if( mU2RXGetIntFlag() ) + { + while( U2STAbits.URXDA ) + { + /* Retrieve the received character and place it in the queue of + received characters. */ + cChar = U2RXREG; + xYieldRequired = xQueueSendFromISR( xRxedChars, &cChar, xYieldRequired ); + } + mU2RXClearIntFlag(); + } + + /* Are any Tx interrupts pending? */ + if( mU2TXGetIntFlag() ) + { + while( !( U2STAbits.UTXBF ) ) + { + if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xYieldRequired ) == pdTRUE ) + { + /* Send the next character queued for Tx. */ + U2TXREG = cChar; + } + else + { + /* Queue empty, nothing to send. */ + xTxHasEnded = pdTRUE; + break; + } + } + + mU2TXClearIntFlag(); + } + + /* If sending or receiving necessitates a context switch, then switch now. */ + portEND_SWITCHING_ISR( xYieldRequired ); +} + + + + + + + diff --git a/Demo/PIC32MX_MPLAB/serial/serial_isr.S b/Demo/PIC32MX_MPLAB/serial/serial_isr.S new file mode 100644 index 000000000..15c9773a8 --- /dev/null +++ b/Demo/PIC32MX_MPLAB/serial/serial_isr.S @@ -0,0 +1,24 @@ +#include +#include +#include "ISR_Support.h" + + .set nomips16 + .set noreorder + + .extern vU2InterruptHandler + .extern xISRStackTop + .global vU2InterruptWrapper + + .set noreorder + .set noat + .ent vU2InterruptWrapper + +vU2InterruptWrapper: + + portSAVE_CONTEXT + jal vU2InterruptHandler + nop + portRESTORE_CONTEXT + + .end vU2InterruptWrapper + diff --git a/Demo/PIC32MX_MPLAB/timertest.c b/Demo/PIC32MX_MPLAB/timertest.c new file mode 100644 index 000000000..831c3fc0b --- /dev/null +++ b/Demo/PIC32MX_MPLAB/timertest.c @@ -0,0 +1,125 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +/* High speed timer test as described in main.c. */ + + +/* Scheduler includes. */ +#include "FreeRTOS.h" + +/* Demo includes. */ +#include "partest.h" + +/* The number of interrupts to pass before we start looking at the jitter. */ +#define timerSETTLE_TIME 200 + +/* The maximum value the 16bit timer can contain. */ +#define timerMAX_COUNT 0xffff + + +/*-----------------------------------------------------------*/ + +/* The maximum time (in processor clocks) between two consecutive timer +interrupts so far. */ +unsigned portLONG ulMaxJitter = 0; + +/*-----------------------------------------------------------*/ + +void vSetupTimerTest( unsigned portSHORT usFrequencyHz ) +{ + /* T2 is used to generate interrupts. The core timer is used to provide an + accurate time measurement. */ + T2CON = 0; + TMR2 = 0; + + /* Timer 2 is going to interrupt at usFrequencyHz Hz. */ + PR2 = ( unsigned portSHORT ) ( configPERIPHERAL_CLOCK_HZ / ( unsigned portLONG ) usFrequencyHz ); + + /* Setup timer 2 interrupt priority to be above the kernel priority so + the timer jitter is not effected by the kernel activity. */ + ConfigIntTimer2( T2_INT_ON | ( configKERNEL_INTERRUPT_PRIORITY + 1 ) ); + + /* Clear the interrupt as a starting condition. */ + IFS0bits.T2IF = 0; + + /* Enable the interrupt. */ + IEC0bits.T2IE = 1; + + /* Start the timer. */ + T2CONbits.TON = 1; +} +/*-----------------------------------------------------------*/ + +void __attribute__( (interrupt(ipl0), vector(_TIMER_2_VECTOR))) vT2InterruptHandler( void ); +void vT2InterruptHandler( void ) +{ +static unsigned portLONG ulLastCount = 0, ulSettleCount = 0; +static unsigned portLONG ulThisCount, ulDifference; + + /* Capture the timer value as we enter the interrupt. */ + ulThisCount = _CP0_GET_COUNT(); + + if( ulSettleCount >= timerSETTLE_TIME ) + { + /* What is the difference between the timer value in this interrupt + and the value from the last interrupt. */ + ulDifference = ulThisCount - ulLastCount; + + /* Store the difference in the timer values if it is larger than the + currently stored largest value. The difference over and above the + expected difference will give the 'jitter' in the processing of these + interrupts. */ + if( ulDifference > ulMaxJitter ) + { + ulMaxJitter = ulDifference; + } + } + else + { + /* Don't bother storing any values for the first couple of + interrupts. */ + ulSettleCount++; + } + + /* Remember what the timer value was this time through, so we can calculate + the difference the next time through. */ + ulLastCount = ulThisCount; + + /* Clear the timer interrupt. */ + IFS0bits.T2IF = 0; +} + + diff --git a/Demo/PIC32MX_MPLAB/timertest.h b/Demo/PIC32MX_MPLAB/timertest.h new file mode 100644 index 000000000..e5481f2fe --- /dev/null +++ b/Demo/PIC32MX_MPLAB/timertest.h @@ -0,0 +1,46 @@ +/* + FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + 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. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com a version that has been certified for use + in safety critical systems, plus commercial licensing, development and + support options. + *************************************************************************** +*/ + +#ifndef TIMER_TEST_H +#define TIMER_TEST_H + +/* Setup the high frequency timer interrupt. */ +void vSetupTimerTest( unsigned portSHORT usFrequencyHz ); + +#endif /* TIMER_TEST_H */ + + +