Update demo project for Tensilita - work in progres..
Add support for POSIX style errno - work in progress.
diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.cproject b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.cproject
index 8cca4c4..a574d0e 100644
--- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.cproject
+++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.cproject
@@ -18,16 +18,19 @@
 							<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.cdt.build.core.settings.holder.libs.283188354" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>

 							<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.cdt.build.core.settings.holder.1363672131" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">

 								<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.818579882" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Common/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/portable/ThirdParty/XCC/Xtensa"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Common/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/portable/XCC/Xtensa"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\include}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\portable\XCC}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\Tensilica_Simulator_Xplorer_XCC&quot;"/>

 								</option>

 								<option id="org.eclipse.cdt.build.core.settings.holder.symbols.1072492848" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">

 									<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>

@@ -72,16 +75,19 @@
 							</tool>

 							<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.cdt.build.core.settings.holder.29534978" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">

 								<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.1529034681" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Common/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/portable/ThirdParty/XCC/Xtensa"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Common/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/portable/XCC/Xtensa"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\include}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\portable\XCC}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\Tensilica_Simulator_Xplorer_XCC&quot;"/>

 								</option>

 								<option id="org.eclipse.cdt.build.core.settings.holder.symbols.459736431" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">

 									<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>

@@ -126,16 +132,19 @@
 							</tool>

 							<tool errorParsers="org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.cdt.build.core.settings.holder.541186543" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">

 								<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.2101310742" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Demo/Common/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/include"/>

-									<listOptionValue builtIn="false" value="C:/workplace/FreeRTOSSVN/FreeRTOS/Source/portable/ThirdParty/XCC/Xtensa"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

-									<listOptionValue builtIn="false" value="C:/usr/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/arch/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/lib/xcc/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/tools/RG-2017.8-win32/XtensaTools/xtensa-elf/include"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++"/>

+									<listOptionValue builtIn="false" value="C:/devtools/xtensa/XtDevTools/install/builds/RG-2017.8-win32/sample_controller/xtensa-elf/include/xcc/c++/xtensa-elf"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Demo/Common/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/include"/>

+									<listOptionValue builtIn="false" value="C:/Users/ribarry/Dev/FreeRTOS/WorkingCopy/FreeRTOS/Source/portable/XCC/Xtensa"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\include}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;../${workspace_loc:RTOSDemo\FreeRTOS_Source\portable\XCC}&quot;"/>

+									<listOptionValue builtIn="false" value="&quot;C:\Users\ribarry\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\Tensilica_Simulator_Xplorer_XCC&quot;"/>

 								</option>

 								<option id="org.eclipse.cdt.build.core.settings.holder.symbols.740810983" name="Symbols" superClass="org.eclipse.cdt.build.core.settings.holder.symbols" valueType="definedSymbols">

 									<listOptionValue builtIn="false" value="__CHAR_BIT__=8"/>

@@ -208,7 +217,4 @@
 			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>

 		</scannerConfigBuildInfo>

 	</storageModule>

-	<storageModule moduleId="refreshScope" versionNumber="1">

-		<resource resourceType="PROJECT" workspacePath="/RTOSDemo"/>

-	</storageModule>

 </cproject>

diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.project b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.project
index 51db76b..e885f1a 100644
--- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.project
+++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.project
@@ -59,11 +59,6 @@
 			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/GenQTest.c</locationURI>

 		</link>

 		<link>

-			<name>CommonDemoTasks/IntQueue.c</name>

-			<type>1</type>

-			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/IntQueue.c</locationURI>

-		</link>

-		<link>

 			<name>CommonDemoTasks/IntSemTest.c</name>

 			<type>1</type>

 			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/IntSemTest.c</locationURI>

@@ -139,6 +134,11 @@
 			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/death.c</locationURI>

 		</link>

 		<link>

+			<name>CommonDemoTasks/dynamic.c</name>

+			<type>1</type>

+			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/dynamic.c</locationURI>

+		</link>

+		<link>

 			<name>CommonDemoTasks/flop.c</name>

 			<type>1</type>

 			<locationURI>PARENT-1-PROJECT_LOC/Common/Minimal/flop.c</locationURI>

