]> git.sur5r.net Git - freertos/commitdiff
Add CreateProjectDirectoryStructure.bat to the SAM4 demo.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 12 Aug 2012 04:25:38 +0000 (04:25 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 12 Aug 2012 04:25:38 +0000 (04:25 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1768 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h [new file with mode: 0644]

diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat
new file mode 100644 (file)
index 0000000..a744b23
--- /dev/null
@@ -0,0 +1,58 @@
+REM This file should be executed from the command line prior to the first\r
+REM build.  It will be necessary to refresh the Eclipse project once the\r
+REM .bat file has been executed (normally just press F5 to refresh).\r
+\r
+REM Copies all the required files from their location within the standard\r
+REM FreeRTOS directory structure to under the Eclipse project directory.\r
+REM This permits the Eclipse project to be used in 'managed' mode and without\r
+REM having to setup any linked resources.\r
+\r
+REM Standard paths\r
+SET FREERTOS_SOURCE=..\..\Source\r
+SET COMMON_SOURCE=..\Common\minimal\r
+SET COMMON_INCLUDE=..\Common\include\r
+\r
+REM Have the files already been copied?\r
+IF EXIST src\asf\thirdparty\FreeRTOS Goto END\r
+\r
+    REM Create the required directory structure.\r
+    MD src\asf\thirdparty\FreeRTOS\r
+    MD src\asf\thirdparty\FreeRTOS\include\r
+    MD src\asf\thirdparty\FreeRTOS\portable\r
+    MD src\asf\thirdparty\FreeRTOS\portable\GCC\r
+    MD src\asf\thirdparty\FreeRTOS\portable\GCC\ARM_CM3\r
+    MD src\asf\thirdparty\FreeRTOS\portable\MemMang    \r
+    MD src\Common-Demo-Source\include\r
+    \r
+    REM Copy the core kernel files into the project directory\r
+    copy %FREERTOS_SOURCE%\tasks.c src\asf\thirdparty\FreeRTOS\r
+    copy %FREERTOS_SOURCE%\queue.c src\asf\thirdparty\FreeRTOS\r
+    copy %FREERTOS_SOURCE%\list.c src\asf\thirdparty\FreeRTOS\r
+    copy %FREERTOS_SOURCE%\timers.c src\asf\thirdparty\FreeRTOS\r
+\r
+    REM Copy the common header files into the project directory\r
+    copy %FREERTOS_SOURCE%\include\*.* src\asf\thirdparty\FreeRTOS\include\r
+    \r
+    REM Copy the portable layer files into the project directory\r
+    copy %FREERTOS_SOURCE%\portable\GCC\ARM_CM3\*.* src\asf\thirdparty\FreeRTOS\portable\GCC\ARM_CM3\r
+    \r
+    REM Copy the memory allocation files into the project directory\r
+    copy %FREERTOS_SOURCE%\portable\MemMang\heap_4.c src\asf\thirdparty\FreeRTOS\portable\MemMang\r
+\r
+    REM Copy the files that define the common demo tasks.\r
+    copy %COMMON_SOURCE%\dynamic.c         src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\BlockQ.c          src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\flash_timer.c     src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\death.c           src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\blocktim.c        src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\semtest.c         src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\PollQ.c           src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\GenQTest.c        src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\recmutex.c        src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\countsem.c        src\Common-Demo-Source\r
+    copy %COMMON_SOURCE%\integer.c         src\Common-Demo-Source\r
+    \r
+    REM Copy the common demo file headers.\r
+    copy %COMMON_INCLUDE%\*.h              src\Common-Demo-Source\include\r
+    \r
+: END\r
index 13e628a46aa5635b0a10ba81202541b46f179baf..d00d30fc9b7cec18b7a703b790b6ee31bc2fbc1c 100644 (file)
Binary files a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo and b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo differ
index 76f7aadf2438628cdc20762f65df0cb09f2f0ffc..74d0bc86cfe2ef32c04bf97f3017a56abad81d28 100644 (file)
   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">\r
     <ToolchainSettings>\r
       <ArmGcc>\r
-  <armgcc.common.general.symbols>__SAM4S16C__</armgcc.common.general.symbols>\r
-  <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex>\r
-  <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss>\r
-  <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep>\r
-  <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin>\r
-  <armgcc.compiler.symbols.DefSymbols>\r
-    <ListValues>\r
-      <Value>ARM_MATH_CM4=true</Value>\r
-      <Value>BOARD=SAM4S_EK</Value>\r
-      <Value>__SAM4S16C__</Value>\r
-      <Value>XMEGA=0</Value>\r
-      <Value>MEGA=0</Value>\r
-      <Value>UC3=0</Value>\r
-    </ListValues>\r
-  </armgcc.compiler.symbols.DefSymbols>\r
-  <armgcc.compiler.directories.IncludePaths>\r
-    <ListValues>\r
-      <Value>../src</Value>\r
-      <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
-      <Value>../src/asf/common/boards</Value>\r
-      <Value>../src/asf/common/services/gpio</Value>\r
-      <Value>../src/asf/common/utils</Value>\r
-      <Value>../src/asf/sam/boards</Value>\r
-      <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
-      <Value>../src/asf/sam/drivers/pio</Value>\r
-      <Value>../src/asf/sam/utils</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
-      <Value>../src/asf/sam/utils/header_files</Value>\r
-      <Value>../src/asf/sam/utils/preprocessor</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
-      <Value>../src/config</Value>\r
-      <Value>../src/asf/thirdparty/FreeRTOS/include</Value>\r
-      <Value>../src/asf/thirdparty/FreeRTOS/portable/GCC/ARM_CM3</Value>\r
-      <Value>../src/Common-Demo-Source/include</Value>\r
-      <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles</Value>\r
-      <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\CMSIS\Include</Value>\r
-      <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\Device\ATMEL</Value>\r
-      <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\Device\ATMEL\sam4s\include</Value>\r
-      <Value>../src/asf/sam/drivers/pmc</Value>\r
-      <Value>../src/asf/common/services/clock</Value>\r
-      <Value>../src/asf/sam/drivers/usart</Value>\r
-    </ListValues>\r
-  </armgcc.compiler.directories.IncludePaths>\r
-  <armgcc.compiler.optimization.OtherFlags>-fdata-sections</armgcc.compiler.optimization.OtherFlags>\r
-  <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>\r
-  <armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel>\r
-  <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings>\r
-  <armgcc.compiler.miscellaneous.OtherFlags>-pipe -Wall -Wextra -std=gnu99 -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -Dprintf=iprintf</armgcc.compiler.miscellaneous.OtherFlags>\r
-  <armgcc.linker.libraries.LibrarySearchPaths>\r
-    <ListValues>\r
-      <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
-    </ListValues>\r
-  </armgcc.linker.libraries.LibrarySearchPaths>\r
-  <armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>\r
-  <armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>\r
-  <armgcc.assembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>../src</Value>\r
-      <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
-      <Value>../src/asf/common/boards</Value>\r
-      <Value>../src/asf/common/services/gpio</Value>\r
-      <Value>../src/asf/common/utils</Value>\r
-      <Value>../src/asf/sam/boards</Value>\r
-      <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
-      <Value>../src/asf/sam/drivers/pio</Value>\r
-      <Value>../src/asf/sam/utils</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
-      <Value>../src/asf/sam/utils/header_files</Value>\r
-      <Value>../src/asf/sam/utils/preprocessor</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
-      <Value>../src/config</Value>\r
-      <Value>../src/asf/sam/drivers/pmc</Value>\r
-      <Value>../src/asf/common/services/clock</Value>\r
-      <Value>../src/asf/sam/drivers/usart</Value>\r
-    </ListValues>\r
-  </armgcc.assembler.general.IncludePaths>\r
-  <armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>\r
-  <armgcc.preprocessingassembler.general.IncludePaths>\r
-    <ListValues>\r
-      <Value>../src</Value>\r
-      <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
-      <Value>../src/asf/common/boards</Value>\r
-      <Value>../src/asf/common/services/gpio</Value>\r
-      <Value>../src/asf/common/utils</Value>\r
-      <Value>../src/asf/sam/boards</Value>\r
-      <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
-      <Value>../src/asf/sam/drivers/pio</Value>\r
-      <Value>../src/asf/sam/utils</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
-      <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
-      <Value>../src/asf/sam/utils/header_files</Value>\r
-      <Value>../src/asf/sam/utils/preprocessor</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
-      <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
-      <Value>../src/config</Value>\r
-      <Value>../src/asf/sam/drivers/pmc</Value>\r
-      <Value>../src/asf/common/services/clock</Value>\r
-      <Value>../src/asf/sam/drivers/usart</Value>\r
-    </ListValues>\r
-  </armgcc.preprocessingassembler.general.IncludePaths>\r
-</ArmGcc>\r
+        <armgcc.common.general.symbols>__SAM4S16C__</armgcc.common.general.symbols>\r
+        <armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex>\r
+        <armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss>\r
+        <armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep>\r
+        <armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin>\r
+        <armgcc.compiler.symbols.DefSymbols>\r
+          <ListValues>\r
+            <Value>ARM_MATH_CM4=true</Value>\r
+            <Value>BOARD=SAM4S_EK</Value>\r
+            <Value>__SAM4S16C__</Value>\r
+            <Value>XMEGA=0</Value>\r
+            <Value>MEGA=0</Value>\r
+            <Value>UC3=0</Value>\r
+          </ListValues>\r
+        </armgcc.compiler.symbols.DefSymbols>\r
+        <armgcc.compiler.directories.IncludePaths>\r
+          <ListValues>\r
+            <Value>../src</Value>\r
+            <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
+            <Value>../src/asf/common/boards</Value>\r
+            <Value>../src/asf/common/services/gpio</Value>\r
+            <Value>../src/asf/common/utils</Value>\r
+            <Value>../src/asf/sam/boards</Value>\r
+            <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
+            <Value>../src/asf/sam/drivers/pio</Value>\r
+            <Value>../src/asf/sam/utils</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
+            <Value>../src/asf/sam/utils/header_files</Value>\r
+            <Value>../src/asf/sam/utils/preprocessor</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
+            <Value>../src/config</Value>\r
+            <Value>../src/asf/thirdparty/FreeRTOS/include</Value>\r
+            <Value>../src/asf/thirdparty/FreeRTOS/portable/GCC/ARM_CM3</Value>\r
+            <Value>../src/Common-Demo-Source/include</Value>\r
+            <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles</Value>\r
+            <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\CMSIS\Include</Value>\r
+            <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\Device\ATMEL</Value>\r
+            <Value>C:\devtools\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.83\ARMSupportFiles\Device\ATMEL\sam4s\include</Value>\r
+            <Value>../src/asf/sam/drivers/pmc</Value>\r
+            <Value>../src/asf/common/services/clock</Value>\r
+            <Value>../src/asf/sam/drivers/usart</Value>\r
+          </ListValues>\r
+        </armgcc.compiler.directories.IncludePaths>\r
+        <armgcc.compiler.optimization.OtherFlags>-fdata-sections</armgcc.compiler.optimization.OtherFlags>\r
+        <armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>\r
+        <armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel>\r
+        <armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings>\r
+        <armgcc.compiler.miscellaneous.OtherFlags>-pipe -Wall -Wextra -std=gnu99 -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -Dprintf=iprintf</armgcc.compiler.miscellaneous.OtherFlags>\r
+        <armgcc.linker.libraries.LibrarySearchPaths>\r
+          <ListValues>\r
+            <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
+          </ListValues>\r
+        </armgcc.linker.libraries.LibrarySearchPaths>\r
+        <armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>\r
+        <armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>\r
+        <armgcc.assembler.general.IncludePaths>\r
+          <ListValues>\r
+            <Value>../src</Value>\r
+            <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
+            <Value>../src/asf/common/boards</Value>\r
+            <Value>../src/asf/common/services/gpio</Value>\r
+            <Value>../src/asf/common/utils</Value>\r
+            <Value>../src/asf/sam/boards</Value>\r
+            <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
+            <Value>../src/asf/sam/drivers/pio</Value>\r
+            <Value>../src/asf/sam/utils</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
+            <Value>../src/asf/sam/utils/header_files</Value>\r
+            <Value>../src/asf/sam/utils/preprocessor</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
+            <Value>../src/config</Value>\r
+            <Value>../src/asf/sam/drivers/pmc</Value>\r
+            <Value>../src/asf/common/services/clock</Value>\r
+            <Value>../src/asf/sam/drivers/usart</Value>\r
+          </ListValues>\r
+        </armgcc.assembler.general.IncludePaths>\r
+        <armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>\r
+        <armgcc.preprocessingassembler.general.IncludePaths>\r
+          <ListValues>\r
+            <Value>../src</Value>\r
+            <Value>../src/asf/common/applications/user_application/sam4s16c_sam4s_ek</Value>\r
+            <Value>../src/asf/common/boards</Value>\r
+            <Value>../src/asf/common/services/gpio</Value>\r
+            <Value>../src/asf/common/utils</Value>\r
+            <Value>../src/asf/sam/boards</Value>\r
+            <Value>../src/asf/sam/boards/sam4s_ek</Value>\r
+            <Value>../src/asf/sam/drivers/pio</Value>\r
+            <Value>../src/asf/sam/utils</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/include</Value>\r
+            <Value>../src/asf/sam/utils/cmsis/sam4s/source/templates</Value>\r
+            <Value>../src/asf/sam/utils/header_files</Value>\r
+            <Value>../src/asf/sam/utils/preprocessor</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Include</Value>\r
+            <Value>../src/asf/thirdparty/CMSIS/Lib/GCC</Value>\r
+            <Value>../src/config</Value>\r
+            <Value>../src/asf/sam/drivers/pmc</Value>\r
+            <Value>../src/asf/common/services/clock</Value>\r
+            <Value>../src/asf/sam/drivers/usart</Value>\r
+          </ListValues>\r
+        </armgcc.preprocessingassembler.general.IncludePaths>\r
+      </ArmGcc>\r
     </ToolchainSettings>\r
     <GenerateHexFile>True</GenerateHexFile>\r
     <GenerateMapFile>True</GenerateMapFile>\r
     <None Include="src\asf\sam\drivers\usart\usart.h">\r
       <SubType>compile</SubType>\r
     </None>\r
+    <Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_4.c">\r
+      <SubType>compile</SubType>\r
+    </Compile>\r
     <Compile Include="src\Common-Demo-Source\include\demo_serial.h">\r
       <SubType>compile</SubType>\r
     </Compile>\r
     <Compile Include="src\asf\thirdparty\FreeRTOS\portable\GCC\ARM_CM3\portmacro.h">\r
       <SubType>compile</SubType>\r
     </Compile>\r
-    <Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_2.c">\r
-      <SubType>compile</SubType>\r
-    </Compile>\r
     <Compile Include="src\asf\thirdparty\FreeRTOS\queue.c">\r
       <SubType>compile</SubType>\r
     </Compile>\r
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c
new file mode 100644 (file)
index 0000000..18b7d4a
--- /dev/null
@@ -0,0 +1,304 @@
+/*\r
+    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+       \r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
+     *    Complete, revised, and edited pdf reference manuals are also       *\r
+     *    available.                                                         *\r
+     *                                                                       *\r
+     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
+     *    ensuring you get running as quickly as possible and with an        *\r
+     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
+     *    the FreeRTOS project to continue with its mission of providing     *\r
+     *    professional grade, cross platform, de facto standard solutions    *\r
+     *    for microcontrollers - completely free of charge!                  *\r
+     *                                                                       *\r
+     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
+     *                                                                       *\r
+     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    >>>NOTE<<< The modification to the GPL is included to allow you to\r
+    distribute a combined work that includes FreeRTOS without being obliged to\r
+    provide the source code for proprietary components outside of the FreeRTOS\r
+    kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
+    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+    \r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?                                      *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    \r
+    http://www.FreeRTOS.org - Documentation, training, latest information, \r
+    license and contact details.\r
+    \r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool.\r
+\r
+    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
+    the code with commercial support, indemnification, and middleware, under \r
+    the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
+    provide a safety engineered and independently SIL3 certified version under \r
+    the SafeRTOS brand: http://www.SafeRTOS.com.\r
+*/\r
+\r
+\r
+/*\r
+ * This version of comtest. c is for use on systems that have limited stack\r
+ * space and no display facilities.  The complete version can be found in\r
+ * the Demo/Common/Full directory.\r
+ *\r
+ * Creates two tasks that operate on an interrupt driven serial port.  A\r
+ * loopback connector should be used so that everything that is transmitted is\r
+ * also received.  The serial port does not use any flow control.  On a\r
+ * standard 9way 'D' connector pins two and three should be connected together.\r
+ *\r
+ * The first task posts a sequence of characters to the Tx queue, toggling an\r
+ * LED on each successful post.  At the end of the sequence it sleeps for a\r
+ * pseudo-random period before resending the same sequence.\r
+ *\r
+ * The UART Tx end interrupt is enabled whenever data is available in the Tx\r
+ * queue.  The Tx end ISR removes a single character from the Tx queue and\r
+ * passes it to the UART for transmission.\r
+ *\r
+ * The second task blocks on the Rx queue waiting for a character to become\r
+ * available.  When the UART Rx end interrupt receives a character it places\r
+ * it in the Rx queue, waking the second task.  The second task checks that the\r
+ * characters removed from the Rx queue form the same sequence as those posted\r
+ * to the Tx queue, and toggles an LED for each correct character.\r
+ *\r
+ * The receiving task is spawned with a higher priority than the transmitting\r
+ * task.  The receiver will therefore wake every time a character is\r
+ * transmitted so neither the Tx or Rx queue should ever hold more than a few\r
+ * characters.\r
+ *\r
+ */\r
+\r
+/* Scheduler include files. */\r
+#include <stdlib.h>\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Demo program include files. */\r
+#include "demo_serial.h"\r
+#include "comtest2.h"\r
+#include "partest.h"\r
+\r
+#define comSTACK_SIZE                          configMINIMAL_STACK_SIZE\r
+#define comTX_LED_OFFSET                       ( 0 )\r
+#define comRX_LED_OFFSET                       ( 1 )\r
+#define comTOTAL_PERMISSIBLE_ERRORS ( 2 )\r
+\r
+/* The Tx task will transmit the sequence of characters at a pseudo random\r
+interval.  This is the maximum and minimum block time between sends. */\r
+#define comTX_MAX_BLOCK_TIME           ( ( portTickType ) 0x96 )\r
+#define comTX_MIN_BLOCK_TIME           ( ( portTickType ) 0x32 )\r
+#define comOFFSET_TIME                         ( ( portTickType ) 3 )\r
+\r
+/* We should find that each character can be queued for Tx immediately and we\r
+don't have to block to send. */\r
+#define comNO_BLOCK                                    ( ( portTickType ) 0 )\r
+\r
+/* The Rx task will block on the Rx queue for a long period. */\r
+#define comRX_BLOCK_TIME                       ( ( portTickType ) 0xffff )\r
+\r
+/* The sequence transmitted is from comFIRST_BYTE to and including comLAST_BYTE. */\r
+#define comFIRST_BYTE                          ( 'A' )\r
+#define comLAST_BYTE                           ( 'X' )\r
+\r
+#define comBUFFER_LEN                          ( ( unsigned portBASE_TYPE ) ( comLAST_BYTE - comFIRST_BYTE ) + ( unsigned portBASE_TYPE ) 1 )\r
+#define comINITIAL_RX_COUNT_VALUE      ( 0 )\r
+\r
+/* Handle to the com port used by both tasks. */\r
+static xComPortHandle xPort = NULL;\r
+\r
+/* The transmit task as described at the top of the file. */\r
+static portTASK_FUNCTION_PROTO( vComTxTask, pvParameters );\r
+\r
+/* The receive task as described at the top of the file. */\r
+static portTASK_FUNCTION_PROTO( vComRxTask, pvParameters );\r
+\r
+/* The LED that should be toggled by the Rx and Tx tasks.  The Rx task will\r
+toggle LED ( uxBaseLED + comRX_LED_OFFSET).  The Tx task will toggle LED\r
+( uxBaseLED + comTX_LED_OFFSET ). */\r
+static unsigned portBASE_TYPE uxBaseLED = 0;\r
+\r
+/* Check variable used to ensure no error have occurred.  The Rx task will\r
+increment this variable after every successfully received sequence.  If at any\r
+time the sequence is incorrect the the variable will stop being incremented. */\r
+static volatile unsigned portBASE_TYPE uxRxLoops = comINITIAL_RX_COUNT_VALUE;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned long ulBaudRate, unsigned portBASE_TYPE uxLED )\r
+{\r
+       /* Initialise the com port then spawn the Rx and Tx tasks. */\r
+       uxBaseLED = uxLED;\r
+       xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );\r
+\r
+       /* The Tx task is spawned with a lower priority than the Rx task. */\r
+       xTaskCreate( vComTxTask, ( signed char * ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );\r
+       xTaskCreate( vComRxTask, ( signed char * ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static portTASK_FUNCTION( vComTxTask, pvParameters )\r
+{\r
+signed char cByteToSend;\r
+portTickType xTimeToWait;\r
+\r
+       /* Just to stop compiler warnings. */\r
+       ( void ) pvParameters;\r
+\r
+       for( ;; )\r
+       {\r
+               /* Simply transmit a sequence of characters from comFIRST_BYTE to\r
+               comLAST_BYTE. */\r
+               for( cByteToSend = comFIRST_BYTE; cByteToSend <= comLAST_BYTE; cByteToSend++ )\r
+               {\r
+                       if( xSerialPutChar( xPort, cByteToSend, comNO_BLOCK ) == pdPASS )\r
+                       {\r
+                               vParTestToggleLED( uxBaseLED + comTX_LED_OFFSET );\r
+                       }\r
+               }\r
+\r
+               /* Turn the LED off while we are not doing anything. */\r
+               vParTestSetLED( uxBaseLED + comTX_LED_OFFSET, pdFALSE );\r
+\r
+               /* We have posted all the characters in the string - wait before\r
+               re-sending.  Wait a pseudo-random time as this will provide a better\r
+               test. */\r
+               xTimeToWait = xTaskGetTickCount() + comOFFSET_TIME;\r
+\r
+               /* Make sure we don't wait too long... */\r
+               xTimeToWait %= comTX_MAX_BLOCK_TIME;\r
+\r
+               /* ...but we do want to wait. */\r
+               if( xTimeToWait < comTX_MIN_BLOCK_TIME )\r
+               {\r
+                       xTimeToWait = comTX_MIN_BLOCK_TIME;\r
+               }\r
+\r
+               vTaskDelay( xTimeToWait );\r
+       }\r
+} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */\r
+/*-----------------------------------------------------------*/\r
+\r
+static portTASK_FUNCTION( vComRxTask, pvParameters )\r
+{\r
+signed char cExpectedByte, cByteRxed;\r
+portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;\r
+\r
+       /* Just to stop compiler warnings. */\r
+       ( void ) pvParameters;\r
+\r
+       for( ;; )\r
+       {\r
+               /* We expect to receive the characters from comFIRST_BYTE to\r
+               comLAST_BYTE in an incrementing order.  Loop to receive each byte. */\r
+               for( cExpectedByte = comFIRST_BYTE; cExpectedByte <= comLAST_BYTE; cExpectedByte++ )\r
+               {\r
+                       /* Block on the queue that contains received bytes until a byte is\r
+                       available. */\r
+                       if( xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ) )\r
+                       {\r
+                               /* Was this the byte we were expecting?  If so, toggle the LED,\r
+                               otherwise we are out on sync and should break out of the loop\r
+                               until the expected character sequence is about to restart. */\r
+                               if( cByteRxed == cExpectedByte )\r
+                               {\r
+                                       vParTestToggleLED( uxBaseLED + comRX_LED_OFFSET );\r
+                               }\r
+                               else\r
+                               {\r
+                                       xResyncRequired = pdTRUE;\r
+                                       break; /*lint !e960 Non-switch break allowed. */\r
+                               }\r
+                       }\r
+               }\r
+\r
+               /* Turn the LED off while we are not doing anything. */\r
+               vParTestSetLED( uxBaseLED + comRX_LED_OFFSET, pdFALSE );\r
+\r
+               /* Did we break out of the loop because the characters were received in\r
+               an unexpected order?  If so wait here until the character sequence is\r
+               about to restart. */\r
+               if( xResyncRequired == pdTRUE )\r
+               {\r
+                       while( cByteRxed != comLAST_BYTE )\r
+                       {\r
+                               /* Block until the next char is available. */\r
+                               xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME );\r
+                       }\r
+\r
+                       /* Note that an error occurred which caused us to have to resync.\r
+                       We use this to stop incrementing the loop counter so\r
+                       sAreComTestTasksStillRunning() will return false - indicating an\r
+                       error. */\r
+                       xErrorOccurred++;\r
+\r
+                       /* We have now resynced with the Tx task and can continue. */\r
+                       xResyncRequired = pdFALSE;\r
+               }\r
+               else\r
+               {\r
+                       if( xErrorOccurred < comTOTAL_PERMISSIBLE_ERRORS )\r
+                       {\r
+                               /* Increment the count of successful loops.  As error\r
+                               occurring (i.e. an unexpected character being received) will\r
+                               prevent this counter being incremented for the rest of the\r
+                               execution.   Don't worry about mutual exclusion on this\r
+                               variable - it doesn't really matter as we just want it\r
+                               to change. */\r
+                               uxRxLoops++;\r
+                       }\r
+               }\r
+       }\r
+} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */\r
+/*-----------------------------------------------------------*/\r
+\r
+portBASE_TYPE xAreComTestTasksStillRunning( void )\r
+{\r
+portBASE_TYPE xReturn;\r
+\r
+       /* If the count of successful reception loops has not changed than at\r
+       some time an error occurred (i.e. a character was received out of sequence)\r
+       and we will return false. */\r
+       if( uxRxLoops == comINITIAL_RX_COUNT_VALUE )\r
+       {\r
+               xReturn = pdFALSE;\r
+       }\r
+       else\r
+       {\r
+               xReturn = pdTRUE;\r
+       }\r
+\r
+       /* Reset the count of successful Rx loops.  When this function is called\r
+       again we expect this to have been incremented. */\r
+       uxRxLoops = comINITIAL_RX_COUNT_VALUE;\r
+\r
+       return xReturn;\r
+}\r
+\r
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h
new file mode 100644 (file)
index 0000000..afafdd5
--- /dev/null
@@ -0,0 +1,137 @@
+/*\r
+    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+       \r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
+     *    Complete, revised, and edited pdf reference manuals are also       *\r
+     *    available.                                                         *\r
+     *                                                                       *\r
+     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
+     *    ensuring you get running as quickly as possible and with an        *\r
+     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
+     *    the FreeRTOS project to continue with its mission of providing     *\r
+     *    professional grade, cross platform, de facto standard solutions    *\r
+     *    for microcontrollers - completely free of charge!                  *\r
+     *                                                                       *\r
+     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
+     *                                                                       *\r
+     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    >>>NOTE<<< The modification to the GPL is included to allow you to\r
+    distribute a combined work that includes FreeRTOS without being obliged to\r
+    provide the source code for proprietary components outside of the FreeRTOS\r
+    kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
+    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+    \r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    Having a problem?  Start by reading the FAQ "My application does   *\r
+     *    not run, what could be wrong?                                      *\r
+     *                                                                       *\r
+     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    \r
+    http://www.FreeRTOS.org - Documentation, training, latest information, \r
+    license and contact details.\r
+    \r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool.\r
+\r
+    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
+    the code with commercial support, indemnification, and middleware, under \r
+    the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
+    provide a safety engineered and independently SIL3 certified version under \r
+    the SafeRTOS brand: http://www.SafeRTOS.com.\r
+*/\r
+\r
+#ifndef SERIAL_COMMS_H\r
+#define SERIAL_COMMS_H\r
+\r
+typedef void * xComPortHandle;\r
+\r
+typedef enum\r
+{ \r
+       serCOM1, \r
+       serCOM2, \r
+       serCOM3, \r
+       serCOM4, \r
+       serCOM5, \r
+       serCOM6, \r
+       serCOM7, \r
+       serCOM8 \r
+} eCOMPort;\r
+\r
+typedef enum \r
+{ \r
+       serNO_PARITY, \r
+       serODD_PARITY, \r
+       serEVEN_PARITY, \r
+       serMARK_PARITY, \r
+       serSPACE_PARITY \r
+} eParity;\r
+\r
+typedef enum \r
+{ \r
+       serSTOP_1, \r
+       serSTOP_2 \r
+} eStopBits;\r
+\r
+typedef enum \r
+{ \r
+       serBITS_5, \r
+       serBITS_6, \r
+       serBITS_7, \r
+       serBITS_8 \r
+} eDataBits;\r
+\r
+typedef enum \r
+{ \r
+       ser50,          \r
+       ser75,          \r
+       ser110,         \r
+       ser134,         \r
+       ser150,    \r
+       ser200,\r
+       ser300,         \r
+       ser600,         \r
+       ser1200,        \r
+       ser1800,        \r
+       ser2400,   \r
+       ser4800,\r
+       ser9600,                \r
+       ser19200,       \r
+       ser38400,       \r
+       ser57600,       \r
+       ser115200\r
+} eBaud;\r
+\r
+xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength );\r
+xComPortHandle xSerialPortInit( eCOMPort ePort, eBaud eWantedBaud, eParity eWantedParity, eDataBits eWantedDataBits, eStopBits eWantedStopBits, unsigned portBASE_TYPE uxBufferLength );\r
+void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength );\r
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime );\r
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime );\r
+portBASE_TYPE xSerialWaitForSemaphore( xComPortHandle xPort );\r
+void vSerialClose( xComPortHandle xPort );\r
+\r
+#endif\r
+\r