From 6e89fe4fefb9e1a70d1903f2d50e2bd8f127cf02 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 24 Aug 2023 15:17:17 -0700 Subject: [PATCH 01/11] Use new version of CI-CD Actions --- .github/.cSpellWords.txt | 8 +++++ .github/workflows/ci.yml | 72 +++++++++++++++++++++++----------------- cspell.config.yaml | 22 ++++++++++++ 3 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 .github/.cSpellWords.txt create mode 100644 cspell.config.yaml diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt new file mode 100644 index 0000000..158bf07 --- /dev/null +++ b/.github/.cSpellWords.txt @@ -0,0 +1,8 @@ +CMOCK +CMock +Cmock +Coverity +MISRA +Misra +coverity +misra diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 078b33d..c552cc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build Library in Debug mode run: | cmake -S test -B build/ \ @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build Code Example used in Doxygen run: | cmake -S test -B Build -DBUILD_CODE_EXAMPLE=ON @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build Library and Unit Tests with Sanitizer run: | CFLAGS="-O0 -Wall -Wexta -Werror" @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build run: | sudo apt-get install -y lcov sed @@ -90,41 +90,44 @@ jobs: echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info lcov --rc lcov_branch_coverage=1 --list build/coverage.info - name: Check Coverage - uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main + uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@v2 with: - path: ./build/coverage.info + coverage-file: ./build/coverage.info complexity: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check complexity - uses: FreeRTOS/CI-CD-Github-Actions/complexity@main + uses: FreeRTOS/CI-CD-Github-Actions/complexity@v2 with: path: ./ + spell-check: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run spellings check - uses: FreeRTOS/CI-CD-Github-Actions/spellings@main + uses: FreeRTOS/CI-CD-GitHub-Actions/rust-spell-check@v2 with: path: ./ + formatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check formatting - uses: FreeRTOS/CI-CD-Github-Actions/formatting@main + uses: FreeRTOS/CI-CD-Github-Actions/formatting@v2 with: path: ./ exclude-dirs: .git + git-secrets: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Checkout awslabs/git-secrets - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: awslabs/git-secrets ref: master @@ -135,44 +138,53 @@ jobs: run: | git-secrets --register-aws git-secrets --scan + link-verifier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup Python for link verifier action - uses: actions/setup-python@v2 - with: - python-version: '3.8' + - uses: actions/checkout@v3 - name: Check Links env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: FreeRTOS/CI-CD-GitHub-Actions/link-verifier@main + uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@v2 + + verify-manifest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + + - name: Run manifest verifier + uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@v2 with: path: ./ - exclude-dirs: cbmc - include-file-types: .c,.h,.dox + fail-on-incorrect-version: true + doxygen: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run doxygen build - uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main + uses: FreeRTOS/CI-CD-Github-Actions/doxygen@v2 with: path: ./ memory_statistics: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install Python3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: - python-version: '3.7.x' + python-version: "3.7.x" - name: Measure sizes - uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main + uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@v2 with: - config: .github/memory_statistics_config.json - check_against: docs/doxygen/include/size_table.md + config: .github/memory_statistics_config.json + check_against: docs/doxygen/include/size_table.md proof_ci: + if: ${{ github.event.pull_request }} runs-on: cbmc_ubuntu-latest_16-core steps: - name: Set up CBMC runner diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 0000000..e7d8a56 --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,22 @@ +--- +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: '0.2' +# Allows things like stringLength +allowCompoundWords: true +useGitignore: true +# Could split this up? And do a dictionary for each repo? +# But feel like if this isn't super slow +# That having just one single dictionary might be nicer? +dictionaryDefinitions: + - name: freertos-words + path: '.github/.cSpellWords.txt' + addWords: true +dictionaries: + - freertos-words +ignorePaths: + - 'node_modules' + - '.cSpellWords.txt' + - 'dependency' + - 'docs' + - 'ThirdParty' + From c8a34b35c8788c058de4c60b1a2ee0b50a150ee5 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 25 Aug 2023 03:54:22 -0700 Subject: [PATCH 02/11] Use cSpell spell check, and use ubuntu-20.04 for formatting check --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c552cc6..b899e12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,12 +108,12 @@ jobs: - name: Clone This Repo uses: actions/checkout@v3 - name: Run spellings check - uses: FreeRTOS/CI-CD-GitHub-Actions/rust-spell-check@v2 + uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@v2 with: path: ./ formatting: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Check formatting From c03f58312fde7e51b81d2e423d312528f6eb92b5 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 25 Aug 2023 04:03:14 -0700 Subject: [PATCH 03/11] Update the cSpell word list, fix broken links --- .github/.cSpellWords.txt | 17 +++++++++++++++++ .../proofs/Sntp_CalculatePollInterval/README.md | 2 +- .../proofs/Sntp_ConvertToUnixTime/README.md | 2 +- .../proofs/Sntp_DeserializeResponse/README.md | 2 +- .../proofs/Sntp_ReceiveTimeResponse/README.md | 2 +- .../cbmc/proofs/Sntp_SerializeRequest/README.md | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 158bf07..139a7e9 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -1,8 +1,25 @@ +CBMC +CMAC CMOCK CMock +CRYP +Cbmc Cmock Coverity MISRA Misra +RSTR +SNTP +Sntp +TRNG +cbmc +converttounixtime coverity +ctest +fracs +lcov +lums misra +sinclude +sntp +xlarge diff --git a/test/cbmc/proofs/Sntp_CalculatePollInterval/README.md b/test/cbmc/proofs/Sntp_CalculatePollInterval/README.md index 287de56..0487840 100644 --- a/test/cbmc/proofs/Sntp_CalculatePollInterval/README.md +++ b/test/cbmc/proofs/Sntp_CalculatePollInterval/README.md @@ -14,7 +14,7 @@ To run the proof. * Run `make`. * Open html/index.html in a web browser. -To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. +To use [`arpa`](https://awslabs.github.io/aws-proof-build-assistant) to simplify writing Makefiles. ------------- * Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. diff --git a/test/cbmc/proofs/Sntp_ConvertToUnixTime/README.md b/test/cbmc/proofs/Sntp_ConvertToUnixTime/README.md index 3bf0834..9c887c2 100644 --- a/test/cbmc/proofs/Sntp_ConvertToUnixTime/README.md +++ b/test/cbmc/proofs/Sntp_ConvertToUnixTime/README.md @@ -14,7 +14,7 @@ To run the proof. * Run `make`. * Open html/index.html in a web browser. -To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. +To use [`arpa`](https://awslabs.github.io/aws-proof-build-assistant) to simplify writing Makefiles. ------------- * Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. diff --git a/test/cbmc/proofs/Sntp_DeserializeResponse/README.md b/test/cbmc/proofs/Sntp_DeserializeResponse/README.md index c6ac66c..10c3038 100644 --- a/test/cbmc/proofs/Sntp_DeserializeResponse/README.md +++ b/test/cbmc/proofs/Sntp_DeserializeResponse/README.md @@ -11,7 +11,7 @@ To run the proof. * Run `make`. * Open html/index.html in a web browser. -To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. +To use [`arpa`](https://awslabs.github.io/aws-proof-build-assistant) to simplify writing Makefiles. ------------- * Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. diff --git a/test/cbmc/proofs/Sntp_ReceiveTimeResponse/README.md b/test/cbmc/proofs/Sntp_ReceiveTimeResponse/README.md index 5d6e85d..229e4f6 100644 --- a/test/cbmc/proofs/Sntp_ReceiveTimeResponse/README.md +++ b/test/cbmc/proofs/Sntp_ReceiveTimeResponse/README.md @@ -11,7 +11,7 @@ To run the proof. * Run `make`. * Open html/index.html in a web browser. -To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. +To use [`arpa`](https://awslabs.github.io/aws-proof-build-assistant) to simplify writing Makefiles. ------------- * Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. diff --git a/test/cbmc/proofs/Sntp_SerializeRequest/README.md b/test/cbmc/proofs/Sntp_SerializeRequest/README.md index 0a5122e..8e3991f 100644 --- a/test/cbmc/proofs/Sntp_SerializeRequest/README.md +++ b/test/cbmc/proofs/Sntp_SerializeRequest/README.md @@ -14,7 +14,7 @@ To run the proof. * Run `make`. * Open html/index.html in a web browser. -To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. +To use [`arpa`](https://awslabs.github.io/aws-proof-build-assistant) to simplify writing Makefiles. ------------- * Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. From f2fa0043f0afc4bd5eceaf007c6ad68128cd4d91 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 25 Aug 2023 07:43:57 -0700 Subject: [PATCH 04/11] Add missing words, remove old lexicon --- .github/.cSpellWords.txt | 3 + lexicon.txt | 262 --------------------------------------- 2 files changed, 3 insertions(+), 262 deletions(-) delete mode 100644 lexicon.txt diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 139a7e9..e670988 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -6,6 +6,8 @@ CRYP Cbmc Cmock Coverity +DCMOCK +DNDEBUG MISRA Misra RSTR @@ -22,4 +24,5 @@ lums misra sinclude sntp +utest xlarge diff --git a/lexicon.txt b/lexicon.txt deleted file mode 100644 index 8d9e2a1..0000000 --- a/lexicon.txt +++ /dev/null @@ -1,262 +0,0 @@ -actualabsdiff -aes -alarmservernotsynchronized -api -apis -ascii -auth -authcodesize -authintf -aws -backoff -beforelooptime -blocktimems -br -buffersize -bytesorerror -bytesremaining -bytessent -bytestorecv -bytestorecv -bytestosend -bytestosend -cbmc -clienttime -clienttimesec -clienttxtime -clockfreqtolerance -clockoffsetms -cmac -com -config -configpagestyle -configs -const -copydoc -coresntp -coverity -css -currenttimelist -de -deamon -december -defgroup -deserialization -deserialize -deserializer -deserializeresponse -deserializing -desiredaccuracy -diff -dns -doxygen -endcode -endian -endif -enum -expectedbytestosend -expectedinterval -expectedtxtime -faqs -feb -firstorderdiff -fracs -fracsinnetorder -fracsinnetorder -freertos -gcc -getsystemtimefunc -getsystemtimefunc -gettimefunc -github -gov -hsm -html -htonl -https -ietf -ifdef -ifndef -inc -ingroup -inlooptime -int -iot -ip -iso -jan -january -june -kod -lastrequesttime -leapsecondinfo -leapversionmode -logdebug -logerror -loginfo -logwarn -lsb -mainpage -md -mdash -misra -mit -mtu -networkcontext -networkinterfacereceivestub -networkinterfacesendstub -nist -noleapsecond -noninfringement -ntp -ntpv -numofservers -oldertime -org -origintime -overflown -packetsize -param -pauthcodesize -pauthcodesize -pauthintf -pauthintf -pbuffer -pclientrxtime -pclienttime -pclienttxtime -pclockoffset -pcontext -pcurrenttime -phasresponsetimedout -pkcs -pml -pnetworkbuffer -pnetworkbuffer -pnetworkcontext -pnetworkcontext -pnetworkintf -png -poldertime -positivediff -posix -ppacket -pparsedresponse -ppm -ppollinterval -preadstarttime -prequestpacket -prequesttime -prequesttxtime -presponsebuffer -presponsecode -presponsedata -presponsepacket -presponserxtime -printf -pserveraddr -pservername -pserverrxtime -pservertime -pservertxtime -psntptime -ptime -ptimeserver -ptimeservers -ptr -ptransportintf -pudptransportintf -punixtimemicrosecs -punixtimesecs -pusercontext -pwordmemory -randomnum -randomnumber -receivetime -recv -recvfrom -refid -reftime -rejectedresponsecode -resolvednsfunc -responsesize -responsetimeoutms -retryable -rfc -rootdelay -rootdisp -rootdispersion -rstr -rx -sdk -secsinnetorder -secsinnetorder -sendsntppacket -sendto -serializerequest -serveraddr -servernamelen -serverport -serverresponsetimeoutms -servertime -servertimesec -servertxtime -setsystemtimeatindex -setsystemtimefunc -signedfirstorderdiffrecv -signedfirstorderdiffsend -sizeof -sntp -sntpauthcontext -sntpbuffertoosmall -sntpclockoffsetoverflow -sntperrorautherror -sntperrorauthfailure -sntperrorbadparameter -sntperrorbuffertoosmall -sntperrorchangeserver -sntperrorcontextnotinitialized -sntperrordnsfailure -sntperrornetworkfailure -sntperrorresponsetimeout -sntperrorsendtimeout -sntperrortimenotsupported -sntpinvalidresponse -sntpnoresponse -sntpnoresponsereceived -sntppacketsize -sntprejectedresponse -sntprejectedresponsechangeserver -sntprejectedresponseothercode -sntprejectedresponseretrywithbackoff -sntpservernotauthenticated -sntpsuccess -sntptimestamp -sntpv -sntpzeropollinterval -spdx -startingpos -startingpos -struct -sublicense -testbuffer -testclockoffsetcalculation -timebeforeloop -timediffsec -timeoutms -timeserver -transmittime -trng -tx -typename -udp -udprecvretcodes -udpsendretcodes -uint -unix -utc -validateserverauth -wordmemory -wordval -www -xffff From bf27808ec68ca363ff045d7d385e12d847dbf0f5 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Wed, 30 Aug 2023 15:29:06 -0700 Subject: [PATCH 05/11] Use the new version of the cspell.config.yaml --- cspell.config.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index e7d8a56..331f137 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -4,6 +4,12 @@ version: '0.2' # Allows things like stringLength allowCompoundWords: true useGitignore: true +languageSettings: + - allowCompoundWords: true + caseSensitive: false + enabled: true + languageId: c + locale: "*" # Could split this up? And do a dictionary for each repo? # But feel like if this isn't super slow # That having just one single dictionary might be nicer? @@ -14,9 +20,8 @@ dictionaryDefinitions: dictionaries: - freertos-words ignorePaths: - - 'node_modules' - '.cSpellWords.txt' - 'dependency' - 'docs' - 'ThirdParty' - + - 'History.txt' From 110950bb25c04fab3eaca438916c55ed7658a6ad Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Thu, 31 Aug 2023 14:19:22 -0700 Subject: [PATCH 06/11] Update the cspell config file to clean it up a bit --- cspell.config.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cspell.config.yaml b/cspell.config.yaml index 331f137..911ce1d 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -3,24 +3,28 @@ $schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell version: '0.2' # Allows things like stringLength allowCompoundWords: true + +# Read files not to spell check from the git ignore useGitignore: true + +# Language settings for C languageSettings: - - allowCompoundWords: true - caseSensitive: false + - caseSensitive: false enabled: true languageId: c locale: "*" -# Could split this up? And do a dictionary for each repo? -# But feel like if this isn't super slow -# That having just one single dictionary might be nicer? + +# Add a dictionary, and the path to the word list dictionaryDefinitions: - name: freertos-words path: '.github/.cSpellWords.txt' addWords: true + dictionaries: - freertos-words + +# Paths and files to ignore ignorePaths: - - '.cSpellWords.txt' - 'dependency' - 'docs' - 'ThirdParty' From 802d8c76492a4d5b83f4e3ebb4b61136d971cef7 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 1 Sep 2023 09:31:48 -0700 Subject: [PATCH 07/11] Use merged version of some actions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b899e12..694d25c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info lcov --rc lcov_branch_coverage=1 --list build/coverage.info - name: Check Coverage - uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@v2 + uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main with: coverage-file: ./build/coverage.info complexity: @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check complexity - uses: FreeRTOS/CI-CD-Github-Actions/complexity@v2 + uses: FreeRTOS/CI-CD-Github-Actions/complexity@main with: path: ./ @@ -157,7 +157,7 @@ jobs: fetch-depth: 0 - name: Run manifest verifier - uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@v2 + uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main with: path: ./ fail-on-incorrect-version: true From 75a2eef8d376ded7bd9b03fb435e56818605c206 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Fri, 1 Sep 2023 18:22:11 -0700 Subject: [PATCH 08/11] Use merged mainline version of formatting --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 694d25c..1d9a1f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check formatting - uses: FreeRTOS/CI-CD-Github-Actions/formatting@v2 + uses: FreeRTOS/CI-CD-Github-Actions/formatting@main with: path: ./ exclude-dirs: .git From 053d699d5c49d2767aad7cb5b65d665a20c62200 Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Sat, 2 Sep 2023 16:09:32 -0700 Subject: [PATCH 09/11] Update the README file --- README.md | 105 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 77 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index d6baf7e..12dc9b9 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,86 @@ ## coreSNTP Library -This repository contains the coreSNTP library, a client library to use Simple Network Time Protocol (SNTP) to synchronize device clocks with internet time. This library implements the SNTPv4 specification defined in [RFC 4330](https://tools.ietf.org/html/rfc4330). - -An SNTP client can request time from both NTP and SNTP servers. According to the SNTPv4 specification, "_To an NTP or SNTP server, NTP and SNTP clients are indistinguishable; to an NTP or SNTP client, NTP and SNTP servers are indistinguishable._", thereby, allowing SNTP clients to request time from NTP servers. - -This library has gone through code quality checks including verification that no function has a [GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) score over 8, and checks against deviations from mandatory rules in the [MISRA coding standard](https://www.misra.org.uk). Deviations from the MISRA C:2012 guidelines are documented under [MISRA Deviations](MISRA.md). This library has also undergone both static code analysis from [Coverity static analysis](https://scan.coverity.com/), and validation of memory safety through the [CBMC automated reasoning tool](https://www.cprover.org/cbmc/). - -See memory requirements for this library [here](./docs/doxygen/include/size_table.md). - -**coreSNTP v1.2.0 [source code](https://github.com/FreeRTOS/coreSNTP/tree/v1.2.0/source) is part of the [FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) release.** +**[API Documentation Pages for current and previous releases of this library can be found here](https://freertos.github.io/coreSNTP/)** + +This repository contains the coreSNTP library, a client library to use Simple +Network Time Protocol (SNTP) to synchronize device clocks with internet time. +This library implements the SNTPv4 specification defined in +[RFC 4330](https://tools.ietf.org/html/rfc4330). + +An SNTP client can request time from both NTP and SNTP servers. According to the +SNTPv4 specification, "_To an NTP or SNTP server, NTP and SNTP clients are +indistinguishable; to an NTP or SNTP client, NTP and SNTP servers are +indistinguishable._", thereby, allowing SNTP clients to request time from NTP +servers. + +This library has gone through code quality checks including verification that no +function has a +[GNU Complexity](https://www.gnu.org/software/complexity/manual/complexity.html) +score over 8, and checks against deviations from mandatory rules in the +[MISRA coding standard](https://www.misra.org.uk). Deviations from the MISRA +C:2012 guidelines are documented under [MISRA Deviations](MISRA.md). This +library has also undergone both static code analysis from +[Coverity static analysis](https://scan.coverity.com/), and validation of memory +safety through the +[CBMC automated reasoning tool](https://www.cprover.org/cbmc/). + +See memory requirements for this library +[here](./docs/doxygen/include/size_table.md). + +**coreSNTP v1.2.0 +[source code](https://github.com/FreeRTOS/coreSNTP/tree/v1.2.0/source) is part +of the +[FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) +release.** ### Documentation -The API reference documentation for the coreSNTP library version released in [FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS) can be viewed from the [freertos.org website](https://freertos.org/coresntp/index.html). +The API reference documentation for the coreSNTP library version released in +[FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS) can be viewed from the +[freertos.org website](https://freertos.org/coresntp/index.html). ## Cloning this repository -This repo uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to bring in dependent components. + +This repo uses +[Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to bring +in dependent components. To clone using HTTPS: + ``` git clone https://github.com/FreeRTOS/coreSNTP.git --recurse-submodules ``` + Using SSH: + ``` git clone git@github.com:FreeRTOS/coreSNTP.git --recurse-submodules ``` -If you have downloaded the repo without using the `--recurse-submodules` argument, you need to run: +If you have downloaded the repo without using the `--recurse-submodules` +argument, you need to run: + ``` git submodule update --init --recursive ``` ## Building the library -You can build the coreSNTP source files that are in the [source](source/) directory, and add [source/include](source/include) to your compiler's include path. +You can build the coreSNTP source files that are in the [source](source/) +directory, and add [source/include](source/include) to your compiler's include +path. -If using CMake, the [coreSntpFilePaths.cmake](coreSntpFilePaths.cmake) file contains the above information of the source files and the header include path from this repository. +If using CMake, the [coreSntpFilePaths.cmake](coreSntpFilePaths.cmake) file +contains the above information of the source files and the header include path +from this repository. ## Reference Example -A reference example of using the coreSNTP library can be viewed in the `FreeRTOS/FreeRTOS` repository [here](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator). -The demo application showcases use of the library in order to create an SNTP client for periodic time synchronization of the system clock. +A reference example of using the coreSNTP library can be viewed in the +`FreeRTOS/FreeRTOS` repository +[here](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/coreSNTP_Windows_Simulator). +The demo application showcases use of the library in order to create an SNTP +client for periodic time synchronization of the system clock. ## Building Unit Tests @@ -48,7 +88,9 @@ The unit tests for the library use CMock/Unity unit testing framework. ### Checkout CMock Submodule -To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule: +To build unit tests, the submodule dependency of CMock is required. Use the +following command to clone the submodule: + ``` git submodule update --checkout --init --recursive test/unit-test/CMock ``` @@ -56,16 +98,19 @@ git submodule update --checkout --init --recursive test/unit-test/CMock ### Unit Test Platform Prerequisites - For running unit tests - - **C90 compiler** like gcc - - **CMake 3.13.0 or later** - - **Ruby 2.0.0 or later** is additionally required for the CMock test framework (that we use). -- For running the coverage target, **gcov** and **lcov** are additionally required. + - **C90 compiler** like gcc + - **CMake 3.13.0 or later** + - **Ruby 2.0.0 or later** is additionally required for the CMock test + framework (that we use). +- For running the coverage target, **gcov** and **lcov** are additionally + required. ### Steps to build **Unit Tests** -1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule)) +1. Go to the root directory of this repository. (Make sure that the **CMock** + submodule is cloned as described [above](#checkout-cmock-submodule)) -1. Run the *cmake* command: `cmake -S test -B build -DBUILD_UNIT_TESTS=ON` +1. Run the _cmake_ command: `cmake -S test -B build -DBUILD_UNIT_TESTS=ON` 1. Run this command to build the library and unit tests: `make -C build all` @@ -73,19 +118,22 @@ git submodule update --checkout --init --recursive test/unit-test/CMock 1. Run `cd build && ctest` to execute all tests and view the test run summary. - ## CBMC proofs -To learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training). +To learn more about CBMC and proofs specifically, review the training material +[here](https://model-checking.github.io/cbmc-training). The `test/cbmc/proofs` directory contains CBMC proofs. -In order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html). +In order to run these proofs you will need to install CBMC and other tools by +following the instructions +[here](https://model-checking.github.io/cbmc-training/installation.html). ## Generating documentation The Doxygen references were created using Doxygen version 1.9.2. To generate the -Doxygen pages, please run the following command from the root of this repository: +Doxygen pages, please run the following command from the root of this +repository: ```shell doxygen docs/doxygen/config.doxyfile @@ -93,7 +141,8 @@ doxygen docs/doxygen/config.doxyfile ## Contributing -See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on contributing. +See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on +contributing. ## License From 3b1ca12ee95551f59a2b2d38f5876e21ab4f9f7d Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Tue, 5 Sep 2023 10:26:26 -0700 Subject: [PATCH 10/11] Add in bot formatting action --- .github/workflows/formatting.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/formatting.yml diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 0000000..f7141e7 --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,23 @@ +name: Format Pull Request Files + +on: + issue_comment: + types: [created] + +env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + +jobs: + Formatting: + name: Run Formatting Check + if: ${{ github.event.issue.pull_request }} && + ( ( github.event.comment.body == '/bot run uncrustify' ) || + ( github.event.comment.body == '/bot run formatting' ) ) + runs-on: ubuntu-20.04 + steps: + - name: Apply Formatting Fix + uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@v2 + id: check-formatting From 739263b2915293b82eb5ddf098f74d847f9512ca Mon Sep 17 00:00:00 2001 From: Soren Ptak Date: Tue, 5 Sep 2023 13:55:41 -0700 Subject: [PATCH 11/11] Update to use merged mainline actions, use checkout@v3 instead of checkout@v2 on all jobs --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/formatting.yml | 2 +- .github/workflows/release.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d9a1f9..a28d886 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,7 @@ jobs: - name: Clone This Repo uses: actions/checkout@v3 - name: Run spellings check - uses: FreeRTOS/CI-CD-GitHub-Actions/spellings@v2 + uses: FreeRTOS/CI-CD-Github-Actions/spellings@main with: path: ./ @@ -146,7 +146,7 @@ jobs: - name: Check Links env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@v2 + uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main verify-manifest: runs-on: ubuntu-latest @@ -167,7 +167,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Run doxygen build - uses: FreeRTOS/CI-CD-Github-Actions/doxygen@v2 + uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main with: path: ./ memory_statistics: @@ -179,7 +179,7 @@ jobs: with: python-version: "3.7.x" - name: Measure sizes - uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@v2 + uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main with: config: .github/memory_statistics_config.json check_against: docs/doxygen/include/size_table.md diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index f7141e7..8257add 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -19,5 +19,5 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Apply Formatting Fix - uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@v2 + uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main id: check-formatting diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eeead2e..c33fb1c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Check if tag exists run: | git fetch origin @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.commit_id }} - name: Configure git identity @@ -87,7 +87,7 @@ jobs: - name: Install ZIP tools run: sudo apt-get install zip unzip - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.commit_id }} path: coreSNTP