@@ -291,92 +291,92 @@
 		<link>

 			<name>FreeRTOS_Source/portable/XCC/port.c</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/port.c</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/port.c</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/portasm.S</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/portasm.S</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/portasm.S</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/portbenchmark.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/portbenchmark.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/portbenchmark.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/portclib.c</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/portclib.c</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/portclib.c</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/portmacro.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/portmacro.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/portmacro.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/porttrace.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/porttrace.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/porttrace.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/readme_xtensa.txt</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/readme_xtensa.txt</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/readme_xtensa.txt</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_api.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_api.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_api.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_config.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_config.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_config.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_context.S</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_context.S</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_context.S</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_context.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_context.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_context.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_init.c</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_init.c</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_init.c</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_intr.c</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_intr.c</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_intr.c</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_intr_asm.S</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_intr_asm.S</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_intr_asm.S</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_overlay_os_hook.c</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_overlay_os_hook.c</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_overlay_os_hook.c</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_rtos.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_rtos.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_rtos.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_timer.h</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_timer.h</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_timer.h</locationURI>

 		</link>

 		<link>

 			<name>FreeRTOS_Source/portable/XCC/xtensa_vectors.S</name>

 			<type>1</type>

-			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/ThirdParty/XCC/Xtensa/xtensa_vectors.S</locationURI>

+			<locationURI>PARENT-2-PROJECT_LOC/Source/portable/XCC/Xtensa/xtensa_vectors.S</locationURI>

 		</link>

 	</linkedResources>

 </projectDescription>

diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.settings/targets/xtensa/Debug.bts b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.settings/targets/xtensa/Debug.bts
index e04cdd3..9a6fd1f 100644
--- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.settings/targets/xtensa/Debug.bts
+++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/.settings/targets/xtensa/Debug.bts
@@ -2,6 +2,18 @@
 <BuildTarget tool="xtensa" version="1.0">
     <BuildSettings>
         <BaseSettings path="project">
+            <PreprocessorOptions>
+                <StringListMapOptions>
+                    <StringListMapEntry>
+                        <key>Includes</key>
+                        <value flag="-I" inheritance="prepend">
+                            <ListEntry>${workspace_loc:RTOSDemo/FreeRTOS_Source/include}</ListEntry>
+                            <ListEntry>${workspace_loc:RTOSDemo/FreeRTOS_Source/portable/XCC}</ListEntry>
+                            <ListEntry>${workspace_loc:RTOSDemo}</ListEntry>
+                        </value>
+                    </StringListMapEntry>
+                </StringListMapOptions>
+            </PreprocessorOptions>
             <CompilerOptions>
                 <FlagValueMapOptions>
                     <FlagValueMapEntry>
diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c
index 29d669b..9e53064 100644
--- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c
+++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c
@@ -67,6 +67,7 @@
 #include "TimerDemo.h"

 #include "countsem.h"

 #include "death.h"

+#include "dynamic.h"

 #include "QueueSet.h"

 #include "QueueOverwrite.h"

 #include "EventGroupsDemo.h"

@@ -94,42 +95,16 @@
 

 #define mainTIMER_TEST_PERIOD			( 50 )

 

-/* Parameters that are passed into the register check tasks solely for the

-purpose of ensuring parameters are passed into tasks correctly. */

-#define mainREG_TEST_TASK_1_PARAMETER	( ( void * ) 0x12345678 )

-#define mainREG_TEST_TASK_2_PARAMETER	( ( void * ) 0x87654321 )

-

-/* Whether or not to enable interrupt queue tests. */

-#define mainENABLE_INT_QUEUE_TESTS		( 0 )

-

 /* The task that periodically checks that all the standard demo tasks are

  * still executing and error free.

  */

 static void prvCheckTask( void *pvParameters );

 

-/* Tasks that implement register tests. */

-static void prvRegTest1Task( void *pvParameters );

-static void prvRegTest2Task( void *pvParameters );

-

-/* Functions implemented in assembly file regtest_xtensa.S. */

-extern void vRegTest1( void );

-extern void vRegTest2( void );

 /*-----------------------------------------------------------*/

 

 /* The variable into which error messages are latched. */

 static char *pcStatusMessage = "No errors";

 

