Update libraries and sundry check-ins ready for the V10.3.0 kernel release.
diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/https/common/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/https/common/main.c
index dd485a6..a1b0fa5 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/https/common/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/https/common/main.c
@@ -305,6 +305,19 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack.

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

+

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

+

 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an

 implementation of vApplicationGetIdleTaskMemory() to provide the memory that is

 used by the Idle task. */

diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/jobs/jobs_notify_next/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/jobs/jobs_notify_next/main.c
index e07f2c2..f06d37c 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/jobs/jobs_notify_next/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/jobs/jobs_notify_next/main.c
@@ -305,6 +305,18 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack.

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

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

+

 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an

 implementation of vApplicationGetIdleTaskMemory() to provide the memory that is

 used by the Idle task. */

diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/mqtt/common/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/mqtt/common/main.c
index 3c531b6..0c11b0c 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/mqtt/common/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/mqtt/common/main.c
@@ -314,6 +314,18 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack.

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

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

+

 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an

 implementation of vApplicationGetIdleTaskMemory() to provide the memory that is

 used by the Idle task. */

diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/shadow/shadow_device_operations/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/shadow/shadow_device_operations/main.c
index 6b71b1a..357a2c2 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/shadow/shadow_device_operations/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/shadow/shadow_device_operations/main.c
@@ -306,6 +306,18 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack.

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

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

+

 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an

 implementation of vApplicationGetIdleTaskMemory() to provide the memory that is

 used by the Idle task. */

diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/utilities/task_pool/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/utilities/task_pool/main.c
index f7bc12d..22f9590 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/utilities/task_pool/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_IoT_Libraries/utilities/task_pool/main.c
@@ -146,6 +146,23 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack.

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	/* This example is the first in a sequence that adds IoT functionality into

+	an existing TCP / IP project.In this first project the TCP / IP stack is not

+	actually used, but it is still built, which requires this function to be

+	present.For now this function does not need to do anything. */

+	__debugbreak();

+	*(pulNumber) = 0;

+	return pdFALSE;

+}

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

+

 UBaseType_t uxRand( void )

 {

 	/* This example is the first in a sequence that adds IoT functionality into

diff --git a/FreeRTOS-Labs/Demo/FreeRTOS_Plus_TCP_and_FAT_Windows_Simulator/main.c b/FreeRTOS-Labs/Demo/FreeRTOS_Plus_TCP_and_FAT_Windows_Simulator/main.c
index a94a1cd..6474697 100644
--- a/FreeRTOS-Labs/Demo/FreeRTOS_Plus_TCP_and_FAT_Windows_Simulator/main.c
+++ b/FreeRTOS-Labs/Demo/FreeRTOS_Plus_TCP_and_FAT_Windows_Simulator/main.c
@@ -814,6 +814,19 @@
 }

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

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack. 

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER 

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

+

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

+

 #if( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME != 0 )

 

 	const char *pcApplicationHostnameHook( void )

diff --git a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c
index a977015..0e0a759 100644
--- a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c
+++ b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c
@@ -1,5 +1,5 @@
 /*

- * FreeRTOS+CLI V1.0.4

+ * FreeRTOS+CLI V1.0.x Labs copy

  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.

  *

  * Permission is hereby granted, free of charge, to any person obtaining a copy of

diff --git a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.h b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.h
index 12fdd70..25c2392 100644
--- a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.h
+++ b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.h
@@ -1,5 +1,5 @@
 /*

- * FreeRTOS+CLI V1.0.4

+ * FreeRTOS+CLI V1.0.x Labs copy

  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.

  *

  * Permission is hereby granted, free of charge, to any person obtaining a copy of

diff --git a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/History.txt b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/History.txt
index 8c62cf9..95a6130 100644
--- a/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/History.txt
+++ b/FreeRTOS-Labs/Source/FreeRTOS-Plus-CLI/History.txt
@@ -1,4 +1,4 @@
-Changes between V1.0.3 and V1.0.4 released

+Changes between V1.0.3 and TBD

 

 	+ Update to use stdint and the FreeRTOS specific typedefs that were

 	  introduced in FreeRTOS V8.0.0.

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/DemoTasks/SimpleMQTTExamples.c b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/DemoTasks/SimpleMQTTExamples.c
index 3ad5e66..80a0416 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/DemoTasks/SimpleMQTTExamples.c
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/DemoTasks/SimpleMQTTExamples.c
@@ -48,13 +48,15 @@
 /**

  * @brief The timeout for MQTT operations in this example.

  */

-#define mqttexampleMQTT_TIMEOUT_MS			( 5000 )

+#define mqttexampleMQTT_TIMEOUT_MS			( 50000 )

 

 /**

  * @brief The MQTT client identifier used in this example.

  */

 #define mqttexampleCLIENT_IDENTIFIER		"mqttexampleclient"

 

+const char *pcClientIdentifiers[] = { "AAA" };//, "BBB", "CCC", "DDD", "EEE", "FFF", "GGG", "HHH", "III", "JJJ" };

+

 /**

  * @brief Details of the MQTT broker to connect to.

  *

@@ -98,11 +100,6 @@
 /*-----------------------------------------------------------*/

 

 /**

- * @brief The MQTT connection handle used in this example.

- */

-static IotMqttConnection_t xMQTTConnection = IOT_MQTT_CONNECTION_INITIALIZER;

-

-/**

  * @brief Parameters used to create the system task pool.

  */

 static const IotTaskPoolInfo_t xTaskPoolParameters = {

@@ -167,28 +164,28 @@
  *

  * @note This example does not use TLS and therefore will not work with MQTT.

  */

-static void prvMQTTConnect( void );

+static void prvMQTTConnect( IotMqttConnection_t *xMQTTConnection, const char *pcClientID );

 

 /**

- * @brief Subscribes to the topic as specified in mqttexampleTOPIC.

+ * @brief Subscribes to pcTopicString.

  */

-static void prvMQTTSubscribe( void );

+static void prvMQTTSubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );

 

 /**

  * @brief Publishes a messages mqttexampleMESSAGE on mqttexampleTOPIC topic.

  */

-static void prvMQTTPublish( void );

+static void prvMQTTPublish( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );

 

 /**

  * @brief Unsubscribes from the mqttexampleTOPIC topic.

  */

-static void prvMQTTUnsubscribe( void );

+static void prvMQTTUnsubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );

 

 /**

  * @brief Disconnects from the MQTT broker gracefully by sending an MQTT

  * DISCONNECT message.

  */

-static void prvMQTTDisconnect( void );

