}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack.\r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER\r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack.\r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER\r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack.\r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER\r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack.\r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER\r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack.\r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER\r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ /* This example is the first in a sequence that adds IoT functionality into\r
+ an existing TCP / IP project.In this first project the TCP / IP stack is not\r
+ actually used, but it is still built, which requires this function to be\r
+ present.For now this function does not need to do anything. */\r
+ __debugbreak();\r
+ *(pulNumber) = 0;\r
+ return pdFALSE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
UBaseType_t uxRand( void )\r
{\r
/* This example is the first in a sequence that adds IoT functionality into\r
}\r
/*-----------------------------------------------------------*/\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack. \r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER \r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
#if( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME != 0 )\r
\r
const char *pcApplicationHostnameHook( void )\r
/*\r
- * FreeRTOS+CLI V1.0.4\r
+ * FreeRTOS+CLI V1.0.x Labs copy\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
/*\r
- * FreeRTOS+CLI V1.0.4\r
+ * FreeRTOS+CLI V1.0.x Labs copy\r
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a copy of\r
-Changes between V1.0.3 and V1.0.4 released\r
+Changes between V1.0.3 and TBD\r
\r
+ Update to use stdint and the FreeRTOS specific typedefs that were\r
introduced in FreeRTOS V8.0.0.\r
/**\r
* @brief The timeout for MQTT operations in this example.\r
*/\r
-#define mqttexampleMQTT_TIMEOUT_MS ( 5000 )\r
+#define mqttexampleMQTT_TIMEOUT_MS ( 50000 )\r
\r
/**\r
* @brief The MQTT client identifier used in this example.\r
*/\r
#define mqttexampleCLIENT_IDENTIFIER "mqttexampleclient"\r
\r
+const char *pcClientIdentifiers[] = { "AAA" };//, "BBB", "CCC", "DDD", "EEE", "FFF", "GGG", "HHH", "III", "JJJ" };\r
+\r
/**\r
* @brief Details of the MQTT broker to connect to.\r
*\r
#define mqttexampleMESSAGE_RECEIVED_BIT ( 1UL << 1UL )\r
/*-----------------------------------------------------------*/\r
\r
-/**\r
- * @brief The MQTT connection handle used in this example.\r
- */\r
-static IotMqttConnection_t xMQTTConnection = IOT_MQTT_CONNECTION_INITIALIZER;\r
-\r
/**\r
* @brief Parameters used to create the system task pool.\r
*/\r
*\r
* @note This example does not use TLS and therefore will not work with MQTT.\r
*/\r
-static void prvMQTTConnect( void );\r
+static void prvMQTTConnect( IotMqttConnection_t *xMQTTConnection, const char *pcClientID );\r
\r
/**\r
- * @brief Subscribes to the topic as specified in mqttexampleTOPIC.\r
+ * @brief Subscribes to pcTopicString.\r
*/\r
-static void prvMQTTSubscribe( void );\r
+static void prvMQTTSubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );\r
\r
/**\r
* @brief Publishes a messages mqttexampleMESSAGE on mqttexampleTOPIC topic.\r
*/\r
-static void prvMQTTPublish( void );\r
+static void prvMQTTPublish( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );\r
\r
/**\r
* @brief Unsubscribes from the mqttexampleTOPIC topic.\r
*/\r
-static void prvMQTTUnsubscribe( void );\r
+static void prvMQTTUnsubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString );\r
\r
/**\r
* @brief Disconnects from the MQTT broker gracefully by sending an MQTT\r
* DISCONNECT message.\r
*/\r
-static void prvMQTTDisconnect( void );\r
+static void prvMQTTDisconnect( IotMqttConnection_t xMQTTConnection );\r
/*-----------------------------------------------------------*/\r
\r
static void prvExample_OnDisconnect( void * pvCallbackContext,\r
TaskHandle_t xDemoTaskHandle = ( TaskHandle_t ) pvCallbackContext;\r
\r
/* Ensure that the message is received on the expected topic. */\r
- configASSERT( pxCallbackParams->u.message.info.topicNameLength == strlen( mqttexampleTOPIC ) );\r
- configASSERT( strncmp( pxCallbackParams->u.message.info.pTopicName,\r
- mqttexampleTOPIC,\r
- strlen( mqttexampleTOPIC ) ) == 0 );\r
+// configASSERT( pxCallbackParams->u.message.info.topicNameLength == strlen( mqttexampleTOPIC ) );\r
+// configASSERT( strncmp( pxCallbackParams->u.message.info.pTopicName,\r
+// mqttexampleTOPIC,\r
+// strlen( mqttexampleTOPIC ) ) == 0 );\r
\r
/* Ensure that the expected message is received. */\r
configASSERT( pxCallbackParams->u.message.info.payloadLength == strlen( mqttexampleMESSAGE ) );\r
\r
void vStartSimpleMQTTDemo( void )\r
{\r
+uint32_t x;\r
+const uint32_t ulMax_x = sizeof( pcClientIdentifiers ) / sizeof( char * );\r
+\r
/* This example uses a single application task, which in turn is used to\r
* connect, subscribe, publish, unsubscribe and disconnect from the MQTT\r
* broker. */\r
+for( x = 0; x < ulMax_x; x++ )\r
+{\r
xTaskCreate( prvMQTTDemoTask, /* Function that implements the task. */\r
"MQTTDemo", /* Text name for the task - only used for debugging. */\r
configMINIMAL_STACK_SIZE, /* Size of stack (in words, not bytes) to allocate for the task. */\r
- NULL, /* Task parameter - not used in this case. */\r
+ ( void * ) x, /* Task parameter - not used in this case. */\r
tskIDLE_PRIORITY, /* Task priority, must be between 0 and configMAX_PRIORITIES - 1. */\r
NULL ); /* Used to pass out a handle to the created task - not used in this case. */\r
}\r
+}\r
/*-----------------------------------------------------------*/\r
\r
static void prvMQTTDemoTask( void *pvParameters )\r
{\r
IotMqttError_t xResult;\r
uint32_t ulNotificationValue = 0, ulPublishCount;\r
-const uint32_t ulMaxPublishCount = 5UL;\r
-const TickType_t xNoDelay = ( TickType_t ) 0;\r
+uint32_t ulMaxPublishCount = 0UL;\r
+const TickType_t xNoDelay = ( TickType_t ) 1;\r
+IotMqttConnection_t xMQTTConnection = IOT_MQTT_CONNECTION_INITIALIZER;\r
+uint32_t ulTaskNumber = ( uint32_t ) pvParameters, x;\r
+char cTopicString[ sizeof( mqttexampleTOPIC ) + 5 ];//_RB_ Access by other tasks so must be persistant and will cause memory faults on memory protected systems.\r
+#pragma message ("Access by other tasks so must be persistant and will cause memory faults on memory protected systems.")\r
\r
/* Remove compiler warnings about unused parameters. */\r
( void ) pvParameters;\r
xResult = IotMqtt_Init();\r
configASSERT( xResult == IOT_MQTT_SUCCESS );\r
\r
+ /* Create a topic string that is unique to the MQTT connection created by\r
+ this task. */\r
+ snprintf( cTopicString, sizeof( cTopicString ), "%s/%s", mqttexampleTOPIC, pcClientIdentifiers[ ulTaskNumber ] );\r
+\r
for( ; ; )\r
{\r
/* Don't expect any notifications to be pending yet. */\r
- configASSERT( ulTaskNotifyTake( pdTRUE, xNoDelay ) == 0 );\r
+ ulNotificationValue = ulTaskNotifyTake( pdTRUE, xNoDelay );\r
+ configASSERT( ulNotificationValue == 0 );\r
\r
\r
/****************************** Connect. ******************************/\r
* mqttexampleMQTT_BROKER_PORT at the top of this file. Please change\r
* it to the MQTT broker you want to connect to. Note that this example\r
* does not use TLS and therefore will not work with AWS IoT. */\r
- prvMQTTConnect();\r
+ prvMQTTConnect( &xMQTTConnection, pcClientIdentifiers[ ulTaskNumber ] );\r
configPRINTF( ( "Connected to %s\r\n", mqttexampleMQTT_BROKER_ENDPOINT ) );\r
\r
\r
* client will then publish to the same topic it subscribed to, so will\r
* expect all the messages it sends to the broker to be sent back to it\r
* from the broker. */\r
- prvMQTTSubscribe();\r
- configPRINTF( ( "Subscribed to the topic %s\r\n", mqttexampleTOPIC ) );\r
+ prvMQTTSubscribe( xMQTTConnection, cTopicString );\r
+ configPRINTF( ( "Subscribed to the topic %s\r\n", cTopicString ) );\r
\r
\r
/*********************** Publish 5 messages. **************************/\r
\r
/* Publish a few messages while connected. */\r
+ for( x = 0; x < ( ulTaskNumber + 1UL ); x++ )\r
+ {\r
+ ulMaxPublishCount = uxRand();\r
+ }\r
+\r
+ /* Cap ulMaxPublishCount but ensure it is not zero. */\r
+ ulMaxPublishCount %= 10UL;\r
+ ulMaxPublishCount++;\r
+\r
for( ulPublishCount = 0; ulPublishCount < ulMaxPublishCount; ulPublishCount++ )\r
{\r
/* Publish a message on the mqttexampleTOPIC topic as specified at\r
* the top of this file. */\r
- prvMQTTPublish();\r
- configPRINTF( ( "Published %s on the topic %s\r\n", mqttexampleMESSAGE, mqttexampleTOPIC ) );\r
+ prvMQTTPublish( xMQTTConnection, cTopicString );\r
+ configPRINTF( ( "Published %s on the topic %s\r\n", mqttexampleMESSAGE, cTopicString ) );\r
\r
/* Since we are subscribed to the same topic as we published on, we\r
* will get the same message back from the MQTT broker. Wait for the\r
\r
/* Unsubscribe from the topic mqttexampleTOPIC and disconnect\r
* gracefully. */\r
- prvMQTTUnsubscribe();\r
- prvMQTTDisconnect();\r
+ prvMQTTUnsubscribe( xMQTTConnection, cTopicString );\r
+ prvMQTTDisconnect( xMQTTConnection );\r
configPRINTF( ( "Disconnected from %s\r\n\r\n", mqttexampleMQTT_BROKER_ENDPOINT ) );\r
\r
/* Wait for the disconnect operation to complete which is informed to us\r
/* Wait for some time between two iterations to ensure that we do not\r
* bombard the public test mosquitto broker. */\r
configPRINTF( ( "prvMQTTDemoTask() completed an iteration without hitting an assert. Total free heap is %u\r\n\r\n", xPortGetFreeHeapSize() ) );\r
- vTaskDelay( pdMS_TO_TICKS( 5000 ) );\r
+// vTaskDelay( pdMS_TO_TICKS( 5000 ) );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvMQTTConnect( void )\r
+static void prvMQTTConnect( IotMqttConnection_t *xMQTTConnection, const char *pcClientID )\r
{\r
IotMqttError_t xResult;\r
IotNetworkServerInfo_t xMQTTBrokerInfo;\r
IotMqttNetworkInfo_t xNetworkInfo = IOT_MQTT_NETWORK_INFO_INITIALIZER;\r
IotMqttConnectInfo_t xConnectInfo = IOT_MQTT_CONNECT_INFO_INITIALIZER;\r
-\r
+static char c[ 10 ];\r
+static int id = 0;\r
\r
/******************* Broker information setup. **********************/\r
\r
/* The client identifier is used to uniquely identify this MQTT client to\r
* the MQTT broker. In a production device the identifier can be something\r
* unique, such as a device serial number. */\r
- xConnectInfo.pClientIdentifier = mqttexampleCLIENT_IDENTIFIER;\r
- xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( mqttexampleCLIENT_IDENTIFIER );\r
+ xConnectInfo.pClientIdentifier = pcClientID;\r
+ xConnectInfo.clientIdentifierLength = ( uint16_t ) strlen( pcClientID );\r
\r
/* This example does not use any authentication and therefore username and\r
* password fields are not used. */\r
xResult = IotMqtt_Connect( &( xNetworkInfo ),\r
&( xConnectInfo ),\r
mqttexampleMQTT_TIMEOUT_MS,\r
- &( xMQTTConnection ) );\r
+ xMQTTConnection );\r
configASSERT( xResult == IOT_MQTT_SUCCESS );\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvMQTTSubscribe( void )\r
+static void prvMQTTSubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )\r
{\r
IotMqttError_t xResult;\r
IotMqttSubscription_t xMQTTSubscription;\r
* as the callback context which is used by the callback to send a task\r
* notification to this task.*/\r
xMQTTSubscription.qos = IOT_MQTT_QOS_1;\r
- xMQTTSubscription.pTopicFilter = mqttexampleTOPIC;\r
- xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC );\r
+ xMQTTSubscription.pTopicFilter = pcTopicString;\r
+ xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( pcTopicString );\r
xMQTTSubscription.callback.pCallbackContext = ( void * ) xTaskGetCurrentTaskHandle();\r
xMQTTSubscription.callback.function = prvExample_OnMessageReceived;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvMQTTPublish( void )\r
+static void prvMQTTPublish( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )\r
{\r
IotMqttError_t xResult;\r
IotMqttPublishInfo_t xMQTTPublishInfo;\r
* back to us. It is verified in the publish callback. */\r
xMQTTPublishInfo.qos = IOT_MQTT_QOS_1;\r
xMQTTPublishInfo.retain = false;\r
- xMQTTPublishInfo.pTopicName = mqttexampleTOPIC;\r
- xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( mqttexampleTOPIC );\r
+ xMQTTPublishInfo.pTopicName = pcTopicString;\r
+ xMQTTPublishInfo.topicNameLength = ( uint16_t ) strlen( pcTopicString );\r
xMQTTPublishInfo.pPayload = mqttexampleMESSAGE;\r
xMQTTPublishInfo.payloadLength = strlen( mqttexampleMESSAGE );\r
xMQTTPublishInfo.retryMs = mqttexamplePUBLISH_RETRY_MS;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvMQTTUnsubscribe( void )\r
+static void prvMQTTUnsubscribe( IotMqttConnection_t xMQTTConnection, const char * const pcTopicString )\r
{\r
IotMqttError_t xResult;\r
IotMqttSubscription_t xMQTTSubscription;\r
\r
/* Unsubscribe from the mqttexampleTOPIC topic filter. */\r
- xMQTTSubscription.pTopicFilter = mqttexampleTOPIC;\r
- xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( mqttexampleTOPIC );\r
+ xMQTTSubscription.pTopicFilter = pcTopicString;\r
+ xMQTTSubscription.topicFilterLength = ( uint16_t ) strlen( pcTopicString );\r
/* The following members of the IotMqttSubscription_t are ignored by the\r
* unsubscribe operation. Just initialize them to avoid "use of uninitialized\r
* variable" warnings. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvMQTTDisconnect( void )\r
+static void prvMQTTDisconnect( IotMqttConnection_t xMQTTConnection )\r
{\r
/* Send a MQTT DISCONNECT packet to the MQTT broker to do a graceful\r
* disconnect. */\r
results in the wired network being used, while setting\r
configNETWORK_INTERFACE_TO_USE to 2 results in the wireless network being\r
used. */\r
-#define configNETWORK_INTERFACE_TO_USE 3L\r
+#define configNETWORK_INTERFACE_TO_USE 2L\r
\r
/* The address of an echo server is only left in this project as it doubles as\r
the address to which logging is sent should UDP logging be enabled. */\r
#define configECHO_SERVER_ADDR0 192\r
#define configECHO_SERVER_ADDR1 168\r
-#define configECHO_SERVER_ADDR2 0\r
-#define configECHO_SERVER_ADDR3 11\r
+#define configECHO_SERVER_ADDR2 26\r
+#define configECHO_SERVER_ADDR3 100\r
\r
/* Default MAC address configuration. The demo creates a virtual network\r
connection that uses this MAC address by accessing the raw Ethernet/WiFi data\r
\r
/* Default IP address configuration. Used in ipconfigUSE_DNS is set to 0, or\r
ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
-#define configIP_ADDR0 10\r
-#define configIP_ADDR1 10\r
-#define configIP_ADDR2 10\r
-#define configIP_ADDR3 200\r
+#define configIP_ADDR0 192\r
+#define configIP_ADDR1 168\r
+#define configIP_ADDR2 1\r
+#define configIP_ADDR3 51\r
\r
/* Default gateway IP address configuration. Used in ipconfigUSE_DNS is set to\r
0, or ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
-#define configGATEWAY_ADDR0 10\r
-#define configGATEWAY_ADDR1 10\r
-#define configGATEWAY_ADDR2 10\r
+#define configGATEWAY_ADDR0 192\r
+#define configGATEWAY_ADDR1 168\r
+#define configGATEWAY_ADDR2 1\r
#define configGATEWAY_ADDR3 1\r
\r
/* Default DNS server configuration. OpenDNS addresses are 208.67.222.222 and\r
208.67.220.220. Used in ipconfigUSE_DNS is set to 0, or ipconfigUSE_DNS is set\r
to 1 but a DNS server cannot be contacted.*/\r
-#define configDNS_SERVER_ADDR0 208\r
-#define configDNS_SERVER_ADDR1 67\r
-#define configDNS_SERVER_ADDR2 222\r
-#define configDNS_SERVER_ADDR3 222\r
+#define configDNS_SERVER_ADDR0 8\r
+#define configDNS_SERVER_ADDR1 8\r
+#define configDNS_SERVER_ADDR2 8\r
+#define configDNS_SERVER_ADDR3 8\r
\r
/* Default netmask configuration. Used in ipconfigUSE_DNS is set to 0, or\r
ipconfigUSE_DNS is set to 1 but a DNS server cannot be contacted. */\r
#define configNET_MASK0 255\r
-#define configNET_MASK1 0\r
-#define configNET_MASK2 0\r
+#define configNET_MASK1 255\r
+#define configNET_MASK2 255\r
#define configNET_MASK3 0\r
\r
/* The UDP port to which print messages are sent. */\r
set to 1 if a valid configuration cannot be obtained from a DHCP server for any\r
reason. The static configuration used is that passed into the stack by the\r
FreeRTOS_IPInit() function call. */\r
-#define ipconfigUSE_DHCP 1\r
+#define ipconfigUSE_DHCP 0\r
\r
/* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at\r
increasing time intervals until either a reply is received from a DHCP server\r
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
/*-----------------------------------------------------------*/\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
return uxRand();\r
}\r
\r
+/*\r
+ * Supply a random number to FreeRTOS+TCP stack. \r
+ * THIS IS ONLY A DUMMY IMPLEMENTATION THAT RETURNS A PSEUDO RANDOM NUMBER \r
+ * SO IS NOT INTENDED FOR USE IN PRODUCTION SYSTEMS.\r
+ */\r
+BaseType_t xApplicationGetRandomNumber(uint32_t* pulNumber)\r
+{\r
+ *(pulNumber) = uxRand();\r
+ return pdTRUE;\r
+}\r
+\r
#include "xscutimer.h"\r
#include "xscugic.h"\r
#include "xil_exception.h"\r
+#include "xuartps_hw.h"\r
\r
/* mainSELECTED_APPLICATION is used to select between three demo applications,\r
* as described at the top of this file.\r
FreeRTOS_asm_vectors.S, which is part of this project. Switch to use the\r
FreeRTOS vector table. */\r
vPortInstallFreeRTOSVectorTable();\r
+\r
+ /* Initialise UART for use with QEMU. */\r
+ XUartPs_ResetHw( 0xE0000000 );\r
+ XUartPs_WriteReg(0xE0000000, XUARTPS_CR_OFFSET,\r
+ ((u32)XUARTPS_CR_RX_DIS | (u32)XUARTPS_CR_TX_EN |\r
+ (u32)XUARTPS_CR_STOPBRK));\r
}\r
/*-----------------------------------------------------------*/\r
\r
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
- <tvExp>0</tvExp>
+ <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
- <nTsel>15</nTsel>
+ <nTsel>16</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<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>
<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><2>.\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><1>.\main_s.c</Filename>
+ <ExecCommand></ExecCommand>
+ <Expression>\\FreeRTOSDemo_s\main_s.c\67</Expression>
+ </Bp>
+ </Breakpoint>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<Group>
<GroupName>User</GroupName>
- <tvExp>0</tvExp>
+ <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<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>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
- <Capability>1</Capability>
+ <Capability>0</Capability>
<DriverSelection>4099</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
</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>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
- <nTsel>15</nTsel>
+ <nTsel>16</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<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>
<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>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
+ <bSchkAxf>0</bSchkAxf>
+ <bTchkAxf>0</bTchkAxf>
<nTsel>0</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<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>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP>
+ <RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
+ <uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>0</v6Lang>
<v6LangP>0</v6LangP>
configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 );\r
/* Run time stats are not being gathered - this is just to exercise\r
API. */\r
- configASSERT( xTaskGetIdleRunTimeCounter() == 0 ); \r
+ configASSERT( ulTaskGetIdleRunTimeCounter() == 0 ); \r
vTaskSuspend( NULL );\r
}\r
/*-----------------------------------------------------------*/\r
TickType_t xTimeAtStart;\r
const TickType_t xStartMargin = 2UL;\r
\r
-/* Used to control whether to use xTaskAbortDelay() or xTaskAbortDelayFromISR() so\r
-both are used with all the tests. */\r
-BaseType_t xUseFromISRVersion = pdFALSE, xHigherPriorityTaskWoken;\r
-\r
/* Just to remove compiler warnings. */\r
( void ) pvParameters;\r
\r
raise the priority of the controlling task to that of the blocking\r
task to minimise discrepancies. */\r
vTaskPrioritySet( NULL, abtBLOCKING_PRIORITY );\r
-\r
vTaskDelay( xMaxBlockTime + xHalfMaxBlockTime + xStartMargin );\r
-\r
- /* For test coverage sometimes xTaskAbortDelay() is used and sometimes\r
- xTaskAbortDelayFromISR() is used. */\r
- if( xUseFromISRVersion == pdFALSE )\r
+ if( xTaskAbortDelay( xBlockingTask ) != pdPASS )\r
{\r
- if( xTaskAbortDelay( xBlockingTask ) != pdPASS )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
- }\r
- else\r
- {\r
- xHigherPriorityTaskWoken = pdFALSE;\r
-\r
- /* For test coverage, sometimes xHigherPriorityTaskWoken is used, and\r
- sometimes NULL is used. */\r
-\r
- if( ( xControllingCycles % 2 ) == 0 )\r
- {\r
- if( xTaskAbortDelayFromISR( xBlockingTask, &xHigherPriorityTaskWoken ) != pdPASS )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
- }\r
- else\r
- {\r
- if( xTaskAbortDelayFromISR( xBlockingTask, NULL ) != pdPASS )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
- }\r
-\r
- /* The tasks have the same priority so xHigherPriorityTaskWoken should\r
- never get set. */\r
- if( xHigherPriorityTaskWoken != pdFALSE )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
+ xErrorOccurred = pdTRUE;\r
}\r
\r
/* Reset the priority to the normal controlling priority. */\r
\r
/* To indicate this task is still executing. */\r
xControllingCycles++;\r
-\r
- if( ( xControllingCycles % abtMAX_TESTS ) == 0 )\r
- {\r
- /* Looped through all the tests. Switch between using xTaskAbortDelay()\r
- and xTaskAbortDelayFromISR() for the next round of tests. */\r
- xUseFromISRVersion = !xUseFromISRVersion;\r
- }\r
}\r
}\r
/*-----------------------------------------------------------*/\r
{\r
xErrorOccurred = pdTRUE;\r
}\r
-\r
- xReturned = xTaskAbortDelayFromISR( xThisTask, NULL );\r
- if( xReturned != pdFALSE )\r
- {\r
- xErrorOccurred = pdTRUE;\r
- }\r
}\r
/*-----------------------------------------------------------*/\r
\r
for( ;; )\r
{\r
/* The queue is empty, so sending an item to the back of the queue\r
- should have the same efect as sending it to the front of the queue.\r
+ should have the same effect as sending it to the front of the queue.\r
\r
First send to the front and check everything is as expected. */\r
ulLoopCounterSnapshot = ulLoopCounter;\r
else if( xTriggerLevel < xReadBlockTime )\r
{\r
/* Trigger level was less than the block time so we expect to\r
- have received the trigger level number of bytes. */\r
- if( ( xTriggerLevel - xBytesReceived ) > xAllowableMargin )\r
+ have received the trigger level number of bytes - could be more\r
+ though depending on other activity between the task being\r
+ unblocked and the task reading the number of bytes received. */\r
+ if( ( xBytesReceived - xTriggerLevel ) > xAllowableMargin )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
receive no greater than the block time, but one or two less is\r
ok due to variations in how far through the time slice the\r
functions get executed. */\r
- if( xBytesReceived > xReadBlockTime )\r
+ if( ( xBytesReceived - xReadBlockTime ) > xAllowableMargin )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/include}""/>\r
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/freertos_source/portable/GCC/RISC-V}""/>\r
</option>\r
- <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"/>\r
+ <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"/>\r
<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"/>\r
<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"/>\r
<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">\r
* See http://www.freertos.org/a00110.html.\r
*----------------------------------------------------------*/\r
\r
-#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR\r
+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */\r
+#define configMTIME_BASE_ADDRESS ( ( CLINT_CTRL_ADDR ) + 0xBFF8UL )\r
+#define configMTIMECMP_BASE_ADDRESS ( ( CLINT_CTRL_ADDR ) + 0x4000UL )\r
+\r
#define configUSE_PREEMPTION 1\r
#define configUSE_IDLE_HOOK 0\r
#define configUSE_TICK_HOOK 1\r
-#define configCPU_CLOCK_HZ ( 10000000 ) /*QEMU*/\r
+#define configCPU_CLOCK_HZ ( 1000000 )\r
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )\r
#define configMAX_PRIORITIES ( 7 )\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 105 )\r
/* Software timer definitions. */\r
#define configUSE_TIMERS 1\r
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
-#define configTIMER_QUEUE_LENGTH 4\r
+#define configTIMER_QUEUE_LENGTH 6\r
#define configTIMER_TASK_STACK_DEPTH ( 110 )\r
\r
/* Task priorities. Allow these to be overridden. */\r
\r
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
or 0 to run the more comprehensive test and demo application. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1\r
\r
/*\r
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
extern void main_blinky( void );\r
#else\r
+ #warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures.\r
extern void main_full( void );\r
#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */\r
\r
</tool>\r
</toolChain>\r
</folderInfo>\r
- <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">\r
- <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"/>\r
- </fileInfo>\r
<sourceEntries>\r
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>\r
</sourceEntries>\r
* See http://www.freertos.org/a00110.html.\r
*----------------------------------------------------------*/\r
\r
-#define configCLINT_BASE_ADDRESS 0 /* There is no CLINT so the base address must be set to 0. */\r
-\r
+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */\r
+#define configMTIME_BASE_ADDRESS ( 0 )\r
+#define configMTIMECMP_BASE_ADDRESS ( 0 )\r
\r
\r
#define configUSE_PREEMPTION 1\r
#include "hw_platform.h"\r
#include "riscv_plic.h"\r
\r
+/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */\r
+#define configMTIME_BASE_ADDRESS ( ( PRCI_BASE ) + 0xBFF8UL )\r
+#define configMTIMECMP_BASE_ADDRESS ( ( PRCI_BASE ) + 0x4000UL )\r
+\r
+\r
/*-----------------------------------------------------------\r
* Application specific definitions.\r
*\r
*\r
* See http://www.freertos.org/a00110.html.\r
*----------------------------------------------------------*/\r
-#define configCLINT_BASE_ADDRESS PRCI_BASE\r
+\r
#define configUSE_PREEMPTION 1\r
#define configUSE_IDLE_HOOK 1\r
#define configUSE_TICK_HOOK 1\r
\r
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
or 0 to run the more comprehensive test and demo application. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1\r
\r
/*\r
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
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
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Optimised|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v140</PlatformToolset>\r
+ <PlatformToolset>v142</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
TaskHandle_t xTestTask;\r
TaskStatus_t xTaskInfo;\r
extern StackType_t uxTimerTaskStack[];\r
-static TickType_t xLastIdleExecutionTime = 0;\r
-TickType_t xIdleExecutionTime;\r
+static uint32_t ulLastIdleExecutionTime = 0;\r
+uint32_t ulIdleExecutionTime;\r
\r
/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and\r
xTaskGetIdleTaskHandle() functions. Also try using the function that sets\r
}\r
}\r
\r
- xIdleExecutionTime = xTaskGetIdleRunTimeCounter();\r
- if( xIdleExecutionTime == xLastIdleExecutionTime )\r
+ ulIdleExecutionTime = ulTaskGetIdleRunTimeCounter();\r
+ if( ulIdleExecutionTime == ulLastIdleExecutionTime )\r
{\r
pcStatusMessage = "Error: Total amount of Idle task execution time did not change";\r
}\r
- xLastIdleExecutionTime = xIdleExecutionTime;\r
+ ulLastIdleExecutionTime = ulIdleExecutionTime;\r
}\r
/*-----------------------------------------------------------*/\r
\r
ports.\r
+ Updated the behaviour of the ARMv7-M MPU (Memory Protection Unit) ports to\r
match that of the ARMv8-M ports whereby privilege escalations can only\r
- originate from within the kernel's own memory segment.\r
+ originate from within the kernel's own memory segment. Added\r
+ configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY configuration constant.\r
+ + Update existing MPU ports to correctly disable the MPU before it is\r
+ updated.\r
+ Added LPC51U68 Cortex-M0+ port for GCC (MCUXpresso), Keil and IAR\r
compilers.\r
+ Added CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube demo.\r
- + Added xTaskAbortDelayFromISR() API function.\r
+ Added xTaskNotifyValueClear() API function.\r
+ Improve timing accuracy (reduce clock slippage when compared to real time)\r
in the Windows simulator port by using a waitable timer to determine the\r
+ Added T-Head demo.\r
+ Added LPC54018 MPU demo.\r
+ Added uxTimerGetReloadMode() API function.\r
+ + Rename xTaskGetIdleRunTimeCounter() to ulTaskGetIdleRunTimeCounter().\r
+ + Added RISC-V port for IAR compiler.\r
\r
\r
Changes between FreeRTOS V10.2.1 and FreeRTOS V10.2.0 released May 13 2019:\r
#define pcTimerGetTimerName pcTimerGetName\r
#define pcQueueGetQueueName pcQueueGetName\r
#define vTaskGetTaskInfo vTaskGetInfo\r
+ #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter\r
\r
/* Backward compatibility within the scheduler code only - these definitions\r
are not really required but are included for completeness. */\r
* task will leave the Blocked state, and return from whichever function call\r
* placed the task into the Blocked state.\r
*\r
+ * There is no 'FromISR' version of this function as an interrupt would need to\r
+ * know which object a task was blocked on in order to know which actions to\r
+ * take. For example, if the task was blocked on a queue the interrupt handler\r
+ * would then need to know if the queue was locked.\r
+ *\r
* @param xTask The handle of the task to remove from the Blocked state.\r
*\r
* @return If the task referenced by xTask was not in the Blocked state then\r
*/\r
BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
\r
-/**\r
-* task. h\r
-* <pre>BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken )</pre>\r
-*\r
-* INCLUDE_xTaskAbortDelay must be defined as 1 in FreeRTOSConfig.h for this\r
-* function to be available.\r
-*\r
-* A version of xTaskAbortDelay() that can be used from an interrupt service routine.\r
-*\r
-* A task will enter the Blocked state when it is waiting for an event. The\r
-* event it is waiting for can be a temporal event (waiting for a time), such\r
-* as when vTaskDelay() is called, or an event on an object, such as when\r
-* xQueueReceive() or ulTaskNotifyTake() is called. If the handle of a task\r
-* that is in the Blocked state is used in a call to xTaskAbortDelay() then the\r
-* task will leave the Blocked state, and return from whichever function call\r
-* placed the task into the Blocked state.\r
-*\r
-* @param xTask The handle of the task to remove from the Blocked state.\r
-*\r
-* @param pxHigherPriorityTaskWoken xTaskAbortDelayFromISR() will set\r
-* *pxHigherPriorityTaskWoken to pdTRUE if a task was removed from the Blocked state,\r
-* and the task that was removed from the Blocked state has a priority higher than the\r
-* currently running task. If xTaskAbortDelayFromISR() sets this value to pdTRUE then\r
-* a context switch should be requested before the interrupt is exited.\r
-*\r
-* @return If the task referenced by xTask was not in the Blocked state then\r
-* pdFAIL is returned. Otherwise pdPASS is returned.\r
-*\r
-* \defgroup xTaskAbortDelay xTaskAbortDelayFromISR\r
-* \ingroup TaskCtrl\r
-*/\r
-BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
-\r
/**\r
* task. h\r
* <pre>UBaseType_t uxTaskPriorityGet( const TaskHandle_t xTask );</pre>\r
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )\r
\r
#ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY\r
- #warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."\r
+ #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"\r
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0\r
#endif\r
/*-----------------------------------------------------------*/\r
#define portMEMORY_BARRIER() __asm volatile( "" ::: "memory" )\r
\r
#ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY\r
- #warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."\r
+ #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"\r
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0\r
#endif\r
/*-----------------------------------------------------------*/\r
#ifndef __FREERTOS_RISC_V_EXTENSIONS_H__\r
#define __FREERTOS_RISC_V_EXTENSIONS_H__\r
\r
+#define portasmHAS_SIFIVE_CLINT 1\r
#define portasmHAS_MTIME 1\r
#define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */\r
\r
/* No additional registers to save, so this macro does nothing. */\r
.endm\r
\r
-/* Restore the additional registers found on the Pulpino. */\r
.macro portasmRESTORE_ADDITIONAL_REGISTERS\r
/* No additional registers to restore, so this macro does nothing. */\r
.endm\r
#include "string.h"\r
\r
#ifdef configCLINT_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
#ifndef configMTIME_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
#ifndef configMTIMECMP_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
/* Let the user override the pre-loading of the initial LR with the address of\r
/* Don't use 0xa5 as the stack fill bytes as that is used by the kernerl for\r
the task stacks, and so will legitimately appear in many positions within\r
the ISR stack. */\r
- #define portISR_STACK_FILL_BYTE 0xee \r
+ #define portISR_STACK_FILL_BYTE 0xee\r
#else\r
extern const uint32_t __freertos_irq_stack_top[];\r
const StackType_t xISRStackTop = ( StackType_t ) __freertos_irq_stack_top;\r
/* Check the freertos_risc_v_chip_specific_extensions.h and/or command line\r
definitions. */\r
#if defined( portasmHAS_CLINT ) && defined( portasmHAS_MTIME )\r
- #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.\r
+ #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\r
#endif\r
\r
#ifdef portasmHAS_CLINT\r
- #warning The portasmHAS_CLINT constant has been depracted. Please replace it with portasmHAS_CLINT. For now portasmHAS_MTIME is derived from portasmHAS_CLINT.\r
+ #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\r
#define portasmHAS_MTIME portasmHAS_CLINT\r
+ #define portasmHAS_SIFIVE_CLINT portasmHAS_CLINT\r
#endif\r
\r
#ifndef portasmHAS_MTIME\r
- #error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).\r
+ #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\r
#endif\r
\r
#ifndef portasmHANDLE_INTERRUPT\r
- #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.\r
+ #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\r
+#endif\r
+\r
+#ifndef portasmHAS_SIFIVE_CLINT\r
+ #define portasmHAS_SIFIVE_CLINT 0\r
#endif\r
\r
/* Only the standard core registers are stored by default. Any additional\r
.func\r
xPortStartFirstTask:\r
\r
-#if( portasmHAS_MTIME != 0 )\r
+#if( portasmHAS_SIFIVE_CLINT != 0 )\r
/* If there is a clint then interrupts can branch directly to the FreeRTOS\r
trap handler. Otherwise the interrupt controller will need to be configured\r
outside of this file. */\r
/*-----------------------------------------------------------*/\r
\r
#ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY\r
- #warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."\r
+ #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"\r
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0\r
#endif\r
/*-----------------------------------------------------------*/\r
#ifndef __FREERTOS_RISC_V_EXTENSIONS_H__\r
#define __FREERTOS_RISC_V_EXTENSIONS_H__\r
\r
+#define portasmHAS_SIFIVE_CLINT 1\r
#define portasmHAS_MTIME 1\r
#define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */\r
\r
/* No additional registers to save, so this macro does nothing. */\r
ENDM\r
\r
-/* Restore the additional registers found on the Pulpino. */\r
portasmRESTORE_ADDITIONAL_REGISTERS MACRO\r
/* No additional registers to restore, so this macro does nothing. */\r
ENDM\r
#include "string.h"\r
\r
#ifdef configCLINT_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
#ifndef configMTIME_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
#ifndef configMTIMECMP_BASE_ADDRESS\r
- #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.\r
+ #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\r
#endif\r
\r
/* Let the user override the pre-loading of the initial LR with the address of\r
/* Check the freertos_risc_v_chip_specific_extensions.h and/or command line\r
definitions. */\r
#if defined( portasmHAS_CLINT ) && defined( portasmHAS_MTIME )\r
- #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.\r
+ #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\r
#endif\r
\r
#ifdef portasmHAS_CLINT\r
- #warning The portasmHAS_CLINT constant has been depracted. Please replace it with portasmHAS_CLINT. For now portasmHAS_MTIME is derived from portasmHAS_CLINT.\r
+ #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\r
#define portasmHAS_MTIME portasmHAS_CLINT\r
+ #define portasmHAS_SIFIVE_CLINT portasmHAS_CLINT\r
#endif\r
\r
#ifndef portasmHAS_MTIME\r
- #error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_MTIME to either 1 (MTIME clock present) or 0 (MTIME clock not present).\r
+ #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\r
#endif\r
\r
#ifndef portasmHANDLE_INTERRUPT\r
- #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.\r
+ #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\r
+#endif\r
+\r
+\r
+#ifndef portasmHAS_SIFIVE_CLINT\r
+ #define portasmHAS_SIFIVE_CLINT 0\r
#endif\r
\r
/* CSR definitions. */\r
\r
xPortStartFirstTask:\r
\r
-#if( portasmHAS_MTIME != 0 )\r
+#if( portasmHAS_SIFIVE_CLINT != 0 )\r
/* If there is a clint then interrupts can branch directly to the FreeRTOS\r
trap handler. Otherwise the interrupt controller will need to be configured\r
outside of this file. */\r
void vPortExitCritical( void )\r
{\r
configASSERT( uxCriticalNesting );\r
- uxCriticalNesting--;\r
- if( uxCriticalNesting == 0 )\r
- {\r
- portENABLE_INTERRUPTS();\r
- }\r
+ uxCriticalNesting--;\r
+ if( uxCriticalNesting == 0 )\r
+ {\r
+ portENABLE_INTERRUPTS();\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
case portSVC_RAISE_PRIVILEGE : /* Only raise the privilege, if the\r
* svc was raised from any of the\r
* system calls. */\r
- if( ulPC >= ( uint32_t ) __syscalls_flash_start__ &&\r
- ulPC <= ( uint32_t ) __syscalls_flash_end__ )\r
+ if( ( ulPC >= ( uint32_t ) __syscalls_flash_start__ ) &&\r
+ ( ulPC <= ( uint32_t ) __syscalls_flash_end__ ) )\r
{\r
__asm\r
{\r
/*-----------------------------------------------------------*/\r
\r
#ifndef configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY\r
- #warning "configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY is not defined. We recommend defining it to 1 in FreeRTOSConfig.h for better security."\r
+ #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"\r
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0\r
#endif\r
/*-----------------------------------------------------------*/\r
{\r
TCB_t *pxTCB = NULL;\r
BaseType_t xAlreadyYielded = pdFALSE;\r
-TickType_t xTicksToNextUnblockTime;\r
\r
/* If uxSchedulerSuspended is zero then this function does not match a\r
previous call to vTaskSuspendAll(). */\r
they should be processed now. This ensures the tick count does\r
not slip, and that any delayed tasks are resumed at the correct\r
time. */\r
- while( xPendedTicks > ( TickType_t ) 0 )\r
{\r
- /* Calculate how far into the future the next task will\r
- leave the Blocked state because its timeout expired. If\r
- there are no tasks due to leave the blocked state between\r
- the time now and the time at which the tick count overflows\r
- then xNextTaskUnblockTime will the tick overflow time.\r
- This means xNextTaskUnblockTime can never be less than\r
- xTickCount, and the following can therefore not\r
- underflow. */\r
- configASSERT( xNextTaskUnblockTime >= xTickCount );\r
- xTicksToNextUnblockTime = xNextTaskUnblockTime - xTickCount;\r
+ TickType_t xPendedCounts = xPendedTicks; /* Non-volatile copy. */\r
\r
- /* Don't want to move the tick count more than the number\r
- of ticks that are pending, so cap if necessary. */\r
- if( xTicksToNextUnblockTime > xPendedTicks )\r
+ if( xPendedCounts > ( TickType_t ) 0U )\r
{\r
- xTicksToNextUnblockTime = xPendedTicks;\r
- }\r
+ do\r
+ {\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ {\r
+ xYieldPending = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ mtCOVERAGE_TEST_MARKER();\r
+ }\r
+ --xPendedCounts;\r
+ } while( xPendedCounts > ( TickType_t ) 0U );\r
\r
- if( xTicksToNextUnblockTime == 0 )\r
- {\r
- /* xTicksToNextUnblockTime could be zero if the tick\r
- count is about to overflow and xTicksToNetUnblockTime\r
- holds the time at which the tick count will overflow\r
- (rather than the time at which the next task will\r
- unblock). Set to 1 otherwise xPendedTicks won't be\r
- decremented below. */\r
- xTicksToNextUnblockTime = ( TickType_t ) 1;\r
+ xPendedTicks = 0;\r
}\r
- else if( xTicksToNextUnblockTime > ( TickType_t ) 1 )\r
+ else\r
{\r
- /* Move the tick count one short of the next unblock\r
- time, then call xTaskIncrementTick() to move the tick\r
- count up to the next unblock time to unblock the task,\r
- if any. This will also swap the blocked task and\r
- overflow blocked task lists if necessary. */\r
- xTickCount += ( xTicksToNextUnblockTime - ( TickType_t ) 1 );\r
+ mtCOVERAGE_TEST_MARKER();\r
}\r
- xYieldPending |= xTaskIncrementTick();\r
-\r
- /* Adjust for the number of ticks just added to\r
- xTickCount and go around the loop again if\r
- xTicksToCatchUp is still greater than 0. */\r
- xPendedTicks -= xTicksToNextUnblockTime;\r
}\r
\r
if( xYieldPending != pdFALSE )\r
}\r
/*----------------------------------------------------------*/\r
\r
-#if ( INCLUDE_xTaskAbortDelay == 1 )\r
-\r
- BaseType_t xTaskAbortDelayFromISR( TaskHandle_t xTask, BaseType_t * const pxHigherPriorityTaskWoken )\r
- {\r
- TCB_t *pxTCB = xTask;\r
- BaseType_t xReturn;\r
- UBaseType_t uxSavedInterruptStatus;\r
-\r
- configASSERT( pxTCB );\r
-\r
- /* RTOS ports that support interrupt nesting have the concept of a maximum\r
- system call (or maximum API call) interrupt priority. Interrupts that are\r
- above the maximum system call priority are kept permanently enabled, even\r
- when the RTOS kernel is in a critical section, but cannot make any calls to\r
- FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h\r
- then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion\r
- failure if a FreeRTOS API function is called from an interrupt that has been\r
- assigned a priority above the configured maximum system call priority.\r
- Only FreeRTOS functions that end in FromISR can be called from interrupts\r
- that have been assigned a priority at or (logically) below the maximum\r
- system call interrupt priority. FreeRTOS maintains a separate interrupt\r
- safe API to ensure interrupt entry is as fast and as simple as possible.\r
- More information (albeit Cortex-M specific) is provided on the following\r
- link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */\r
- portASSERT_IF_INTERRUPT_PRIORITY_INVALID();\r
-\r
- uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
- {\r
- /* A task can only be prematurely removed from the Blocked state if\r
- it is actually in the Blocked state. */\r
- if( eTaskGetState( xTask ) == eBlocked )\r
- {\r
- xReturn = pdPASS;\r
-\r
- /* Remove the reference to the task from the blocked list. A higher\r
- priority interrupt won't touch the xStateListItem because of the\r
- critical section. */\r
- ( void ) uxListRemove( &( pxTCB->xStateListItem ) );\r
-\r
- /* Is the task waiting on an event also? If so remove it from\r
- the event list too. */\r
- if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
- {\r
- ( void ) uxListRemove( &( pxTCB->xEventListItem ) );\r
-\r
- /* This lets the task know it was forcibly removed from the\r
- blocked state so it should not re-evaluate its block time and\r
- then block again. */\r
- pxTCB->ucDelayAborted = pdTRUE;\r
- }\r
- else\r
- {\r
- mtCOVERAGE_TEST_MARKER();\r
- }\r
-\r
- /* Place the unblocked task into the appropriate ready list. */\r
- prvAddTaskToReadyList( pxTCB );\r
-\r
- if( pxTCB->uxPriority > pxCurrentTCB->uxPriority )\r
- {\r
- if( pxHigherPriorityTaskWoken != NULL )\r
- {\r
- /* Pend the yield to be performed when the scheduler\r
- is unsuspended. */\r
- *pxHigherPriorityTaskWoken = pdTRUE;\r
- }\r
- }\r
- else\r
- {\r
- mtCOVERAGE_TEST_MARKER();\r
- }\r
- }\r
- else\r
- {\r
- xReturn = pdFAIL;\r
- }\r
- }\r
- portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
-\r
- return xReturn;\r
- }\r
-\r
-#endif\r
-/*----------------------------------------------------------*/\r
-\r
#if ( INCLUDE_xTaskAbortDelay == 1 )\r
\r
BaseType_t xTaskAbortDelay( TaskHandle_t xTask )\r