-/* The following two variables are used to communicate the status of the

-register check tasks to the check task.  If the variables keep incrementing,

-then the register check tasks have not discovered any errors.  If a variable

-stops incrementing, then an error has been found. */

-volatile unsigned long ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;

-

-/* The following variable is used to communicate whether the timers for the

-IntQueue tests have been Initialized. This is needed to ensure that the queues

-are accessed from the tick hook only after they have been created in the

-interrupt queue test. */

-volatile BaseType_t xTimerForQueueTestInitialized = pdFALSE;

 /*-----------------------------------------------------------*/

 

 int main_full( void )

@@ -137,57 +112,45 @@
 	/* Start the check task as described at the top of this file. */

 	xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

 

-	#if( mainENABLE_INT_QUEUE_TESTS == 0 )

+	/* Create the standard demo tasks. */

+	vStartTaskNotifyTask();

+	vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );

+	vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );

+	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );

+	vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );

+	vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );

+

+	vStartQueuePeekTasks();

+	vStartMathTasks( mainFLOP_TASK_PRIORITY );

+	vStartRecursiveMutexTasks();

+	vStartCountingSemaphoreTasks();

+	vStartDynamicPriorityTasks();

+	vStartQueueSetTasks();

+

+	vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );

+	vStartEventGroupTasks();

+	vStartInterruptSemaphoreTasks();

+	vStartQueueSetPollingTask();

+	vCreateBlockTimeTasks();

+

+	vCreateAbortDelayTasks();

+	vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );

+

+	vStartStreamBufferTasks();

+	vStartStreamBufferInterruptDemo();

+

+	#if( configUSE_PREEMPTION != 0  )

 	{

-		/* Create the standard demo tasks. */

-		vStartTaskNotifyTask();

-		vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );

-		vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );

-		vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );

-		vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );

-		vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );

-

-		vStartQueuePeekTasks();

-		vStartMathTasks( mainFLOP_TASK_PRIORITY );

-		vStartRecursiveMutexTasks();

-		vStartCountingSemaphoreTasks();

-		vStartQueueSetTasks();

-

-		vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );

-		vStartEventGroupTasks();

-		vStartInterruptSemaphoreTasks();

-		vStartQueueSetPollingTask();

-		vCreateBlockTimeTasks();

-

-		#if( configUSE_PREEMPTION != 0  )

-		{

-			/* Don't expect these tasks to pass when preemption is not used. */

-			vStartTimerDemoTask( mainTIMER_TEST_PERIOD );

-		}

-		#endif

-

-		vCreateAbortDelayTasks();

-		vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );

-

-		vStartStreamBufferTasks();

-		vStartStreamBufferInterruptDemo();

-

-		/* Create the register check tasks, as described at the top of this	file */

-		xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );

-		xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );

-

-		/* The suicide tasks must be created last as they need to know how many

-		tasks were running prior to their creation.  This then allows them to

-		ascertain whether or not the correct/expected number of tasks are running at

-		any given time. */

-		vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );

+		/* Don't expect these tasks to pass when preemption is not used. */

+		vStartTimerDemoTask( mainTIMER_TEST_PERIOD );

 	}

-	#else /* mainENABLE_INT_QUEUE_TESTS */

-	{

-		/* Start interrupt queue test tasks. */

-		vStartInterruptQueueTasks();

-	}

-	#endif /* mainENABLE_INT_QUEUE_TESTS */

+	#endif

+

+	/* The suicide tasks must be created last as they need to know how many

+	tasks were running prior to their creation.  This then allows them to

+	ascertain whether or not the correct/expected number of tasks are running at

+	any given time. */

+	vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );

 

 	/* Start the scheduler itself. */

 	vTaskStartScheduler();

@@ -202,7 +165,6 @@
 {

 TickType_t xNextWakeTime;

 const TickType_t xCycleFrequency = pdMS_TO_TICKS( 5000UL );

-static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;

 

 	/* Just to remove compiler warning. */

 	( void ) pvParameters;

@@ -215,124 +177,105 @@
 		/* Place this task in the blocked state until it is time to run again. */

 		vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );

 

-		#if( mainENABLE_INT_QUEUE_TESTS == 0 )

+		/* Check the standard demo tasks are running without error. */