+static void prvMQTTDisconnect( IotMqttConnection_t xMQTTConnection );

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

 

 static void prvExample_OnDisconnect( void * pvCallbackContext,

@@ -213,10 +210,10 @@
 TaskHandle_t xDemoTaskHandle = ( TaskHandle_t ) pvCallbackContext;

 

 	/* Ensure that the message is received on the expected topic. */

-	configASSERT( pxCallbackParams->u.message.info.topicNameLength == strlen( mqttexampleTOPIC ) );

-	configASSERT( strncmp( pxCallbackParams->u.message.info.pTopicName,

-						   mqttexampleTOPIC,

-						   strlen( mqttexampleTOPIC ) ) == 0 );

+//	configASSERT( pxCallbackParams->u.message.info.topicNameLength == strlen( mqttexampleTOPIC ) );

+//	configASSERT( strncmp( pxCallbackParams->u.message.info.pTopicName,

+//						   mqttexampleTOPIC,

+//						   strlen( mqttexampleTOPIC ) ) == 0 );

 

 	/* Ensure that the expected message is received. */

 	configASSERT( pxCallbackParams->u.message.info.payloadLength == strlen( mqttexampleMESSAGE ) );

@@ -243,24 +240,34 @@
 

 void vStartSimpleMQTTDemo( void )

 {

+uint32_t x;

+const uint32_t ulMax_x = sizeof( pcClientIdentifiers ) / sizeof( char * );

+

 	/* This example uses a single application task, which in turn is used to

 	 * connect, subscribe, publish, unsubscribe and disconnect from the MQTT

 	 * broker. */

+for( x = 0; x < ulMax_x; x++ )

+{

 	xTaskCreate( prvMQTTDemoTask,			/* Function that implements the task. */

 				 "MQTTDemo",				/* Text name for the task - only used for debugging. */

 				 configMINIMAL_STACK_SIZE,	/* Size of stack (in words, not bytes) to allocate for the task. */

-				 NULL,						/* Task parameter - not used in this case. */

+				 ( void * ) x,						/* Task parameter - not used in this case. */

 				 tskIDLE_PRIORITY,			/* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */

 				 NULL );					/* Used to pass out a handle to the created task - not used in this case. */

 }

+}

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

 

 static void prvMQTTDemoTask( void *pvParameters )

 {

 IotMqttError_t xResult;

 uint32_t ulNotificationValue = 0, ulPublishCount;

-const uint32_t ulMaxPublishCount = 5UL;

-const TickType_t xNoDelay = ( TickType_t ) 0;

+uint32_t ulMaxPublishCount = 0UL;

+const TickType_t xNoDelay = ( TickType_t ) 1;

+IotMqttConnection_t xMQTTConnection = IOT_MQTT_CONNECTION_INITIALIZER;

+uint32_t ulTaskNumber = ( uint32_t ) pvParameters, x;

+char cTopicString[ sizeof( mqttexampleTOPIC ) + 5 ];//_RB_ Access by other tasks so must be persistant and will cause memory faults on memory protected systems.

+#pragma message ("Access by other tasks so must be persistant and will cause memory faults on memory protected systems.")

 

 	/* Remove compiler warnings about unused parameters. */

 	( void ) pvParameters;

@@ -274,10 +281,15 @@
 	xResult = IotMqtt_Init();

 	configASSERT( xResult == IOT_MQTT_SUCCESS );

 

+	/* Create a topic string that is unique to the MQTT connection created by

+	this task. */

+	snprintf( cTopicString, sizeof( cTopicString ), "%s/%s", mqttexampleTOPIC, pcClientIdentifiers[ ulTaskNumber ] );

+

 	for( ; ; )

 	{

 		/* Don't expect any notifications to be pending yet. */

-		configASSERT( ulTaskNotifyTake( pdTRUE, xNoDelay ) == 0 );

+		ulNotificationValue = ulTaskNotifyTake( pdTRUE, xNoDelay );

+		configASSERT( ulNotificationValue == 0 );

 

 

 		/****************************** Connect. ******************************/

@@ -287,7 +299,7 @@
 		 * mqttexampleMQTT_BROKER_PORT at the top of this file. Please change

 		 * it to the MQTT broker you want to connect to. Note that this example

 		 * does not use TLS and therefore will not work with AWS IoT. */

-		prvMQTTConnect();

+		prvMQTTConnect( &xMQTTConnection, pcClientIdentifiers[ ulTaskNumber ] );

 		configPRINTF( ( "Connected to %s\r\n", mqttexampleMQTT_BROKER_ENDPOINT ) );

 

 

@@ -298,19 +310,28 @@
 		 * client will then publish to the same topic it subscribed to, so will

 		 * expect all the messages it sends to the broker to be sent back to it

 		 * from the broker. */

-		prvMQTTSubscribe();

-		configPRINTF( ( "Subscribed to the topic %s\r\n", mqttexampleTOPIC ) );

+		prvMQTTSubscribe( xMQTTConnection, cTopicString );

+		configPRINTF( ( "Subscribed to the topic %s\r\n", cTopicString ) );

 

 

 		/*********************** Publish 5 messages. **************************/

 

 		/* Publish a few messages while connected. */

+		for( x = 0; x < ( ulTaskNumber + 1UL ); x++ )

+		{

+			ulMaxPublishCount = uxRand();

+		}

+

+		/* Cap ulMaxPublishCount but ensure it is not zero. */

+		ulMaxPublishCount %= 10UL;

+		ulMaxPublishCount++;

+

 		for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ )

 		{

 			/* Publish a message on the mqttexampleTOPIC topic as specified at

 			 * the top of this file. */

-			prvMQTTPublish();

-			configPRINTF( ( "Published %s on the topic %s\r\n", mqttexampleMESSAGE, mqttexampleTOPIC ) );

+			prvMQTTPublish( xMQTTConnection, cTopicString );

+			configPRINTF( ( "Published %s on the topic %s\r\n", mqttexampleMESSAGE, cTopicString ) );

 

 			/* Since we are subscribed to the same topic as we published on, we

 			 * will get the same message back from the MQTT broker. Wait for the

@@ -331,8 +352,8 @@
 

 		/* Unsubscribe from the topic mqttexampleTOPIC and disconnect

 		 * gracefully. */

-		prvMQTTUnsubscribe();

-		prvMQTTDisconnect();

+		prvMQTTUnsubscribe( xMQTTConnection, cTopicString );

+		prvMQTTDisconnect( xMQTTConnection );

 		configPRINTF( ( "Disconnected from %s\r\n\r\n", mqttexampleMQTT_BROKER_ENDPOINT ) );

 

 		/* Wait for the disconnect operation to complete which is informed to us

@@ -349,18 +370,19 @@
 		/* Wait for some time between two iterations to ensure that we do not

 		 * bombard the public test mosquitto broker. */

 		configPRINTF( ( "prvMQTTDemoTask() completed an iteration without hitting an assert. Total free heap is %u\r\n\r\n", xPortGetFreeHeapSize() ) );

-		vTaskDelay( pdMS_TO_TICKS( 5000 ) );

+//		vTaskDelay( pdMS_TO_TICKS( 5000 ) );

 	}

 }

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

 

-static void prvMQTTConnect( void )

+static void prvMQTTConnect( IotMqttConnection_t *xMQTTConnection, const char *pcClientID )

 {

 IotMqttError_t xResult;

 IotNetworkServerInfo_t xMQTTBrokerInfo;

 IotMqttNetworkInfo_t xNetworkInfo = IOT_MQTT_NETWORK_INFO_INITIALIZER;

 IotMqttConnectInfo_t xConnectInfo = IOT_MQTT_CONNECT_INFO_INITIALIZER;

-

+static char c[ 10 ];

+static int id = 0;

 

 	/******************* Broker information setup. **********************/

 

@@ -417,8 +439,8 @@
 	/* The client identifier is used to uniquely identify this MQTT client to

 	 * the MQTT broker.  In a production device the identifier can be something

 	 * unique, such as a device serial number. */

-	xConnectInfo.pClientIdentifier = mqttexampleCLIENT_IDENTIFIER;

-	xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( mqttexampleCLIENT_IDENTIFIER );

+	xConnectInfo.pClientIdentifier = pcClientID;

+	xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( pcClientID );

 

 	/* This example does not use any authentication and therefore username and

 	 * password fields are not used. */

@@ -432,12 +454,12 @@
 	xResult = IotMqtt_Connect( &( xNetworkInfo ),

 							   &( xConnectInfo ),

 							   mqttexampleMQTT_TIMEOUT_MS,

-							   &( xMQTTConnection ) );

+							   xMQTTConnection );

 	configASSERT( xResult == IOT_MQTT_SUCCESS );

 }

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

 

-static void prvMQTTSubscribe( void )

+static void prvMQTTSubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )

 {

 IotMqttError_t xResult;

 IotMqttSubscription_t xMQTTSubscription;

@@ -446,8 +468,8 @@
 	 * as the callback context which is used by the callback to send a task

 	 * notification to this task.*/

 	xMQTTSubscription.qos = IOT_MQTT_QOS_1;

-	xMQTTSubscription.pTopicFilter = mqttexampleTOPIC;

-	xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC );

+	xMQTTSubscription.pTopicFilter = pcTopicString;

+	xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( pcTopicString );

 	xMQTTSubscription.callback.pCallbackContext = ( void * ) xTaskGetCurrentTaskHandle();

 	xMQTTSubscription.callback.function = prvExample_OnMessageReceived;

 

@@ -462,7 +484,7 @@
 }

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

 

-static void prvMQTTPublish( void )

+static void prvMQTTPublish( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )

 {

 IotMqttError_t xResult;

 IotMqttPublishInfo_t xMQTTPublishInfo;

@@ -472,8 +494,8 @@
 	 * back to us. It is verified in the publish callback. */

 	xMQTTPublishInfo.qos = IOT_MQTT_QOS_1;

 	xMQTTPublishInfo.retain = false;

-	xMQTTPublishInfo.pTopicName = mqttexampleTOPIC;

-	xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( mqttexampleTOPIC );

+	xMQTTPublishInfo.pTopicName = pcTopicString;

+	xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( pcTopicString );

 	xMQTTPublishInfo.pPayload = mqttexampleMESSAGE;

 	xMQTTPublishInfo.payloadLength = strlen( mqttexampleMESSAGE );

 	xMQTTPublishInfo.retryMs = mqttexamplePUBLISH_RETRY_MS;

@@ -489,14 +511,14 @@
 }

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

 

-static void prvMQTTUnsubscribe( void )

+static void prvMQTTUnsubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )

 {

 IotMqttError_t xResult;

 IotMqttSubscription_t xMQTTSubscription;

 

 	/* Unsubscribe from the mqttexampleTOPIC topic filter. */

-	xMQTTSubscription.pTopicFilter = mqttexampleTOPIC;

-	xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC );

