summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/Posix_GCC
diff options
context:
space:
mode:
authorlundinc <lundinc@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2020-08-12 19:11:51 +0000
committerlundinc <lundinc@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2020-08-12 19:11:51 +0000
commit42255af1e27a3157d541f0812eaca447c569ca49 (patch)
tree5c8702c2f0dc1cb9be1a4d5ff285897d96b97dd2 /FreeRTOS/Demo/Posix_GCC
parentf5221dff43de249079c2da081723cb7a456f981f (diff)
downloadfreertos-master.tar.gz
commit 70dcbe4527a45ab4fea6d58c016e7d3032f31e8cHEADmaster
Author: Ming Yue <mingyue86010@gmail.com> Date: Tue Aug 11 17:06:59 2020 -0700 Remove unused wolfSSL files. (#197) * Remove unused wolfSSL files. * Add back some removed ciphers. * Update VS project file. commit 0e0edd96e8236b2ea4a6e6018812807be828c77f Author: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Tue Aug 11 10:50:30 2020 -0700 Use new QEMU test project to improve stream/message buffer tests (#168) * Add Eclipse/GCC project that targets the LM3S8962 QEMU model. * Get the Cortex-M QEMU project working. * Continue working on making stream buffer demo more robust and QEMU project. * Rename directory CORTEX_LM3S8986_QEMU to CORTEX_LM3S6965_QEMU. Work on making the Stream Buffer tests more robust. Check in before adding in the trace recorder. * Rename CORTEX_LM3S6969_QEMU to CORTEX_LM3S6969_GCC_QEMU. * Make the StreamBufferDemo.c common demo file (test file) more robust to other test tasks running at an equally high priority. * Work in progress checkin only - comments in main.c are incorrect. * Correct comments at the top of FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/main.c Make the message buffer tests more robust in the case the a message buffer becomes full when prvSenderTask() has a higher priority than the reader task. * Disable trace recorder in the LM3S6965 QEMU demo. * I'm dropping FreeRTOS-Kernel reference update, since this seems to break the CMBC CI. Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 157a7fc39f19583ac8481e93fa3e1c91b1e1860c Author: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Sun Aug 9 22:21:44 2020 -0700 Use chacheable RAM in IAR project for MPU_M7_NUCLEO_H743ZI2 project (#193) This change updates the IAR project for Nucleo H743ZI2 to use the cacheable DTC RAM and enables L1 cache. In order to ensure the correct functioning of cache, the project sets configTEX_S_C_B_SRAM in FreeRTOSConfig.h to not mark the RAM as shareable. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> commit f3e43556f90f01b82918ad533b0c616489331919 Author: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Sun Aug 9 16:23:53 2020 -0700 Add MPU demo projects for NUCLEO-H743ZI2 board (#155) * Add MPU demo projects for NUCLEO-H743ZI2 board It contains projects for Keil uVision, STM32CubeIDE and IAR EW. This demo shows the use of newly added support for 16 MPU regions. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Delete not needed CMSIS files Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> commit 94aa31c3cbae7c929b8a412768b74631f4a6b461 Author: TakayukiMatsuo <62984531+TakayukiMatsuo@users.noreply.github.com> Date: Sat Aug 8 07:58:14 2020 +0900 Update wolfSSL to the latest version(v.4.4.0) (#186) * deleted old version wolfSSL before updating * updated wolfSSL to the latest version(v4.4.0) * updated wolfSSL to the latest version(v4.4.0) * added macros for timing resistance Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Co-authored-by: Ming Yue <mingyue86010@gmail.com> commit 68518f5866aac58793c737d9a46dd07a6a816aaf Author: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Fri Aug 7 14:59:24 2020 -0700 Removed a 16MByte flash image file that was checked in by mistake (several years ago). (#173) Remove the copies of lwIP that are no longer reference from demo projects. Co-authored-by: Carl Lundin <53273776+lundinc2@users.noreply.github.com> commit d4bf09480a2c77b1a25cce35b32293be61ab586f Author: m17336 <45935231+m17336@users.noreply.github.com> Date: Thu Aug 6 22:37:08 2020 +0300 Update previous AVR ATmega0 and AVR Dx projecs + addition of equivalent projects in MPLAB.X and IAR (#180) * Updated indentation in AVR_ATMega4809_Atmel_Studio and AVR_Dx_Atmel_Studio projects, plus small fixes in their readme files. * Added AVR_ATMega4809_IAR, AVR_ATMega4809_MPLAB.X, AVR_Dx_IAR and AVR_Dx_MPLAB.X demo projects. * Removed build artefacts and added .gitignore files in AVR_ATMega4809_MPLAB.X and AVR_Dx_MPLAB.X projects. Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit f32a0647c8228ddd066f5d69a85b2e49086e4c95 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon Aug 3 16:45:10 2020 -0700 Remove CBMC patch which is not used anymore (#187) * Delete 0002-Change-FreeRTOS_IP_Private.h-union-to-struct.patch * Delete 0002-Change-FreeRTOS_IP_Private.h-union-to-struct.patch commit 08af68ef9049279b265c3d00e9c48fb9594129a8 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Sat Aug 1 16:38:23 2020 -0700 Remove dependency of CBMC on Patches (#181) * Changes to DHCP * CBMC DNS changes * Changes for TCP_IP * Changes to TCP_WIN * Define away static to nothing * Remove patches * Changes after Mark's comments v1 * Update MakefileCommon.json * Correction! commit a7fec906a415363338449447daf10d7517b78848 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 17:39:36 2020 -0700 Misc changes (#183) commit 07cf5e07e4a05d6775a2f9e753269f43f82cf6ba Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 16:15:38 2020 -0700 MISRA compliance changes for FreeRTOS+TCP headers (#165) * misra changes * Update FreeRTOS_IP_Private.h * Update FreeRTOS_IP_Private.h commit e903ac0fed7ce59916899e404f3e5ae5b08d1478 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 16:03:14 2020 -0700 UPD MISRA changes (#164) Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 97551bf44e7dc7dc1e4484a8fd30f699255e8569 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 15:52:00 2020 -0700 MISRA changes in FreeRTOS_TCP_WIN.c (#162) commit f2611cc5e5999c4c87e040a8c2d2e6b5e77a16a6 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 15:38:37 2020 -0700 MISRA compliance changes in FreeRTOS_Sockets{.c/.h} (#161) * MISRA changes Sockets * add other changes * Update FreeRTOSIPConfig.h * Update FreeRTOSIPConfig.h * Update FreeRTOSIPConfig.h * Update FreeRTOSIPConfig.h * correction * Add 'U' * Update FreeRTOS_Sockets.h * Update FreeRTOS_Sockets.h * Update FreeRTOS_Sockets.c * Update FreeRTOS_Sockets.h * Update after Gary's comments * Correction reverted commit ae4d4d38d9b2685bae159b4c87619cdb157c0bf7 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 29 13:56:57 2020 -0700 MISRA compliance changes for FreeRTOS_TCP_IP.c (#160) * MISRA tcp-ip changes * Changes after Hein's comments on original PR * Update FreeRTOS_TCP_IP.c Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit a457f43c66eb0f4be9d8f8678c0e3fb8d7ebd57b Author: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Date: Tue Jul 28 13:01:38 2020 -0700 Add missing error state assignment. (#166) commit 915af50524e15a78ceb6c62b3d33f6562621ee46 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Mon Jul 27 17:30:53 2020 -0700 Add Atmel Studio projects for ATMega4809 and AVR128DA48 (#159) * Added explicit cast to allow roll over and avoid integer promotion during cycles counters comparison in recmutex.c. * Fixed type mismatch between declaration and definition of function xAreSemaphoreTasksStillRunning( void ). * Added Atmel Studio demo projects for ATMega4809 and AVR128DA48. * Per https://www.freertos.org/upgrading-to-FreeRTOS-V8.html, I'm updating portBASE_TYPE to BaseType_t. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Update register test for ATmega4809 - to cover r28, r29, r31. - call public API taskYIELD() instead of portYIELD(). * Update ATmega4809 readme.md to include info for serial port setup, and minor wording fix. Co-authored-by: Alexandru Niculae - M17336 <alexandru.niculae@microchip.com> commit 4a7a48790d64127f85cc763721b575c51c452833 Author: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Date: Thu Jul 23 10:22:33 2020 -0700 Add Uncrustify file used for Kernel. (#163) commit e0d62163b08769fd74f020709c398f994088ca96 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 22 18:06:23 2020 -0700 Sync with +TCP amazon-FreeRTOS (#158) * DNS.c commit * IP.c commit * Add various source & header files commit 8e36bee30eef2107e128edb58e83ee46e8241a91 Author: Nathan Chong <52972368+nchong-at-aws@users.noreply.github.com> Date: Tue Jul 21 12:51:20 2020 -0400 Prove buffer lemmas (#124) * Prove buffer lemmas * Update queue proofs to latest kernel source All changes were syntactic due to uncrustify code-formatting * Strengthen prvCopyDataToQueue proof * Add extract script for diff comparison Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit c720c18ada40b502436ea811e8d03dca919726d8 Author: Hein Tibosch <hein_tibosch@yahoo.es> Date: Tue Jul 14 05:35:44 2020 +0800 FreeRTOS+TCP Adding the combined driver for SAM4E and SAME70 v2 (#78) * Adding a combined +TCP driver for SAM4E and SAME70 * Changes after review from Aniruddha Co-authored-by: Hein Tibosch <hein@htibosch.net> Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> commit 4237049b12d9bb6b03694fecf6ea26a353e637c8 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon Jul 13 12:07:56 2020 -0700 Add changes from 2225-2227 amazon-FreeRTOS (#134) commit 7caa32863458c4470d3c620945c30824199f524c Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Jul 10 23:32:30 2020 -0700 Add Full TCP test suite - not using secure sockets (#131) * Add Full-TCP suite * delete unnecessary files * Change after Joshua's comments commit d7667a0034841f2968f9f9f805030cc608bfbce1 Author: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Fri Jul 3 15:45:44 2020 -0700 Remove unnecessary semicolon from the linker file (#121) This was creating problem with the onboard LPCLink debug probe. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> commit 529c481c39506d0b331bfd0cdea35e5d1aeaaad0 Author: Nathan Chong <52972368+nchong-at-aws@users.noreply.github.com> Date: Thu Jul 2 15:55:20 2020 -0400 Add VeriFast kernel queue proofs (#117) commit d5fedeaa96b5b1d3c0f6b9b52a8064ab72ff2821 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jul 1 13:56:27 2020 -0700 Add checks in FreeRTOS_Socket.c (#104) * Add fail-safes to FreeRTOS_Socket.c * Use all 'pd' errors * Correction after Hein's comments * Correction after Hein's comments v2 * Changes after Hein's comments * Update after Gary's comments commit a9b2aac4e9fda2a259380156df9cc0af51384d2d Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Jun 26 12:09:36 2020 -0700 Folder structure change + Fix broken Projects (#103) * Update folder structure * Correct project files * Move test folder * Some changes after Yuki's comments commit 98bfc38bf3404414878dc68ea41753bea4e24c8e Author: Hein Tibosch <hein_tibosch@yahoo.es> Date: Thu Jun 25 13:01:45 2020 +0800 FreeRTOS+TCP : add memory statistics and dump packets, v3 (#83) * FreeRTOS+TCP : add memory statistics and dump packets, v3 * Two changes as requested by Aniruddha Co-authored-by: Hein Tibosch <hein@htibosch.net> Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> commit 072a173c9df31c75ff64bde440f3f316cedb9033 Author: S.Burch <8697966+wholl0p@users.noreply.github.com> Date: Mon Jun 22 23:39:26 2020 +0200 Fixed Imports for Infineon XMC1100 Board (#88) Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com> commit 2df5eeef5763045c4c74ff0e2a4091b7d19bea89 Author: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Mon Jun 8 14:22:46 2020 -0700 Feature/multiple direct to task notifications (#73) * Add TaskNotifyArray.c with the single task tests updated to use the task notification array up to the point where the timer is created. * Continue working on TaskNotifyArray.c to test the new task notification indexes. Next TaskNotifyArray.c will be refactored to break the tests up a bit. * Refactor and update the comments in TaskNotifyArray.c - no functional changes. * Change from the task notify "array" to task notification "indexed" nomenclature in the new task notification API functions that work on one particular task notification with the array of task notifications. * Update the implementation of the taskNOTIFY_TAKE() and taskNOTIFY_WAIT() trace macros to take the array index of the task notification they are acting on. Rename configNUMBER_OF_TASK_NOTIFICATIONS to configTASK_NOTIFICATION_ARRAY_ENTRIES. Add FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c to the Visual Studio project - the file implements tests specific to the behaviour of the indexed task notification functions and should be used in addition to the tests already provided in FreeRTOS/Demo/Common/Minimal/TaskNotify.c. commit b9e4ecfaf7286d8493d4a96a93fbb325534ad97b Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Jun 5 11:10:58 2020 -0700 Remove Empty and Un-referenced folder from Demo (#86) commit f11bcc8acc57a23fb03603762e758c25b9d0efb7 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Jun 3 16:52:31 2020 -0700 Fix a Bug and corresponding CBMC patch (#84) * Update remove-static-in-freertos-tcp-ip.patch * Update FreeRTOS_TCP_IP.c * Update remove-static-in-freertos-tcp-ip.patch * Update remove-static-in-freertos-tcp-ip.patch Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit bb9f92f771e5f6ea2b9b09c7e89130a75e562eb7 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Wed Jun 3 10:46:55 2020 -0700 Submodule FreeRTOS/Source 10bbbcf0b..6199b72fb (#82) commit 6efc39f44be5b269168836e95aebbdb8ae77dce3 Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Tue Jun 2 15:09:25 2020 -0700 Add Project for running integration tests v2 (#80) * Project for integration tests * relative paths in project files * relative paths in project files-1 * relative paths in project files-2 * addressed comments * addressed comments v2 Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 0eb5909fb02bac9dc074ff1bc2fe338d77f73764 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Thu May 28 17:05:24 2020 -0700 readme.md for ATmega328PB Xplained Mini. (#76) readme.md to get users jump started. commit cb7edd2323a77f3dbea144c1f48f95582becc99e Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu May 28 10:11:58 2020 -0700 Sync with a:FR (#75) * AFR sync * AFR sync: CBMC * AFR sync: CBMC: remove .bak files * AFR sync: CBMC: more cleanup * Corrected CBMC proofs * Corrected CBMC patches * Corrected CBMC patches-1 * Corrected CBMC patches-2 * remove .bak files (3) Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 6557291e5407ca7ec6beca53fced1aaa620c5c02 Author: alfred gedeon <alfred2g@hotmail.com> Date: Wed May 27 14:44:33 2020 -0700 Test: Add Linux Networking support with demo application (#71) * Test: Add Linux Networking support with demo application * Test: revert files affected by uncrustify * Test: revert files affected by uncrustify Co-authored-by: Alfred Gedeon <gedeonag@amazon.com> Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 8b079bc394e7b205d72210ce9e052404d782938f Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Wed May 27 10:44:03 2020 -0700 ATmega328PB Xplained Mini -- demo project for ATmega port. (#70) * Bootstrap a demo from START. No driver is added in this commit. * Add FreeRTOS source code to project. Remove unnecessary folder nesting. Heap_4 is used here. * Copy over main.c, FreeRTOSConfig.h, and regtest.{c, h}. This commit compiles, but will need some work on timer used. * This port has 2KB RAM. We are using 1KB for heap. Further decreasing minimum stack size, and also use stack overflow check 1 to save some stack space. * Preserve EEPROM set to false. * End of the line. * Reduce register test stack size. 32 8-bit register + 10 bytes for stack frame cost. Round up to 50. * Adding Queue test in Integer test. - g3 to easy debugging. - mainCHECK_PERIOD is set to 1000 ticks. Note that this port for now use WDT as tick timer, and period is set to 15ms. - vErrorChecks, is of highest priority. So if this task gets run before other tasks, the very first check will fail. * Avoid false alarm. Since we don't know in which order the tasks are scheduled, clearing any error for the first entry of vErrorChecks. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * ParTest.c to init, set, toggle onboard user LED at PB5. * Added a task to blink onboard user LED. Need a magic number for stack size. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Explicitly setting timing slicing to 0. This is to avoid unecessary context switch when multiple tasks are of the same priority. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * Add taskYIELD() at the end of the loop in each register test task. This is to give other tasks of the same priority a chance to run, regardless of scheduling algorithm. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> * minor, update comment in main.c. commit 95a3a02f95749fb7a600723076e291f9dee7426c Author: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri May 22 16:26:59 2020 -0700 FreeRTOS-Plus: Unit testing Infrastructure and examples (#72) * Added CMock as submodule * Makefile added * Removed TEMP from Makefile * Added configuration files and header files * Update Makefile * Test runner working * make clean * Example added with README * Update README.md * Restored +TCP files * Cleared +TCP changes * removed comments from Makefile * Update README.md * Update README.md * Update README.md * Updated Test/Unit-test/readme.md commit 5003d17feda25490e655c0f1c15d2b13e395c9f7 Author: Hein Tibosch <hein_tibosch@yahoo.es> Date: Wed May 6 14:16:56 2020 -0400 FreeRTOS+TCP : renewing DHCP lease while network is down (#53) Co-authored-by: Hein Tibosch <hein@htibosch.net> Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com> commit d95624c5d6ba95ec0474867d7165de2c28ed41b7 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Tue May 5 09:57:18 2020 -0700 Move CBMC proofs to FreeRTOS+ directory (#64) * move CBMC proofs to FreeRTOS+ directory * Failing proofs corrected * ParseDNSReply proof added back * removed queue_init.h from -Plus/Test Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 95ae7c65758a9473ea16ab08182f056f72331de2 Author: markrtuttle <tuttle@acm.org> Date: Wed Apr 29 04:27:45 2020 +0000 Change cbmc-viewer invocation in CBMC makefile (#63) * Exclude FreeRTOS/Demo from CBMC proof reports. The script cbmc-viewer generates the CBMC proof reports. The script searches source files for symbol definitions and annotates source files with coverage information. This patch causes cbmc-viewer to ignore the directory FreeRTOS/Demo containing 348M of data. The script now terminates in a few seconds. * Make report default target for CBMC Makefile. Modify the Makefile for CBMC proofs to generate the report by default (and not just property checking) and modify property checking to ignore failures (due to property assertions failing) and terminating report generation. Co-authored-by: Mark R. Tuttle <mrtuttle@amazon.com> commit d421ccc89f6f6473dfdd566a00567b0e1fd4cfc3 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Sat Apr 25 16:57:35 2020 -0700 Reword readme.md under ./Test. (#61) commit 38412865985235b90dbd9da9708b68c4de5918f5 Author: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Date: Sat Apr 25 16:56:54 2020 -0700 Removed a:FR reference. (#60) commit 4db195c916c7b13c82ab3a34a499fe606f266810 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Tue Apr 21 15:40:08 2020 -0700 Adding FreeRTOS+TCP CBMC proofs to FreeRTOS/FreeRTOS (#56) ParseDNSReply is to be added in the next PR. commit 40a31b6d35a866a3a6c551d95bf08dae855da5bd Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon Apr 13 13:58:33 2020 -0700 'uL' -> 'UL' commit 5b3a289b69fc92089aa8bd4d1b44ab816f326f73 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon Apr 13 13:50:53 2020 -0700 Changes after Gary's comments commit edf68637dd22470a8d4f59fecc15b51379bcfeda Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Apr 10 16:26:03 2020 -0700 Update FreeRTOS_ARP.c commit 35f3ac32a8899dd714a8a48952a4224fbcebc4aa Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Apr 10 15:56:18 2020 -0700 correct debug output commit 5e12a70db4b6a8e68a434489683306f040252efa Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Apr 10 15:44:45 2020 -0700 Debugging flag check added commit 4e8ac8de25ac4088b9c789b88a77cd39df4d9167 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu Apr 9 16:57:19 2020 -0700 Comment style consistency and Yuhui's suggestions commit e43f7cd086096ad60491fedba69927a1e1a82f20 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu Apr 9 16:47:41 2020 -0700 Cleanup commit ab3b51c7a0d880a6bf453ec63ae604e15050f310 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu Apr 9 16:33:03 2020 -0700 Update after Gary's comments commit 97f7009699ffb972c0745dfdb526d1fa4e0faf84 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 8 14:30:15 2020 -0700 Update after richard's comments commit a9fcafc074cec559dd67961ef44273df6180c2db Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 8 14:07:39 2020 -0700 Corrected the formatting - visual studio had messed up the formatting commit c381861014a8043ce30723fc5a8cf5107719c8df Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 8 13:01:12 2020 -0700 commit 2 after gary's comments commit 75677a8d85fa802cca9058d6e23796d5043a0982 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 8 12:51:10 2020 -0700 Commit after Gary's comments commit 666c0da366030109db2c0c5e7253cebb2f899db7 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 8 10:56:01 2020 -0700 Update after Yuhui's comments - removed (void) from before memcpy, memset etc. - corrected memcpy style as suggested by Yuhui - Added logging for xNetworkInterfaceOutput. No need to configASSERT commit 4a1148d15b6b8169d2412f8179f734683b179795 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Apr 1 16:05:36 2020 -0700 Coverity + MISRA compliance Modified code to conform to the MISRA directives more closely. commit fa74f7dccf6b1a356993c6a894f8e1173b8c8157 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Thu Apr 2 20:26:10 2020 -0700 Removing writes to read-only PLIC interrupt pending registers. Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> commit 5b9777e11e16609648fb98d2f9a47553ab238950 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 31 10:45:23 2020 -0700 A readme file to introduce what ./Test directory is about. commit 211bb4cbd9ae6dfa95e8d8501f37d272bde5ab26 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 24 15:14:24 2020 -0700 Ignore whitespace when working with patches. commit 8156f64d1c45dd59ef12279f19a99f03e79e1f8a Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Feb 25 18:04:23 2020 -0800 Copying CBMC proofs from aws/amazon-freertos repo ./tools/cbmc to this repo ./FreeRTOS/Test/CBMC as is. The commit ID in aws/amazon-freertos is 0c8e0217f2a43bdeb364b58ae01c6c259e03ef1b. commit 9f316c246baafa15c542a5aea81a94f26e3d6507 Author: David Vrabel <david.vrabel@cambridgeconsultants.com> Date: Mon Mar 16 11:21:46 2020 +0000 Demo/Posix_GCC: add demo application for Posix port using GCC This is largely a copy of the Windows demo application with a few key changes: - heap_3 (use malloc()/free()) so tools like valgrind "just work". - printf() wrapped in a mutex to prevent deadlocks on the internal pthread mutexes inside printf(). SCons (https://scons.org/) is used as the build system. This will be built as a 64-bit application, but note that the memory allocation trace points only record the lower 32-bits of the address. commit f78f919b3e2f0d707531a301a8ca07cd02bc4778 Author: Markus Rinne <markus.ka.rinne@gmail.com> Date: Thu Mar 19 21:00:24 2020 +0200 Fix function comments commit 1cd2d38d960a3576addb224582c88489bade5141 Author: David Chalco <david@chalco.io> Date: Fri Mar 20 10:29:05 2020 -0700 unix separators for path and remove .exe suffix from risc compiler (works on windows/mac) commit 938b19419eded12817737ab0644e94ed2ba7e95d Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Thu Mar 19 18:23:09 2020 -0700 Removing ./FreeRTOS-Labs directory, since: - IoT libraries are now in LTS branch. - FAT/POSIX/Light-weight MQTT are in https://github.com/FreeRTOS/FreeRTOS-Labs. commit 1a4abbc9e91b13fd6394464ade59d5e048320c7c Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 17 19:30:02 2020 -0700 Maintenance -- clean up readme.txt and add url to GitHub. (#38) * Removing readme.txt, as now we have README.md in place. The only information missing from README.md is about FAQ. * Adding FAQ information in README.md. * Adding a .url to root to redict user to FreeRTOS github home page. commit 47bb466aa19395b7785bcb830e2e4dd35f6bafc5 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 17 13:07:44 2020 -0700 Update issue templates Template maintenance. - adding title prefix. - adding examples to "additional context" section. commit f506290041f56867765f8efa70ed2862125bdb7c Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 17 10:15:07 2020 -0700 Create SECURITY.md Apply the recommended SECURITY.md from AWS to our repo. commit 8982a2f80a80a2a0a47cf82de07b52101bd9d606 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Fri Mar 13 12:50:10 2020 -0700 Add ./lib directory to make sure Zynq project compiles. commit ecf0f12aa14ad6fdafe1ef37257cbb4e03e2abd5 Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed Mar 11 10:19:48 2020 -0700 Sync up with Amazon-freertos repo (10th March 2020) (#34) * Sync up with amazon-freertos * Sync up with amazon-freertos * Sync up with amazon-freertos commit 0acffef047973e2e61c2201fd69cd9bbd317f674 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Mar 10 10:20:48 2020 -0700 GitHub PR template. (#29) commit c40a6da2e4cb8042b56d1b174051cbbe9813781a Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Mon Mar 9 11:18:48 2020 -0700 pass payload length when calling UDP callback (#30) * pass payload length when calling UDP callback commit 12d580e93d4d9074b9a867632f0681a511b4ad12 Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Fri Mar 6 18:16:51 2020 -0800 Update issue templates Initial issue template. Created following https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser. If change is needed, we could go another round. commit 9debffb5e0e42ff716f58b2270b3af09652294af Author: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Fri Mar 6 17:27:46 2020 -0800 Update README.md to remove dead link. See the conversation https://github.com/FreeRTOS/FreeRTOS/commit/42c627b2b88cb3b487fea983d8b566a8bbae54fa#comments . Linkage for both ```./FreeRTOS/Source``` and ```./FreeRTOS/Demo``` are removed, since it looks weird to only provide linkage to Demo. commit 7e1a4bf563240501fc45167aee9d929c533939dd Author: AniruddhaKanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Fri Mar 6 15:18:09 2020 -0800 Fix DHCP option Client-identifier (#28) commit 42c627b2b88cb3b487fea983d8b566a8bbae54fa Author: Yuhui.Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Fri Mar 6 09:15:11 2020 -0800 Update readme and revert relative URL. (#27) * Reordering: bumping cloning instruction up. * Rewording readme.md to be clear kernel code is a submodule of this repository. * Reverting relative URL, since user cannot click through on GitHub page. (With URL, user could still download the correct version of the code. Reverting simply due to UI issue.) commit 5751ae9b60e248ebd0b4dd7c58df54364d2bb9d5 Author: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Fri Mar 6 09:11:42 2020 -0800 Update CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso project (#26) This commit updates the project for LPC55S69 so that it works with the latest version of MCUXpresso and SDK. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> commit a9ffffe1f01f45f79e127c15727784984077932f Author: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Date: Thu Mar 5 17:16:13 2020 -0800 Using Relative URL For Submoduling. (#24) commit 52c82076b38fe73d1dc46c97abf74ae9b803696c Author: Carl Lundin <53273776+lundinc2@users.noreply.github.com> Date: Thu Mar 5 09:16:31 2020 -0800 use relative path to point to bundled toolchain instead (#25) commit b877e4ec478de2c24d07ab46241070d7c66f375c Author: lundinc2 <53273776+lundinc2@users.noreply.github.com> Date: Tue Feb 25 13:18:38 2020 -0800 Moved vulnerability reporting and code of conduct to top of CONTRIBUTING.md (#20) commit bef165d46799fb8faa58aaa224f80c16b6538e69 Author: Yuhui.Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Feb 18 22:06:38 2020 -0800 Linking test source file from relative path. (#19) commit 89e7bbe292afd3912d1f0b2402cc506878bad869 Author: Yuhui.Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Tue Feb 18 17:47:55 2020 -0800 A preliminary .gitignore file, to prevent us checking in files unnecessary. (#18) https://github.com/github/gitignore. commit c2a98127acb48c4562233230e66ca5c282688579 Author: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Sun Feb 16 13:19:53 2020 -0800 Minor wording changes in the 'previous releases' section of the readme.me file. (#17) commit 24c772d1439e5c291c0a29fce0a46996ca8afaa9 Author: Yuhui.Zheng <10982575+yuhui-zheng@users.noreply.github.com> Date: Fri Feb 14 12:47:01 2020 -0800 Submodule kernel directory. (#16) * Removing FreeRTOS/Source in readiness for submoduling. * Submoduling kernel. * README.md update due to submoduling. When releasing, please follow these steps: 1. in local directory, clean directory and check "git status" shows "nothing to commit, working tree clean" for ALL subdirectories. 2. copy source code and instructions only to an empty folder. Git related should not be in this folder -- this covers .git, .gitignore, .github, .gitmodules, gitmessages, ...... 3. zip the folder from step 2. (create both .zip and .7z) 4. attach .zip and .7z to the release. (e.g. attach these two in new release -- https://github.com/FreeRTOS/FreeRTOS/releases/new) 5. PLEASE download both, unzip, diff with your local git repo. (should not see any difference other than git related.) And, sanity check a couple of projects. commit c3f8b91652392dc55e0d7067b90a40de5f5f0837 Author: Rashed Talukder <9218468+rashedtalukder@users.noreply.github.com> Date: Thu Feb 13 17:47:14 2020 -0800 Update readme. Fixed typos and cli commands (#14) commit 4723b825f2989213c1cdb2ebf4d6793e0292e363 Author: Julian Poidevin <julian-poidevin@users.noreply.github.com> Date: Fri Feb 14 02:43:36 2020 +0100 Fixed wrong git clone SSH command (#13) Replaced bad https URL with proper SSH URL commit fc819b821715c42602819e58499846147a6394f5 Author: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Date: Thu Feb 13 17:42:22 2020 -0800 Correct the xTimerCreate() documentation which said NULL was returned if the timer period was passed into the function as 0, whereas that is not the case. (#15) Add a note to the documentation for both the xTimerCreate() and xTimerCreateStatic() functions that the timer period must be greater than 0. commit 1c711ab530b5f0dbd811d7d62e0a3763706ffff4 Author: Rashed Talukder <9218468+rashedtalukder@users.noreply.github.com> Date: Wed Feb 12 23:00:18 2020 -0800 Updated contributions guidelines (#12) commit 84fcc0d5317d96c6b086034093c8c1c83e050819 Author: Cobus van Eeden <35851496+cobusve@users.noreply.github.com> Date: Wed Feb 12 15:05:06 2020 -0800 Updates to Markdown files and readme.txt (#11) git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2826 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS/Demo/Posix_GCC')
-rw-r--r--FreeRTOS/Demo/Posix_GCC/.gitignore4
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h66
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h307
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/SConscript26
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c288
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c372
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h40
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/main.c97
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/main_networking.c321
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c75
-rw-r--r--FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h18
11 files changed, 1578 insertions, 36 deletions
diff --git a/FreeRTOS/Demo/Posix_GCC/.gitignore b/FreeRTOS/Demo/Posix_GCC/.gitignore
new file mode 100644
index 000000000..061e55f6f
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/.gitignore
@@ -0,0 +1,4 @@
+.sconsign.dblite
+build/
+src/FreeRTOS
+src/FreeRTOS-Plus
diff --git a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h b/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h
index 3c11b8aec..c85297250 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSConfig.h
@@ -118,7 +118,7 @@ functions anyway. */
#define sbSEND_COMPLETED( pxStreamBuffer ) vGenerateCoreBInterrupt( pxStreamBuffer )
#endif /* configINCLUDE_MESSAGE_BUFFER_AMP_DEMO */
-extern void vAssertCalled( unsigned long ulLine, const char * const pcFileName );
+extern void vAssertCalled( const char * const pcFileName, unsigned long ulLine );
/* projCOVERAGE_TEST should be defined on the command line so this file can be
used with multiple project configurations. If it is
@@ -146,7 +146,7 @@ used with multiple project configurations. If it is
configASSERT() when performing code coverage tests though, as it is not
intended to asserts() to fail, some some code is intended not to run if no
errors are present. */
- #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __LINE__, __FILE__ )
+ #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled( __FILE__, __LINE__ )
#define configUSE_MALLOC_FAILED_HOOK 1
@@ -154,5 +154,67 @@ used with multiple project configurations. If it is
#include "trcRecorder.h"
#endif
+/* networking definitions */
+#define configMAC_ISR_SIMULATOR_PRIORITY ( configMAX_PRIORITIES - 1 )
+#define ipconfigUSE_NETWORK_EVENT_HOOK 1
+//#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME pdMS_TO_TICKS(5000)
+#define configNETWORK_INTERFACE_TO_USE 1L
+
+/* The address of an echo server that will be used by the two demo echo client
+tasks.
+http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Clients.html
+http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/UDP_Echo_Clients.html */
+
+#define configECHO_SERVER_ADDR0 172
+#define configECHO_SERVER_ADDR1 19
+#define configECHO_SERVER_ADDR2 195
+#define configECHO_SERVER_ADDR3 36
+
+/* Default MAC address configuration. The demo creates a virtual network
+connection that uses this MAC address by accessing the raw Ethernet/WiFi data
+to and from a real network connection on the host PC. See the
+configNETWORK_INTERFACE_TO_USE definition above for information on how to
+configure the real network connection to use. */
+#define configMAC_ADDR0 0x00
+#define configMAC_ADDR1 0x11
+#define configMAC_ADDR2 0x22
+#define configMAC_ADDR3 0x33
+#define configMAC_ADDR4 0x44
+#define configMAC_ADDR5 0x41
+
+/* 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 172
+#define configIP_ADDR1 19
+#define configIP_ADDR2 195
+#define configIP_ADDR3 37
+
+/* 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 172
+#define configGATEWAY_ADDR1 19
+#define configGATEWAY_ADDR2 192
+#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 10
+#define configDNS_SERVER_ADDR1 4
+#define configDNS_SERVER_ADDR2 4
+#define configDNS_SERVER_ADDR3 10
+
+/* 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 255
+#define configNET_MASK2 240
+#define configNET_MASK3 0
+
+/* The UDP port to which print messages are sent. */
+#define configPRINT_PORT ( 15000 )
#endif /* FREERTOS_CONFIG_H */
diff --git a/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h b/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h
new file mode 100644
index 000000000..261774fad
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/FreeRTOSIPConfig.h
@@ -0,0 +1,307 @@
+/*
+ * FreeRTOS Kernel V10.3.0
+ * 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
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+
+/*****************************************************************************
+ *
+ * See the following URL for configuration information.
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html
+ *
+ *****************************************************************************/
+
+#ifndef FREERTOS_IP_CONFIG_H
+#define FREERTOS_IP_CONFIG_H
+
+/* Prototype for the function used to print out. In this case it prints to the
+console before the network is connected then a UDP port after the network has
+connected. */
+extern void vLoggingPrintf( const char *pcFormatString, ... );
+
+/* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to
+1 then FreeRTOS_debug_printf should be defined to the function used to print
+out the debugging messages. */
+#define ipconfigHAS_DEBUG_PRINTF 1
+#if( ipconfigHAS_DEBUG_PRINTF == 1 )
+ #define FreeRTOS_debug_printf(X) vLoggingPrintf X
+#endif
+
+/* Set to 1 to print out non debugging messages, for example the output of the
+FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1
+then FreeRTOS_printf should be set to the function used to print out the
+messages. */
+#define ipconfigHAS_PRINTF 1
+#if( ipconfigHAS_PRINTF == 1 )
+ #define FreeRTOS_printf(X) vLoggingPrintf X
+#endif
+
+/* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing
+on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */
+#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN
+
+/* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums)
+then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software
+stack repeating the checksum calculations. */
+#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1
+
+/* Several API's will block until the result is known, or the action has been
+performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be
+set per socket, using setsockopt(). If not set, the times below will be
+used as defaults. */
+#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 )
+#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 )
+
+/* Include support for LLMNR: Link-local Multicast Name Resolution
+(non-Microsoft) */
+#define ipconfigUSE_LLMNR ( 1 )
+
+/* Include support for NBNS: NetBIOS Name Service (Microsoft) */
+#define ipconfigUSE_NBNS ( 1 )
+
+/* Include support for DNS caching. For TCP, having a small DNS cache is very
+useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low
+and also DNS may use small timeouts. If a DNS reply comes in after the DNS
+socket has been destroyed, the result will be stored into the cache. The next
+call to FreeRTOS_gethostbyname() will return immediately, without even creating
+a socket. */
+#define ipconfigUSE_DNS_CACHE ( 1 )
+#define ipconfigDNS_CACHE_NAME_LENGTH ( 16 )
+#define ipconfigDNS_CACHE_ENTRIES ( 4 )
+#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 )
+
+/* The IP stack executes it its own task (although any application task can make
+use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY
+sets the priority of the task that executes the IP stack. The priority is a
+standard FreeRTOS task priority so can take any value from 0 (the lowest
+priority) to (configMAX_PRIORITIES - 1) (the highest priority).
+configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in
+FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to
+the priority assigned to the task executing the IP stack relative to the
+priority assigned to tasks that use the IP stack. */
+#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
+
+/* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP
+task. This setting is less important when the FreeRTOS Win32 simulator is used
+as the Win32 simulator only stores a fixed amount of information on the task
+stack. FreeRTOS includes optional stack overflow detection, see:
+http://www.freertos.org/Stacks-and-stack-overflow-checking.html */
+#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 )
+
+/* ipconfigRAND32() is called by the IP stack to generate random numbers for
+things such as a DHCP transaction number or initial sequence number. Random
+number generation is performed via this macro to allow applications to use their
+own random number generation method. For example, it might be possible to
+generate a random number by sampling noise on an analogue input. */
+extern UBaseType_t uxRand();
+#define ipconfigRAND32() uxRand()
+
+/* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the
+network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK
+is not set to 1 then the network event hook will never be called. See
+http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml
+*/
+#define ipconfigUSE_NETWORK_EVENT_HOOK 1
+
+/* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but
+a network buffer cannot be obtained then the calling task is held in the Blocked
+state (so other tasks can continue to executed) until either a network buffer
+becomes available or the send block time expires. If the send block time expires
+then the send operation is aborted. The maximum allowable send block time is
+capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the
+maximum allowable send block time prevents prevents a deadlock occurring when
+all the network buffers are in use and the tasks that process (and subsequently
+free) the network buffers are themselves blocked waiting for a network buffer.
+ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
+milliseconds can be converted to a time in ticks by dividing the time in
+milliseconds by portTICK_PERIOD_MS. */
+#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
+
+/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
+address, netmask, DNS server address and gateway address from a DHCP server. If
+ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The
+stack will revert to using the static IP address even when ipconfigUSE_DHCP is
+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 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
+and accepted, or the interval between transmissions reaches
+ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
+static IP address passed as a parameter to FreeRTOS_IPInit() if the
+re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
+a DHCP reply being received. */
+#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
+
+/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
+stack can only send a UDP message to a remove IP address if it knowns the MAC
+address associated with the IP address, or the MAC address of the router used to
+contact the remote IP address. When a UDP message is received from a remote IP
+address the MAC address and IP address are added to the ARP cache. When a UDP
+message is sent to a remote IP address that does not already appear in the ARP
+cache then the UDP message is replaced by a ARP message that solicits the
+required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
+number of entries that can exist in the ARP table at any one time. */
+#define ipconfigARP_CACHE_ENTRIES 6
+
+/* ARP requests that do not result in an ARP response will be re-transmitted a
+maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
+aborted. */
+#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
+
+/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
+table being created or refreshed and the entry being removed because it is stale.
+New ARP requests are sent for ARP cache entries that are nearing their maximum
+age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
+equal to 1500 seconds (or 25 minutes). */
+#define ipconfigMAX_ARP_AGE 150
+
+/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
+routines, which are relatively large. To save code space the full
+FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster
+alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr()
+takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter.
+FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets
+(for example, 192, 168, 0, 1) as its parameters. If
+ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
+FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
+not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
+#define ipconfigINCLUDE_FULL_INET_ADDR 1
+
+/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
+are available to the IP stack. The total number of network buffers is limited
+to ensure the total amount of RAM that can be consumed by the IP stack is capped
+to a pre-determinable value. */
+#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
+
+/* A FreeRTOS queue is used to send events from application tasks to the IP
+stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
+be queued for processing at any one time. The event queue must be a minimum of
+5 greater than the total number of network buffers. */
+#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
+
+/* The address of a socket is the combination of its IP address and its port
+number. FreeRTOS_bind() is used to manually allocate a port number to a socket
+(to 'bind' the socket to a port), but manual binding is not normally necessary
+for client sockets (those sockets that initiate outgoing connections rather than
+wait for incoming connections on a known port number). If
+ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling
+FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP
+stack automatically binding the socket to a port number from the range
+socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If
+ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto()
+on a socket that has not yet been bound will result in the send operation being
+aborted. */
+#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1
+
+/* Defines the Time To Live (TTL) values used in outgoing UDP packets. */
+#define ipconfigUDP_TIME_TO_LIVE 128
+#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */
+
+/* USE_TCP: Use TCP and all its features */
+#define ipconfigUSE_TCP ( 1 )
+
+/* USE_WIN: Let TCP use windowing mechanism. */
+#define ipconfigUSE_TCP_WIN ( 1 )
+
+/* The MTU is the maximum number of bytes the payload of a network frame can
+contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
+lower value can save RAM, depending on the buffer management scheme used. If
+ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
+be divisible by 8. */
+#define ipconfigNETWORK_MTU 1200U
+
+/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
+through the FreeRTOS_gethostbyname() API function. */
+#define ipconfigUSE_DNS 1
+
+/* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will
+generate replies to incoming ICMP echo (ping) requests. */
+#define ipconfigREPLY_TO_INCOMING_PINGS 1
+
+/* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the
+FreeRTOS_SendPingRequest() API function is available. */
+#define ipconfigSUPPORT_OUTGOING_PINGS 0
+
+/* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select()
+(and associated) API function is available. */
+#define ipconfigSUPPORT_SELECT_FUNCTION 1
+
+/* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames
+that are not in Ethernet II format will be dropped. This option is included for
+potential future IP stack developments. */
+#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1
+
+/* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the
+responsibility of the Ethernet interface to filter out packets that are of no
+interest. If the Ethernet interface does not implement this functionality, then
+set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack
+perform the filtering instead (it is much less efficient for the stack to do it
+because the packet will already have been passed into the stack). If the
+Ethernet driver does all the necessary filtering in hardware then software
+filtering can be removed by using a value other than 1 or 0. */
+#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1
+
+/* The windows simulator cannot really simulate MAC interrupts, and needs to
+block occasionally to allow other tasks to run. */
+#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
+
+/* Advanced only: in order to access 32-bit fields in the IP packets with
+32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
+This has to do with the contents of the IP-packets: all 32-bit fields are
+32-bit-aligned, plus 16-bit(!) */
+#define ipconfigPACKET_FILLER_SIZE 2U
+
+/* Define the size of the pool of TCP window descriptors. On the average, each
+TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6
+outstanding packets (for Rx and Tx). When using up to 10 TP sockets
+simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */
+#define ipconfigTCP_WIN_SEG_COUNT 240
+
+/* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed
+maximum size. Define the size of Rx buffer for TCP sockets. */
+#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 )
+
+/* Define the size of Tx buffer for TCP sockets. */
+#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 )
+
+/* When using call-back handlers, the driver may check if the handler points to
+real program memory (RAM or flash) or just has a random non-zero value. */
+#define ipconfigIS_VALID_PROG_ADDRESS(x) ( (x) != NULL )
+
+/* Include support for TCP hang protection. All sockets in a connecting or
+disconnecting stage will timeout after a period of non-activity. */
+#define ipconfigTCP_HANG_PROTECTION ( 1 )
+#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 )
+
+/* Include support for TCP keep-alive messages. */
+#define ipconfigTCP_KEEP_ALIVE ( 1 )
+#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */
+
+#define portINLINE __inline
+
+#endif /* FREERTOS_IP_CONFIG_H */
diff --git a/FreeRTOS/Demo/Posix_GCC/src/SConscript b/FreeRTOS/Demo/Posix_GCC/src/SConscript
index 962556ce3..5768f64d0 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/SConscript
+++ b/FreeRTOS/Demo/Posix_GCC/src/SConscript
@@ -25,14 +25,19 @@ Import("env")
env.Append(CPPPATH = [
".",
+ "./utils",
"FreeRTOS/Source/include",
"FreeRTOS/Source/portable/ThirdParty/GCC/Posix",
"FreeRTOS/Demo/Common/include",
"FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/Compiler/GCC/",
])
env.Append(LIBS = [
"pthread",
+ "pcap",
])
src = [
@@ -40,7 +45,11 @@ src = [
"main.c",
"main_blinky.c",
"main_full.c",
+ "main_networking.c",
"run-time-stats-utils.c",
+ "utils/wait_for_event.c",
+ "SimpleTCPEchoServer.c",
+ "TCPEchoClient_SingleTasks.c",
# FreeRTOS kernel
"FreeRTOS/Source/event_groups.c",
@@ -56,6 +65,19 @@ src = [
# Posix port.
"FreeRTOS/Source/portable/ThirdParty/GCC/Posix/port.c",
+ # FreeRTOS TCP
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DNS.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DHCP.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_ARP.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_WIN.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Stream_Buffer.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_2.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_UDP_IP.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Sockets.c",
+ "FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/NetworkInterface/linux/NetworkInterface.c",
+
# Demo library.
"FreeRTOS/Demo/Common/Minimal/AbortDelay.c",
"FreeRTOS/Demo/Common/Minimal/BlockQ.c",
@@ -92,10 +114,14 @@ if GetOption("coverage"):
env.Append(CFLAGS = [
"-fprofile-arcs",
"-ftest-coverage",
+ "-ggdb3",
+ "-Og",
])
env.Append(LINKFLAGS = [
"-fprofile-arcs",
"-ftest-coverage",
+ "-ggdb3",
+ "-Og",
])
src += [
diff --git a/FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c b/FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c
new file mode 100644
index 000000000..2a2c704d7
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/SimpleTCPEchoServer.c
@@ -0,0 +1,288 @@
+/*
+ FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
+ All rights reserved
+
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License (version 2) as published by the
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
+
+ ***************************************************************************
+ >>! NOTE: The modification to the GPL is included to allow you to !<<
+ >>! distribute a combined work that includes FreeRTOS without being !<<
+ >>! obliged to provide the source code for proprietary components !<<
+ >>! outside of the FreeRTOS kernel. !<<
+ ***************************************************************************
+
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following
+ link: http://www.freertos.org/a00114.html
+
+ ***************************************************************************
+ * *
+ * FreeRTOS provides completely free yet professionally developed, *
+ * robust, strictly quality controlled, supported, and cross *
+ * platform software that is more than just the market leader, it *
+ * is the industry's de facto standard. *
+ * *
+ * Help yourself get started quickly while simultaneously helping *
+ * to support the FreeRTOS project by purchasing a FreeRTOS *
+ * tutorial book, reference manual, or both: *
+ * http://www.FreeRTOS.org/Documentation *
+ * *
+ ***************************************************************************
+
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
+ the FAQ page "My application does not run, what could be wrong?". Have you
+ defined configASSERT()?
+
+ http://www.FreeRTOS.org/support - In return for receiving this top quality
+ embedded software for free we request you assist our global community by
+ participating in the support forum.
+
+ http://www.FreeRTOS.org/training - Investing in training allows your team to
+ be as productive as possible as early as possible. Now you can receive
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
+ Ltd, and the world's leading authority on the world's leading RTOS.
+
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.
+
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
+
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
+ licenses offer ticketed support, indemnification and commercial middleware.
+
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+ engineered and independently SIL3 certified version for use in safety and
+ mission critical applications that require provable dependability.
+
+ 1 tab == 4 spaces!
+*/
+
+/*
+ * FreeRTOS tasks are used with FreeRTOS+TCP to create a TCP echo server on the
+ * standard echo port number (7).
+ *
+ * See the following web page for essential demo usage and configuration
+ * details:
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Echo_Server.html
+ */
+
+/* Standard includes. */
+#include <stdint.h>
+#include <stdio.h>
+
+/* FreeRTOS includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "semphr.h"
+
+/* FreeRTOS+TCP includes. */
+#include "FreeRTOS_IP.h"
+#include "FreeRTOS_Sockets.h"
+
+/* Remove the whole file if FreeRTOSIPConfig.h is set to exclude TCP. */
+#if( ipconfigUSE_TCP == 1 )
+
+/* The maximum time to wait for a closing socket to close. */
+#define tcpechoSHUTDOWN_DELAY ( pdMS_TO_TICKS( 5000 ) )
+
+/* The standard echo port number. */
+#define tcpechoPORT_NUMBER 7
+
+/* If ipconfigUSE_TCP_WIN is 1 then the Tx sockets will use a buffer size set by
+ipconfigTCP_TX_BUFFER_LENGTH, and the Tx window size will be
+configECHO_SERVER_TX_WINDOW_SIZE times the buffer size. Note
+ipconfigTCP_TX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
+stack constant, whereas configECHO_SERVER_TX_WINDOW_SIZE is set in
+FreeRTOSConfig.h as it is a demo application constant. */
+#ifndef configECHO_SERVER_TX_WINDOW_SIZE
+ #define configECHO_SERVER_TX_WINDOW_SIZE 2
+#endif
+
+/* If ipconfigUSE_TCP_WIN is 1 then the Rx sockets will use a buffer size set by
+ipconfigTCP_RX_BUFFER_LENGTH, and the Rx window size will be
+configECHO_SERVER_RX_WINDOW_SIZE times the buffer size. Note
+ipconfigTCP_RX_BUFFER_LENGTH is set in FreeRTOSIPConfig.h as it is a standard TCP/IP
+stack constant, whereas configECHO_SERVER_RX_WINDOW_SIZE is set in
+FreeRTOSConfig.h as it is a demo application constant. */
+#ifndef configECHO_SERVER_RX_WINDOW_SIZE
+ #define configECHO_SERVER_RX_WINDOW_SIZE 2
+#endif
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Uses FreeRTOS+TCP to listen for incoming echo connections, creating a task
+ * to handle each connection.
+ */
+static void prvConnectionListeningTask( void *pvParameters );
+
+/*
+ * Created by the connection listening task to handle a single connection.
+ */
+static void prvServerConnectionInstance( void *pvParameters );
+
+/*-----------------------------------------------------------*/
+
+/* Stores the stack size passed into vStartSimpleTCPServerTasks() so it can be
+reused when the server listening task creates tasks to handle connections. */
+static uint16_t usUsedStackSize = 0;
+
+/*-----------------------------------------------------------*/
+
+void vStartSimpleTCPServerTasks( uint16_t usStackSize, UBaseType_t uxPriority )
+{
+ /* Create the TCP echo server. */
+ xTaskCreate( prvConnectionListeningTask, "ServerListener", usStackSize, NULL, uxPriority + 1, NULL );
+
+ /* Remember the requested stack size so it can be re-used by the server
+ listening task when it creates tasks to handle connections. */
+ usUsedStackSize = usStackSize;
+}
+/*-----------------------------------------------------------*/
+
+static void prvConnectionListeningTask( void *pvParameters )
+{
+struct freertos_sockaddr xClient, xBindAddress;
+Socket_t xListeningSocket, xConnectedSocket;
+socklen_t xSize = sizeof( xClient );
+static const TickType_t xReceiveTimeOut = portMAX_DELAY;
+const BaseType_t xBacklog = 20;
+
+#if( ipconfigUSE_TCP_WIN == 1 )
+ WinProperties_t xWinProps;
+
+ /* Fill in the buffer and window sizes that will be used by the socket. */
+ xWinProps.lTxBufSize = ipconfigTCP_TX_BUFFER_LENGTH;
+ xWinProps.lTxWinSize = configECHO_SERVER_TX_WINDOW_SIZE;
+ xWinProps.lRxBufSize = ipconfigTCP_RX_BUFFER_LENGTH;
+ xWinProps.lRxWinSize = configECHO_SERVER_RX_WINDOW_SIZE;
+#endif /* ipconfigUSE_TCP_WIN */
+
+ /* Just to prevent compiler warnings. */
+ ( void ) pvParameters;
+
+ /* Attempt to open the socket. */
+ xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
+ configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Set a time out so accept() will just wait for a connection. */
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+
+ /* Set the window and buffer sizes. */
+ #if( ipconfigUSE_TCP_WIN == 1 )
+ {
+ FreeRTOS_setsockopt( xListeningSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
+ }
+ #endif /* ipconfigUSE_TCP_WIN */
+
+ /* Bind the socket to the port that the client task will send to, then
+ listen for incoming connections. */
+ xBindAddress.sin_port = tcpechoPORT_NUMBER;
+ xBindAddress.sin_port = FreeRTOS_htons( xBindAddress.sin_port );
+ FreeRTOS_bind( xListeningSocket, &xBindAddress, sizeof( xBindAddress ) );
+ FreeRTOS_listen( xListeningSocket, xBacklog );
+
+ for( ;; )
+ {
+ /* Wait for a client to connect. */
+ xConnectedSocket = FreeRTOS_accept( xListeningSocket, &xClient, &xSize );
+ configASSERT( xConnectedSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Spawn a task to handle the connection. */
+ xTaskCreate( prvServerConnectionInstance, "EchoServer", usUsedStackSize, ( void * ) xConnectedSocket, tskIDLE_PRIORITY, NULL );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvServerConnectionInstance( void *pvParameters )
+{
+int32_t lBytes, lSent, lTotalSent;
+Socket_t xConnectedSocket;
+static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 5000 );
+static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 5000 );
+TickType_t xTimeOnShutdown;
+uint8_t *pucRxBuffer;
+
+ xConnectedSocket = ( Socket_t ) pvParameters;
+
+ /* Attempt to create the buffer used to receive the string to be echoed
+ back. This could be avoided using a zero copy interface that just returned
+ the same buffer. */
+ pucRxBuffer = ( uint8_t * ) pvPortMalloc( ipconfigTCP_MSS );
+
+ if( pucRxBuffer != NULL )
+ {
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+ FreeRTOS_setsockopt( xConnectedSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xReceiveTimeOut ) );
+
+ for( ;; )
+ {
+ /* Zero out the receive array so there is NULL at the end of the string
+ when it is printed out. */
+ memset( pucRxBuffer, 0x00, ipconfigTCP_MSS );
+
+ /* Receive data on the socket. */
+ lBytes = FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 );
+
+ /* If data was received, echo it back. */
+ if( lBytes >= 0 )
+ {
+ lSent = 0;
+ lTotalSent = 0;
+
+ /* Call send() until all the data has been sent. */
+ while( ( lSent >= 0 ) && ( lTotalSent < lBytes ) )
+ {
+ lSent = FreeRTOS_send( xConnectedSocket, pucRxBuffer, lBytes - lTotalSent, 0 );
+ lTotalSent += lSent;
+ }
+
+ if( lSent < 0 )
+ {
+ /* Socket closed? */
+ break;
+ }
+ }
+ else
+ {
+ /* Socket closed? */
+ break;
+ }
+ }
+ }
+
+ /* Initiate a shutdown in case it has not already been initiated. */
+ FreeRTOS_shutdown( xConnectedSocket, FREERTOS_SHUT_RDWR );
+
+ /* Wait for the shutdown to take effect, indicated by FreeRTOS_recv()
+ returning an error. */
+ xTimeOnShutdown = xTaskGetTickCount();
+ do
+ {
+ if( FreeRTOS_recv( xConnectedSocket, pucRxBuffer, ipconfigTCP_MSS, 0 ) < 0 )
+ {
+ break;
+ }
+ } while( ( xTaskGetTickCount() - xTimeOnShutdown ) < tcpechoSHUTDOWN_DELAY );
+
+ /* Finished with the socket, buffer, the task. */
+ vPortFree( pucRxBuffer );
+ FreeRTOS_closesocket( xConnectedSocket );
+
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+/* The whole file is excluded if TCP is not compiled in. */
+#endif /* ipconfigUSE_TCP */
+
diff --git a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c b/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c
new file mode 100644
index 000000000..4fc2fc08a
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.c
@@ -0,0 +1,372 @@
+/*
+ * FreeRTOS Kernel V10.3.0
+ * 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
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+/*
+ * A set of tasks are created that send TCP echo requests to the standard echo
+ * port (port 7) on the IP address set by the configECHO_SERVER_ADDR0 to
+ * configECHO_SERVER_ADDR3 constants, then wait for and verify the reply
+ * (another demo is avilable that demonstrates the reception being performed in
+ * a task other than that from with the request was made).
+ *
+ * See the following web page for essential demo usage and configuration
+ * details:
+ * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
+ */
+
+/* Standard includes. */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* FreeRTOS includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* FreeRTOS+TCP includes. */
+#include "FreeRTOS_IP.h"
+#include "FreeRTOS_Sockets.h"
+
+/* Exclude the whole file if FreeRTOSIPConfig.h is configured to use UDP only. */
+#if ( ipconfigUSE_TCP == 1 )
+
+/* The echo tasks create a socket, send out a number of echo requests, listen
+for the echo reply, then close the socket again before starting over. This
+delay is used between each iteration to ensure the network does not get too
+congested. */
+ #define echoLOOP_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS )
+
+/* The echo server is assumed to be on port 7, which is the standard echo
+protocol port. */
+ #define echoECHO_PORT ( 7 )
+
+/* The size of the buffers is a multiple of the MSS - the length of the data
+sent is a pseudo random size between 20 and echoBUFFER_SIZES. */
+ #define echoBUFFER_SIZE_MULTIPLIER ( 3 )
+ #define echoBUFFER_SIZES ( ipconfigTCP_MSS * echoBUFFER_SIZE_MULTIPLIER )
+
+/* The number of instances of the echo client task to create. */
+ #define echoNUM_ECHO_CLIENTS ( 1 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Uses a socket to send data to, then receive data from, the standard echo
+ * port number 7.
+ */
+ static void prvEchoClientTask( void *pvParameters );
+
+/*
+ * Creates a pseudo random sized buffer of data to send to the echo server.
+ */
+ static BaseType_t prvCreateTxData( char *ucBuffer,
+ uint32_t ulBufferLength );
+
+/*-----------------------------------------------------------*/
+
+/* Rx and Tx time outs are used to ensure the sockets do not wait too long for
+missing data. */
+ static const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( 4000 );
+ static const TickType_t xSendTimeOut = pdMS_TO_TICKS( 2000 );
+
+/* Counters for each created task - for inspection only. */
+ static uint32_t ulTxRxCycles[ echoNUM_ECHO_CLIENTS ] = { 0 },
+ ulTxRxFailures[ echoNUM_ECHO_CLIENTS ] = { 0 },
+ ulConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
+
+/* Rx and Tx buffers for each created task. */
+ static char cTxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ],
+ cRxBuffers[ echoNUM_ECHO_CLIENTS ][ echoBUFFER_SIZES ];
+
+/*-----------------------------------------------------------*/
+
+ void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize,
+ UBaseType_t uxTaskPriority )
+ {
+ BaseType_t x;
+
+ /* Create the echo client tasks. */
+ for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
+ {
+ xTaskCreate( prvEchoClientTask, /* The function that implements the task. */
+ "Echo0", /* Just a text name for the task to aid debugging. */
+ usTaskStackSize, /* The stack size is defined in FreeRTOSIPConfig.h. */
+ ( void * ) x, /* The task parameter, not used in this case. */
+ uxTaskPriority, /* The priority assigned to the task is defined in FreeRTOSConfig.h. */
+ NULL ); /* The task handle is not used. */
+ }
+ }
+/*-----------------------------------------------------------*/
+
+ static void prvEchoClientTask( void *pvParameters )
+ {
+ Socket_t xSocket;
+ struct freertos_sockaddr xEchoServerAddress;
+ int32_t lLoopCount = 0UL;
+ const int32_t lMaxLoopCount = 1;
+ volatile uint32_t ulTxCount = 0UL;
+ BaseType_t xReceivedBytes, xReturned, xInstance;
+ BaseType_t lTransmitted, lStringLength;
+ char *pcTransmittedString, *pcReceivedString;
+ WinProperties_t xWinProps;
+ TickType_t xTimeOnEntering;
+ BaseType_t ret;
+
+ /* Fill in the buffer and window sizes that will be used by the socket. */
+ xWinProps.lTxBufSize = 6 * ipconfigTCP_MSS;
+ xWinProps.lTxWinSize = 3;
+ xWinProps.lRxBufSize = 6 * ipconfigTCP_MSS;
+ xWinProps.lRxWinSize = 3;
+
+ /* This task can be created a number of times. Each instance is numbered
+ to enable each instance to use a different Rx and Tx buffer. The number is
+ passed in as the task's parameter. */
+ xInstance = ( BaseType_t ) pvParameters;
+
+ /* Point to the buffers to be used by this instance of this task. */
+ pcTransmittedString = &( cTxBuffers[ xInstance ][ 0 ] );
+ pcReceivedString = &( cRxBuffers[ xInstance ][ 0 ] );
+
+ /* Echo requests are sent to the echo server. The address of the echo
+ server is configured by the constants configECHO_SERVER_ADDR0 to
+ configECHO_SERVER_ADDR3 in FreeRTOSConfig.h. */
+ xEchoServerAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
+ xEchoServerAddress.sin_addr = FreeRTOS_inet_addr_quick( configECHO_SERVER_ADDR0,
+ configECHO_SERVER_ADDR1,
+ configECHO_SERVER_ADDR2,
+ configECHO_SERVER_ADDR3 );
+
+ for( ; ; )
+ {
+ /* Create a TCP socket. */
+ xSocket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_STREAM, FREERTOS_IPPROTO_TCP );
+ configASSERT( xSocket != FREERTOS_INVALID_SOCKET );
+
+ /* Set a time out so a missing reply does not cause the task to block
+ indefinitely. */
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof( xReceiveTimeOut ) );
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_SNDTIMEO, &xSendTimeOut, sizeof( xSendTimeOut ) );
+
+ /* Set the window and buffer sizes. */
+ FreeRTOS_setsockopt( xSocket, 0, FREERTOS_SO_WIN_PROPERTIES, ( void * ) &xWinProps, sizeof( xWinProps ) );
+
+ /* Connect to the echo server. */
+ printf( "connecting to echo server....\n" );
+
+ ret = FreeRTOS_connect( xSocket, &xEchoServerAddress, sizeof( xEchoServerAddress ) );
+
+ if( ret == 0 )
+ {
+ printf( "Connected to server.. \n" );
+ ulConnections[ xInstance ]++;
+
+ /* Send a number of echo requests. */
+ for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ )
+ {
+ /* Create the string that is sent to the echo server. */
+ lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES );
+
+ /* Add in some unique text at the front of the string. */
+ sprintf( pcTransmittedString, "TxRx message number %u", ulTxCount );
+ ulTxCount++;
+
+ printf( "sending data to the echo server \n" );
+ /* Send the string to the socket. */
+ lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
+ ( void * ) pcTransmittedString, /* The data being sent. */
+ lStringLength, /* The length of the data being sent. */
+ 0 ); /* No flags. */
+
+ if( lTransmitted < 0 )
+ {
+ /* Error? */
+ break;
+ }
+
+ /* Clear the buffer into which the echoed string will be
+ placed. */
+ memset( ( void * ) pcReceivedString, 0x00, echoBUFFER_SIZES );
+ xReceivedBytes = 0;
+
+ /* Receive data echoed back to the socket. */
+ while( xReceivedBytes < lTransmitted )
+ {
+ xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
+ &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
+ lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */
+ 0 ); /* No flags. */
+
+ if( xReturned < 0 )
+ {
+ /* Error occurred. Latch it so it can be detected
+ below. */
+ xReceivedBytes = xReturned;
+ break;
+ }
+ else if( xReturned == 0 )
+ {
+ /* Timed out. */
+ break;
+ }
+ else
+ {
+ /* Keep a count of the bytes received so far. */
+ xReceivedBytes += xReturned;
+ }
+ }
+
+ /* If an error occurred it will be latched in xReceivedBytes,
+ otherwise xReceived bytes will be just that - the number of
+ bytes received from the echo server. */
+ if( xReceivedBytes > 0 )
+ {
+ /* Compare the transmitted string to the received string. */
+ configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 );
+
+ if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 )
+ {
+ /* The echo reply was received without error. */
+ ulTxRxCycles[ xInstance ]++;
+ }
+ else
+ {
+ /* The received string did not match the transmitted
+ string. */
+ ulTxRxFailures[ xInstance ]++;
+ break;
+ }
+ }
+ else if( xReceivedBytes < 0 )
+ {
+ /* FreeRTOS_recv() returned an error. */
+ break;
+ }
+ else
+ {
+ /* Timed out without receiving anything? */
+ break;
+ }
+ }
+
+ /* Finished using the connected socket, initiate a graceful close:
+ FIN, FIN+ACK, ACK. */
+ FreeRTOS_shutdown( xSocket, FREERTOS_SHUT_RDWR );
+
+ /* Expect FreeRTOS_recv() to return an error once the shutdown is
+ complete. */
+ xTimeOnEntering = xTaskGetTickCount();
+
+ do
+ {
+ xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
+ &( pcReceivedString[ 0 ] ), /* The buffer into which the received data will be written. */
+ echoBUFFER_SIZES, /* The size of the buffer provided to receive the data. */
+ 0 );
+
+ if( xReturned < 0 )
+ {
+ break;
+ }
+ } while( ( xTaskGetTickCount() - xTimeOnEntering ) < xReceiveTimeOut );
+ }
+ else
+ {
+ printf( "Could not connect to server %ld\n", ret );
+ }
+
+ /* Close this socket before looping back to create another. */
+ FreeRTOS_closesocket( xSocket );
+
+ /* Pause for a short while to ensure the network is not too
+ congested. */
+ vTaskDelay( echoLOOP_DELAY );
+ }
+ }
+/*-----------------------------------------------------------*/
+
+ static BaseType_t prvCreateTxData( char *cBuffer,
+ uint32_t ulBufferLength )
+ {
+ BaseType_t lCharactersToAdd, lCharacter;
+ char cChar = '0';
+ const BaseType_t lMinimumLength = 60;
+
+ /* Randomise the number of characters that will be sent in the echo
+ request. */
+ do
+ {
+ lCharactersToAdd = ipconfigRAND32() % ( ulBufferLength - 20UL );
+ } while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
+
+ /* Fill the buffer. */
+ for( lCharacter = 0; lCharacter < lCharactersToAdd; lCharacter++ )
+ {
+ cBuffer[ lCharacter ] = cChar;
+ cChar++;
+
+ if( cChar > '~' )
+ {
+ cChar = '0';
+ }
+ }
+
+ return lCharactersToAdd;
+ }
+/*-----------------------------------------------------------*/
+
+ BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void )
+ {
+ static uint32_t ulLastEchoSocketCount[ echoNUM_ECHO_CLIENTS ] = { 0 }, ulLastConnections[ echoNUM_ECHO_CLIENTS ] = { 0 };
+ BaseType_t xReturn = pdPASS, x;
+
+ /* Return fail is the number of cycles does not increment between
+ consecutive calls. */
+ for( x = 0; x < echoNUM_ECHO_CLIENTS; x++ )
+ {
+ if( ulTxRxCycles[ x ] == ulLastEchoSocketCount[ x ] )
+ {
+ xReturn = pdFAIL;
+ }
+ else
+ {
+ ulLastEchoSocketCount[ x ] = ulTxRxCycles[ x ];
+ }
+
+ if( ulConnections[ x ] == ulLastConnections[ x ] )
+ {
+ xReturn = pdFAIL;
+ }
+ else
+ {
+ ulConnections[ x ] = ulLastConnections[ x ];
+ }
+ }
+
+ return xReturn;
+ }
+
+#endif /* ipconfigUSE_TCP */
diff --git a/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h b/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h
new file mode 100644
index 000000000..864a3a10f
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/TCPEchoClient_SingleTasks.h
@@ -0,0 +1,40 @@
+/*
+ * FreeRTOS Kernel V10.3.0
+ * 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
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+#ifndef SINGLE_TASK_TCP_ECHO_CLIENTS_H
+#define SINGLE_TASK_TCP_ECHO_CLIENTS_H
+
+/*
+ * Create the TCP echo client tasks. This is the version where an echo request
+ * is made from the same task that listens for the echo reply.
+ */
+void vStartTCPEchoClientTasks_SingleTasks( uint16_t usTaskStackSize, UBaseType_t uxTaskPriority );
+BaseType_t xAreSingleTaskTCPEchoClientsStillRunning( void );
+
+#endif /* SINGLE_TASK_TCP_ECHO_CLIENTS_H */
+
+
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main.c b/FreeRTOS/Demo/Posix_GCC/src/main.c
index 630c71d72..dd2406ac4 100644
--- a/FreeRTOS/Demo/Posix_GCC/src/main.c
+++ b/FreeRTOS/Demo/Posix_GCC/src/main.c
@@ -53,6 +53,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdarg.h>
/* FreeRTOS kernel includes. */
#include "FreeRTOS.h"
@@ -72,7 +73,11 @@ If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and
demo application will be built. The comprehensive test and demo application is
implemented and described in main_full.c. */
#ifndef mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
+ #define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
+#endif
+
+#ifndef mainCREATE_TCP_ECHO_TASKS_SINGLE
+ #define mainCREATE_TCP_ECHO_TASKS_SINGLE 1
#endif
/* This demo uses heap_3.c (the libc provided malloc() and free()). */
@@ -85,6 +90,7 @@ implemented and described in main_full.c. */
*/
extern void main_blinky( void );
extern void main_full( void );
+extern void main_tcp_echo_client_tasks( void );
/*
* Only the comprehensive demo uses application hook (callback) functions. See
@@ -99,10 +105,15 @@ void vFullDemoIdleFunction( void );
*/
void vApplicationMallocFailedHook( void );
void vApplicationIdleHook( void );
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
+void vApplicationStackOverflowHook( TaskHandle_t pxTask,
+ char *pcTaskName );
void vApplicationTickHook( void );
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
+ StackType_t **ppxIdleTaskStackBuffer,
+ uint32_t *pulIdleTaskStackSize );
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
+ StackType_t **ppxTimerTaskStackBuffer,
+ uint32_t *pulTimerTaskStackSize );
/*
* Writes trace data to a disk file when the trace recording is stopped.
@@ -127,7 +138,7 @@ static BaseType_t xTraceRunning = pdTRUE;
int main( void )
{
/* Do not include trace code when performing a code coverage analysis. */
- #if( projCOVERAGE_TEST != 1 )
+ #if ( projCOVERAGE_TEST != 1 )
{
/* Initialise the trace recorder. Use of the trace recorder is optional.
See http://www.FreeRTOS.org/trace for more information. */
@@ -141,11 +152,12 @@ int main( void )
}
#endif
- console_init();
-
- /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
- of this file. */
- #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
+ console_init();
+ #if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 )
+ {
+ main_tcp_echo_client_tasks();
+ }
+ #elif ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
{
main_blinky();
}
@@ -153,7 +165,7 @@ int main( void )
{
main_full();
}
- #endif
+ #endif /* if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 ) */
return 0;
}
@@ -173,7 +185,7 @@ void vApplicationMallocFailedHook( void )
(although it does not provide information on how the remaining heap might be
fragmented). See http://www.freertos.org/a00111.html for more
information. */
- vAssertCalled( __LINE__, __FILE__ );
+ vAssertCalled( __FILE__, __LINE__ );
}
/*-----------------------------------------------------------*/
@@ -189,19 +201,20 @@ void vApplicationIdleHook( void )
because it is the responsibility of the idle task to clean up memory
allocated by the kernel to any task that has since deleted itself. */
- sleep(1);
+ sleep( 1 );
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
{
/* Call the idle task processing used by the full demo. The simple
blinky demo does not use the idle task hook. */
- vFullDemoIdleFunction();
+ /*vFullDemoIdleFunction();*/
}
#endif
}
/*-----------------------------------------------------------*/
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
+void vApplicationStackOverflowHook( TaskHandle_t pxTask,
+ char *pcTaskName )
{
( void ) pcTaskName;
( void ) pxTask;
@@ -211,7 +224,7 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
function is called if a stack overflow is detected. This function is
provided as an example only as stack overflow checking does not function
when running the FreeRTOS Windows port. */
- vAssertCalled( __LINE__, __FILE__ );
+ vAssertCalled( __FILE__, __LINE__ );
}
/*-----------------------------------------------------------*/
@@ -223,12 +236,23 @@ void vApplicationTickHook( void )
code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */
- #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
- {
- vFullDemoTickHookFunction();
- }
+ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 && \
+ mainCREATE_TCP_ECHO_TASKS_SINGLE != 1 )
+ {
+ vFullDemoTickHookFunction();
+ }
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
}
+
+void vLoggingPrintf( const char *pcFormat,
+ ... )
+{
+va_list arg;
+
+ va_start( arg, pcFormat );
+ vprintf( pcFormat, arg );
+ va_end( arg );
+}
/*-----------------------------------------------------------*/
void vApplicationDaemonTaskStartupHook( void )
@@ -240,7 +264,8 @@ void vApplicationDaemonTaskStartupHook( void )
}
/*-----------------------------------------------------------*/
-void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
+void vAssertCalled( const char * const pcFileName,
+ unsigned long ulLine )
{
static BaseType_t xPrinted = pdFALSE;
volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
@@ -253,12 +278,13 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
( void ) pcFileName;
- taskENTER_CRITICAL();
+ taskENTER_CRITICAL();
{
/* Stop the trace recording. */
if( xPrinted == pdFALSE )
{
xPrinted = pdTRUE;
+
if( xTraceRunning == pdTRUE )
{
prvSaveTraceFile();
@@ -270,8 +296,8 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
value. */
while( ulSetToNonZeroInDebuggerToContinue == 0 )
{
- __asm volatile( "NOP" );
- __asm volatile( "NOP" );
+ __asm volatile ( "NOP" );
+ __asm volatile ( "NOP" );
}
}
taskEXIT_CRITICAL();
@@ -281,13 +307,13 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
static void prvSaveTraceFile( void )
{
/* Tracing is not used when code coverage analysis is being performed. */
- #if( projCOVERAGE_TEST != 1 )
+ #if ( projCOVERAGE_TEST != 1 )
{
- FILE* pxOutputFile;
+ FILE * pxOutputFile;
vTraceStop();
- pxOutputFile = fopen( "Trace.dump", "wb");
+ pxOutputFile = fopen( "Trace.dump", "wb" );
if( pxOutputFile != NULL )
{
@@ -300,20 +326,22 @@ static void prvSaveTraceFile( void )
printf( "\r\nFailed to create trace dump file\r\n" );
}
}
- #endif
+ #endif /* if ( projCOVERAGE_TEST != 1 ) */
}
/*-----------------------------------------------------------*/
/* 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. */
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
+ StackType_t **ppxIdleTaskStackBuffer,
+ uint32_t *pulIdleTaskStackSize )
{
/* If the buffers to be provided to the Idle task are declared inside this
function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
-static StaticTask_t xIdleTaskTCB;
-static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
+ static StaticTask_t xIdleTaskTCB;
+ static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
@@ -332,12 +360,14 @@ static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
+ StackType_t **ppxTimerTaskStackBuffer,
+ uint32_t *pulTimerTaskStackSize )
{
/* If the buffers to be provided to the Timer task are declared inside this
function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
-static StaticTask_t xTimerTaskTCB;
+ static StaticTask_t xTimerTaskTCB;
/* Pass out a pointer to the StaticTask_t structure in which the Timer
task's state will be stored. */
@@ -351,4 +381,3 @@ static StaticTask_t xTimerTaskTCB;
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
}
-
diff --git a/FreeRTOS/Demo/Posix_GCC/src/main_networking.c b/FreeRTOS/Demo/Posix_GCC/src/main_networking.c
new file mode 100644
index 000000000..edb589720
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/main_networking.c
@@ -0,0 +1,321 @@
+/*
+ * FreeRTOS Kernel V10.3.0
+ * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+/*
+ * This project is a cut down version of the project described on the following
+ * link. Only the simple UDP client and server and the TCP echo clients are
+ * included in the build:
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
+ */
+
+/* Standard includes. */
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+
+/* FreeRTOS includes. */
+#include <FreeRTOS.h>
+#include "task.h"
+
+/* Demo application includes. */
+#include "FreeRTOS_IP.h"
+#include "FreeRTOS_Sockets.h"
+/*#include "SimpleUDPClientAndServer.h" */
+/*#include "SimpleTCPEchoServer.h" */
+/*#include "TCPEchoClient_SingleTasks.h" */
+/*#include "demo_logging.h" */
+#include "TCPEchoClient_SingleTasks.h"
+
+/* Simple UDP client and server task parameters. */
+#define mainSIMPLE_UDP_CLIENT_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY )
+#define mainSIMPLE_UDP_CLIENT_SERVER_PORT ( 5005UL )
+
+/* Echo client task parameters - used for both TCP and UDP echo clients. */
+#define mainECHO_CLIENT_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Not used in the linux port. */
+#define mainECHO_CLIENT_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
+
+/* Echo server task parameters. */
+#define mainECHO_SERVER_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Not used in the linux port. */
+#define mainECHO_SERVER_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
+
+/* Define a name that will be used for LLMNR and NBNS searches. */
+#define mainHOST_NAME "RTOSDemo"
+#define mainDEVICE_NICK_NAME "linux_demo"
+
+/* Set the following constants to 1 or 0 to define which tasks to include and
+exclude:
+
+mainCREATE_TCP_ECHO_TASKS_SINGLE: When set to 1 a set of tasks are created that
+send TCP echo requests to the standard echo port (port 7), then wait for and
+verify the echo reply, from within the same task (Tx and Rx are performed in the
+same RTOS task). The IP address of the echo server must be configured using the
+configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in
+FreeRTOSConfig.h.
+
+*/
+#define mainCREATE_TCP_ECHO_TASKS_SINGLE 1
+/*-----------------------------------------------------------*/
+
+/*
+ * Just seeds the simple pseudo random number generator.
+ */
+static void prvSRand( UBaseType_t ulSeed );
+
+/*
+ * Miscellaneous initialisation including preparing the logging and seeding the
+ * random number generator.
+ */
+static void prvMiscInitialisation( void );
+
+/* The default IP and MAC address used by the demo. The address configuration
+defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is
+1 but a DHCP server could not be contacted. See the online documentation for
+more information. */
+static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };
+static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };
+static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };
+static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };
+
+/* Set the following constant to pdTRUE to log using the method indicated by the
+name of the constant, or pdFALSE to not log using the method indicated by the
+name of the constant. Options include to standard out (xLogToStdout), to a disk
+file (xLogToFile), and to a UDP port (xLogToUDP). If xLogToUDP is set to pdTRUE
+then UDP messages are sent to the IP address configured as the echo server
+address (see the configECHO_SERVER_ADDR0 definitions in FreeRTOSConfig.h) and
+the port number set by configPRINT_PORT in FreeRTOSConfig.h. */
+const BaseType_t xLogToStdout = pdTRUE, xLogToFile = pdFALSE, xLogToUDP = pdFALSE;
+
+/* Default MAC address configuration. The demo creates a virtual network
+connection that uses this MAC address by accessing the raw Ethernet data
+to and from a real network connection on the host PC. See the
+configNETWORK_INTERFACE_TO_USE definition for information on how to configure
+the real network connection to use. */
+const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };
+
+/* Use by the pseudo random number generator. */
+static UBaseType_t ulNextRand;
+
+/*-----------------------------------------------------------*/
+
+void main_tcp_echo_client_tasks( void )
+{
+const uint32_t ulLongTime_ms = pdMS_TO_TICKS( 1000UL );
+
+ /*
+ * Instructions for using this project are provided on:
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/examples_FreeRTOS_simulator.html
+ */
+
+ /* Miscellaneous initialisation including preparing the logging and seeding
+ the random number generator. */
+ prvMiscInitialisation();
+
+ /* Initialise the network interface.
+
+ ***NOTE*** Tasks that use the network are created in the network event hook
+ when the network is connected and ready for use (see the definition of
+ vApplicationIPNetworkEventHook() below). The address values passed in here
+ are used if ipconfigUSE_DHCP is set to 0, or if ipconfigUSE_DHCP is set to 1
+ but a DHCP server cannot be contacted. */
+ FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\n" ) );
+ FreeRTOS_IPInit( ucIPAddress,
+ ucNetMask,
+ ucGatewayAddress,
+ ucDNSServerAddress,
+ ucMACAddress );
+
+ /* Start the RTOS scheduler. */
+ FreeRTOS_debug_printf( ( "vTaskStartScheduler\n" ) );
+ vTaskStartScheduler();
+ FreeRTOS_debug_printf( ( "Should not reach this point after scheduler\n" ) );
+
+ /* If all is well, the scheduler will now be running, and the following
+ line will never be reached. If the following line does execute, then
+ there was insufficient FreeRTOS heap memory available for the idle and/or
+ timer tasks to be created. See the memory management section on the
+ FreeRTOS web site for more details (this is standard text that is not not
+ really applicable to the Win32 simulator port). */
+ for( ; ; )
+ {
+ usleep( ulLongTime_ms * 1000 );
+ }
+}
+/*-----------------------------------------------------------*/
+
+/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
+events are only received if implemented in the MAC driver. */
+void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
+{
+uint32_t ulIPAddress, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
+char cBuffer[ 16 ];
+static BaseType_t xTasksAlreadyCreated = pdFALSE;
+
+ /* If the network has just come up...*/
+ if( eNetworkEvent == eNetworkUp )
+ {
+ /* Create the tasks that use the IP stack if they have not already been
+ created. */
+ if( xTasksAlreadyCreated == pdFALSE )
+ {
+ /* See the comments above the definitions of these pre-processor
+ macros at the top of this file for a description of the individual
+ demo tasks. */
+
+ #if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 )
+ {
+ vStartTCPEchoClientTasks_SingleTasks( mainECHO_CLIENT_TASK_STACK_SIZE, mainECHO_CLIENT_TASK_PRIORITY );
+ }
+ #endif /* mainCREATE_TCP_ECHO_TASKS_SINGLE */
+
+ xTasksAlreadyCreated = pdTRUE;
+ }
+
+ /* Print out the network configuration, which may have come from a DHCP
+ server. */
+ FreeRTOS_GetAddressConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress );
+ FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
+ FreeRTOS_printf( ( "\r\n\r\nIP Address: %s\r\n", cBuffer ) );
+
+ FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
+ FreeRTOS_printf( ( "Subnet Mask: %s\r\n", cBuffer ) );
+
+ FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
+ FreeRTOS_printf( ( "Gateway Address: %s\r\n", cBuffer ) );
+
+ FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
+ FreeRTOS_printf( ( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer ) );
+ }
+ else
+ {
+ printf( "application iddle hook network down\n" );
+ }
+}
+/*-----------------------------------------------------------*/
+
+UBaseType_t uxRand( void )
+{
+const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL;
+
+ /* Utility function to generate a pseudo random number. */
+
+ ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
+ return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
+}
+/*-----------------------------------------------------------*/
+
+static void prvSRand( UBaseType_t ulSeed )
+{
+ /* Utility function to seed the pseudo random number generator. */
+ ulNextRand = ulSeed;
+}
+/*-----------------------------------------------------------*/
+
+static void prvMiscInitialisation( void )
+{
+time_t xTimeNow;
+
+ /* Seed the random number generator. */
+ time( &xTimeNow );
+ FreeRTOS_debug_printf( ( "Seed for randomiser: %lu\n", xTimeNow ) );
+ prvSRand( ( uint32_t ) xTimeNow );
+ FreeRTOS_debug_printf( ( "Random numbers: %08X %08X %08X %08X\n",
+ ipconfigRAND32(),
+ ipconfigRAND32(),
+ ipconfigRAND32(),
+ ipconfigRAND32() ) );
+}
+/*-----------------------------------------------------------*/
+
+#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) || ( ipconfigDHCP_REGISTER_HOSTNAME == 1 )
+
+ const char * pcApplicationHostnameHook( void )
+ {
+ /* Assign the name "FreeRTOS" to this network node. This function will
+ be called during the DHCP: the machine will be registered with an IP
+ address plus this name. */
+ return mainHOST_NAME;
+ }
+
+#endif
+/*-----------------------------------------------------------*/
+
+#if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 )
+
+ BaseType_t xApplicationDNSQueryHook( const char *pcName )
+ {
+ BaseType_t xReturn;
+
+ /* Determine if a name lookup is for this node. Two names are given
+ to this node: that returned by pcApplicationHostnameHook() and that set
+ by mainDEVICE_NICK_NAME. */
+ if( strcasecmp( pcName, pcApplicationHostnameHook() ) == 0 )
+ {
+ xReturn = pdPASS;
+ }
+ else if( strcasecmp( pcName, mainDEVICE_NICK_NAME ) == 0 )
+ {
+ xReturn = pdPASS;
+ }
+ else
+ {
+ xReturn = pdFAIL;
+ }
+
+ return xReturn;
+ }
+
+#endif /* if ( ipconfigUSE_LLMNR != 0 ) || ( ipconfigUSE_NBNS != 0 ) */
+
+/*
+ * Callback that provides the inputs necessary to generate a randomized TCP
+ * Initial Sequence Number per RFC 6528. THIS IS ONLY A DUMMY IMPLEMENTATION
+ * THAT RETURNS A PSEUDO RANDOM NUMBER SO IS NOT INTENDED FOR USE IN PRODUCTION
+ * SYSTEMS.
+ */
+extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
+ uint16_t usSourcePort,
+ uint32_t ulDestinationAddress,
+ uint16_t usDestinationPort )
+{
+ ( void ) ulSourceAddress;
+ ( void ) usSourcePort;
+ ( void ) ulDestinationAddress;
+ ( void ) usDestinationPort;
+
+ 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/Posix_GCC/src/utils/wait_for_event.c b/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c
new file mode 100644
index 000000000..6d0bfffda
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.c
@@ -0,0 +1,75 @@
+#include <pthread.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "wait_for_event.h"
+
+struct event
+{
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ bool event_triggered;
+};
+
+struct event * event_create()
+{
+ struct event * ev = malloc( sizeof( struct event ) );
+
+ ev->event_triggered = false;
+ pthread_mutex_init( &ev->mutex, NULL );
+ pthread_cond_init( &ev->cond, NULL );
+ return ev;
+}
+
+void event_delete( struct event * ev )
+{
+ pthread_mutex_destroy( &ev->mutex );
+ pthread_cond_destroy( &ev->cond );
+ free( ev );
+}
+
+bool event_wait( struct event * ev )
+{
+ pthread_mutex_lock( &ev->mutex );
+
+ while( ev->event_triggered == false )
+ {
+ pthread_cond_wait( &ev->cond, &ev->mutex );
+ }
+
+ pthread_mutex_unlock( &ev->mutex );
+ return true;
+}
+bool event_wait_timed( struct event * ev,
+ time_t ms )
+{
+ struct timespec ts;
+ int ret = 0;
+
+ clock_gettime( CLOCK_REALTIME, &ts );
+ //ts.tv_sec += ms;
+ ts.tv_nsec += (ms * 1000000);
+ pthread_mutex_lock( &ev->mutex );
+
+ while( (ev->event_triggered == false) && (ret == 0) )
+ {
+ ret = pthread_cond_timedwait( &ev->cond, &ev->mutex, &ts );
+
+ if( ( ret == -1 ) && ( errno == ETIMEDOUT ) )
+ {
+ return false;
+ }
+ }
+
+ ev->event_triggered = false;
+ pthread_mutex_unlock( &ev->mutex );
+ return true;
+}
+
+void event_signal( struct event * ev )
+{
+ pthread_mutex_lock( &ev->mutex );
+ ev->event_triggered = true;
+ pthread_cond_signal( &ev->cond );
+ pthread_mutex_unlock( &ev->mutex );
+}
diff --git a/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h b/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h
new file mode 100644
index 000000000..2693a0d8c
--- /dev/null
+++ b/FreeRTOS/Demo/Posix_GCC/src/utils/wait_for_event.h
@@ -0,0 +1,18 @@
+#ifndef _WAIT_FOR_EVENT_H_
+#define _WAIT_FOR_EVENT_H_
+
+#include <stdbool.h>
+#include <time.h>
+
+struct event;
+
+struct event * event_create();
+void event_delete( struct event * );
+bool event_wait( struct event * ev );
+bool event_wait_timed( struct event * ev,
+ time_t ms );
+void event_signal( struct event * ev );
+
+
+
+#endif /* ifndef _WAIT_FOR_EVENT_H_ */