+		#if( configUSE_PREEMPTION != 0 )

 		{

-			/* Check the standard demo tasks are running without error. */

-			#if( configUSE_PREEMPTION != 0 )

+			/* These tasks are only created when preemption is used. */

+			if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )

 			{

-				/* These tasks are only created when preemption is used. */

-				if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )

-				{

-					pcStatusMessage = "Error: TimerDemo";

-				}

-			}

-			#endif

-

-			if( xAreTaskNotificationTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error:  Notification";

-			}

-			else if( xAreBlockingQueuesStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: BlockQueue";

-			}

-			else if( xAreSemaphoreTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: SemTest";

-			}

-			else if( xArePollingQueuesStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: PollQueue";

-			}

-			else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: IntMath";

-			}

-			else if( xAreGenericQueueTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: GenQueue";

-			}

-			else if( xAreQueuePeekTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: QueuePeek";

-			}

-			else if( xAreMathsTaskStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Flop";

-			}

-			else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: RecMutex";

-			}

-			else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: CountSem";

-			}

-			else if( xAreQueueSetTasksStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Queue set";

-			}

-			else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Queue overwrite";

-			}

-			else if( xAreEventGroupTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: EventGroup";

-			}

-			else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: IntSem";

-			}

-			else if( xAreQueueSetPollTasksStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Queue set polling";

-			}

-			else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Block time";

-			}

-			else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Abort delay";

-			}

-			else if( xAreMessageBufferTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error:  MessageBuffer";

-			}

-			else if( xAreStreamBufferTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error:  StreamBuffer";

-			}

-			else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS )

-			{

-				pcStatusMessage = "Error: Stream buffer interrupt";

-			}

-			else if( xIsCreateTaskStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: Death";

-			}

-			else if( ulLastRegTest1Value == ulRegTest1Counter )

-			{

-				pcStatusMessage = "Error: Reg Test 1";

-			}

-			else if( ulLastRegTest2Value == ulRegTest2Counter )

-			{

-				pcStatusMessage = "Error: Reg Test 2";

-			}

-

-			/* Update register test counters. */

-			ulLastRegTest1Value = ulRegTest1Counter;

-			ulLastRegTest2Value = ulRegTest2Counter;

-		}

-		#else /* mainENABLE_INT_QUEUE_TESTS */

-		{

-			if( xAreIntQueueTasksStillRunning() != pdTRUE )

-			{

-				pcStatusMessage = "Error: IntQueue";

+				pcStatusMessage = "Error: TimerDemo";

 			}

 		}

-		#endif /* mainENABLE_INT_QUEUE_TESTS */

+		#endif

+

+		if( xAreTaskNotificationTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error:  Notification";

+		}

+		else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: IntMath";

+		}

+		else if( xAreGenericQueueTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: GenQueue";

+		}

+		else if( xAreBlockingQueuesStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: BlockQueue";

+		}

+		else if( xAreSemaphoreTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: SemTest";

+		}

+		else if( xArePollingQueuesStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: PollQueue";

+		}

+		else if( xAreQueuePeekTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: QueuePeek";

+		}

+		else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: RecMutex";

+		}

+		else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: CountSem";

+		}

+		else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Dynamic";

+		}

+		else if( xAreQueueSetTasksStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Queue set";

+		}

+		else if( xAreEventGroupTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: EventGroup";

+		}

+		else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Queue overwrite";

+		}

+		else if( xAreQueueSetPollTasksStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Queue set polling";

+		}

+		else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Block time";

+		}

+		else if( xAreMessageBufferTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error:  MessageBuffer";

+		}

+		else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Abort delay";

+		}

+		else if( xAreStreamBufferTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error:  StreamBuffer";

+		}

+		else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Stream buffer interrupt";

+		}

+		else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: IntSem";

+		}

+		else if( xIsCreateTaskStillRunning() != pdTRUE )

+		{

+			pcStatusMessage = "Error: Death";

+		}

+		else if( xAreMathsTaskStillRunning() != pdPASS )

+		{

+			pcStatusMessage = "Error: Flop";

+		}

 

 		/* This is the only task that uses stdout so its ok to call printf()

 		directly. */