+	xMQTTSubscription.pTopicFilter = pcTopicString;

+	xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( pcTopicString );

 	/* The following members of the IotMqttSubscription_t are ignored by the

 	 * unsubscribe operation. Just initialize them to avoid "use of uninitialized

 	 * variable" warnings. */

@@ -515,7 +537,7 @@
 }

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

 

-static void prvMQTTDisconnect( void )

+static void prvMQTTDisconnect( IotMqttConnection_t xMQTTConnection )

 {

 	/* Send a MQTT DISCONNECT packet to the MQTT broker to do a graceful

 	 * disconnect. */

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSConfig.h
index 966ac70..29b4aac 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSConfig.h
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSConfig.h
@@ -136,14 +136,14 @@
 results in the wired network being used, while setting

 configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being

 used. */

-#define configNETWORK_INTERFACE_TO_USE 3L

+#define configNETWORK_INTERFACE_TO_USE 2L

 

 /* The address of an echo server is only left in this project as it doubles as

 the address to which logging is sent should UDP logging be enabled. */

 #define configECHO_SERVER_ADDR0	192

 #define configECHO_SERVER_ADDR1 168

-#define configECHO_SERVER_ADDR2 0

-#define configECHO_SERVER_ADDR3 11

+#define configECHO_SERVER_ADDR2 26

+#define configECHO_SERVER_ADDR3 100

 

 /* Default MAC address configuration.  The demo creates a virtual network

 connection that uses this MAC address by accessing the raw Ethernet/WiFi data

@@ -159,31 +159,31 @@
 

 /* Default IP address configuration.  Used in ipconfigUSE_DNS is set to 0, or

 ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */

-#define configIP_ADDR0		10

-#define configIP_ADDR1		10

-#define configIP_ADDR2		10

-#define configIP_ADDR3		200

+#define configIP_ADDR0		192

+#define configIP_ADDR1		168

+#define configIP_ADDR2		1

+#define configIP_ADDR3		51

 

 /* Default gateway IP address configuration.  Used in ipconfigUSE_DNS is set to

 0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */

-#define configGATEWAY_ADDR0	10

-#define configGATEWAY_ADDR1	10

-#define configGATEWAY_ADDR2	10

+#define configGATEWAY_ADDR0	192

+#define configGATEWAY_ADDR1	168

+#define configGATEWAY_ADDR2	1

 #define configGATEWAY_ADDR3	1

 

 /* Default DNS server configuration.  OpenDNS addresses are 208.67.222.222 and

 208.67.220.220.  Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set

 to 1 but a DNS server cannot be contacted.*/

-#define configDNS_SERVER_ADDR0 	208

-#define configDNS_SERVER_ADDR1 	67

-#define configDNS_SERVER_ADDR2 	222

-#define configDNS_SERVER_ADDR3 	222

+#define configDNS_SERVER_ADDR0 	8

+#define configDNS_SERVER_ADDR1 	8

+#define configDNS_SERVER_ADDR2 	8

+#define configDNS_SERVER_ADDR3 	8

 

 /* Default netmask configuration.  Used in ipconfigUSE_DNS is set to 0, or

 ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */

 #define configNET_MASK0		255

-#define configNET_MASK1		0

-#define configNET_MASK2		0

+#define configNET_MASK1		255

+#define configNET_MASK2		255

 #define configNET_MASK3		0

 

 /* The UDP port to which print messages are sent. */

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSIPConfig.h b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSIPConfig.h
index 4729ef1..563f0cb 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSIPConfig.h
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/FreeRTOSIPConfig.h
@@ -146,7 +146,7 @@
 set to 1 if a valid configuration cannot be obtained from a DHCP server for any

 reason.  The static configuration used is that passed into the stack by the

 FreeRTOS_IPInit() function call. */

-#define ipconfigUSE_DHCP	1

+#define ipconfigUSE_DHCP	0

 

 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at

 increasing time intervals until either a reply is received from a DHCP server

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/main.c
index bedfd3e..f2f8eb5 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/main.c
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/main.c
@@ -353,3 +353,12 @@
 	*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;

 }

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

+

+

+

+

+

+

+

+

+

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj
index 29a2fba..f3f2192 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/WIN32.vcxproj
@@ -19,13 +19,11 @@
     <ConfigurationType>Application</ConfigurationType>

     <UseOfMfc>false</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>Application</ConfigurationType>

     <UseOfMfc>false</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c
index beae122..fae30bd 100644
--- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c
+++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Minimal_Windows_Simulator/main.c
@@ -371,3 +371,14 @@
 	return uxRand();

 }

 

+/*

+ * Supply a random number to FreeRTOS+TCP stack. 

+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER 

+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.

+ */

+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)

+{

+	*(pulNumber) = uxRand();

+	return pdTRUE;

+}

+

diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
index 22950ff..7903326 100644
--- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
+++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
@@ -86,6 +86,7 @@
 #include "xscutimer.h"

 #include "xscugic.h"

 #include "xil_exception.h"

+#include "xuartps_hw.h"

 

 /* mainSELECTED_APPLICATION is used to select between three demo applications,

  * as described at the top of this file.

@@ -208,6 +209,12 @@
 	FreeRTOS_asm_vectors.S, which is part of this project.  Switch to use the

 	FreeRTOS vector table. */

 	vPortInstallFreeRTOSVectorTable();

+

+	/* Initialise UART for use with QEMU. */

+	XUartPs_ResetHw( 0xE0000000 );

+	XUartPs_WriteReg(0xE0000000, XUARTPS_CR_OFFSET,

+				((u32)XUARTPS_CR_RX_DIS | (u32)XUARTPS_CR_TX_EN |

+						(u32)XUARTPS_CR_STOPBRK));

 }

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

 

diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvoptx b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvoptx
index 189102f..5d7cd2f 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvoptx
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvoptx
@@ -73,7 +73,7 @@
         <LExpSel>0</LExpSel>
       </OPTXL>
       <OPTFL>
-        <tvExp>0</tvExp>
+        <tvExp>1</tvExp>
         <tvExpOptDlg>0</tvExpOptDlg>
         <IsCurrentTarget>1</IsCurrentTarget>
       </OPTFL>
@@ -103,7 +103,7 @@
         <bEvRecOn>1</bEvRecOn>
         <bSchkAxf>0</bSchkAxf>
         <bTchkAxf>0</bTchkAxf>
-        <nTsel>15</nTsel>
+        <nTsel>16</nTsel>
         <sDll></sDll>
         <sDllPa></sDllPa>
         <sDlgDll></sDlgDll>
@@ -120,7 +120,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGTARM</Key>
-          <Name>(6010=70,43,547,639,0)(6018=1091,145,1280,478,0)(6019=1091,137,1280,457,0)(6008=-1,-1,-1,-1,0)(6009=-1,-1,-1,-1,0)(6014=1022,0,1280,731,0)(6015=777,40,1035,662,1)(6003=207,84,780,620,1)(6000=-1,-1,-1,-1,0)</Name>
+          <Name>(6010=70,43,547,639,0)(6018=1091,145,1280,478,0)(6019=1091,137,1280,457,0)(6008=-1,-1,-1,-1,0)(6009=-1,-1,-1,-1,0)(6014=1022,0,1280,731,0)(6015=2837,586,3095,1208,1)(6003=2678,41,3260,577,1)(6000=-1,-1,-1,-1,0)</Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -143,7 +143,40 @@
           <Name>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
         </SetRegEntry>
       </TargetDriverDllRegistry>
-      <Breakpoint/>
+      <Breakpoint>
+        <Bp>
+          <Number>0</Number>
+          <Type>0</Type>
+          <LineNumber>105</LineNumber>
+          <EnabledFlag>1</EnabledFlag>
+          <Address>2116472</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>1</BreakIfRCount>
+          <Filename>&lt;2&gt;.\main_ns.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression>\\FreeRTOSDemo_ns\main_ns.c\105</Expression>
+        </Bp>
+        <Bp>
+          <Number>1</Number>
+          <Type>0</Type>
+          <LineNumber>67</LineNumber>
+          <EnabledFlag>1</EnabledFlag>
+          <Address>2044</Address>
+          <ByteObject>0</ByteObject>
+          <HtxType>0</HtxType>
+          <ManyObjects>0</ManyObjects>
+          <SizeOfObject>0</SizeOfObject>
+          <BreakByAccess>0</BreakByAccess>
+          <BreakIfRCount>1</BreakIfRCount>
+          <Filename>&lt;1&gt;.\main_s.c</Filename>
+          <ExecCommand></ExecCommand>
+          <Expression>\\FreeRTOSDemo_s\main_s.c\67</Expression>
+        </Bp>
+      </Breakpoint>
       <Tracepoint>
         <THDelay>0</THDelay>
       </Tracepoint>
@@ -439,7 +472,7 @@
 
   <Group>
     <GroupName>User</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvprojx b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvprojx
index 5c98a40..4edbd14 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvprojx
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/FreeRTOSDemo_ns.uvprojx
@@ -10,13 +10,13 @@
       <TargetName>FVP Simulation Model</TargetName>
       <ToolsetNumber>0x4</ToolsetNumber>
       <ToolsetName>ARM-ADS</ToolsetName>
-      <pCCUsed>6070000::V6.7::.\ARMCLANG</pCCUsed>
+      <pCCUsed>6130001::V6.13.1::.\ARMCLANG</pCCUsed>
       <uAC6>1</uAC6>
       <TargetOption>
         <TargetCommonOption>
           <Device>ARMCM33_DSP_FP_TZ</Device>
           <Vendor>ARM</Vendor>
-          <PackID>ARM.CMSIS.5.5.1</PackID>
+          <PackID>ARM.CMSIS.5.6.0</PackID>
           <PackURL>http://www.keil.com/pack/</PackURL>
           <Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ESEL ELITTLE</Cpu>
           <FlashUtilSpec></FlashUtilSpec>
@@ -133,7 +133,7 @@
             <UseExternalTool>0</UseExternalTool>
             <RunIndependent>0</RunIndependent>
             <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
-            <Capability>1</Capability>
+            <Capability>0</Capability>
             <DriverSelection>4099</DriverSelection>
           </Flash1>
           <bUseTDR>1</bUseTDR>
@@ -540,24 +540,24 @@
       </file>
       <file attr="config" category="header" condition="ARMv8-M TZ Device" name="Device\ARM\ARMCM33\Include\Template\partition_ARMCM33.h" version="1.1.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\partition_ARMCM33.h</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
       </file>
       <file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM33\Source\ARM\startup_ARMCM33.s" version="1.0.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\startup_ARMCM33.s</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
       </file>
       <file attr="config" category="sourceC" name="Device\ARM\ARMCM33\Source\system_ARMCM33.c" version="1.0.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\system_ARMCM33.c</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvoptx b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvoptx
index 5d15b91..ac87fd0 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvoptx
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvoptx
@@ -103,7 +103,7 @@
         <bEvRecOn>1</bEvRecOn>
         <bSchkAxf>0</bSchkAxf>
         <bTchkAxf>0</bTchkAxf>
-        <nTsel>15</nTsel>
+        <nTsel>16</nTsel>
         <sDll></sDll>
         <sDllPa></sDllPa>
         <sDlgDll></sDlgDll>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvprojx b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvprojx
index 0ad1de3..220ee39 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvprojx
+++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/FreeRTOSDemo_s.uvprojx
@@ -10,13 +10,13 @@
       <TargetName>FVP Simulation Model</TargetName>
       <ToolsetNumber>0x4</ToolsetNumber>
       <ToolsetName>ARM-ADS</ToolsetName>
-      <pCCUsed>6070000::V6.7::.\ARMCLANG</pCCUsed>
+      <pCCUsed>6130001::V6.13.1::.\ARMCLANG</pCCUsed>
       <uAC6>1</uAC6>
       <TargetOption>
         <TargetCommonOption>
           <Device>ARMCM33_DSP_FP_TZ</Device>
           <Vendor>ARM</Vendor>
-          <PackID>ARM.CMSIS.5.5.1</PackID>
+          <PackID>ARM.CMSIS.5.6.0</PackID>
           <PackURL>http://www.keil.com/pack/</PackURL>
           <Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP TZ CLOCK(12000000) ESEL ELITTLE</Cpu>
           <FlashUtilSpec></FlashUtilSpec>
@@ -488,24 +488,24 @@
     <files>
       <file attr="config" category="header" condition="ARMv8-M TZ Device" name="Device\ARM\ARMCM33\Include\Template\partition_ARMCM33.h" version="1.1.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\partition_ARMCM33.h</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
       </file>
       <file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM33\Source\ARM\startup_ARMCM33.s" version="1.0.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\startup_ARMCM33.s</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
       </file>
       <file attr="config" category="sourceC" name="Device\ARM\ARMCM33\Source\system_ARMCM33.c" version="1.0.0">
         <instance index="0">RTE\Device\ARMCM33_DSP_FP_TZ\system_ARMCM33.c</instance>
-        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM33 CMSIS"/>
-        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
+        <component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.2.0" condition="ARMCM33 CMSIS"/>
+        <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.6.0"/>
         <targetInfos>
           <targetInfo name="FVP Simulation Model"/>
         </targetInfos>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx
index e07fcd2..f711f26 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx
+++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx
@@ -101,6 +101,8 @@
         <sRunDeb>0</sRunDeb>
         <sLrtime>0</sLrtime>
         <bEvRecOn>1</bEvRecOn>
+        <bSchkAxf>0</bSchkAxf>
+        <bTchkAxf>0</bTchkAxf>
         <nTsel>0</nTsel>
         <sDll></sDll>
         <sDllPa></sDllPa>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx
index fcdc1f4..015238d 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx
+++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx
@@ -16,7 +16,7 @@
         <TargetCommonOption>
           <Device>ARMCM4_FP</Device>
           <Vendor>ARM</Vendor>
-          <PackID>ARM.CMSIS.5.5.1</PackID>
+          <PackID>ARM.CMSIS.5.6.0</PackID>
           <PackURL>http://www.keil.com/pack/</PackURL>
           <Cpu>IROM(0x00000000,0x80000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ESEL ELITTLE</Cpu>
           <FlashUtilSpec></FlashUtilSpec>
@@ -184,6 +184,7 @@
             <hadXRAM>0</hadXRAM>
             <uocXRam>0</uocXRam>
             <RvdsVP>2</RvdsVP>
+            <RvdsMve>0</RvdsMve>
             <hadIRAM2>0</hadIRAM2>
             <hadIROM2>0</hadIROM2>
             <StupSel>8</StupSel>
@@ -324,6 +325,7 @@
             <uThumb>0</uThumb>
             <uSurpInc>0</uSurpInc>
             <uC99>0</uC99>
+            <uGnu>0</uGnu>
             <useXO>0</useXO>
             <v6Lang>0</v6Lang>
             <v6LangP>0</v6LangP>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c
index 185ac7b..9a13d6f 100644
--- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c
+++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c
@@ -778,7 +778,7 @@
 	configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 );

 	/* Run time stats are not being gathered - this is just to exercise

 	API. */

-	configASSERT( xTaskGetIdleRunTimeCounter() == 0 ); 

+	configASSERT( ulTaskGetIdleRunTimeCounter() == 0 ); 

 	vTaskSuspend( NULL );

 }

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

diff --git a/FreeRTOS/Demo/Common/Minimal/AbortDelay.c b/FreeRTOS/Demo/Common/Minimal/AbortDelay.c
index 9fc8cfe..65d0104 100644
--- a/FreeRTOS/Demo/Common/Minimal/AbortDelay.c
+++ b/FreeRTOS/Demo/Common/Minimal/AbortDelay.c
@@ -149,10 +149,6 @@
 TickType_t xTimeAtStart;

 const TickType_t xStartMargin = 2UL;

 

-/* Used to control whether to use xTaskAbortDelay() or xTaskAbortDelayFromISR() so

-both are used with all the tests. */

-BaseType_t xUseFromISRVersion = pdFALSE, xHigherPriorityTaskWoken;

-

 	/* Just to remove compiler warnings. */

 	( void ) pvParameters;

 

@@ -177,46 +173,10 @@
 		raise the priority of the controlling task to that of the blocking

 		task to minimise discrepancies. */

 		vTaskPrioritySet( NULL, abtBLOCKING_PRIORITY );

-

 		vTaskDelay( xMaxBlockTime + xHalfMaxBlockTime + xStartMargin );

-

-		/* For test coverage sometimes xTaskAbortDelay() is used and sometimes

-		xTaskAbortDelayFromISR() is used. */

-		if( xUseFromISRVersion == pdFALSE )

+		if( xTaskAbortDelay( xBlockingTask ) != pdPASS )

 		{

-			if( xTaskAbortDelay( xBlockingTask ) != pdPASS )

-			{

-				xErrorOccurred = pdTRUE;

-			}

-		}

-		else