@@ -349,89 +292,39 @@
 {

 TaskHandle_t xTimerTask;

 

-	#if( mainENABLE_INT_QUEUE_TESTS == 0 )

+	/* Call the periodic timer test, which tests the timer API functions that

+	can be called from an ISR. */

+	#if( configUSE_PREEMPTION != 0 )

 	{

-		/* Exercise using task notifications from an interrupt. */

-		xNotifyTaskFromISR();

-

-		/* Write to a queue that is in use as part of the queue set demo to

-		 * demonstrate using queue sets from an ISR. */

-		vQueueSetAccessQueueSetFromISR();

-

-		/* Call the periodic queue overwrite from ISR demo. */

-		vQueueOverwritePeriodicISRDemo();

-

-		/* Exercise event groups from interrupts. */

-		vPeriodicEventGroupsProcessing();

-

-		/* Exercise giving mutexes from an interrupt. */

-		vInterruptSemaphorePeriodicTest();

-

-		/* Queue set access from interrupt. */

-		vQueueSetPollingInterruptAccess();

-

-		/* Call the periodic timer test, which tests the timer API functions that

-		can be called from an ISR. */

-		#if( configUSE_PREEMPTION != 0 )

-		{

-			/* Only created when preemption is used. */

-			vTimerPeriodicISRTests();

-		}

-		#endif

-

-		/* Writes to stream buffer byte by byte to test the stream buffer trigger

-		level functionality. */

-		vPeriodicStreamBufferProcessing();

-

-		/* Writes a string to a string buffer four bytes at a time to demonstrate

-		a stream being sent from an interrupt to a task. */

-		vBasicStreamBufferSendFromISR();

+		/* Only created when preemption is used. */

+		vTimerPeriodicISRTests();

 	}

-	#else /* mainENABLE_INT_QUEUE_TESTS */

-	{

-		/* Access queues from interrupt. Make sure to access after the queues have

-		been created. */

-		if( xTimerForQueueTestInitialized == pdTRUE )

-		{

-			portYIELD_FROM_ISR( xFirstTimerHandler() );

-		}

-	}

-	#endif /* mainENABLE_INT_QUEUE_TESTS */

+	#endif

+

+	/* Call the periodic queue overwrite from ISR demo. */

+	vQueueOverwritePeriodicISRDemo();

+

+	/* Write to a queue that is in use as part of the queue set demo to

+	demonstrate using queue sets from an ISR. */

+	vQueueSetAccessQueueSetFromISR();

+	vQueueSetPollingInterruptAccess();

+

+	/* Exercise event groups from interrupts. */

+	vPeriodicEventGroupsProcessing();

+

+	/* Exercise giving mutexes from an interrupt. */

+	vInterruptSemaphorePeriodicTest();

+

+	/* Exercise using task notifications from an interrupt. */

+	xNotifyTaskFromISR();

+

+	/* Writes to stream buffer byte by byte to test the stream buffer trigger

+	level functionality. */

+	vPeriodicStreamBufferProcessing();

+

+	/* Writes a string to a string buffer four bytes at a time to demonstrate

+	a stream being sent from an interrupt to a task. */

+	vBasicStreamBufferSendFromISR();

 }

 /*-----------------------------------------------------------*/

 

-static void prvRegTest1Task( void *pvParameters )

-{

-	/* Although the regtest task is written in assembly, its entry point is

-	written in C for convenience of checking the task parameter is being passed

-	in correctly. */

-	if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )

-	{

-		/* Start the part of the test that is written in assembly. */

-		vRegTest1();

-	}

-

-	/* The following line will only execute if the task parameter is found to

-	be incorrect.  The check task will detect that the regtest loop counter is

-	not being incremented and flag an error. */

-	vTaskDelete( NULL );

-}

-/*-----------------------------------------------------------*/

-

-static void prvRegTest2Task( void *pvParameters )

-{

-	/* Although the regtest task is written in assembly, its entry point is

-	written in C for convenience of checking the task parameter is being passed

-	in correctly. */

-	if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )

-	{

-		/* Start the part of the test that is written in assembly. */

-		vRegTest2();

-	}

-

-	/* The following line will only execute if the task parameter is found to

-	be incorrect.  The check task will detect that the regtest loop counter is

-	not being incremented and flag an error. */