-		{

-			xHigherPriorityTaskWoken = pdFALSE;

-

-			/* For test coverage, sometimes xHigherPriorityTaskWoken is used, and

-			sometimes NULL is used. */

-

-			if( ( xControllingCycles % 2 ) == 0 )

-			{

-				if( xTaskAbortDelayFromISR( xBlockingTask, &xHigherPriorityTaskWoken ) != pdPASS )

-				{

-					xErrorOccurred = pdTRUE;

-				}

-			}

-			else

-			{

-				if( xTaskAbortDelayFromISR( xBlockingTask, NULL ) != pdPASS )

-				{

-					xErrorOccurred = pdTRUE;

-				}

-			}

-

-			/* The tasks have the same priority so xHigherPriorityTaskWoken should

-			never get set. */

-			if( xHigherPriorityTaskWoken != pdFALSE )

-			{

-				xErrorOccurred = pdTRUE;

-			}

+			xErrorOccurred = pdTRUE;

 		}

 

 		/* Reset the priority to the normal controlling priority. */

@@ -241,13 +201,6 @@
 

 		/* To indicate this task is still executing. */

 		xControllingCycles++;

-

-		if( ( xControllingCycles % abtMAX_TESTS ) == 0 )

-		{

-			/* Looped through all the tests.  Switch between using xTaskAbortDelay()

-			and xTaskAbortDelayFromISR() for the next round of tests. */

-			xUseFromISRVersion = !xUseFromISRVersion;

-		}

 	}

 }

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

@@ -335,12 +288,6 @@
 	{

 		xErrorOccurred = pdTRUE;

 	}

-

-	xReturned = xTaskAbortDelayFromISR( xThisTask, NULL );

-	if( xReturned != pdFALSE )

-	{

-		xErrorOccurred = pdTRUE;

-	}

 }

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

 

diff --git a/FreeRTOS/Demo/Common/Minimal/GenQTest.c b/FreeRTOS/Demo/Common/Minimal/GenQTest.c
index 97f693c..b902233 100644
--- a/FreeRTOS/Demo/Common/Minimal/GenQTest.c
+++ b/FreeRTOS/Demo/Common/Minimal/GenQTest.c
@@ -218,7 +218,7 @@
 	for( ;; )

 	{

 		/* The queue is empty, so sending an item to the back of the queue

-		should have the same efect as sending it to the front of the queue.

+		should have the same effect as sending it to the front of the queue.

 

 		First send to the front and check everything is as expected. */

 		ulLoopCounterSnapshot = ulLoopCounter;

diff --git a/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c b/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c
index c5854bc..3eac259 100644
--- a/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c
+++ b/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c
@@ -971,8 +971,10 @@
 			else if( xTriggerLevel < xReadBlockTime )

 			{

 				/* Trigger level was less than the block time so we expect to

-				have received the trigger level number of bytes. */

-				if( ( xTriggerLevel - xBytesReceived ) > xAllowableMargin )

+				have received the trigger level number of bytes - could be more

+				though depending on other activity between the task being

+				unblocked and the task reading the number of bytes received. */

+				if( ( xBytesReceived - xTriggerLevel ) > xAllowableMargin )

 				{

 					xErrorDetected = pdTRUE;

 				}

@@ -983,7 +985,7 @@
 				receive no greater than the block time, but one or two less is

 				ok due to variations in how far through the time slice the

 				functions get executed. */

-				if( xBytesReceived > xReadBlockTime )

+				if( ( xBytesReceived - xReadBlockTime ) > xAllowableMargin )

 				{

 					xErrorDetected = pdTRUE;

 				}

diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/.cproject b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/.cproject
index 377ae24..3598301 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/.cproject
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/.cproject
@@ -31,7 +31,7 @@
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freertos_source/include}&quot;"/>

 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V}&quot;"/>

 								</option>

-								<option id="gnu.c.compiler.option.misc.other.1598749994" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections --specs=nano.specs -fno-builtin-printf" valueType="string"/>

+								<option id="gnu.c.compiler.option.misc.other.1598749994" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections --specs=nano.specs -fno-builtin-printf  -Wno-unused-parameter" valueType="string"/>

 								<option id="gnu.c.compiler.option.warnings.extrawarn.527816261" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" useByScannerDiscovery="false" value="true" valueType="boolean"/>

 								<option id="gnu.c.compiler.option.dialect.std.1770102192" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>

 								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.252676358" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols">

diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h
index 3132565..33d8e4c 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h
@@ -95,11 +95,14 @@
  * See http://www.freertos.org/a00110.html.

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

 

-#define configCLINT_BASE_ADDRESS		CLINT_CTRL_ADDR

+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */

+#define configMTIME_BASE_ADDRESS 	( ( CLINT_CTRL_ADDR ) + 0xBFF8UL )

+#define configMTIMECMP_BASE_ADDRESS ( ( CLINT_CTRL_ADDR ) + 0x4000UL )

+

 #define configUSE_PREEMPTION			1

 #define configUSE_IDLE_HOOK				0

 #define configUSE_TICK_HOOK				1

-#define configCPU_CLOCK_HZ				( 10000000 ) /*QEMU*/

+#define configCPU_CLOCK_HZ				( 1000000 )

 #define configTICK_RATE_HZ				( ( TickType_t ) 1000 )

 #define configMAX_PRIORITIES			( 7 )

 #define configMINIMAL_STACK_SIZE		( ( unsigned short ) 105 )

@@ -125,7 +128,7 @@
 /* Software timer definitions. */

 #define configUSE_TIMERS				1

 #define configTIMER_TASK_PRIORITY		( configMAX_PRIORITIES - 1 )

-#define configTIMER_QUEUE_LENGTH		4

+#define configTIMER_QUEUE_LENGTH		6

 #define configTIMER_TASK_STACK_DEPTH	( 110 )

 

 /* Task priorities.  Allow these to be overridden. */

diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c
index d274e16..04c095b 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c
@@ -74,7 +74,7 @@
 

 /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,

 or 0 to run the more comprehensive test and demo application. */

-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	0

+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	1

 

 /*

  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.

@@ -83,6 +83,7 @@
 #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1

 	extern void main_blinky( void );

 #else

+	#warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures.

 	extern void main_full( void );

 #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */

 

diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/.cproject b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/.cproject
index 54955b3..273960b 100644
--- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/.cproject
+++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/.cproject
@@ -181,9 +181,6 @@
 							</tool>

 						</toolChain>

 					</folderInfo>

-					<fileInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.2124579326.468406560" name="fsl_lpuart.c" rcbsApplicability="disable" resourcePath="common/rv32m1_sdk_riscv/devices/RV32M1/drivers/fsl_lpuart.c" toolsToInvoke="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.906968630.2006953853">

-						<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.906968630.2006953853" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.906968630"/>

-					</fileInfo>

 					<sourceEntries>

 						<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>

 					</sourceEntries>

diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h
index 3903ae5..2821797 100644
--- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h
@@ -85,8 +85,9 @@
  * See http://www.freertos.org/a00110.html.

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

 

-#define configCLINT_BASE_ADDRESS		0 /* There is no CLINT so the base address must be set to 0. */

-

+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */

+#define configMTIME_BASE_ADDRESS 	( 0 )

+#define configMTIMECMP_BASE_ADDRESS ( 0 )

 

 

 #define configUSE_PREEMPTION			1

diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h
index 79f1a00..e426d94 100644
--- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h
@@ -74,6 +74,11 @@
 #include "hw_platform.h"

 #include "riscv_plic.h"

 

+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */

+#define configMTIME_BASE_ADDRESS 	( ( PRCI_BASE ) + 0xBFF8UL )

+#define configMTIMECMP_BASE_ADDRESS ( ( PRCI_BASE ) + 0x4000UL )

+

+

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

  * Application specific definitions.

  *

@@ -85,7 +90,7 @@
  *

  * See http://www.freertos.org/a00110.html.

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

-#define configCLINT_BASE_ADDRESS		PRCI_BASE

+

 #define configUSE_PREEMPTION			1

 #define configUSE_IDLE_HOOK				1

 #define configUSE_TICK_HOOK				1

diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c
index d8923ac..0f0d40d 100644
--- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c
+++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c
@@ -52,7 +52,7 @@
 

 /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,

 or 0 to run the more comprehensive test and demo application. */

-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	0

+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY	1

 

 /*

  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.

diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/miv-basic.resc b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/miv-basic.resc
index a16ab93..55dfc6b 100644
--- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/miv-basic.resc
+++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/miv-basic.resc
@@ -3,5 +3,5 @@
 machine LoadPlatformDescription @platforms/boards/miv-board.repl
 peripherals
 showAnalyzer sysbus.uart
-sysbus.cpu StartGdbServer 3333 true
+machine StartGdbServer 3333 true
 log "Renode has been started successfully and is ready for a gdb connection. (This is not an error)" 3
diff --git a/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/WIN32.vcxproj b/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/WIN32.vcxproj
index bf5bf02..97f11d5 100644
--- a/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/WIN32.vcxproj
+++ b/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/WIN32.vcxproj
@@ -23,19 +23,19 @@
     <ConfigurationType>Application</ConfigurationType>

     <UseOfMfc>false</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v142</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

     <ConfigurationType>Application</ConfigurationType>

     <UseOfMfc>false</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v142</PlatformToolset>

   </PropertyGroup>

   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Optimised|Win32'" Label="Configuration">

     <ConfigurationType>Application</ConfigurationType>

     <UseOfMfc>false</UseOfMfc>

     <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>v140</PlatformToolset>

+    <PlatformToolset>v142</PlatformToolset>

   </PropertyGroup>

   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

   <ImportGroup Label="ExtensionSettings">

diff --git a/FreeRTOS/Demo/WIN32-MingW/main_full.c b/FreeRTOS/Demo/WIN32-MingW/main_full.c
index 718c1e1..d444d51 100644
--- a/FreeRTOS/Demo/WIN32-MingW/main_full.c
+++ b/FreeRTOS/Demo/WIN32-MingW/main_full.c
@@ -627,8 +627,8 @@
 TaskHandle_t xTestTask;

 TaskStatus_t xTaskInfo;

 extern StackType_t uxTimerTaskStack[];

-static TickType_t xLastIdleExecutionTime = 0;

-TickType_t xIdleExecutionTime;

+static uint32_t ulLastIdleExecutionTime = 0;

+uint32_t ulIdleExecutionTime;

 

 	/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and

 	xTaskGetIdleTaskHandle() functions.  Also try using the function that sets

@@ -728,12 +728,12 @@
 		}

 	}

 

-	xIdleExecutionTime = xTaskGetIdleRunTimeCounter();

-	if( xIdleExecutionTime == xLastIdleExecutionTime )

+	ulIdleExecutionTime = ulTaskGetIdleRunTimeCounter();

+	if( ulIdleExecutionTime == ulLastIdleExecutionTime )

 	{

 		pcStatusMessage = "Error: Total amount of Idle task execution time did not change";

 	}

-	xLastIdleExecutionTime = xIdleExecutionTime;

+	ulLastIdleExecutionTime = ulIdleExecutionTime;

 }

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

 

diff --git a/FreeRTOS/History.txt b/FreeRTOS/History.txt
index 0c932dc..3a22164 100644
--- a/FreeRTOS/History.txt
+++ b/FreeRTOS/History.txt
@@ -26,11 +26,13 @@
 	  ports.

 	+ Updated the behaviour of the ARMv7-M MPU (Memory Protection Unit) ports to

 	  match that of the ARMv8-M ports whereby privilege escalations can only

-	  originate from within the kernel's own memory segment.

+	  originate from within the kernel's own memory segment.  Added

+	  configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY configuration constant.

+	+  Update existing MPU ports to correctly disable the MPU before it is

+	   updated.

 	+ Added LPC51U68 Cortex-M0+ port for GCC (MCUXpresso), Keil and IAR

 	  compilers.

 	+ Added CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube demo.

-	+ Added xTaskAbortDelayFromISR() API function.

 	+ Added xTaskNotifyValueClear() API function.

 	+ Improve timing accuracy (reduce clock slippage when compared to real time)

 	  in the Windows simulator port by using a waitable timer to determine the

@@ -38,6 +40,8 @@
 	+ Added T-Head demo.

 	+ Added LPC54018 MPU demo.

 	+ Added uxTimerGetReloadMode() API function.

+	+ Rename xTaskGetIdleRunTimeCounter() to ulTaskGetIdleRunTimeCounter().

+	+ Added RISC-V port for IAR compiler.

 

 

 Changes between FreeRTOS V10.2.1 and FreeRTOS V10.2.0 released May 13 2019:

diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h
index c2ebf24..33e9fa6 100644
--- a/FreeRTOS/Source/include/FreeRTOS.h
+++ b/FreeRTOS/Source/include/FreeRTOS.h
@@ -953,6 +953,7 @@
 	#define pcTimerGetTimerName pcTimerGetName

 	#define pcQueueGetQueueName pcQueueGetName

 	#define vTaskGetTaskInfo vTaskGetInfo

+	#define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter

 

 	/* Backward compatibility within the scheduler code only - these definitions

 	are not really required but are included for completeness. */

diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h
index 40e1e53..62302f0 100644
--- a/FreeRTOS/Source/include/task.h
+++ b/FreeRTOS/Source/include/task.h
@@ -831,6 +831,11 @@
  * task will leave the Blocked state, and return from whichever function call

  * placed the task into the Blocked state.

  *

+ * There is no 'FromISR' version of this function as an interrupt would need to

+ * know which object a task was blocked on in order to know which actions to

+ * take.  For example, if the task was blocked on a queue the interrupt handler

+ * would then need to know if the queue was locked.

+ *

  * @param xTask The handle of the task to remove from the Blocked state.

  *

  * @return If the task referenced by xTask was not in the Blocked state then

@@ -842,39 +847,6 @@
 BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;

 

 /**

-* task. h

-* <pre>BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken )</pre>

-*

-* INCLUDE_xTaskAbortDelay must be defined as 1 in FreeRTOSConfig.h for this

-* function to be available.

-*

-* A version of xTaskAbortDelay() that can be used from an interrupt service routine.

-*

-* A task will enter the Blocked state when it is waiting for an event.  The

-* event it is waiting for can be a temporal event (waiting for a time), such

-* as when vTaskDelay() is called, or an event on an object, such as when

-* xQueueReceive() or ulTaskNotifyTake() is called.  If the handle of a task

-* that is in the Blocked state is used in a call to xTaskAbortDelay() then the

-* task will leave the Blocked state, and return from whichever function call

-* placed the task into the Blocked state.

-*

-* @param xTask The handle of the task to remove from the Blocked state.

-*

-* @param pxHigherPriorityTaskWoken xTaskAbortDelayFromISR() will set

-* *pxHigherPriorityTaskWoken to pdTRUE if a task was removed from the Blocked state,

-* and the task that was removed from the Blocked state has a priority higher than the

-* currently running task.  If xTaskAbortDelayFromISR() sets this value to pdTRUE then

-* a context switch should be requested before the interrupt is exited.

-*

-* @return If the task referenced by xTask was not in the Blocked state then

-* pdFAIL is returned.  Otherwise pdPASS is returned.

-*

-* \defgroup xTaskAbortDelay xTaskAbortDelayFromISR

-* \ingroup TaskCtrl

-*/

-BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;

-

-/**

  * task. h

  * <pre>UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask );</pre>

  *

diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
index 415255f..54f37e0 100644
--- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h
@@ -295,7 +295,7 @@
 #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )

 

 #ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY

-	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."

+	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. https://www.freertos.org/FreeRTOS-V10.3.x.html"

 	#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0

 #endif

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

diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/portmacro.h
index 415255f..54f37e0 100644
--- a/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/portmacro.h
+++ b/FreeRTOS/Source/portable/GCC/ARM_CM4_MPU/portmacro.h
@@ -295,7 +295,7 @@
 #define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )

 

 #ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY

-	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."

+	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. https://www.freertos.org/FreeRTOS-V10.3.x.html"

 	#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0

 #endif

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

diff --git a/FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h b/FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
index 7ce23b8..995ec79 100644
--- a/FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
+++ b/FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
@@ -53,6 +53,7 @@
 #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__

 #define __FREERTOS_RISC_V_EXTENSIONS_H__

 

+#define portasmHAS_SIFIVE_CLINT 1

 #define portasmHAS_MTIME 1

 #define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */

 

@@ -60,7 +61,6 @@
 	/* No additional registers to save, so this macro does nothing. */

 	.endm

 

-/* Restore the additional registers found on the Pulpino. */

 .macro portasmRESTORE_ADDITIONAL_REGISTERS

 	/* No additional registers to restore, so this macro does nothing. */

 	.endm

diff --git a/FreeRTOS/Source/portable/GCC/RISC-V/port.c b/FreeRTOS/Source/portable/GCC/RISC-V/port.c
index 511882d..89b468e 100644
--- a/FreeRTOS/Source/portable/GCC/RISC-V/port.c
+++ b/FreeRTOS/Source/portable/GCC/RISC-V/port.c
@@ -38,15 +38,15 @@
 #include "string.h"

 

 #ifdef configCLINT_BASE_ADDRESS

-	#warning The configCLINT_BASE_ADDRESS constant has been deprecated.  configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting.  Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS.

+	#warning The configCLINT_BASE_ADDRESS constant has been deprecated.  configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting.  Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef configMTIME_BASE_ADDRESS