-	vTaskDelete( NULL );

-}

-/*-----------------------------------------------------------*/

diff --git a/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo b/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo
index b50bd10..138d3b8 100644
--- a/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo
+++ b/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo
Binary files differ
diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h
index 4b40881..20f3739 100644
--- a/FreeRTOS/Source/include/FreeRTOS.h
+++ b/FreeRTOS/Source/include/FreeRTOS.h
@@ -806,6 +806,10 @@
 	#define configUSE_TASK_NOTIFICATIONS 1

 #endif

 

+#ifndef configUSE_POSIX_ERRNO

+	#define configUSE_POSIX_ERRNO 0

+#endif

+

 #ifndef portTICK_TYPE_IS_ATOMIC

 	#define portTICK_TYPE_IS_ATOMIC 0

 #endif

@@ -928,6 +932,10 @@
 	#define pdTASK_CODE TaskFunction_t

 	#define xListItem ListItem_t

 	#define xList List_t

+

+	/* For libraries that break the list data hiding, and access list structure

+	members directly (which is not supposed to be done). */

+	#define pxContainer pvContainer

 #endif /* configENABLE_BACKWARD_COMPATIBILITY */

 

 #if( configUSE_ALTERNATIVE_API != 0 )

@@ -1033,7 +1041,9 @@
 	#if( INCLUDE_xTaskAbortDelay == 1 )

 		uint8_t ucDummy21;

 	#endif

-

+	#if ( configUSE_POSIX_ERRNO == 1 )

+		int				iDummy22;

+	#endif

 } StaticTask_t;

 

 /*

diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h
index 31994d2..2f85d50 100644
--- a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h
+++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h
@@ -78,6 +78,12 @@
 #define portBYTE_ALIGNMENT			8

 /*-----------------------------------------------------------*/

 

+/* Compiler directives. */

+#define portWEAK_SYMBOL				__attribute__( ( weak ) )

+

+/*-----------------------------------------------------------*/

+

+

 /* Scheduler utilities. */

 #define portYIELD()											\

 {															\

diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c
index ceb863c..65c0f7b 100644
--- a/FreeRTOS/Source/tasks.c
+++ b/FreeRTOS/Source/tasks.c
@@ -336,6 +336,10 @@
 		uint8_t ucDelayAborted;

 	#endif

 

+	#if( configUSE_POSIX_ERRNO == 1 )

+		int iTaskErrno;

+	#endif

+

 } tskTCB;

 

 /* The old tskTCB name is maintained above then typedefed to the new TCB_t name

@@ -365,6 +369,12 @@
 

 #endif

 

+/* Global POSIX errno. Its value is changed upon context switching to match

+the errno of the currently running task. */

+#if ( configUSE_POSIX_ERRNO == 1 )

+	int FreeRTOS_errno = 0;

+#endif

+

 /* Other file private variables. --------------------------------*/

 PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks 	= ( UBaseType_t ) 0U;

 PRIVILEGED_DATA static volatile TickType_t xTickCount 				= ( TickType_t ) configINITIAL_TICK_COUNT;

@@ -2919,11 +2929,25 @@
 		/* Check for stack overflow, if configured. */

 		taskCHECK_FOR_STACK_OVERFLOW();

 

+		/* Before the currently running task is switched out, save its errno. */

+		#if( configUSE_POSIX_ERRNO == 1 )

+		{

+			pxCurrentTCB->iTaskErrno = FreeRTOS_errno;

+		}

+		#endif

+

 		/* Select a new task to run using either the generic C or port

 		optimised asm code. */

 		taskSELECT_HIGHEST_PRIORITY_TASK(); /*lint !e9079 void * is used as this macro is used with timers and co-routines too.  Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */

 		traceTASK_SWITCHED_IN();

 

+		/* After the new task is switched in, update the global errno. */

+		#if( configUSE_POSIX_ERRNO == 1 )

+		{

+			FreeRTOS_errno = pxCurrentTCB->iTaskErrno;

+		}

+		#endif

+

 		#if ( configUSE_NEWLIB_REENTRANT == 1 )

 		{

 			/* Switch Newlib's _impure_ptr variable to point to the _reent