-	#warning configMTIME_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtime register then set configMTIME_BASE_ADDRESS to the mapped address.  Otherwise set configMTIME_BASE_ADDRESS to 0.

+	#warning configMTIME_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtime register then set configMTIME_BASE_ADDRESS to the mapped address.  Otherwise set configMTIME_BASE_ADDRESS to 0.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef configMTIMECMP_BASE_ADDRESS

-	#warning configMTIMECMP_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtimecmp register then set configMTIMECMP_BASE_ADDRESS to the mapped address.  Otherwise set configMTIMECMP_BASE_ADDRESS to 0.

+	#warning configMTIMECMP_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtimecmp register then set configMTIMECMP_BASE_ADDRESS to the mapped address.  Otherwise set configMTIMECMP_BASE_ADDRESS to 0.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 /* Let the user override the pre-loading of the initial LR with the address of

@@ -72,7 +72,7 @@
 	/* Don't use 0xa5 as the stack fill bytes as that is used by the kernerl for

 	the task stacks, and so will legitimately appear in many positions within

 	the ISR stack. */

-	#define portISR_STACK_FILL_BYTE	0xee	

+	#define portISR_STACK_FILL_BYTE	0xee

 #else

 	extern const uint32_t __freertos_irq_stack_top[];

 	const StackType_t xISRStackTop = ( StackType_t ) __freertos_irq_stack_top;

diff --git a/FreeRTOS/Source/portable/GCC/RISC-V/portASM.S b/FreeRTOS/Source/portable/GCC/RISC-V/portASM.S
index a5756f9..fe142df 100644
--- a/FreeRTOS/Source/portable/GCC/RISC-V/portASM.S
+++ b/FreeRTOS/Source/portable/GCC/RISC-V/portASM.S
@@ -72,20 +72,25 @@
 /* Check the freertos_risc_v_chip_specific_extensions.h and/or command line

 definitions. */

 #if defined( portasmHAS_CLINT ) && defined( portasmHAS_MTIME )

-	#error The portasmHAS_CLINT constant has been depracted.  Please replace it with portasmHAS_CLINT.  portasmHAS_CLINT and portasmHAS_MTIME cannot both be defined at once.

+	#error The portasmHAS_CLINT constant has been deprecated.  Please replace it with portasmHAS_MTIME.  portasmHAS_CLINT and portasmHAS_MTIME cannot both be defined at once.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifdef portasmHAS_CLINT

-	#warning The portasmHAS_CLINT constant has been depracted.  Please replace it with portasmHAS_CLINT.  For now portasmHAS_MTIME is derived from portasmHAS_CLINT.

+	#warning The portasmHAS_CLINT constant has been deprecated.  Please replace it with portasmHAS_MTIME and portasmHAS_SIFIVE_CLINT.  For now portasmHAS_MTIME and portasmHAS_SIFIVE_CLINT are derived from portasmHAS_CLINT.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 	#define portasmHAS_MTIME portasmHAS_CLINT

+	#define portasmHAS_SIFIVE_CLINT portasmHAS_CLINT

 #endif

 

 #ifndef portasmHAS_MTIME

-	#error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).

+	#error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef portasmHANDLE_INTERRUPT

-	#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts.  portasmHANDLE_INTERRUPT can be defined on the assmbler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.

+	#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts.  portasmHANDLE_INTERRUPT can be defined on the assembler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.  https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

+#endif

+

+#ifndef portasmHAS_SIFIVE_CLINT

+	#define portasmHAS_SIFIVE_CLINT 0

 #endif

 

 /* Only the standard core registers are stored by default.  Any additional

@@ -293,7 +298,7 @@
 .func

 xPortStartFirstTask:

 

-#if( portasmHAS_MTIME != 0 )

+#if( portasmHAS_SIFIVE_CLINT != 0 )

 	/* If there is a clint then interrupts can branch directly to the FreeRTOS

 	trap handler.  Otherwise the interrupt controller will need to be configured

 	outside of this file. */

diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F_MPU/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM4F_MPU/portmacro.h
index 51de83b..f0e759f 100644
--- a/FreeRTOS/Source/portable/IAR/ARM_CM4F_MPU/portmacro.h
+++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F_MPU/portmacro.h
@@ -246,7 +246,7 @@
 /*-----------------------------------------------------------*/

 

 #ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY

-	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."

+	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. https://www.freertos.org/FreeRTOS-V10.3.x.html"

 	#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0

 #endif

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

diff --git a/FreeRTOS/Source/portable/IAR/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h b/FreeRTOS/Source/portable/IAR/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
index 51c9057..dda6f3f 100644
--- a/FreeRTOS/Source/portable/IAR/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
+++ b/FreeRTOS/Source/portable/IAR/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h
@@ -53,6 +53,7 @@
 #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__

 #define __FREERTOS_RISC_V_EXTENSIONS_H__

 

+#define portasmHAS_SIFIVE_CLINT 1

 #define portasmHAS_MTIME 1

 #define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */

 

@@ -60,7 +61,6 @@
 	/* No additional registers to save, so this macro does nothing. */

 	ENDM

 

-/* Restore the additional registers found on the Pulpino. */

 portasmRESTORE_ADDITIONAL_REGISTERS MACRO

 	/* No additional registers to restore, so this macro does nothing. */

 	ENDM

diff --git a/FreeRTOS/Source/portable/IAR/RISC-V/port.c b/FreeRTOS/Source/portable/IAR/RISC-V/port.c
index 3fb3e22..985c9f0 100644
--- a/FreeRTOS/Source/portable/IAR/RISC-V/port.c
+++ b/FreeRTOS/Source/portable/IAR/RISC-V/port.c
@@ -38,15 +38,15 @@
 #include "string.h"

 

 #ifdef configCLINT_BASE_ADDRESS

-	#warning The configCLINT_BASE_ADDRESS constant has been deprecated.  configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting.  Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS.

+	#warning The configCLINT_BASE_ADDRESS constant has been deprecated.  configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting.  Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef configMTIME_BASE_ADDRESS

-	#warning configMTIME_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtime register then set configMTIME_BASE_ADDRESS to the mapped address.  Otherwise set configMTIME_BASE_ADDRESS to 0.

+	#warning configMTIME_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtime register then set configMTIME_BASE_ADDRESS to the mapped address.  Otherwise set configMTIME_BASE_ADDRESS to 0.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef configMTIMECMP_BASE_ADDRESS

-	#warning configMTIMECMP_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtimecmp register then set configMTIMECMP_BASE_ADDRESS to the mapped address.  Otherwise set configMTIMECMP_BASE_ADDRESS to 0.

+	#warning configMTIMECMP_BASE_ADDRESS must be defined in FreeRTOSConfig.h.  If the target chip includes a memory-mapped mtimecmp register then set configMTIMECMP_BASE_ADDRESS to the mapped address.  Otherwise set configMTIMECMP_BASE_ADDRESS to 0.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 /* Let the user override the pre-loading of the initial LR with the address of

diff --git a/FreeRTOS/Source/portable/IAR/RISC-V/portASM.s b/FreeRTOS/Source/portable/IAR/RISC-V/portASM.s
index d04a308..473725f 100644
--- a/FreeRTOS/Source/portable/IAR/RISC-V/portASM.s
+++ b/FreeRTOS/Source/portable/IAR/RISC-V/portASM.s
@@ -72,20 +72,26 @@
 /* Check the freertos_risc_v_chip_specific_extensions.h and/or command line

 definitions. */

 #if defined( portasmHAS_CLINT ) && defined( portasmHAS_MTIME )

-	#error The portasmHAS_CLINT constant has been depracted.  Please replace it with portasmHAS_CLINT.  portasmHAS_CLINT and portasmHAS_MTIME cannot both be defined at once.

+	#error The portasmHAS_CLINT constant has been deprecated.  Please replace it with portasmHAS_MTIME.  portasmHAS_CLINT and portasmHAS_MTIME cannot both be defined at once.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifdef portasmHAS_CLINT

-	#warning The portasmHAS_CLINT constant has been depracted.  Please replace it with portasmHAS_CLINT.  For now portasmHAS_MTIME is derived from portasmHAS_CLINT.

+	#warning The portasmHAS_CLINT constant has been deprecated.  Please replace it with portasmHAS_MTIME and portasmHAS_SIFIVE_CLINT.  For now portasmHAS_MTIME and portasmHAS_SIFIVE_CLINT are derived from portasmHAS_CLINT.  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 	#define portasmHAS_MTIME portasmHAS_CLINT

+	#define portasmHAS_SIFIVE_CLINT portasmHAS_CLINT

 #endif

 

 #ifndef portasmHAS_MTIME

-	#error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).

+	#error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).  See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

 #endif

 

 #ifndef portasmHANDLE_INTERRUPT

-	#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts.  portasmHANDLE_INTERRUPT can be defined on the assmbler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.

+	#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts.  portasmHANDLE_INTERRUPT can be defined on the assembler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.  https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html

+#endif

+

+

+#ifndef portasmHAS_SIFIVE_CLINT

+	#define portasmHAS_SIFIVE_CLINT 0

 #endif

 

 /* CSR definitions. */

@@ -299,7 +305,7 @@
 

 xPortStartFirstTask:

 

-#if( portasmHAS_MTIME != 0 )

+#if( portasmHAS_SIFIVE_CLINT != 0 )

 	/* If there is a clint then interrupts can branch directly to the FreeRTOS

 	trap handler.  Otherwise the interrupt controller will need to be configured

 	outside of this file. */

diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c
index be659fd..79e8b4d 100644
--- a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c
+++ b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c
@@ -248,11 +248,11 @@
 void vPortExitCritical( void )

 {

 	configASSERT( uxCriticalNesting );

-    uxCriticalNesting--;

-    if( uxCriticalNesting == 0 )

-    {

-        portENABLE_INTERRUPTS();

-    }

+	uxCriticalNesting--;

+	if( uxCriticalNesting == 0 )

+	{

+		portENABLE_INTERRUPTS();

+	}

 }

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

 

diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/port.c
index 3cd73b2..0d92e0b 100644
--- a/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/port.c
+++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/port.c
@@ -268,8 +268,8 @@
 		case portSVC_RAISE_PRIVILEGE	:	/* Only raise the privilege, if the

 											 * svc was raised from any of the

 											 * system calls. */

-											if( ulPC >= ( uint32_t ) __syscalls_flash_start__ &&

-												ulPC <= ( uint32_t ) __syscalls_flash_end__ )

+											if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) &&

+												( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) )

 											{

 												__asm

 												{

diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/portmacro.h
index bd9e1c9..431ea4c 100644
--- a/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/portmacro.h
+++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4_MPU/portmacro.h
@@ -303,7 +303,7 @@
 /*-----------------------------------------------------------*/

 

 #ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY

-	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."

+	#warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security. https://www.freertos.org/FreeRTOS-V10.3.x.html"

 	#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0

 #endif

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

diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c
index 2004433..e6efe7f 100644
--- a/FreeRTOS/Source/tasks.c
+++ b/FreeRTOS/Source/tasks.c
@@ -2195,7 +2195,6 @@
 {

 TCB_t *pxTCB = NULL;

 BaseType_t xAlreadyYielded = pdFALSE;

-TickType_t xTicksToNextUnblockTime;

 

 	/* If uxSchedulerSuspended is zero then this function does not match a

 	previous call to vTaskSuspendAll(). */

@@ -2250,51 +2249,30 @@
 				they should be processed now.  This ensures the tick count does

 				not	slip, and that any delayed tasks are resumed at the correct

 				time. */

-				while( xPendedTicks > ( TickType_t ) 0 )

 				{

-					/* Calculate how far into the future the next task will

-					leave the Blocked state because its timeout expired.  If

-					there are no tasks due to leave	the blocked state between

-					the time now and the time at which the tick count overflows

-					then xNextTaskUnblockTime will the tick overflow time.

-					This means xNextTaskUnblockTime can never be less than

-					xTickCount, and the following can therefore not

-					underflow. */

-					configASSERT( xNextTaskUnblockTime >= xTickCount );

-					xTicksToNextUnblockTime = xNextTaskUnblockTime - xTickCount;

+					TickType_t xPendedCounts = xPendedTicks; /* Non-volatile copy. */

 

-					/* Don't want to move the tick count more than the number

-					of ticks that are pending, so cap if necessary. */

-					if( xTicksToNextUnblockTime > xPendedTicks )

+					if( xPendedCounts > ( TickType_t ) 0U )

 					{

-						xTicksToNextUnblockTime = xPendedTicks;

-					}

+						do

+						{

+							if( xTaskIncrementTick() != pdFALSE )

+							{

+								xYieldPending = pdTRUE;

+							}

+							else

+							{

+								mtCOVERAGE_TEST_MARKER();

+							}

+							--xPendedCounts;

+						} while( xPendedCounts > ( TickType_t ) 0U );

 

-					if( xTicksToNextUnblockTime == 0 )

-					{

-						/* xTicksToNextUnblockTime could be zero if the tick

-						count is about to overflow and xTicksToNetUnblockTime

-						holds the time at which the tick count will overflow

-						(rather than the time at which the next task will

-						unblock).  Set to 1 otherwise xPendedTicks won't be

-						decremented below. */

-						xTicksToNextUnblockTime = ( TickType_t ) 1;

+						xPendedTicks = 0;

 					}

-					else if( xTicksToNextUnblockTime > ( TickType_t ) 1 )

+					else

 					{

-						/* Move the tick count one short of the next unblock

-						time, then call xTaskIncrementTick() to move the tick

-						count up to the next unblock time to unblock the task,

-						if any.  This will also swap the blocked task and

-						overflow blocked task lists if necessary. */

-						xTickCount += ( xTicksToNextUnblockTime - ( TickType_t ) 1 );

+						mtCOVERAGE_TEST_MARKER();

 					}

-					xYieldPending |= xTaskIncrementTick();

-

-					/* Adjust for the number of ticks just added to

-					xTickCount and go around the loop again if

-					xTicksToCatchUp is still greater than 0. */

-					xPendedTicks -= xTicksToNextUnblockTime;

 				}

 

 				if( xYieldPending != pdFALSE )

@@ -2648,91 +2626,6 @@
 

 #if ( INCLUDE_xTaskAbortDelay == 1 )

 

-	BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken )

-	{

-	TCB_t *pxTCB = xTask;

-	BaseType_t xReturn;

-	UBaseType_t uxSavedInterruptStatus;

-

-		configASSERT( pxTCB );

-

-		/* RTOS ports that support interrupt nesting have the concept of a maximum

-		system call (or maximum API call) interrupt priority.  Interrupts that are

-		above the maximum system call priority are kept permanently enabled, even

-		when the RTOS kernel is in a critical section, but cannot make any calls to

-		FreeRTOS API functions.  If configASSERT() is defined in FreeRTOSConfig.h

-		then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion

-		failure if a FreeRTOS API function is called from an interrupt that has been

-		assigned a priority above the configured maximum system call priority.

-		Only FreeRTOS functions that end in FromISR can be called from interrupts

-		that have been assigned a priority at or (logically) below the maximum

-		system call	interrupt priority.  FreeRTOS maintains a separate interrupt

-		safe API to ensure interrupt entry is as fast and as simple as possible.

-		More information (albeit Cortex-M specific) is provided on the following

-		link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */

-		portASSERT_IF_INTERRUPT_PRIORITY_INVALID();

-

-		uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();

-		{

-			/* A task can only be prematurely removed from the Blocked state if

-			it is actually in the Blocked state. */

-			if( eTaskGetState( xTask ) == eBlocked )

-			{

-				xReturn = pdPASS;

-

-				/* Remove the reference to the task from the blocked list.  A higher

-				priority interrupt won't touch the xStateListItem because of the

-				critical section. */

-				( void ) uxListRemove( &( pxTCB->xStateListItem ) );

-

-				/* Is the task waiting on an event also?  If so remove it from

-				the event list too. */

-				if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )

-				{

-					( void ) uxListRemove( &( pxTCB->xEventListItem ) );

-

-					/* This lets the task know it was forcibly removed from the

-					blocked state so it should not re-evaluate its block time and

-					then block again. */

-					pxTCB->ucDelayAborted = pdTRUE;

-				}

-				else

-				{

-					mtCOVERAGE_TEST_MARKER();

-				}

-

-				/* Place the unblocked task into the appropriate ready list. */

-				prvAddTaskToReadyList( pxTCB );

-

-				if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )

-				{

-					if( pxHigherPriorityTaskWoken != NULL )

-					{

-						/* Pend the yield to be performed when the scheduler

-						is unsuspended. */

-						*pxHigherPriorityTaskWoken = pdTRUE;

-					}

-				}

-				else

-				{

-					mtCOVERAGE_TEST_MARKER();

-				}

-			}

-			else

-			{

-				xReturn = pdFAIL;

-			}

-		}

-		portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );

-

-		return xReturn;

-	}

-

-#endif

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

-

-#if ( INCLUDE_xTaskAbortDelay == 1 )

-

 	BaseType_t xTaskAbortDelay( TaskHandle_t xTask )

 	{

 	TCB_t *pxTCB = xTask;