diff --git a/.asf.yaml b/.asf.yaml
index 4e7b260a7..31267a11d 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -1,9 +1,10 @@
-# Reference: https://github.com/apache/infrastructure-asfyaml.
github:
description: "Apache NuttX Apps is a collection of tools, shells, network utilities, libraries, interpreters and can be used with the NuttX RTOS"
homepage: https://nuttx.apache.org/
features:
+ # Enable issues management
issues: true
+ # Enable project for project management boards
projects: true
labels:
- nuttx
@@ -13,22 +14,9 @@ github:
- mcu
- microcontroller
enabled_merge_buttons:
- squash: false
- merge: false
- rebase: true
- protected_branches:
- master:
- required_status_checks:
- strict: false
-# Contexts cause hanging CI etc disable for now.
-# contexts:
-# - Check
-# - Lint
-# - Build
- required_pull_request_reviews:
- dismiss_stale_reviews: true
- require_last_push_approval: true
- required_approving_review_count: 2
- required_linear_history: true
- required_signatures: false
- required_conversation_resolution: true
+ # disable squash button:
+ squash: false
+ # disable merge button:
+ merge: false
+ # enable rebase button:
+ rebase: true
diff --git a/.codespell-ignore-lines b/.codespell-ignore-lines
deleted file mode 100644
index 5902decae..000000000
--- a/.codespell-ignore-lines
+++ /dev/null
@@ -1,16 +0,0 @@
- mynewt-nimble/nimble/host/services/ans/src/ble_svc_ans.c
- mynewt-nimble/nimble/host/services/ans/include
-#include "services/ans/ble_svc_ans.h"
-#include "crypto/controlse/ccertificate.hxx"
- * notifications for the ANS Unread Alert Status characteristic
- object = new Controlse::CCertificate(
- Controlse::CCertificate cert(se, settings->key_id);
- auto certificate = Controlse::CCertificate(
- * |---------- [-rw-r--r-- 15] afile.txt
- g_afile.name = "afile.txt";
- "*.deh", "*.hhe", "*.seh", NULL);
- MUSIC("introa"), MUSIC("runnin"), MUSIC("stalks"), MUSIC("countd"),
- MUSIC("betwee"), MUSIC("doom"), MUSIC("the_da"), MUSIC("shawn"),
- MUSIC("messag"), MUSIC("count2"), MUSIC("ddtbl3"), MUSIC("ampie"),
- MUSIC("tense"), MUSIC("shawn3"), MUSIC("openin"), MUSIC("evil"),
-/* ANS service */
diff --git a/.codespellrc b/.codespellrc
deleted file mode 100644
index 743ab2a75..000000000
--- a/.codespellrc
+++ /dev/null
@@ -1,16 +0,0 @@
-[codespell]
-
-# Add complete lines to be ignored to this file.
-# Example for ignoring all current occurrences of (verifiably correct) word usage:
-# grep -hirw "emac" | sort | uniq >>.codespell-ignore-lines
-exclude-file = .codespell-ignore-lines
-
-# Ignore complete files (e.g. legal text or other immutable material).
-skip =
- LICENSE,
- examples/webpanel/content/www/xterm.min.js,
- **/games/NXDoom/src/doom/d_englsh.h,
- **/games/NXDoom/src/doom/d_french.h
-
-# Ignore words list (FTP protocol commands and technical terms)
-ignore-words-list = ALLO, ARCHTYPE, parm, shiftIn
diff --git a/.github/ISSUE_TEMPLATE/001_bug_report.yml b/.github/ISSUE_TEMPLATE/001_bug_report.yml
deleted file mode 100644
index 1206aa1ea..000000000
--- a/.github/ISSUE_TEMPLATE/001_bug_report.yml
+++ /dev/null
@@ -1,166 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-name: Bug report
-description: Report a bug to improve NuttX stability
-title: "[BUG]
"
-labels: [๐ needs triage, "Type: Bug"]
-body:
- - type: markdown
- attributes:
- value: |
- Hello NuttX Community member! Please keep things tidy by putting your post in the proper place:
-
- Reporting a bug: use this form.
- Asking a question or getting help: use the [General Help](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=Community%3A+Question&projects=&template=003_help.yml&title=%5BHELP%5D+%3Ctitle%3E) form or [Mailing list](https://nuttx.apache.org/community/).
- Requesting a new feature: use the [Feature request](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=Type%3A+Enhancement&projects=&template=002_feature_request.yml&title=%5BFEATURE%5D+%3Ctitle%3E) form.
- - type: textarea
- attributes:
- label: "Description / Steps to reproduce the issue"
- description: "A clear and concise description of what the bug is, and why you consider it to be a bug, and steps for how to reproduce it"
- placeholder: |
- A description with steps to reproduce the issue.
- May include logs, images, or videos.
- 1. Step 1
- 2. Step 2
- validations:
- required: true
-
- - type: markdown
- attributes:
- value: |
- ### Environment
- Please specify your environment.
-
- - type: dropdown
- id: os
- attributes:
- label: On which OS does this issue occur?
- multiple: true
- options:
- - "[OS: BSD]"
- - "[OS: Linux]"
- - "[OS: Mac]"
- - "[OS: Windows]"
- - "[OS: Other]"
- validations:
- required: true
-
- - type: input
- id: os_version
- attributes:
- label: What is the version of your OS?
- description: Please fill out the distro or OS version from the previous dropdown
- placeholder: "MacOS 14, Ubuntu 23.10, Windows 10/MSYS_NT-10.0-19045, ecc"
- validations:
- required: true
-
- - type: input
- attributes:
- label: NuttX Version
- placeholder: "e.g., master, 12.5.1, ecc"
- validations:
- required: true
-
- - type: dropdown
- id: architecture
- attributes:
- label: Issue Architecture
- description: What architecture(s) are you seeing the problem on?
- multiple: true
- options:
- - "[Arch: all]"
- - "[Arch: arm]"
- - "[Arch: arm64]"
- - "[Arch: avr]"
- - "[Arch: ceva]"
- - "[Arch: hc]"
- - "[Arch: mips]"
- - "[Arch: misoc]"
- - "[Arch: openrisc]"
- - "[Arch: renesas]"
- - "[Arch: risc-v]"
- - "[Arch: simulator]"
- - "[Arch: sparc]"
- - "[Arch: tricore]"
- - "[Arch: x86]"
- - "[Arch: x86_64]"
- - "[Arch: xtensa]"
- - "[Arch: z16]"
- - "[Arch: z80]"
- validations:
- required: true
-
- - type: dropdown
- id: area
- attributes:
- label: Issue Area
- description: What area(s) are you seeing the problem on?
- multiple: true
- options:
- - "[Area: Audio]"
- - "[Area: Benchmarks]"
- - "[Area: Boot]"
- - "[Area: CAN]"
- - "[Area: Binfmt]"
- - "[Area: Crypto]"
- - "[Area: Database]"
- - "[Area: Examples]"
- - "[Area: File System]"
- - "[Area: Games]"
- - "[Area: Graphics]"
- - "[Area: Industry]"
- - "[Area: Inertial]"
- - "[Area: Interpreters]"
- - "[Area: Logging]"
- - "[Area: LTE]"
- - "[Area: Math]"
- - "[Area: Mlearing]"
- - "[Area: Modbus]"
- - "[Area: Networking]"
- - "[Area: NSH]"
- - "[Area: SDR]"
- - "[Area: System]"
- - "[Area: Testing]"
- - "[Area: Video]"
- - "[Area: Wireless]"
- - "[Area: Build System]"
- - "[Area: Tools]"
- - "[Area: Other]"
- - "[Area: Posix]"
- validations:
- required: true
-
- - type: textarea
- attributes:
- label: "Host information"
- description: "What is the output of `make host_info` command while your buggy configuration selected and if possible device connected to your system?"
- validations:
- required: false
-
- - type: markdown
- attributes:
- value: |
- ### Before You Submit
-
- Please verify that you've followed these steps:
- - Confirm the problem is reproducible on [**master**](https://github.com/apache/nuttx-apps) or [**latest stable**](https://nuttx.apache.org/download) release.
- - Run `make distclean` when encountering build issues.
- - Search [existing issues](https://github.com/apache/nuttx-apps/issues) (including [closed](https://github.com/apache/nuttx-apps/issues?q=is%3Aissue+is%3Aclosed))
- - Read the [FAQ](https://nuttx.apache.org/docs/latest/faq/index.html).
-
- - type: checkboxes
- attributes:
- label: "Verification"
- options:
- - label: "I have verified before submitting the report."
- required: true
diff --git a/.github/ISSUE_TEMPLATE/002_feature_request.yml b/.github/ISSUE_TEMPLATE/002_feature_request.yml
deleted file mode 100644
index 1edb675cb..000000000
--- a/.github/ISSUE_TEMPLATE/002_feature_request.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-name: Feature request
-description: Request an enhancement for NuttX
-title: "[FEATURE] "
-labels: ["Type: Enhancement"]
-body:
- - type: markdown
- attributes:
- value: |
- Hello NuttX Community member! Please keep things tidy by putting your post in the proper place:
-
- Requesting a new feature: use this form.
- Asking a question or getting help: use the [General Help](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=Community%3A+Question&projects=&template=003_help.yml&title=%5BHELP%5D+%3Ctitle%3E) form or [Mailing list](https://nuttx.apache.org/community/).
- Reporting a bug: use the [Bug report](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=%F0%9F%91%80+needs+triage%2CType%3A+Bug&projects=&template=001_bug_report.yml&title=%5BBUG%5D+%3Ctitle%3E) form.
-
- - type: textarea
- id: question-description
- attributes:
- label: Is your feature request related to a problem? Please describe.
- description: Please provide a clear and concise description of what the problem is. Add relevant issue link.
- validations:
- required: true
-
- - type: textarea
- id: solution
- attributes:
- label: Describe the solution you'd like
- description: Please provide a clear and concise description of what you want to happen.
- validations:
- required: true
-
- - type: textarea
- id: alternatives
- attributes:
- label: Describe alternatives you've considered
- description: Please provide a clear and concise description of any alternative solutions or features you've considered.
-
- - type: markdown
- attributes:
- value: |
- ### Before You Submit
-
- Please verify that you've followed these steps:
- - Search [existing feature requests](https://github.com/apache/nuttx-apps/issues) (including [closed](https://github.com/apache/nuttx-apps/issues?q=is%3Aissue+is%3Aclosed))
-
- - type: checkboxes
- attributes:
- label: "Verification"
- options:
- - label: "I have verified before submitting the report."
- required: true
diff --git a/.github/ISSUE_TEMPLATE/003_help.yml b/.github/ISSUE_TEMPLATE/003_help.yml
deleted file mode 100644
index 0d4f82858..000000000
--- a/.github/ISSUE_TEMPLATE/003_help.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-name: General Help
-description: Get general support regarding NuttX
-title: "[HELP] "
-labels: ["Community: Question"]
-body:
- - type: markdown
- attributes:
- value: |
- Hello NuttX Community member! Please keep things tidy by putting your post in the proper place:
-
- Asking a question or getting help: use this form or [Mailing list](https://nuttx.apache.org/community/).
- Reporting a bug: use the [Bug report](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=%F0%9F%91%80+needs+triage%2CType%3A+Bug&projects=&template=001_bug_report.yml&title=%5BBUG%5D+%3Ctitle%3E) form.
- Requesting a new feature: use the [Feature request](https://github.com/apache/nuttx-apps/issues/new?assignees=&labels=Type%3A+Enhancement&projects=&template=002_feature_request.yml&title=%5BFEATURE%5D+%3Ctitle%3E) form
-
- - type: markdown
- attributes:
- value: |
- ### Whether you're a beginner or an experienced developer, NuttX Help is here to assist you with all your NuttX questions and concerns.
-
- - type: textarea
- id: question-description
- attributes:
- label: Description
- description: Explain the background or context of your question. This helps others understand your problem or inquiry better.
- validations:
- required: true
-
- - type: markdown
- attributes:
- value: |
- ### Before You Submit
-
- Please verify that you've followed these steps:
- - I have searched [NuttX Documentation](https://nuttx.apache.org/docs/latest/) and didn't find an answer to my question.
- - Search [existing issues](https://github.com/apache/nuttx-apps/issues) (including [closed](https://github.com/apache/nuttx-apps/issues?q=is%3Aissue+is%3Aclosed))
-
- - type: checkboxes
- attributes:
- label: "Verification"
- options:
- - label: "I have verified before submitting the report."
- required: true
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
deleted file mode 100644
index 3ba13e0ce..000000000
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ /dev/null
@@ -1 +0,0 @@
-blank_issues_enabled: false
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index d95cfcec5..f0c731226 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,21 +1,6 @@
-*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
-
## Summary
-*Update this section with information on why change is necessary,
- what it exactly does and how, if new feature shows up, provide
- references (dependencies, similar problems and solutions), etc.*
-
## Impact
-*Update this section, where applicable, on how change affects users,
- build process, hardware, documentation, security, compatibility, etc.*
-
## Testing
-*Update this section with details on how did you verify the change,
- what Host was used for build (OS, CPU, compiler, ..), what Target was
- used for verification (arch, board:config, ..), etc. Providing build
- and runtime logs from before and after change is highly appreciated.*
-
-
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
deleted file mode 100644
index 89213a4c0..000000000
--- a/.github/SECURITY.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Security Policy
-
-## Supported Versions
-
-| Version | Supported |
-| ------- | ------------------ |
-| 11.0.x | :heavy_check_mark: |
-| 10.3.x | :heavy_check_mark: |
-| 10.2.x | :heavy_check_mark: |
-| 10.1.x | :heavy_check_mark: |
-| 10.0.x | :heavy_check_mark: |
-| 9.1.x | :heavy_check_mark: |
-| < 9.1 | :x: |
-
-## Reporting a Vulnerability
-
-If you think you have found a possible vulnerability please reach out to the _private_ project mailing list
-private@nuttx.apache.org or the Apache Security list security@apache.org.
-
-Please **DO NOT** create a GitHub issue or email the project dev list as they are public.
-This project follows the Apache Vulnerability Handling Policy documented [here](https://www.apache.org/security/committers.html#vulnerability-handling).
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index 5ace4600a..000000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-version: 2
-updates:
- - package-ecosystem: "github-actions"
- directory: "/"
- schedule:
- interval: "weekly"
diff --git a/.github/labeler.yml b/.github/labeler.yml
deleted file mode 100644
index 278cc551a..000000000
--- a/.github/labeler.yml
+++ /dev/null
@@ -1,171 +0,0 @@
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# Note: NuttX PR Labeler only supports a subset of the
-# `actions/labeler` syntax: `changed-files` and
-# `any-glob-to-any-file`. See .github/workflows/labeler.yml
-
-# add arch labels
-
-"Area: Audio":
- - changed-files:
- - any-glob-to-any-file: 'audioutils/**'
- - any-glob-to-any-file: 'include/audioutils/**'
-
-"Area: Benchmarks":
- - changed-files:
- - any-glob-to-any-file: 'benchmarks/**'
- - any-glob-to-any-file: 'include/benchmarks/**'
-
-"Area: Boot":
- - changed-files:
- - any-glob-to-any-file: 'boot/**'
- - any-glob-to-any-file: 'include/boot/**'
-
-"Area: CAN":
- - changed-files:
- - any-glob-to-any-file: 'canutils/**'
- - any-glob-to-any-file: 'include/canutils/**'
-
-"Area: Binfmt":
- - changed-files:
- - any-glob-to-any-file: 'builtin/**'
- - any-glob-to-any-file: 'include/builtin/**'
-
-"Area: Crypto":
- - changed-files:
- - any-glob-to-any-file: 'crypto/**'
- - any-glob-to-any-file: 'include/crypto/**'
-
-"Area: Database":
- - changed-files:
- - any-glob-to-any-file: 'database/**'
- - any-glob-to-any-file: 'include/database/**'
-
-"Area: Examples":
- - changed-files:
- - any-glob-to-any-file: 'examples/**'
-
-"Area: File System":
- - changed-files:
- - any-glob-to-any-file: 'fsutils/**'
- - any-glob-to-any-file: 'include/fsutils/**'
-
-"Area: Games":
- - changed-files:
- - any-glob-to-any-file: 'games/**'
- - any-glob-to-any-file: 'include/games/**'
-
-"Area: Graphics":
- - changed-files:
- - any-glob-to-any-file: 'graphics/**'
- - any-glob-to-any-file: 'include/graphics/**'
-
-"Area: Industry":
- - changed-files:
- - any-glob-to-any-file: 'industry/**'
- - any-glob-to-any-file: 'include/industry/**'
-
-"Area: Inertial":
- - changed-files:
- - any-glob-to-any-file: 'inertial/**'
- - any-glob-to-any-file: 'include/inertial/**'
-
-"Area: Interpreters":
- - changed-files:
- - any-glob-to-any-file: 'interpreters/**'
- - any-glob-to-any-file: 'include/interpreters/**'
-
-"Area: Logging":
- - changed-files:
- - any-glob-to-any-file: 'logging/**'
- - any-glob-to-any-file: 'include/logging/**'
-
-"Area: LTE":
- - changed-files:
- - any-glob-to-any-file: 'lte/**'
- - any-glob-to-any-file: 'include/lte/**'
-
-"Area: Math":
- - changed-files:
- - any-glob-to-any-file: 'math/**'
- - any-glob-to-any-file: 'include/math/**'
-
-"Area: Mlearning":
- - changed-files:
- - any-glob-to-any-file: 'mlearning/**'
- - any-glob-to-any-file: 'include/mlearning/**'
-
-"Area: Modbus":
- - changed-files:
- - any-glob-to-any-file: 'modbus/**'
- - any-glob-to-any-file: 'include/modbus/**'
-
-"Area: Networking":
- - changed-files:
- - any-glob-to-any-file: 'netutils/**'
- - any-glob-to-any-file: 'include/netuitls/**'
-
-"Area: NSH":
- - changed-files:
- - any-glob-to-any-file: 'nshlib/**'
- - any-glob-to-any-file: 'include/nshlib/**'
-
-"Area: SDR":
- - changed-files:
- - any-glob-to-any-file: 'sdr/**'
- - any-glob-to-any-file: 'include/sdr/**'
-
-"Area: System":
- - changed-files:
- - any-glob-to-any-file: 'system/**'
- - any-glob-to-any-file: 'include/system/**'
-
-"Area: Testing":
- - changed-files:
- - any-glob-to-any-file: 'testing/**'
- - any-glob-to-any-file: 'include/testing/**'
-
-"Area: Video":
- - changed-files:
- - any-glob-to-any-file: 'videotuils/**'
- - any-glob-to-any-file: 'include/videotuils/**'
-
-"Area: Wireless":
- - changed-files:
- - any-glob-to-any-file: 'wireless/**'
- - any-glob-to-any-file: 'include/wireless/**'
-
-"Area: Build system":
- - changed-files:
- - any-glob-to-any-file: 'Makefile'
- - any-glob-to-any-file: 'Make.defs'
- - any-glob-to-any-file: '*.mk'
- - any-glob-to-any-file: 'CMakeLists.txt'
- - any-glob-to-any-file: 'cmake/**'
- - any-glob-to-any-file: 'import/**'
- - any-glob-to-any-file: 'staging/**'
-
-"Area: Tools":
- - changed-files:
- - any-glob-to-any-file: 'tools/**'
-
-"Area: CI":
- - changed-files:
- - any-glob-to-any-file: '.github/**'
diff --git a/.github/linters/setup.cfg b/.github/linters/setup.cfg
deleted file mode 100644
index a8b142d93..000000000
--- a/.github/linters/setup.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-[flake8]
-ignore = W503,W605,E203,E704
-max-complexity = 27
-max-line-length = 125
-multi_line_output=3
-show-source = True
-statistics = True
-
-[isort]
-profile = black
diff --git a/.github/workflows/arch.yml b/.github/workflows/arch.yml
deleted file mode 100644
index 02e39ab2b..000000000
--- a/.github/workflows/arch.yml
+++ /dev/null
@@ -1,260 +0,0 @@
-# Identify the Arch for the PR and select the applicable builds
-name: Arch
-
-on:
- workflow_call:
- inputs:
- os:
- description: "Operating System hosting the build: Linux, macOS or msys2"
- required: true
- type: string
- boards:
- description: "List of All Builds: [arm-01, risc-v-01, xtensa-01, ...]"
- required: true
- type: string
- outputs:
- skip_all_builds:
- description: "Set to 1 if all builds should be skipped"
- value: ${{ jobs.Select-Builds.outputs.skip_all_builds }}
- selected_builds:
- description: "Selected Builds for the PR: [arm-01, risc-v-01, xtensa-01, ...]"
- value: ${{ jobs.Select-Builds.outputs.selected_builds }}
-
-jobs:
- Select-Builds:
- runs-on: ubuntu-latest
-
- outputs:
- skip_all_builds: ${{ steps.select-builds.outputs.skip_all_builds }}
- selected_builds: ${{ steps.select-builds.outputs.selected_builds }}
-
- steps:
-
- # Get the Arch for the PR: arm, arm64, risc-v, xtensa, ...
- - name: Get arch
- id: get-arch
- run: |
-
- # If PR is Not Created or Modified: Build all targets
- pr=${{github.event.pull_request.number}}
- if [[ "$pr" == "" ]]; then
- echo "Not a Created or Modified PR, will build all targets"
- exit
- fi
-
- # Ignore the Label "Area: Documentation", because it won't affect the Build Targets
- query='.labels | map(select(.name != "Area: Documentation")) | '
- select_name='.[].name'
- select_length='length'
-
- # Get the Labels for the PR: "Arch: risc-v \n Board: risc-v \n Size: XS"
- # If GitHub CLI Fails: Build all targets
- labels=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json labels --jq "$query$select_name" || echo "")
- numlabels=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json labels --jq "$query$select_length" || echo "")
- echo "labels=$labels"
- echo "numlabels=$numlabels" | tee -a $GITHUB_OUTPUT
-
- # Identify the Size, Arch and Board Labels
- if [[ "$labels" == *"Size: "* ]]; then
- echo 'labels_contain_size=1' | tee -a $GITHUB_OUTPUT
- fi
- if [[ "$labels" == *"Arch: "* ]]; then
- echo 'labels_contain_arch=1' | tee -a $GITHUB_OUTPUT
- fi
- if [[ "$labels" == *"Board: "* ]]; then
- echo 'labels_contain_board=1' | tee -a $GITHUB_OUTPUT
- fi
-
- # Get the Arch Label
- if [[ "$labels" == *"Arch: arm64"* ]]; then
- echo 'arch_contains_arm64=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: arm"* ]]; then
- echo 'arch_contains_arm=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: risc-v"* ]]; then
- echo 'arch_contains_riscv=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: simulator"* ]]; then
- echo 'arch_contains_sim=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: x86_64"* ]]; then
- echo 'arch_contains_x86_64=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: x86"* ]]; then
- echo 'arch_contains_x86=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Arch: xtensa"* ]]; then
- echo 'arch_contains_xtensa=1' | tee -a $GITHUB_OUTPUT
- fi
-
- # Get the Board Label
- if [[ "$labels" == *"Board: arm64"* ]]; then
- echo 'board_contains_arm64=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: arm"* ]]; then
- echo 'board_contains_arm=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: risc-v"* ]]; then
- echo 'board_contains_riscv=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: simulator"* ]]; then
- echo 'board_contains_sim=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: x86_64"* ]]; then
- echo 'board_contains_x86_64=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: x86"* ]]; then
- echo 'board_contains_x86=1' | tee -a $GITHUB_OUTPUT
- elif [[ "$labels" == *"Board: xtensa"* ]]; then
- echo 'board_contains_xtensa=1' | tee -a $GITHUB_OUTPUT
- fi
-
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- # Select the Builds for the PR: arm-01, risc-v-01, xtensa-01, ...
- - name: Select builds
- id: select-builds
- run: |
-
- # Skip all macOS Builds
- if [[ "${{ inputs.os }}" == "macOS" ]]; then
- echo "Skipping all macOS Builds"
- echo "skip_all_builds=1" | tee -a $GITHUB_OUTPUT
- exit
- fi
-
- # Fetch the outputs from the previous step
- numlabels=${{ steps.get-arch.outputs.numlabels }}
- labels_contain_size=${{ steps.get-arch.outputs.labels_contain_size }}
- labels_contain_arch=${{ steps.get-arch.outputs.labels_contain_arch }}
- labels_contain_board=${{ steps.get-arch.outputs.labels_contain_board }}
- arch_contains_arm=${{ steps.get-arch.outputs.arch_contains_arm }}
- arch_contains_arm64=${{ steps.get-arch.outputs.arch_contains_arm64 }}
- arch_contains_riscv=${{ steps.get-arch.outputs.arch_contains_riscv }}
- arch_contains_sim=${{ steps.get-arch.outputs.arch_contains_sim }}
- arch_contains_x86=${{ steps.get-arch.outputs.arch_contains_x86 }}
- arch_contains_x86_64=${{ steps.get-arch.outputs.arch_contains_x86_64 }}
- arch_contains_xtensa=${{ steps.get-arch.outputs.arch_contains_xtensa }}
- board_contains_arm=${{ steps.get-arch.outputs.board_contains_arm }}
- board_contains_arm64=${{ steps.get-arch.outputs.board_contains_arm64 }}
- board_contains_riscv=${{ steps.get-arch.outputs.board_contains_riscv }}
- board_contains_sim=${{ steps.get-arch.outputs.board_contains_sim }}
- board_contains_x86=${{ steps.get-arch.outputs.board_contains_x86 }}
- board_contains_x86_64=${{ steps.get-arch.outputs.board_contains_x86_64 }}
- board_contains_xtensa=${{ steps.get-arch.outputs.board_contains_xtensa }}
-
- # inputs.boards is a JSON Array: ["arm-01", "risc-v-01", "xtensa-01", ...]
- # We compact and remove the newlines
- boards=$( echo '${{ inputs.boards }}' | jq --compact-output ".")
- numboards=$( echo "$boards" | jq "length" )
-
- # We consider only Simple PRs with:
- # Arch + Size Labels Only
- # Board + Size Labels Only
- # Arch + Board + Size Labels Only
- if [[ "$labels_contain_size" != "1" ]]; then
- echo "Size Label Missing, will build all targets"
- quit=1
- elif [[ "$numlabels" == "2" && "$labels_contain_arch" == "1" ]]; then
- echo "Arch + Size Labels Only"
- elif [[ "$numlabels" == "2" && "$labels_contain_board" == "1" ]]; then
- echo "Board + Size Labels Only"
- elif [[ "$numlabels" == "3" && "$labels_contain_arch" == "1" && "$labels_contain_board" == "1" ]]; then
- # Arch and Board must be the same
- if [[
- "$arch_contains_arm" != "$board_contains_arm" ||
- "$arch_contains_arm64" != "$board_contains_arm64" ||
- "$arch_contains_riscv" != "$board_contains_riscv" ||
- "$arch_contains_sim" != "$board_contains_sim" ||
- "$arch_contains_x86" != "$board_contains_x86" ||
- "$arch_contains_x86_64" != "$board_contains_x86_64" ||
- "$arch_contains_xtensa" != "$board_contains_xtensa"
- ]]; then
- echo "Arch and Board are not the same, will build all targets"
- quit=1
- else
- echo "Arch + Board + Size Labels Only"
- fi
- else
- echo "Not a Simple PR, will build all targets"
- quit=1
- fi
-
- # If Not a Simple PR: Build all targets
- if [[ "$quit" == "1" ]]; then
- # If PR was Created or Modified: Include all boards
- pr=${{github.event.pull_request.number}}
- if [[ "$pr" != "" ]]; then
- echo "Include all boards"
- boards=$(
- echo '${{ inputs.boards }}' |
- jq --compact-output \
- '.'
- )
- fi
- echo "selected_builds=$boards" | tee -a $GITHUB_OUTPUT
- exit
- fi
-
- # For every board
- for (( i=0; i> $GITHUB_OUTPUT
- echo "apps_ref=$APPS_REF" >> $GITHUB_OUTPUT
+ echo ::set-output name=os_ref::$OS_REF
+ echo ::set-output name=apps_ref::$APPS_REF
- name: Checkout nuttx repo
- uses: actions/checkout@v7
+ uses: actions/checkout@v2
with:
- repository: apache/nuttx
+ repository: apache/incubator-nuttx
ref: ${{ steps.gittargets.outputs.os_ref }}
path: sources/nuttx
fetch-depth: 1
@@ -95,390 +91,105 @@ jobs:
run: git -C sources/nuttx fetch --tags
- name: Checkout apps repo
- uses: actions/checkout@v7
+ uses: actions/checkout@v2
with:
- repository: apache/nuttx-apps
+ repository: apache/incubator-nuttx-apps
ref: ${{ steps.gittargets.outputs.apps_ref }}
path: sources/apps
fetch-depth: 1
- name: Tar sources
run: tar zcf sources.tar.gz sources
-
- name: Archive Source Bundle
- uses: actions/upload-artifact@v7.0.1
+ uses: actions/upload-artifact@v1
with:
name: source-bundle
path: sources.tar.gz
- # Select the Linux Builds based on PR Arch Label
- Linux-Arch:
- uses: apache/nuttx-apps/.github/workflows/arch.yml@master
- needs: Fetch-Source
- with:
- os: Linux
- boards: |
- [
- "arm-01", "risc-v-01", "sim-01", "xtensa-01", "arm64-01", "x86_64-01", "other",
- "arm-02", "risc-v-02", "sim-02", "xtensa-02",
- "arm-03", "risc-v-03", "sim-03", "xtensa-03",
- "arm-04", "risc-v-04",
- "arm-05", "risc-v-05",
- "arm-06", "risc-v-06",
- "arm-07", "arm-08", "arm-09", "arm-10", "arm-11", "arm-12", "arm-13", "arm-14"
- ]
-
- # Run the selected Linux Builds
Linux:
- needs: Linux-Arch
- if: ${{ needs.Linux-Arch.outputs.skip_all_builds != '1' }}
+ needs: Fetch-Source
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
- # Documented sim/login CI test credential (not a production secret).
- # Used when CONFIG_BOARD_ETC_ROMFS_PASSWD_ENABLE=y and defconfig omits
- # the password. See nuttx tools/update_romfs_password.sh.
- NUTTX_ROMFS_PASSWD_PASSWORD: NuttXSimLogin1!
strategy:
- max-parallel: 12
matrix:
- boards: ${{ fromJSON(needs.Linux-Arch.outputs.selected_builds) }}
+ boards: [arm-01, arm-02, arm-03, arm-04, arm-05, arm-06, arm-07, arm-08, arm-09, arm-10, arm-11, arm-12, arm-13, other, risc-v, sim-01, sim-02, xtensa]
steps:
-
- - name: Show Disk Space
- run: df -h
-
- - name: Free Disk Space (Ubuntu)
- run: |
- sudo rm -rf /usr/local/lib/android
-
- - name: After CLEAN-UP Disk Space
- run: df -h
-
- name: Download Source Artifact
- uses: actions/download-artifact@v8
+ uses: actions/download-artifact@v1
with:
name: source-bundle
path: .
-
- name: Extract sources
run: tar zxf sources.tar.gz
-
- name: Docker Login
- uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1
+ uses: azure/docker-login@v1
with:
- registry: ghcr.io
- username: ${{ github.actor }}
+ login-server: ghcr.io
+ username: ${GITHUB_ACTOR}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Pull
- run: docker pull ghcr.io/apache/nuttx/apache-nuttx-ci-linux
-
+ run: docker pull ghcr.io/apache/incubator-nuttx/apache-nuttx-ci-linux
- name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
-
- name: Run builds
uses: ./sources/nuttx/.github/actions/ci-container
env:
BLOBDIR: /tools/blobs
- NUTTX_ROMFS_PASSWD_PASSWORD: NuttXSimLogin1!
with:
run: |
- export NUTTX_ROMFS_PASSWD_PASSWORD=NuttXSimLogin1!
- export ARTIFACTDIR=`pwd`/buildartifacts
-
- for i in 1 2 3; do
- python -m pip install \
- --default-timeout=100 \
- --retries 10 \
- ntfc==0.0.1 && break
- echo "Retry $i failed..."
- sleep 5
- done
-
- mkdir /github/workspace/nuttx-ntfc
- mkdir /github/workspace/nuttx-ntfc/external
- cd /github/workspace/nuttx-ntfc
- # get NTFC test cases
- cd external
- for i in 1 2 3 4 5; do
- git clone -b release-0.0.1 https://github.com/apache/nuttx-ntfc-testing && break
- if [ "$i" -eq 5 ]; then
- echo "Failed to clone nuttx-ntfc-testing after $i attempts"
- exit 1
- fi
-
- delay=$((i * 10))
- echo "Clone attempt $i failed; retrying in ${delay}s..."
- rm -rf nuttx-ntfc-testing
- sleep "$delay"
- done
- mv nuttx-ntfc-testing nuttx-testing
- export NTFCDIR=/github/workspace/nuttx-ntfc
-
echo "::add-matcher::sources/nuttx/.github/gcc.json"
- git config --global --add safe.directory /github/workspace/sources/nuttx
- git config --global --add safe.directory /github/workspace/sources/apps
- cd /github/workspace/sources/nuttx/tools/ci
- if [ "X${{matrix.boards}}" = "Xcodechecker" ]; then
- ./cibuild.sh -c -A -N -R --codechecker testlist/${{matrix.boards}}.dat
- else
- ( sleep 7200 ; echo Killing pytest after timeout... ; pkill -f pytest )&
- ./cibuild.sh -c -A -N -R -S testlist/${{matrix.boards}}.dat
- fi
-
- - name: Post-build Disk Space
- if: always()
- run: df -h
-
- - uses: actions/upload-artifact@v7.0.1
- if: ${{ always() }}
+ export CCACHE_DIR=`pwd`/ccache
+ mkdir $CCACHE_DIR
+ export ARTIFACTDIR=`pwd`/buildartifacts
+ cd sources/nuttx/tools/ci
+ ./cibuild.sh -A -c testlist/${{matrix.boards}}.dat
+ ccache -s
+ - uses: actions/upload-artifact@v2
with:
- name: linux-${{matrix.boards}}-builds
+ name: linux-builds
path: buildartifacts/
continue-on-error: true
- # Test the out-of-tree build
- OOT-Build:
- needs: Linux
- runs-on: ubuntu-latest
- env:
- DOCKER_BUILDKIT: 1
- steps:
- - name: Download Source Artifact
- uses: actions/download-artifact@v8
- with:
- name: source-bundle
- path: .
-
- - name: Extract sources
- run: tar zxf sources.tar.gz
-
- - name: Docker Login
- uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Export NuttX Repo SHA
- run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
-
- - name: Run Out-of-Tree Build Test
- uses: ./sources/nuttx/.github/actions/ci-container
- env:
- BLOBDIR: /tools/blobs
- with:
- run: |
- echo "::add-matcher::sources/nuttx/.github/gcc.json"
- git config --global --add safe.directory /github/workspace/sources/nuttx
- git config --global --add safe.directory /github/workspace/sources/apps
- cd sources/nuttx
- ./tools/ci/cibuild-oot.sh
-
- - uses: actions/upload-artifact@v7.0.1
- if: ${{ always() }}
- with:
- name: oot-build-artifacts
- path: sources/apps/testing/cxx-oot-build
- continue-on-error: true
-
- # Select the macOS Builds based on PR Arch Label
- macOS-Arch:
- uses: apache/nuttx-apps/.github/workflows/arch.yml@master
- needs: Fetch-Source
- with:
- os: macOS
- boards: |
- ["macos", "sim-01", "sim-02", "sim-03"]
-
- # Run the selected macOS Builds
macOS:
- permissions:
- contents: none
- runs-on: macos-15-intel
- needs: macOS-Arch
- if: ${{ needs.macOS-Arch.outputs.skip_all_builds != '1' }}
- env:
- NUTTX_ROMFS_PASSWD_PASSWORD: NuttXSimLogin1!
+ runs-on: macos-10.15
+ needs: Fetch-Source
strategy:
- max-parallel: 2
matrix:
- boards: ${{ fromJSON(needs.macOS-Arch.outputs.selected_builds) }}
+ boards: [macos, sim-01, sim-02]
steps:
- name: Download Source Artifact
- uses: actions/download-artifact@v8
+ uses: actions/download-artifact@v1
with:
name: source-bundle
path: .
-
- name: Extract sources
run: tar zxf sources.tar.gz
-
- name: Restore Tools Cache
id: cache-tools
- uses: actions/cache@v6
+ uses: actions/cache@v2
env:
cache-name: ${{ runner.os }}-cache-tools
with:
- path: ./sources/tools
- key: ${{ runner.os }}-tools-${{ hashFiles('./sources/nuttx/tools/ci/platforms/darwin.sh') }}
+ path: prebuilt
+ key: ${{ runner.os }}-tools-${{ hashFiles('./sources/nuttx/tools/ci/cibuild.sh') }}
- name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
-
- # Released version of Cython has issues with Python 11. Set runner to use Python 3.10
- # https://github.com/cython/cython/issues/4500
- - uses: actions/setup-python@v7
- with:
- python-version: '3.10'
- name: Run Builds
run: |
echo "::add-matcher::sources/nuttx/.github/gcc.json"
- export NUTTX_ROMFS_PASSWD_PASSWORD=NuttXSimLogin1!
+ export CCACHE_DIR=`pwd`/ccache
+ mkdir $CCACHE_DIR
export ARTIFACTDIR=`pwd`/buildartifacts
cd sources/nuttx/tools/ci
- ./cibuild.sh -i -c -A -R testlist/${{matrix.boards}}.dat
-
- - uses: actions/upload-artifact@v7.0.1
+ ./cibuild.sh -i -A -c testlist/${{matrix.boards}}.dat
+ ccache -s
+ - uses: actions/upload-artifact@v2
with:
- name: macos-${{matrix.boards}}-builds
+ name: macos-builds
path: buildartifacts/
continue-on-error: true
-
- # Select the msys2 Builds based on PR Arch Label
- msys2-Arch:
- uses: apache/nuttx-apps/.github/workflows/arch.yml@master
- needs: Fetch-Source
- with:
- os: msys2
- boards: |
- ["msys2"]
-
- # Run the selected msys2 Builds
- msys2:
- needs: msys2-Arch
- if: ${{ needs.msys2-Arch.outputs.skip_all_builds != '1' }}
- runs-on: windows-latest
- strategy:
- fail-fast: false
- max-parallel: 1
- matrix:
- boards: ${{ fromJSON(needs.msys2-Arch.outputs.selected_builds) }}
-
- defaults:
- run:
- shell: msys2 {0}
- steps:
- - uses: actions/checkout@v7
- - uses: msys2/setup-msys2@v2
- with:
- msystem: MSYS
- update: false
- cache: false
- install: >-
- base-devel
- gcc
- gperf
- automake
- autoconf
- git
- python3
- ncurses-devel
- unzip
- zip
- tio
- zlib-devel
- cmake
- ninja
- python-pip
- vim
- genromfs
-
- - name: pip3 install
- run: |
- python3 -m venv --system-site-packages /usr/local
- pip3 install --root-user-action=ignore --no-cache-dir pyelftools cxxfilt kconfiglib
-
- - run: git config --global core.autocrlf false
-
- - name: Download Source Artifact
- uses: actions/download-artifact@v8
- with:
- name: source-bundle
- path: .
-
- - name: Extract sources
- run: tar zxf sources.tar.gz
-
- - name: Export NuttX Repo SHA
- run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
-
- - name: Run Builds
- run: |
- echo "::add-matcher::sources/nuttx/.github/gcc.json"
- export ARTIFACTDIR=`pwd`/buildartifacts
- git config --global --add safe.directory /github/workspace/sources/nuttx
- git config --global --add safe.directory /github/workspace/sources/apps
- cd sources/nuttx/tools/ci
- ./cibuild.sh -g -i -A -C -N -R testlist/${{matrix.boards}}.dat
-
- - uses: actions/upload-artifact@v7.0.1
- with:
- name: msys2-${{matrix.boards}}-builds
- path: buildartifacts/
- continue-on-error: true
-
- # Select the msvc Builds based on PR Arch Label
- msvc-Arch:
- uses: apache/nuttx-apps/.github/workflows/arch.yml@master
- needs: Fetch-Source
- with:
- os: msvc
- boards: |
- ["msvc_placeholder_with_sim_keyword"]
-
- # Build with MSVC in Windows native
- msvc:
- needs: msvc-Arch
- if: ${{ needs.msvc-Arch.outputs.skip_all_builds != '1' }}
- runs-on: windows-2022
- steps:
- - uses: actions/checkout@v7
- # Set up Python environment and install kconfiglib
- - name: Set up Python and install kconfiglib
- uses: actions/setup-python@v7
- with:
- python-version: '3.10'
- - name: Install kconfiglib
- run: |
- pip install kconfiglib
-
- - run: git config --global core.autocrlf false
-
- - name: Download Source Artifact
- uses: actions/download-artifact@v8
- with:
- name: source-bundle
- path: .
-
- - name: Extract sources
- run: |
- 7z x sources.tar.gz -y
- 7z x sources.tar -y -snld
-
- - name: Run Builds
- run: |
- "ARTIFACTDIR=${{github.workspace}}\sources\buildartifacts" >> $env:GITHUB_ENV
- git config --global --add safe.directory ${{github.workspace}}\sources\nuttx
- git config --global --add safe.directory ${{github.workspace}}\sources\apps
- cd sources\nuttx\tools\ci
- .\cibuild.ps1 -n -i -A -C -N testlist\windows.dat
-
- - uses: actions/upload-artifact@v7.0.1
- with:
- name: msvc-builds
- path: ./sources/buildartifacts/
- continue-on-error: true
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index a183d0c12..4ab5c1086 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -19,36 +19,30 @@ concurrency:
group: check-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
-permissions:
- contents: read
-
jobs:
check:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-18.04
steps:
- name: Checkout nuttx repo
- uses: actions/checkout@v7
+ uses: actions/checkout@v2
with:
- repository: apache/nuttx
+ repository: apache/incubator-nuttx
path: nuttx
fetch-depth: 0
- name: Checkout apps repo
- uses: actions/checkout@v7
+ uses: actions/checkout@v2
with:
- repository: apache/nuttx-apps
+ repository: apache/incubator-nuttx-apps
path: apps
fetch-depth: 0
- name: Check Pull Request
run: |
echo "::add-matcher::nuttx/.github/nxstyle.json"
- python3 -m venv .venv
- source .venv/bin/activate
- pip install codespell cmake-format black isort flake8 cvt2utf
cd apps
commits="${{ github.event.pull_request.base.sha }}..HEAD"
git log --oneline $commits
- echo "../nuttx/tools/checkpatch.sh -c -u -m -g $commits"
- ../nuttx/tools/checkpatch.sh -c -u -m -g $commits
+ echo "../nuttx/tools/checkpatch.sh -g $commits"
+ ../nuttx/tools/checkpatch.sh -g $commits
diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml
deleted file mode 100644
index 2965bf5a6..000000000
--- a/.github/workflows/issue_labeler.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-name: Issue Labeler
-
-on:
- issues:
- types: [opened]
-
-jobs:
- label:
- runs-on: ubuntu-latest
- permissions:
- issues: write
- steps:
- - name: Add labels issues automatically based on their body.
- uses: actions/github-script@v9.0.0
- with:
- script: |
- const body = context.payload.issue.body;
- const bodySplit = body.split(/\[|\]/).map(e => e.toLowerCase());
- const oskeywords = ['os: other', 'os: bsd', 'os: linux', 'os: mac', 'os: windows'];
- const archkeywords1 = ['arch: all', 'arch: arm', 'arch: arm64', 'arch: avr', 'arch: ceva'];
- const archkeywords2 = ['arch: hc', 'arch: mips', 'arch: misoc', 'arch: openrisc', 'arch:renesas'];
- const archkeywords3 = ['arch: risc-v', 'arch: simulator', 'arch: sparc', 'arch: tricore'];
- const archkeywords4 = ['arch: x86', 'arch: x86_64', 'arch: xtensa', 'arch: z16', 'arch: z80', 'arch:renesas'];
- const areakeywords1 = ['area: applications', 'area: api', 'area: board support', 'area: build system'];
- const areakeywords2 = ['area: configuring', 'area: debugging', 'area: drivers', 'area: file system', 'area: installing', 'area: kconfig'];
- const areakeywords3 = ['area: kernel', 'area: memory management', 'area: native port', 'area: networking'];
- const areakeywords4 = ['area: os components', 'area: posix', 'area: sensors', 'area: specific peripheral'];
- var keywordsfound = new Set();
- for (const keyword of keywords) {
- if (bodySplit.includes(keyword)) {
- keywordsfound.add(keyword)
- }
- }
- if (keywordsfound.size !== 0) {
- github.rest.issues.addLabels({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: context.issue.number,
- labels: Array.from(keywordsfound)
- })
- }
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
deleted file mode 100644
index 4c6bb3ef7..000000000
--- a/.github/workflows/labeler.yml
+++ /dev/null
@@ -1,150 +0,0 @@
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# This workflow will fetch the updated PR filenames, compute the Size Label
-# and Arch Labels, then save the PR Labels into a PR Artifact. The
-# PR Labels will be written to the PR inside the "workflow_run" trigger
-# (pr_labeler.yml), because this "pull_request" trigger has read-only
-# permission. Don't use "pull_request_target", it's unsafe.
-# See https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=321719166#GitHubActionsSecurity-Buildstriggeredwithpull_request_target
-name: "Pull Request Labeler"
-on:
- - pull_request
-
-jobs:
- labeler:
- permissions:
- contents: read
- pull-requests: read
- issues: read
- runs-on: ubuntu-latest
- steps:
- # Checkout one file from our trusted source: .github/labeler.yml
- # Never checkout and execute any untrusted code from the PR.
- - name: Checkout labeler config
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- with:
- repository: apache/nuttx-apps
- ref: master
- path: labeler
- fetch-depth: 1
- persist-credentials: false
- sparse-checkout: .github/labeler.yml
- sparse-checkout-cone-mode: false
-
- # Fetch the updated PR filenames. Compute the Size Label and Arch Labels.
- - name: Compute PR labels
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- const owner = context.repo.owner;
- const repo = context.repo.repo;
- const pull_number = context.issue.number;
-
- // Fetch the array of updated PR filenames:
- // { status: 'added', filename: 'arch/arm/test.txt', additions: 3, deletions: 0, changes: 3 }
- // { status: 'removed', filename: 'Documentation/legacy_README.md', additions: 0, deletions: 2531, changes: 2531 }
- // { status: 'modified', filename: 'Documentation/security.rst', additions: 1, deletions: 0, changes: 1 }
- const listFilesOptions = github.rest.pulls.listFiles
- .endpoint.merge({ owner, repo, pull_number });
- const listFilesResponse = await github.paginate(listFilesOptions);
-
- // Sum up the number of lines changed
- const sizeFiles = listFilesResponse
- .filter(f => (f.status != 'removed')); // Ignore deleted files
- var linesChanged = 0;
- for (const file of sizeFiles) {
- linesChanged += file.changes;
- }
- console.log({ linesChanged });
-
- // Compute the Size Label
- const sizeLabel =
- (linesChanged <= 10) ? 'Size: XS'
- : (linesChanged <= 100) ? 'Size: S'
- : (linesChanged <= 500) ? 'Size: M'
- : (linesChanged <= 1000) ? 'Size: L'
- : 'Size: XL';
- var prLabels = [ sizeLabel ];
-
- // Parse the Arch Label Patterns in .github/labeler.yml. Condense into:
- // "Arch: arm":
- // - any-glob-to-any-file: 'arch/arm/**'
- // - any-glob-to-any-file: ...
- const fs = require('fs');
- const config = fs.readFileSync('labeler/.github/labeler.yml', 'utf8')
- .split('\n') // Split by newline
- .map(s => s.trim()) // Remove leading and trailing spaces
- .filter(s => (s != '')) // Remove empty lines
- .filter(s => !s.startsWith('#')) // Remove comments
- .filter(s => !s.startsWith('- changed-files:')); // Remove "changed-files"
-
- // Convert the Arch Label Patterns from config to archLabels.
- // archLabels will contain the mappings for Arch Label and Filename Pattern:
- // { label: "Arch: arm", pattern: "arch/arm/.*" },
- // { label: "Arch: arm64", pattern: "arch/arm64/.*" }, ...
- var archLabels = [];
- var label = "";
- for (const c of config) {
- // Get the Arch Label
- if (c.startsWith('"')) { // "Arch: arm":
- label = c.split('"')[1]; // Arch: arm
-
- } else if (c.startsWith('- any-glob-to-any-file:')) { // - any-glob-to-any-file: 'arch/arm/**'
- // Convert the Glob Pattern to Regex Pattern
- const pattern = c.split("'")[1] // arch/arm/**
- .split('.').join('\\.') // . becomes \.
- .split('*').join('[^/]*') // * becomes [^/]*
- .split('[^/]*[^/]*').join('.*'); // ** becomes .*
- archLabels.push({
- label, // Arch: arm
- pattern: '^' + pattern + '$' // Match the Line Start and Line End
- });
-
- } else {
- // We don't support all rules of `actions/labeler`
- throw new Error('.github/labeler.yml should contain only changed-files and any-glob-to-any-file, not: ' + c);
- }
- }
-
- // Search the filenames for matching Arch Labels
- for (const archLabel of archLabels) {
- if (prLabels.includes(archLabel.label)) {
- break;
- }
- for (const file of listFilesResponse) {
- const re = new RegExp(archLabel.pattern);
- const match = re.test(file.filename);
- if (match && !prLabels.includes(archLabel.label)) {
- prLabels.push(archLabel.label);
- break;
- }
- }
- }
- console.log({ prLabels });
-
- // Save the PR Number and PR Labels into a PR Artifact
- // e.g. 'Size: XS\nArch: avr\n'
- const dir = 'pr';
- fs.mkdirSync(dir);
- fs.writeFileSync(dir + '/pr-id.txt', pull_number + '\n');
- fs.writeFileSync(dir + '/pr-labels.txt', prLabels.join('\n') + '\n');
-
- # Upload the PR Artifact as pr.zip
- - name: Upload PR artifact
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: pr
- path: pr/
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 9a82b0362..94256ee1a 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,4 +1,4 @@
-name: Lint
+name: โ๏ธ Lint
on: [pull_request]
@@ -6,29 +6,14 @@ concurrency:
group: lint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
-permissions:
- contents: read
-
jobs:
- lint:
- permissions:
- contents: read # for actions/checkout to fetch code
- statuses: write # for github/super-linter to mark status of each linter run
- name: Lint
+ yamllint:
+ name: ๐บ YAML
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v7
- with:
- fetch-depth: 0
- - run: mkdir super-linter.report
- - name: Lint
- uses: github/super-linter@v7
+ - uses: actions/checkout@v2
+ - name: ๐งน YAML Lint
+ uses: github/super-linter@v4
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- VALIDATE_ALL_CODEBASE: false
- VALIDATE_PYTHON_BLACK: true
- VALIDATE_PYTHON_FLAKE8: true
- PYTHON_FLAKE8_CONFIG_FILE: setup.cfg
- VALIDATE_PYTHON_ISORT: true
- PYTHON_ISORT_CONFIG_FILE: setup.cfg
VALIDATE_YAML: true
+ FILTER_REGEX_INCLUDE: .*\.github/.*
diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml
deleted file mode 100644
index 26ed16441..000000000
--- a/.github/workflows/pr_labeler.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# This workflow will fetch the PR Labels from the PR Artifact, and write
-# the PR Labels into the PR. The workflow is called after the
-# "pull_request" trigger (labeler.yml). This "workflow_run" trigger uses a
-# GitHub Token with Write Permission, so we must never run any untrusted
-# code from the PR, and we must always extract and use the PR Artifact
-# safely. See https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=321719166#GitHubActionsSecurity-Buildstriggeredwithworkflow_run
-name: "Set Pull Request Labels"
-on:
- workflow_run:
- workflows: ["Pull Request Labeler"]
- types:
- - completed
-
-jobs:
- pr_labeler:
- permissions:
- contents: read
- pull-requests: write
- issues: write
- runs-on: ubuntu-latest
- if: >
- github.event.workflow_run.event == 'pull_request' &&
- github.event.workflow_run.conclusion == 'success'
- steps:
- # Download the PR Artifact, containing PR Number and PR Labels
- - name: Download PR artifact
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- with:
- script: |
- const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
- owner: context.repo.owner,
- repo: context.repo.repo,
- run_id: ${{ github.event.workflow_run.id }},
- });
- const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
- return artifact.name == "pr"
- })[0];
- const download = await github.rest.actions.downloadArtifact({
- owner: context.repo.owner,
- repo: context.repo.repo,
- artifact_id: matchArtifact.id,
- archive_format: 'zip',
- });
- const fs = require('fs');
- fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
-
- # Unzip the PR Artifact
- - name: Unzip PR artifact
- run: unzip pr.zip
-
- # Write the PR Labels into the PR
- - name: Write PR labels
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- script: |
- const owner = context.repo.owner;
- const repo = context.repo.repo;
- const fs = require('fs');
-
- // Read the PR Number and PR Labels from the PR Artifact
- // e.g. 'Size: XS\nArch: avr\n'
- const issue_number = Number(fs.readFileSync('pr-id.txt'));
- const labels = fs.readFileSync('pr-labels.txt', 'utf8')
- .split('\n') // Split by newline
- .filter(s => (s != '')); // Remove empty lines
- console.log({ issue_number, labels });
-
- // Write the PR Labels into the PR
- // e.g. [ 'Size: XS', 'Arch: avr' ]
- await github.rest.issues.setLabels({
- owner,
- repo,
- issue_number,
- labels
- });
diff --git a/.gitignore b/.gitignore
index d0382885b..0ae73233a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,51 +1,30 @@
*.a
-*.dbo
-*.dba
*.adb
*.asm
+*.d
*.dSYM
*.exe
-*.gcno
-*.gcda
*.hobj
*.i
-*.inf
*.lib
*.lst
*.o
-*.wo
*.obj
*.rel
*.src
*.swp
*.sym
-*.su
-*.map
*~
-.built
-.context
.depend
.kconfig
-*.lock
/bin
-/bin_debug
/boot_romfsimg.h
/external
/Kconfig
/romfs.img
-/staging
/symtab_apps.c
-/wasm
cscope.out
Make.dep
.context
# nuttx/$(TOPDIR)/Makefile.[unix|win]::$(DIRLINKS_EXTERNAL_DIRS)
.dirlinks
-.vscode
-.DS_Store
-build
-.ccls-cache
-compile_commands.json
-.aider*
-.clang-format
-.cache
diff --git a/Application.mk b/Application.mk
index bc83121a9..b03ff59c0 100644
--- a/Application.mk
+++ b/Application.mk
@@ -1,8 +1,6 @@
############################################################################
# apps/Application.mk
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -25,18 +23,12 @@
# has the value "m"
ifneq ($(MAINSRC),)
- ifeq ($(DYNLIB),y)
+ ifeq ($(MODULE),m)
+ BUILD_MODULE = y
+ endif
+
+ ifeq ($(CONFIG_BUILD_KERNEL),y)
BUILD_MODULE = y
- MODAELFFLAGS = $(CMODULELFFLAGS)
- MODCFLAGS = $(CMODULEFLAGS)
- MODCXXFLAGS = $(CXXMODULEFLAGS)
- MODLDFLAGS = $(LDMODULEFLAGS)
- else ifneq ($(or $(filter y,$(CONFIG_BUILD_KERNEL)), $(filter m,$(MODULE))),)
- BUILD_MODULE = y
- MODAELFFLAGS = $(AELFFLAGS)
- MODCFLAGS = $(CELFFLAGS)
- MODCXXFLAGS = $(CXXELFFLAGS)
- MODLDFLAGS = $(LDELFFLAGS)
endif
endif
@@ -45,18 +37,16 @@ endif
# we need to fix up the path so the DELIM will match the actual delimiter.
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
- CWD = $(strip ${shell echo %CD% | cut -d: -f2})
+CWD = $(strip ${shell echo %CD% | cut -d: -f2})
else
- CWD = $(CURDIR)
+CWD = $(CURDIR)
endif
-SUFFIX ?= $(subst $(DELIM),.,$(CWD))
-
-PROGNAME := $(subst ",,$(PROGNAME))
-
-# Add the static application library to the linked libraries.
-
-LDLIBS += $(call CONVERT_PATH,$(BIN))
+# Add the static application library to the linked libraries. Don't do this
+# with CONFIG_BUILD_KERNEL as there is no static app library
+ifneq ($(CONFIG_BUILD_KERNEL),y)
+ LDLIBS += $(call CONVERT_PATH,$(BIN))
+endif
# When building a module, link with the compiler runtime.
# This should be linked after libapps. Consider that mbedtls in libapps
@@ -65,125 +55,39 @@ ifeq ($(BUILD_MODULE),y)
# Revisit: This only works for gcc and clang.
# Do other compilers have similar?
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
- ifeq ($(wildcard $(COMPILER_RT_LIB)),)
- # if "--print-libgcc-file-name" unable to find the correct libgcc PATH
- # then go ahead and try "--print-file-name"
- COMPILER_RT_LIB := $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name $(notdir $(COMPILER_RT_LIB))))
+ ifneq ($(COMPILER_RT_LIB),)
+ LDLIBS += $(COMPILER_RT_LIB)
endif
- LDLIBS += $(COMPILER_RT_LIB)
endif
-# Apps compilation can achieve out-of-tree intermediate products
-# by specifying "PREFIX" to a directory in its own Makefile.
-# Default value is NULL,
-# Make sure the out-of-tree directory exists and ends with $(DELIM) when setting it.
-
-PREFIX ?=
+SUFFIX = $(subst $(DELIM),.,$(CWD))
+PROGNAME := $(shell echo $(PROGNAME))
# Object files
RASRCS = $(filter %.s,$(ASRCS))
CASRCS = $(filter %.S,$(ASRCS))
-RAOBJS = $(RASRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-CAOBJS = $(CASRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-COBJS = $(CSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-CXXOBJS = $(CXXSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-RUSTOBJS = $(RUSTSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-ZIGOBJS = $(ZIGSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-DOBJS = $(DSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-SWIFTOBJS = $(SWIFTSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
+RAOBJS = $(RASRCS:=$(SUFFIX)$(OBJEXT))
+CAOBJS = $(CASRCS:=$(SUFFIX)$(OBJEXT))
+COBJS = $(CSRCS:=$(SUFFIX)$(OBJEXT))
+CXXOBJS = $(CXXSRCS:=$(SUFFIX)$(OBJEXT))
+RUSTOBJS = $(RUSTSRCS:=$(SUFFIX)$(OBJEXT))
MAINCXXSRCS = $(filter %$(CXXEXT),$(MAINSRC))
MAINCSRCS = $(filter %.c,$(MAINSRC))
MAINRUSTSRCS = $(filter %$(RUSTEXT),$(MAINSRC))
-MAINZIGSRCS = $(filter %$(ZIGEXT),$(MAINSRC))
-MAINDSRCS = $(filter %$(DEXT),$(MAINSRC))
-MAINSWIFTSRCS = $(filter %$(SWIFTEXT),$(MAINSRC))
-MAINCXXOBJ = $(MAINCXXSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-MAINCOBJ = $(MAINCSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-MAINRUSTOBJ = $(MAINRUSTSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-MAINZIGOBJ = $(MAINZIGSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-MAINDOBJ = $(MAINDSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
-MAINSWIFTOBJ = $(MAINSWIFTSRCS:%=$(PREFIX)%$(SUFFIX)$(OBJEXT))
+MAINCXXOBJ = $(MAINCXXSRCS:=$(SUFFIX)$(OBJEXT))
+MAINCOBJ = $(MAINCSRCS:=$(SUFFIX)$(OBJEXT))
+MAINRUSTOBJ = $(MAINRUSTSRCS:=$(SUFFIX)$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(MAINSRC)
-OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS) $(RUSTOBJS) $(ZIGOBJS) $(DOBJS) $(SWIFTOBJS) $(EXTOBJS)
+OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS) $(RUSTOBJS)
ifneq ($(BUILD_MODULE),y)
- OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ) $(MAINSWIFTOBJ)
+ OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ)
endif
-ifneq ($(strip $(PROGNAME)),)
- PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ) $(MAINSWIFTOBJ)
- PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGNAME))
- REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME)))
-
- NLIST := $(shell seq 1 $(words $(PROGNAME)))
- $(foreach i, $(NLIST), \
- $(eval PROGNAME_$(word $i,$(PROGOBJ)) := $(word $i,$(PROGNAME))) \
- $(eval PROGSYM_$(word $i,$(PROGOBJ)) := $(subst -,_,$(word $i,$(PROGNAME)))) \
- $(eval PROGOBJ_$(word $i,$(PROGLIST)) := $(word $i,$(PROGOBJ))) \
- $(eval PRIORITY_$(word $i,$(REGLIST)) := \
- $(if $(word $i,$(PRIORITY)),$(word $i,$(PRIORITY)),$(lastword $(PRIORITY)))) \
- $(eval STACKSIZE_$(word $i,$(REGLIST)) := \
- $(if $(word $i,$(STACKSIZE)),$(word $i,$(STACKSIZE)),$(lastword $(STACKSIZE)))) \
- $(eval UID_$(word $i,$(REGLIST)) := \
- $(if $(word $i,$(UID)),$(word $i,$(UID)),$(lastword $(UID)))) \
- $(eval GID_$(word $i,$(REGLIST)) := \
- $(if $(word $i,$(GID)),$(word $i,$(GID)),$(lastword $(GID)))) \
- $(eval MODE_$(word $i,$(REGLIST)) := \
- $(if $(word $i,$(MODE)),$(word $i,$(MODE)),$(lastword $(MODE)))) \
- $(eval STACKSIZE_$(word $i,$(PROGLIST)) := $(STACKSIZE_$(word $i,$(REGLIST)))) \
- $(eval PRIORITY_$(word $i,$(PROGLIST)) := $(PRIORITY_$(word $i,$(REGLIST)))) \
- $(eval UID_$(word $i,$(PROGLIST)) := $(UID_$(word $i,$(REGLIST)))) \
- $(eval GID_$(word $i,$(PROGLIST)) := $(GID_$(word $i,$(REGLIST)))) \
- $(eval MODE_$(word $i,$(PROGLIST)) := $(MODE_$(word $i,$(REGLIST)))) \
- )
-
- # Emit the application's configured attributes as absolute ELF symbols
- # (nx_stacksize, nx_priority, and nx_uid/nx_gid/nx_mode under
- # CONFIG_SCHED_USER_IDENTITY) so the binary loader can recover them.
- # Per-target so each PROGLIST entry picks up its own STACKSIZE_/PRIORITY_.
-
- $(PROGLIST): MODLDFLAGS += \
- $(if $(STACKSIZE_$@),--defsym nx_stacksize=$(STACKSIZE_$@)) \
- $(if $(filter-out SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),--defsym nx_priority=$(PRIORITY_$@))
-ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
- $(PROGLIST): MODLDFLAGS += \
- $(if $(UID_$@),--defsym nx_uid=$(UID_$@)) \
- $(if $(GID_$@),--defsym nx_gid=$(GID_$@)) \
- $(if $(MODE_$@),--defsym nx_mode=$(MODE_$@))
-endif
-
- # Keep the attribute symbols through --strip-unneeded so the binary loader
- # can still read them from the stripped runtime image in bin/.
- $(PROGLIST): NX_KEEP = $(if $(STACKSIZE_$@),-K nx_stacksize) $(if $(filter-out SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),-K nx_priority) $(if $(UID_$@),-K nx_uid) $(if $(GID_$@),-K nx_gid) $(if $(MODE_$@),-K nx_mode)
-endif
-
-# Condition flags
-
-DO_REGISTRATION ?= y
-
-ifeq ($(PROGNAME),)
- DO_REGISTRATION = n
-endif
-
-ifeq ($(WASM_BUILD),y)
- DO_REGISTRATION = n
-endif
-
-ifeq ($(BUILD_MODULE),y)
- DO_REGISTRATION = n
-endif
-
-# Compile flags, notice the default flags only suitable for flat build
-
-ZIGELFFLAGS ?= $(ZIGFLAGS)
-RUSTELFFLAGS ?= $(RUSTFLAGS)
-DELFFLAGS ?= $(DFLAGS)
-SWIFTELFFLAGS ?= $(SWIFTFLAGS)
-
DEPPATH += --dep-path .
DEPPATH += --obj-path .
@@ -191,239 +95,141 @@ VPATH += :.
# Targets follow
-all:: $(PREFIX).built
- @:
+all:: $(OBJS)
.PHONY: clean depend distclean
.PRECIOUS: $(BIN)
define ELFASSEMBLE
- $(ECHO_BEGIN)"AS: $1 "
- $(Q) $(MODULECC) -c $(MODAELFFLAGS) $($(strip $1)_AELFFLAGS) $1 -o $2
- $(ECHO_END)
+ @echo "AS: $1"
+ $(Q) $(CC) -c $(AELFFLAGS) $($(strip $1)_AELFFLAGS) $1 -o $2
endef
define ELFCOMPILE
- $(ECHO_BEGIN)"CC: $1 "
- $(Q) $(MODULECC) -c $(MODCFLAGS) $($(strip $1)_CELFFLAGS) $1 -o $2
- $(ECHO_END)
+ @echo "CC: $1"
+ $(Q) $(CC) -c $(CELFFLAGS) $($(strip $1)_CELFFLAGS) $1 -o $2
endef
define ELFCOMPILEXX
- $(ECHO_BEGIN)"CXX: $1 "
- $(Q) $(CXX) -c $(MODCXXFLAGS) $($(strip $1)_CXXELFFLAGS) $1 -o $2
- $(ECHO_END)
+ @echo "CXX: $1"
+ $(Q) $(CXX) -c $(CXXELFFLAGS) $($(strip $1)_CXXELFFLAGS) $1 -o $2
endef
define ELFCOMPILERUST
- $(ECHO_BEGIN)"RUSTC: $1 "
+ @echo "RUSTC: $1"
$(Q) $(RUSTC) --emit obj $(RUSTELFFLAGS) $($(strip $1)_RUSTELFFLAGS) $1 -o $2
- $(ECHO_END)
-endef
-
-# Remove target suffix here since zig compiler add .o automatically
-define ELFCOMPILEZIG
- $(ECHO_BEGIN)"ZIG: $1 "
- $(Q) $(ZIG) build-obj $(ZIGELFFLAGS) $($(strip $1)_ZIGELFFLAGS) --name $(basename $2) $1
- $(ECHO_END)
-endef
-
-define ELFCOMPILED
- $(ECHO_BEGIN)"DC: $1 "
- $(Q) $(DC) -c $(DELFFLAGS) $($(strip $1)_DELFFLAGS) $1 -of $2
- $(ECHO_END)
-endef
-
-define ELFCOMPILESWIFT
- $(ECHO_BEGIN)"SWIFTC: $1 "
- $(Q) $(SWIFTC) -c $(SWIFTELFFLAGS) $($(strip $1)_SWIFTELFFLAGS) $1 -o $2
- $(ECHO_END)
endef
define ELFLD
- $(ECHO_BEGIN)"LD: $2 "
- $(Q) $(MODULELD) $(MODLDFLAGS) $(LDMAP) $(LDLIBPATH) $(ARCHCRT0OBJ) $1 $(LDSTARTGROUP) $(LDLIBS) $(LDENDGROUP) -o $2
- $(ECHO_END)
+ @echo "LD: $2"
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) $(ARCHCRT0OBJ) $1 $(LDLIBS) -o $2
endef
-# rename "main()" in $1 to "xxx_main()" and save to $2
-define RENAMEMAIN
- $(ECHO_BEGIN)"Rename main() in $1 and save to $2"
- $(Q) ${shell cat $1 | sed -e "s/fn[ ]\+main/fn $(addsuffix _main,$(PROGSYM_$@))/" > $2}
- $(ECHO_END)
-endef
-
-$(RAOBJS): $(PREFIX)%.s$(SUFFIX)$(OBJEXT): %.s
- $(if $(and $(CONFIG_MODULES),$(MODAELFFLAGS)), \
+$(RAOBJS): %.s$(SUFFIX)$(OBJEXT): %.s
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
-$(CAOBJS): $(PREFIX)%.S$(SUFFIX)$(OBJEXT): %.S
- $(if $(and $(CONFIG_MODULES),$(MODAELFFLAGS)), \
+$(CAOBJS): %.S$(SUFFIX)$(OBJEXT): %.S
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(AELFFLAGS)), \
$(call ELFASSEMBLE, $<, $@), $(call ASSEMBLE, $<, $@))
-$(COBJS): $(PREFIX)%.c$(SUFFIX)$(OBJEXT): %.c
- $(if $(and $(CONFIG_MODULES),$(MODCFLAGS)), \
+$(COBJS): %.c$(SUFFIX)$(OBJEXT): %.c
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
-$(CXXOBJS): $(PREFIX)%$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
- $(if $(and $(CONFIG_MODULES),$(MODCXXFLAGS)), \
+$(CXXOBJS): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
-$(RUSTOBJS): $(PREFIX)%$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
+$(RUSTOBJS): %$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILERUST, $<, $@), $(call COMPILERUST, $<, $@))
-$(ZIGOBJS): $(PREFIX)%$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
- $(if $(and $(CONFIG_MODULES), $(CELFFLAGS)), \
- $(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
-
-$(DOBJS): $(PREFIX)%$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
- $(if $(and $(CONFIG_MODULES), $(CELFFLAGS)), \
- $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
-
-$(SWIFTOBJS): $(PREFIX)%$(SWIFTEXT)$(SUFFIX)$(OBJEXT): %$(SWIFTEXT)
- $(if $(and $(CONFIG_MODULES), $(CELFFLAGS)), \
- $(call ELFCOMPILESWIFT, $<, $@), $(call COMPILESWIFT, $<, $@))
-
-AROBJS :=
-ifneq ($(OBJS),)
-SORTOBJS := $(sort $(OBJS))
-$(eval $(call SPLITVARIABLE,OBJS_SPILT,$(SORTOBJS),100))
-$(foreach BATCH, $(OBJS_SPILT_TOTAL), \
- $(foreach obj, $(OBJS_SPILT_$(BATCH)), \
- $(eval substitute := $(patsubst %$(OBJEXT),%_$(BATCH)$(OBJEXT),$(obj))) \
- $(eval AROBJS += $(substitute)) \
- $(eval $(call AROBJSRULES, $(substitute),$(obj))) \
- ) \
-)
-endif
-
-$(PREFIX).built: $(AROBJS)
- $(call SPLITVARIABLE,ALL_OBJS,$(AROBJS),100)
- $(foreach BATCH, $(ALL_OBJS_TOTAL), \
- $(if $(strip $(ALL_OBJS_$(BATCH))), \
- $(shell $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $(ALL_OBJS_$(BATCH)))) \
- ) \
- )
- $(Q) touch $@
+archive:
+ $(call ARCHIVE_ADD, $(call CONVERT_PATH,$(BIN)), $(OBJS))
ifeq ($(BUILD_MODULE),y)
-$(MAINCXXOBJ): $(PREFIX)%$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
- $(if $(and $(CONFIG_MODULES),$(MODCXXFLAGS)), \
+$(MAINCXXOBJ): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
-$(MAINCOBJ): $(PREFIX)%.c$(SUFFIX)$(OBJEXT): %.c
- $(if $(and $(CONFIG_MODULES),$(MODCFLAGS)), \
+$(MAINCOBJ): %.c$(SUFFIX)$(OBJEXT): %.c
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
-$(MAINZIGOBJ): $(PREFIX)%$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
+PROGLIST := $(wordlist 1,$(words $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ)),$(PROGNAME))
+PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGLIST))
+PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ)
-$(MAINDOBJ): $(PREFIX)%$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
-
-$(MAINSWIFTOBJ): $(PREFIX)%$(SWIFTEXT)$(SUFFIX)$(OBJEXT): %$(SWIFTEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILESWIFT, $<, $@), $(call COMPILESWIFT, $<, $@))
-
-$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ) $(MAINSWIFTOBJ)
+$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ)
$(Q) mkdir -p $(BINDIR)
- $(call ELFLD, $(PROGOBJ_$@), $(call CONVERT_PATH,$@))
- $(Q) chmod +x $@
-ifneq ($(CONFIG_DEBUG_SYMBOLS),)
- $(Q) mkdir -p $(BINDIR_DEBUG)
- $(Q) cp $@ $(BINDIR_DEBUG)
- $(Q) $(MODULESTRIP) $(NX_KEEP) $@
+ $(call ELFLD,$(firstword $(PROGOBJ)),$(call CONVERT_PATH,$(firstword $(PROGLIST))))
+ $(Q) chmod +x $(firstword $(PROGLIST))
+ifneq ($(CONFIG_DEBUG_SYMBOLS),y)
+ $(Q) $(STRIP) $(firstword $(PROGLIST))
endif
+ $(eval PROGLIST=$(filter-out $(firstword $(PROGLIST)),$(PROGLIST)))
+ $(eval PROGOBJ=$(filter-out $(firstword $(PROGOBJ)),$(PROGOBJ)))
install:: $(PROGLIST)
- @:
else
-$(MAINCXXOBJ): $(PREFIX)%$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
- $(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(addsuffix _main,$(PROGSYM_$@))})
- $(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(addsuffix _main,$(PROGSYM_$@))})
- $(if $(and $(CONFIG_MODULES),$(MODCXXFLAGS)), \
+MAINNAME := $(addsuffix _main,$(PROGNAME))
+
+$(MAINCXXOBJ): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
+ $(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword $(MAINNAME))})
+ $(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword $(MAINNAME))})
+ $(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
$(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
-$(MAINCOBJ): $(PREFIX)%.c$(SUFFIX)$(OBJEXT): %.c
- $(eval $<_CFLAGS += ${DEFINE_PREFIX}main=$(addsuffix _main,$(PROGSYM_$@)))
- $(eval $<_CELFFLAGS += ${DEFINE_PREFIX}main=$(addsuffix _main,$(PROGSYM_$@)))
- $(if $(and $(CONFIG_MODULES),$(MODCFLAGS)), \
+$(MAINCOBJ): %.c$(SUFFIX)$(OBJEXT): %.c
+ $(eval $<_CFLAGS += ${shell $(DEFINE) "$(CC)" main=$(firstword $(MAINNAME))})
+ $(eval $<_CELFFLAGS += ${shell $(DEFINE) "$(CC)" main=$(firstword $(MAINNAME))})
+ $(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
-$(MAINRUSTOBJ): $(PREFIX)%$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
+$(MAINRUSTOBJ): %$(RUSTEXT)$(SUFFIX)$(OBJEXT): %$(RUSTEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILERUST, $<, $@), $(call COMPILERUST, $<, $@))
-$(MAINZIGOBJ): $(PREFIX)%$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
- $(Q) $(call RENAMEMAIN, $<, $(basename $<)_tmp.zig)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILEZIG, $(basename $<)_tmp.zig, $@), $(call COMPILEZIG, $(basename $<)_tmp.zig, $@))
- $(Q) rm -f $(basename $<)_tmp.zig
-
-$(MAINDOBJ): $(PREFIX)%$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
-
-$(MAINSWIFTOBJ): $(PREFIX)%$(SWIFTEXT)$(SUFFIX)$(OBJEXT): %$(SWIFTEXT)
- $(if $(and $(CONFIG_MODULES),$(CELFFLAGS)), \
- $(call ELFCOMPILESWIFT, $<, $@), $(call COMPILESWIFT, $<, $@))
-
install::
- @:
endif # BUILD_MODULE
-postinstall::
- @:
-
context::
-ifeq ($(DO_REGISTRATION),y)
+ifneq ($(PROGNAME),)
+
+REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME)))
+APPLIST := $(PROGNAME)
$(REGLIST): $(DEPCONFIG) Makefile
- $(eval PROGNAME_$@ := $(basename $(notdir $@)))
- $(eval PROGSYM_$@ := $(subst -,_,$(PROGNAME_$@)))
-ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
- $(call REGISTER,$(PROGNAME_$@),$(PRIORITY_$@),$(STACKSIZE_$@),$(if $(BUILD_MODULE),,$(PROGSYM_$@)_main),$(UID_$@),$(GID_$@),$(MODE_$@))
-else
- $(call REGISTER,$(PROGNAME_$@),$(PRIORITY_$@),$(STACKSIZE_$@),$(if $(BUILD_MODULE),,$(PROGSYM_$@)_main))
-endif
+ $(call REGISTER,$(firstword $(APPLIST)),$(firstword $(PRIORITY)),$(firstword $(STACKSIZE)),$(if $(BUILD_MODULE),,$(firstword $(APPLIST))_main))
+ $(eval APPLIST=$(filter-out $(firstword $(APPLIST)),$(APPLIST)))
+ $(if $(filter-out $(firstword $(PRIORITY)),$(PRIORITY)),$(eval PRIORITY=$(filter-out $(firstword $(PRIORITY)),$(PRIORITY))))
+ $(if $(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE)),$(eval STACKSIZE=$(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE))))
register:: $(REGLIST)
- @:
else
register::
- @:
endif
-$(PREFIX).depend: Makefile $(wildcard $(foreach SRC, $(SRCS), $(addsuffix /$(SRC), $(subst :, ,$(VPATH))))) $(DEPCONFIG)
- $(shell echo "# Gen Make.dep automatically" >$(PREFIX)Make.dep)
- $(call SPLITVARIABLE,ALL_DEP_OBJS,$^,100)
- $(foreach BATCH, $(ALL_DEP_OBJS_TOTAL), \
- $(shell $(MKDEP) $(DEPPATH) --obj-suffix .c$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.c,$(ALL_DEP_OBJS_$(BATCH))) >>$(PREFIX)Make.dep) \
- $(shell $(MKDEP) $(DEPPATH) --obj-suffix .S$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.S,$(ALL_DEP_OBJS_$(BATCH))) >>$(PREFIX)Make.dep) \
- $(shell $(MKDEP) $(DEPPATH) --obj-suffix $(CXXEXT)$(SUFFIX)$(OBJEXT) "$(CXX)" -- $(CXXFLAGS) -- $(filter %$(CXXEXT),$(ALL_DEP_OBJS_$(BATCH))) >>$(PREFIX)Make.dep) \
- )
+.depend: Makefile $(wildcard $(foreach SRC, $(SRCS), $(addsuffix /$(SRC), $(subst :, ,$(VPATH))))) $(DEPCONFIG)
+ $(Q) $(MKDEP) $(DEPPATH) --obj-suffix .c$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.c,$^) >Make.dep
+ $(Q) $(MKDEP) $(DEPPATH) --obj-suffix .S$(SUFFIX)$(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(filter %.S,$^) >>Make.dep
+ $(Q) $(MKDEP) $(DEPPATH) --obj-suffix $(CXXEXT)$(SUFFIX)$(OBJEXT) "$(CXX)" -- $(CXXFLAGS) -- $(filter %$(CXXEXT),$^) >>Make.dep
$(Q) touch $@
-depend:: $(PREFIX).depend
- @:
+depend:: .depend
clean::
- $(call DELFILE, .built)
- $(call CLEANAROBJS)
$(call CLEAN)
+
distclean:: clean
- $(call DELFILE, .kconfig)
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
--include $(PREFIX)Make.dep
-
-# Include Wasm specific definitions
-include $(APPDIR)/tools/Wasm.mk
+-include Make.dep
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 55110defb..000000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-# ##############################################################################
-# apps/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-# ~~~
-# Important note:
-# This CMakeLists.txt is not meant as a top-level CMakeLists.txt. Instead,
-# CMake must be run using the top-level CMakeLists.txt from the nuttx
-# repository and point to this directory via NUTTX_APPS_DIR. For example:
-# cmake -S -B [...] -DNUTTX_APPS_DIR=
-# ~~~
-
-if(CONFIG_APPS_DIR)
- # add apps cmake modules
- list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
- include(nuttx_add_luamod)
- include(nuttx_add_wamrmod)
- include(nuttx_add_rust)
- include(nuttx_wasm_interface)
- nuttx_add_library(apps)
- if(NOT EXISTS {NUTTX_APPS_BINDIR}/dummy.c)
- file(TOUCH ${NUTTX_APPS_BINDIR}/dummy.c)
- endif()
- target_sources(apps PRIVATE ${NUTTX_APPS_BINDIR}/dummy.c)
-endif()
-
-file(MAKE_DIRECTORY ${NUTTX_APPS_BINDIR}/include)
-include_directories(include)
-include_directories(${NUTTX_APPS_BINDIR}/include)
-
-add_subdirectory(audioutils)
-add_subdirectory(benchmarks)
-add_subdirectory(boot)
-add_subdirectory(canutils)
-add_subdirectory(crypto)
-add_subdirectory(fsutils)
-add_subdirectory(games)
-add_subdirectory(graphics)
-add_subdirectory(industry)
-add_subdirectory(inertial)
-add_subdirectory(interpreters)
-add_subdirectory(logging)
-add_subdirectory(lte)
-add_subdirectory(math)
-add_subdirectory(mlearning)
-add_subdirectory(netutils)
-add_subdirectory(nshlib)
-add_subdirectory(platform)
-add_subdirectory(sdr)
-add_subdirectory(system)
-add_subdirectory(tee)
-add_subdirectory(testing)
-add_subdirectory(videoutils)
-add_subdirectory(wireless)
-
-# add examples and external at the end to allow library dependencies
-add_subdirectory(examples)
-if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/external)
- add_subdirectory(external)
-endif()
-
-add_subdirectory(tools) # after traversing all subdirectories
-add_subdirectory(builtin) # must be last
-
-nuttx_generate_kconfig()
diff --git a/DISCLAIMER b/DISCLAIMER
new file mode 100644
index 000000000..7cf2deeb4
--- /dev/null
+++ b/DISCLAIMER
@@ -0,0 +1,6 @@
+Apache NuttX is an effort undergoing incubation at The Apache Software Foundation (ASF),
+sponsored by the Apache Incubator. Incubation is required of all newly accepted projects
+until a further review indicates that the infrastructure, communications, and decision
+making process have stabilized in a manner consistent with other successful ASF projects.
+While incubation status is not necessarily a reflection of the completeness or stability
+of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
diff --git a/Directory.mk b/Directory.mk
index ff42d2390..0b3ed7dee 100644
--- a/Directory.mk
+++ b/Directory.mk
@@ -1,8 +1,6 @@
############################################################################
# apps/Directory.mk
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -24,16 +22,11 @@ include $(APPDIR)/Make.defs
# Sub-directories that have been built or configured.
-SUBDIRS := $(dir $(wildcard */Makefile))
-CONFIGSUBDIRS := $(filter-out $(dir $(wildcard */Kconfig)),$(SUBDIRS))
-CLEANSUBDIRS := $(dir $(wildcard *$(DELIM).built))
-CLEANSUBDIRS += $(dir $(wildcard */.depend))
-CLEANSUBDIRS += $(dir $(wildcard */.kconfig))
+SUBDIRS := $(dir $(wildcard *$(DELIM)Makefile))
+CONFIGSUBDIRS := $(filter-out $(dir $(wildcard *$(DELIM)Kconfig)),$(SUBDIRS))
+CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).depend))
+CLEANSUBDIRS += $(dir $(wildcard *$(DELIM).kconfig))
CLEANSUBDIRS := $(sort $(CLEANSUBDIRS))
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
- CONFIGSUBDIRS := $(subst /,\,$(CONFIGSUBDIRS))
- CLEANSUBDIRS := $(subst /,\,$(CLEANSUBDIRS))
-endif
all: nothing
@@ -50,16 +43,15 @@ install:
preconfig: $(foreach SDIR, $(CONFIGSUBDIRS), $(SDIR)_preconfig)
ifneq ($(MENUDESC),)
$(Q) $(MKKCONFIG) -m $(MENUDESC)
-endif
$(Q) touch .kconfig
+endif
clean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_clean)
- @:
distclean: $(foreach SDIR, $(CLEANSUBDIRS), $(SDIR)_distclean)
ifneq ($(MENUDESC),)
$(call DELFILE, Kconfig)
-endif
$(call DELFILE, .kconfig)
+endif
-include Make.dep
diff --git a/LICENSE b/LICENSE
index 84b5055da..c9c999015 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1282,7 +1282,7 @@ apps/system/telnet/telnet_client.c
Copyright (C) 2017 Gregory Nutt. All rights reserved.
Author: Gregory Nutt
- The original authors of libtelnet are listed below. Per their license,
+ The original authors of libtelnet are listed below. Per their licesne,
"The author or authors of this code dedicate any and all copyright
interest in this code to the public domain. We make this dedication for
the benefit of the public at large and to the detriment of our heirs and
@@ -1723,554 +1723,3 @@ apps/netutils/chat/chat.h
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
-apps/testing/crypto/3descbc.c
-=========================
- $OpenBSD: des3.c,v 1.8 2010/10/15 10:39:12 jsg Exp $
- Copyright (c) 2002 Markus Friedl. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-apps/testing/crypto/aesctr.c
-=========================
- $OpenBSD: aesctr.c,v 1.1 2005/05/25 05:47:53 markus Exp $
- Copyright (c) 2005 Markus Friedl
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-apps/testing/crypto/aesxts.c
-=========================
- $OpenBSD: aes_xts.c,v 1.2 2013/10/06 16:59:34 jsing Exp $
- Copyright (c) 2002 Markus Friedl. All rights reserved.
- Copyright (c) 2008 Damien Miller. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-apps/testing/crypto/hmac.c
-=========================
- Copyright (c) 2008 Damien Bergamini
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-apps/crypto/tinydtls
-======================
- /*******************************************************************************
- * Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Olaf Bergmann (TZI) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- * Contributors:
- * Olaf Bergmann - initial API and implementation
- * Hauke Mehrtens - memory optimization, ECC integration
- *******************************************************************************/
-
-apps/netutils/wakaama
-=====================
- *Eclipse Distribution License - v 1.0*
-
- Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Eclipse Foundation, Inc. nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-apps/crypto/libsodium
-=====================
- ISC License
-
- Copyright (c) 2013-2023
- Frank Denis
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-apps/crypto/wolfssl
-===================
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
-
-apps/testing/sd_stress
-apps/testing/sd_bench
-===================
-
-Copyright (c) 2016-2021 PX4 Development Team. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-3. Neither the name PX4 nor the names of its contributors may be
- used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-netutils/bare/
-==============
-
-MIT License
-
-Copyright (c) 2022 Frank Smit
-
-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.
diff --git a/Make.defs b/Make.defs
index ab79ce71c..0cfa55529 100644
--- a/Make.defs
+++ b/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -21,7 +19,17 @@
############################################################################
TOPDIR ?= $(APPDIR)/import
--include $(TOPDIR)/Make.defs
+include $(TOPDIR)/Make.defs
+
+# The GNU make CURDIR will always be a POSIX-like path with forward slashes
+# as path segment separators. This is fine for the above inclusions but
+# will cause problems later for the native build. If we know that this is
+# a native build, then we need to fix up the APPDIR path for subsequent
+# use
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+APPDIR := ${shell echo %CD%}
+endif
# Application Directories
@@ -29,16 +37,11 @@ TOPDIR ?= $(APPDIR)/import
# CLEANDIRS is the list of all top-level directories containing Makefiles.
# It is used only for cleaning.
-BUILDIRS := $(dir $(wildcard $(APPDIR)/*/Make.defs))
-BUILDIRS := $(filter-out $(APPDIR)/import/,$(BUILDIRS))
-CONFIGDIRS := $(filter-out $(APPDIR)/builtin/,$(BUILDIRS))
-CONFIGDIRS := $(filter-out $(dir $(wildcard $(APPDIR)/*/Kconfig)),$(CONFIGDIRS))
-CLEANDIRS := $(dir $(wildcard $(APPDIR)/*/Makefile))
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
- BUILDIRS := $(subst /,\,$(BUILDIRS))
- CONFIGDIRS := $(subst /,\,$(CONFIGDIRS))
- CLEANDIRS := $(subst /,\,$(CLEANDIRS))
-endif
+BUILDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Make.defs))
+BUILDIRS := $(filter-out $(APPDIR)$(DELIM)import$(DELIM),$(BUILDIRS))
+CONFIGDIRS := $(filter-out $(APPDIR)$(DELIM)builtin$(DELIM),$(BUILDIRS))
+CONFIGDIRS := $(filter-out $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Kconfig)),$(CONFIGDIRS))
+CLEANDIRS := $(dir $(wildcard $(APPDIR)$(DELIM)*$(DELIM)Makefile))
# CONFIGURED_APPS is the application directories that should be built in
# the current configuration.
@@ -46,7 +49,7 @@ endif
CONFIGURED_APPS :=
define Add_Application
- include $(1)Make.defs
+ include $(1)Make.defs
endef
$(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
@@ -55,9 +58,6 @@ $(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
CXXEXT ?= .cxx
RUSTEXT ?= .rs
-ZIGEXT ?= .zig
-DEXT ?= .d
-SWIFTEXT ?= .swift
# Library path
@@ -66,12 +66,10 @@ LIBPATH ?= $(TOPDIR)$(DELIM)staging
# The install path
BINDIR ?= $(APPDIR)$(DELIM)bin
-BINDIR_DEBUG ?= $(APPDIR)$(DELIM)bin_debug
# The final build target
-BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT)
-WBIN ?= $(APPDIR)$(DELIM)wasm$(DELIM)libwasm$(LIBEXT)
+BIN ?= $(APPDIR)$(DELIM)libapps$(LIBEXT)
# Tools
@@ -83,108 +81,21 @@ endif
# Builtin Registration
-BUILTIN_REGISTRY ?= $(APPDIR)$(DELIM)builtin$(DELIM)registry
-DEPCONFIG ?= $(TOPDIR)$(DELIM).config
+BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry
+DEPCONFIG = $(TOPDIR)$(DELIM).config
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
-ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
define REGISTER
$(Q) echo Register: $1
- $(Q) echo { "$(subst ",,$(1))", $2, $3, $(patsubst ,0,$(subst ",,$(4))), $(patsubst ,0,$(5)), $(patsubst ,0,$(6)), $(patsubst ,0555,$(7))}, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
- $(Q) echo int $(subst ",,$(4))(int argc, char *argv[]); > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"
-
- $(Q) touch $(BUILTIN_REGISTRY)$(DELIM).updated"
-endef
-else
-define REGISTER
- $(Q) echo Register: $1
- $(Q) echo { "$(subst ",,$(1))", $2, $3, $(subst ",,$(4)) }, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
- $(Q) echo int $(subst ",,$(4))(int argc, char *argv[]); > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"
-
- $(Q) touch $(BUILTIN_REGISTRY)$(DELIM).updated"
-endef
-endif
-else
-ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
-define REGISTER
- $(Q) echo "{ \"$1\", $2, $3, $(patsubst ,0,$(4)), $(patsubst ,0,$(5)), $(patsubst ,0,$(6)), $(patsubst ,0555,$(7)) }," > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
+ $(Q) echo { \"$1\", $2, $3, $4 }, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
$(Q) if [ ! -z $4 ]; then \
echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"; \
fi;
$(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
endef
-else
-define REGISTER
- $(Q) echo "Register: $1"
- $(Q) echo "{ \"$1\", $2, $3, $4 }," > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat"
- $(Q) if [ ! -z $4 ]; then \
- echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"; \
- fi;
- $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
-endef
-endif
-endif
# Standard include path
-CFLAGS += ${INCDIR_PREFIX}"$(APPDIR)$(DELIM)include"
-CXXFLAGS += ${INCDIR_PREFIX}"$(APPDIR)$(DELIM)include"
+CFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
+CXXFLAGS += ${shell $(INCDIR) "$(CC)" "$(APPDIR)$(DELIM)include"}
NUTTXLIB ?= $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
-
-# SPLITVARIABLE - Split long variables into specified batches
-# Usage: $(call SPLITVARIABLE, variable-def, variable-ref, batch-size)
-#
-# Example: VAR:= a b c x y z foo bar
-# $(call SPLITVARIABLE, VAR, $(VAR), 3)
-# $(foreach, num, $(VAR_TOTAL), $(shell echo $(VAR_$(num))))
-# Return new variable definition:
-# $(variable-def)_TOTAL : total split sequence , start with 1.
-# $(variable-def)_$(num) : newly defined variable , ended with batch num.
-# In the case above:
-# $(VAR_TOTAL) = 1 2 3
-# $(VAR_1) = a b c
-# $(VAR_2) = x y z
-# $(VAR_3) = foo bar
-
-define SPLITVARIABLE
- $(eval SPLITVARIABLE_PREFIX = $(1))
- $(eval BATCH_SIZE = $(3))
- $(eval TOTAL_BATCH = $(shell expr $(words $(2)) / $(BATCH_SIZE) + 1))
- $(eval $(SPLITVARIABLE_PREFIX)_TOTAL = $(shell seq 1 $(TOTAL_BATCH)))
- $(foreach idx, $($(SPLITVARIABLE_PREFIX)_TOTAL), \
- $(eval FROMINDEX=$(shell expr 1 + $(idx) \* $(BATCH_SIZE) - $(BATCH_SIZE))) \
- $(eval $(SPLITVARIABLE_PREFIX)_$(idx)=$(wordlist $(FROMINDEX), $(shell expr $(FROMINDEX) + $(BATCH_SIZE) - 1), $(2))) \
- )
-endef
-
-define ARLOCK
- flock $1.lock $(call ARCHIVE, $1, $(2))
-endef
-
-# dynamic AR target
-
-define AROBJSRULES
-$(1) : $(2)
- @ cp $(2) $(1)
-endef
-
-# CLEANAROBJS - del AR target files exclusively
-
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
-define CLEANAROBJS
- $(call DELFILE,$(subst /,\,$(AROBJS)))
- $(call DELFILE,$(subst /,\,$(OBJS)))
- $(eval OBJS :=)
-endef
-else
-define CLEANAROBJS
- $(call SPLITVARIABLE,CLEAN_AROBJS,${AROBJS},100)
- $(foreach BATCH, $(CLEAN_AROBJS_TOTAL), \
- $(shell rm -rf $(CLEAN_AROBJS_$(BATCH))))
- $(call SPLITVARIABLE,CLEAN_OBJS,${OBJS},100)
- $(foreach BATCH, $(CLEAN_OBJS_TOTAL), \
- $(shell rm -rf $(CLEAN_OBJS_$(BATCH))))
- $(eval OBJS :=)
-endef
-endif
diff --git a/Makefile b/Makefile
index 5a3570538..f33a9cffc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -22,20 +20,8 @@
export APPDIR = $(CURDIR)
include $(APPDIR)/Make.defs
-include $(APPDIR)/tools/Wasm.mk
-
-# The GNU make CURDIR will always be a POSIX-like path with forward slashes
-# as path segment separators. This is fine for the above inclusions but
-# will cause problems later for the native build. If we know that this is
-# a native build, then we need to fix up the APPDIR path for subsequent
-# use
-
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
- export APPDIR = $(subst /,\,$(CURDIR))
-endif
# Symbol table for loadable apps.
-# SYMTABEXT: Extra arguments for mksymtab.sh
SYMTABSRC = symtab_apps.c
SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
@@ -45,15 +31,16 @@ SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
# We first remove libapps.a before letting the other rules add objects to it
# so that we ensure libapps.a does not contain objects from prior build
-all: $(BIN)
+all:
+ $(RM) $(BIN)
+ $(MAKE) $(BIN)
.PHONY: import install dirlinks export .depdirs preconfig depend clean distclean
-.PHONY: context postinstall clean_context context_all postinstall_all register register_all
+.PHONY: context clean_context context_all register register_all
.PRECIOUS: $(BIN)
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
-$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),postinstall)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),register)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
@@ -68,25 +55,6 @@ $(INCDIR): $(TOPDIR)/tools/incdir.c
IMPORT_TOOLS = $(MKDEP) $(INCDIR)
-ifeq ($(CONFIG_TOOLS_WASM_BUILD),y)
-
-configure_wasm:
- $(Q) cmake -B$(APPDIR)$(DELIM)tools$(DELIM)Wasm$(DELIM)build \
- $(APPDIR)$(DELIM)tools$(DELIM)Wasm \
- -DAPPDIR=$(APPDIR) -DTOPDIR=$(TOPDIR) \
- -DWASI_SDK_PATH=$(WASI_SDK_PATH) \
- -DKCONFIG_FILE_PATH=$(TOPDIR)$(DELIM).config
-
-context_wasm: configure_wasm
- $(Q) cmake --build $(APPDIR)$(DELIM)tools$(DELIM)Wasm$(DELIM)build
-
-else
-
-context_wasm:
-
-endif
-
-
# In the KERNEL build, we must build and install all of the modules. No
# symbol table is needed
@@ -94,12 +62,12 @@ ifeq ($(CONFIG_BUILD_KERNEL),y)
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
-$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
-
-.import: $(BIN)
+.import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
+ $(Q) for app in ${CONFIGURED_APPS}; do \
+ $(MAKE) -C "$${app}" archive ; \
+ done
$(Q) install libapps.a $(APPDIR)$(DELIM)import$(DELIM)libs
$(Q) $(MAKE) install
- $(Q) $(MAKE) postinstall
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
@@ -112,37 +80,32 @@ else
# In FLAT and protected modes, the modules have already been created. A
# symbol table is required.
-ifeq ($(CONFIG_MODULES),)
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ifeq ($(CONFIG_BUILD_LOADABLE),)
+
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
-else
-$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
- $(call LINK_WASM)
-endif
+ $(Q) for app in ${CONFIGURED_APPS}; do \
+ $(MAKE) -C "$${app}" archive ; \
+ done
else
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
+ $(Q) for app in ${CONFIGURED_APPS}; do \
+ $(MAKE) -C "$${app}" archive ; \
+ done
$(Q) $(MAKE) install
- $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) $(SYMTABEXT) >$@.tmp
+ $(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
-ifneq ($(CONFIG_ARM_TOOLCHAIN_GHS),y)
$(SYMTABOBJ): %$(OBJEXT): %.c
- $(call COMPILE, $<, $@, -fno-lto -fno-builtin)
-else
-$(SYMTABOBJ): %$(OBJEXT): %.c
- $(call COMPILE, $<, $@, -Onolink)
-endif
+ $(call COMPILE, -fno-lto $<, $@)
$(BIN): $(SYMTABOBJ)
- $(call ARLOCK, $(call CONVERT_PATH,$(BIN)), $^)
- $(call LINK_WASM)
+ $(call ARCHIVE_ADD, $(call CONVERT_PATH,$(BIN)), $^)
-endif # !CONFIG_MODULES
+endif # !CONFIG_BUILD_LOADABLE
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
- $(Q) $(MAKE) postinstall_all
# Link nuttx
@@ -178,15 +141,10 @@ dirlinks:
context_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context)
register_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_register)
-postinstall_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_postinstall)
-staging:
- $(Q) mkdir -p $@
-
-context: | staging
+context:
$(Q) $(MAKE) context_all
$(Q) $(MAKE) register_all
- $(Q) $(MAKE) context_wasm
Kconfig:
$(foreach SDIR, $(CONFIGDIRS), $(call MAKE_template,$(SDIR),preconfig))
@@ -200,9 +158,7 @@ ifneq ($(EXPORTDIR),)
ifneq ($(CONFIG_BUILD_KERNEL),y)
ifneq ($(BUILTIN_REGISTRY),)
for f in "${BUILTIN_REGISTRY}"$(DELIM)*.bdat "${BUILTIN_REGISTRY}"$(DELIM)*.pdat ; do \
- if [ -f "$${f}" ]; then \
- cp -f "$${f}" "${EXPORTDIR}"$(DELIM)registry ; \
- fi \
+ [ -f "$${f}" ] && cp -f "$${f}" "${EXPORTDIR}"$(DELIM)registry ; \
done
endif
endif
@@ -225,18 +181,27 @@ clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
- $(call DELDIR, $(BINDIR_DEBUG))
$(call CLEAN)
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
- $(call DELFILE, *.lock)
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ $(Q) ( if exist external ( \
+ echo ********************************************************" \
+ echo * The external directory/link must be removed manually *" \
+ echo ********************************************************" \
+ )
+else
+ $(Q) ( if [ -e external ]; then \
+ echo "********************************************************"; \
+ echo "* The external directory/link must be removed manually *"; \
+ echo "********************************************************"; \
+ fi; \
+ )
+endif
$(call DELFILE, .depend)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
- $(call DELDIR, staging)
- $(call DELDIR, wasm)
- $(call DELDIR, $(APPDIR)$(DELIM)tools$(DELIM)Wasm$(DELIM)build)
$(call CLEAN)
diff --git a/README.md b/README.md
index 204931977..d6f72c208 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ NuttX directory. Like:
If all of the above conditions are TRUE, then NuttX will be able to find the
application directory. If your application directory has a different name or is
-located at a different position, then you will have to inform the NuttX build
+location at a different position, then you will have to inform the NuttX build
system of that location. There are several ways to do that:
1) You can define `CONFIG_APPS_DIR` to be the full path to your application
@@ -140,7 +140,7 @@ project. One must:
main()
```
- 4. Set the requirements in the file: `Makefile`, specifically the lines:
+ 4. Set the requirements in the file: `Makefile`, specially the lines:
```makefile
PROGNAME = progname
@@ -181,8 +181,10 @@ A: Here are three:
You can copy any pieces that you like from the old apps/directory to your
custom apps directory as necessary.
- This is documented in `NuttX/boards/README.txt` and `NuttX Porting Guide`
- online at .
+ This is documented in `NuttX/boards/README.txt` and
+ `nuttx/Documentation/NuttXPortingGuide.html` (Online at
+ https://bitbucket.org/nuttx/nuttx/src/master/Documentation/NuttXPortingGuide.html#apndxconfigs
+ under _Build options_). And in the `apps/README.txt` file.
3) If you like the random collection of stuff in the `apps/` directory but
just want to expand the existing components with your own, external
@@ -254,5 +256,4 @@ Technology Software Unrestricted (TSU) exception (see the BIS Export Administrat
Regulations, Section 740.13) for both object code and source code.
The following provides more details on the included cryptographic software:
-https://tls.mbed.org/supported-ssl-ciphersuites.
-https://github.com/intel/tinycrypt
+https://tls.mbed.org/supported-ssl-ciphersuites.
\ No newline at end of file
diff --git a/audioutils/CMakeLists.txt b/audioutils/CMakeLists.txt
deleted file mode 100644
index 06428bfbb..000000000
--- a/audioutils/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/audioutils/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-nuttx_add_subdirectory()
-
-nuttx_generate_kconfig(MENUDESC "Audio Utility libraries")
diff --git a/audioutils/Make.defs b/audioutils/Make.defs
deleted file mode 100644
index c61302297..000000000
--- a/audioutils/Make.defs
+++ /dev/null
@@ -1,23 +0,0 @@
-############################################################################
-# apps/audioutils/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(wildcard $(APPDIR)/audioutils/*/Make.defs)
diff --git a/audioutils/Makefile b/audioutils/Makefile
deleted file mode 100644
index 698b58c20..000000000
--- a/audioutils/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-MENUDESC = "Audio Utility libraries"
-
-include $(APPDIR)/Directory.mk
diff --git a/audioutils/fmsynth/CMakeLists.txt b/audioutils/fmsynth/CMakeLists.txt
deleted file mode 100644
index 839793f3e..000000000
--- a/audioutils/fmsynth/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/audioutils/fmsynth/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_AUDIOUTILS_FMSYNTH_LIB)
- target_sources(apps PRIVATE fmsynth.c fmsynth_eg.c fmsynth_op.c)
-endif()
diff --git a/audioutils/fmsynth/Kconfig b/audioutils/fmsynth/Kconfig
deleted file mode 100644
index 81d7977d0..000000000
--- a/audioutils/fmsynth/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config AUDIOUTILS_FMSYNTH_LIB
- bool "FM Synthesizer Library"
- default n
- ---help---
- Enable support for the FM Synthesizer library.
diff --git a/audioutils/fmsynth/Make.defs b/audioutils/fmsynth/Make.defs
deleted file mode 100644
index e53b36887..000000000
--- a/audioutils/fmsynth/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/fmsynth/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_FMSYNTH_LIB),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/fmsynth
-endif
diff --git a/audioutils/fmsynth/Makefile b/audioutils/fmsynth/Makefile
deleted file mode 100644
index 2ce054331..000000000
--- a/audioutils/fmsynth/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-############################################################################
-# apps/audioutils/fmsynth/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CSRCS = fmsynth.c fmsynth_eg.c fmsynth_op.c
-
-include $(APPDIR)/Application.mk
diff --git a/audioutils/fmsynth/fmsynth.c b/audioutils/fmsynth/fmsynth.c
deleted file mode 100644
index 883ad4680..000000000
--- a/audioutils/fmsynth/fmsynth.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/fmsynth.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define WRAP_ROUND_TIME_SEC (10)
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static int max_phase_time;
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: fetch_feedback
- ****************************************************************************/
-
-static void fetch_feedback(FAR fmsynth_op_t *ops)
-{
- while (ops != NULL)
- {
- fmsynthop_update_feedback(ops);
- ops = ops->parallelop;
- }
-}
-
-/****************************************************************************
- * name: update_phase
- ****************************************************************************/
-
-static void update_phase(FAR fmsynth_sound_t *snd)
-{
- snd->phase_time++;
- if (snd->phase_time >= max_phase_time)
- {
- snd->phase_time = 0;
- }
-}
-
-/****************************************************************************
- * name: sound_modulate
- ****************************************************************************/
-
-static int sound_modulate(FAR fmsynth_sound_t *snd)
-{
- int out = 0;
- FAR fmsynth_op_t *op;
-
- if (snd->operators == NULL)
- {
- return out;
- }
-
- fetch_feedback(snd->operators);
-
- for (op = snd->operators; op != NULL; op = op->parallelop)
- {
- out += fmsynthop_operate(op, snd->phase_time);
- }
-
- update_phase(snd);
-
- return out * snd->volume / FMSYNTH_MAX_VOLUME;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: fmsynth_initialize
- ****************************************************************************/
-
-int fmsynth_initialize(int fs)
-{
- max_phase_time = fs * WRAP_ROUND_TIME_SEC;
- return fmsynthop_set_samplerate(fs);
-}
-
-/****************************************************************************
- * name: create_fmsynthsnd
- ****************************************************************************/
-
-FAR fmsynth_sound_t *create_fmsynthsnd(FAR fmsynth_sound_t *snd)
-{
- if (snd)
- {
- snd->own_allocate = 0;
- snd->phase_time = 0;
- snd->volume = FMSYNTH_MAX_VOLUME;
- snd->operators = NULL;
- snd->next_sound = NULL;
- }
-
- return snd;
-}
-
-/****************************************************************************
- * name: fmsynthsnd_create
- ****************************************************************************/
-
-FAR fmsynth_sound_t *fmsynthsnd_create(void)
-{
- FAR fmsynth_sound_t *ret;
- ret = (FAR fmsynth_sound_t *)malloc(sizeof(fmsynth_sound_t));
-
- if (ret)
- {
- create_fmsynthsnd(ret);
- ret->own_allocate = 1;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: fmsynthsnd_delete
- ****************************************************************************/
-
-void fmsynthsnd_delete(FAR fmsynth_sound_t *snd)
-{
- if (snd != NULL && snd->own_allocate == 1)
- {
- free(snd);
- }
-}
-
-/****************************************************************************
- * name: fmsynthsnd_set_operator
- ****************************************************************************/
-
-int fmsynthsnd_set_operator(FAR fmsynth_sound_t *snd, FAR fmsynth_op_t *op)
-{
- snd->operators = op;
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynthsnd_set_soundfreq
- ****************************************************************************/
-
-void fmsynthsnd_set_soundfreq(FAR fmsynth_sound_t *snd, float freq)
-{
- FAR fmsynth_op_t *op;
-
- for (op = snd->operators; op != NULL; op = op->parallelop)
- {
- fmsynthop_set_soundfreq(op, freq);
- fmsynthop_start(op);
- }
-}
-
-/****************************************************************************
- * name: fmsynthsnd_stop
- ****************************************************************************/
-
-void fmsynthsnd_stop(FAR fmsynth_sound_t *snd)
-{
- FAR fmsynth_op_t *op;
-
- for (op = snd->operators; op != NULL; op = op->parallelop)
- {
- fmsynthop_stop(op);
- }
-}
-
-/****************************************************************************
- * name: fmsynthsnd_set_volume
- ****************************************************************************/
-
-void fmsynthsnd_set_volume(FAR fmsynth_sound_t *snd, float vol)
-{
- snd->volume = vol * FMSYNTH_MAX_VOLUME;
-}
-
-/****************************************************************************
- * name: fmsynthsnd_add_subsound
- ****************************************************************************/
-
-int fmsynthsnd_add_subsound(FAR fmsynth_sound_t *top,
- FAR fmsynth_sound_t *sub)
-{
- FAR fmsynth_sound_t *s = top;
-
- if (!top || !sub)
- {
- return ERROR;
- }
-
- for (s = top; s->next_sound; s = s->next_sound);
-
- s->next_sound = sub;
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynth_rendering
- ****************************************************************************/
-
-int fmsynth_rendering(FAR fmsynth_sound_t *snd,
- FAR int16_t *sample, int sample_num, int chnum,
- fmsynth_tickcb_t cb, unsigned long cbarg)
-{
- int i;
- int ch;
- int out;
- FAR fmsynth_sound_t *itr;
-
- for (i = 0; i < sample_num; i += chnum)
- {
- out = 0;
- for (itr = snd; itr != NULL; itr = itr->next_sound)
- {
- out = out + sound_modulate(itr);
- }
-
- for (ch = 0; ch < chnum; ch++)
- {
- *sample++ = (int16_t)out;
- }
-
- if (cb != NULL)
- {
- cb(cbarg);
- }
- }
-
- if (i > sample_num)
- {
- i -= chnum;
- }
-
- /* Return total bytes stored in the buffer */
-
- return i * sizeof(int16_t);
-}
diff --git a/audioutils/fmsynth/fmsynth_eg.c b/audioutils/fmsynth/fmsynth_eg.c
deleted file mode 100644
index 849e35a5d..000000000
--- a/audioutils/fmsynth/fmsynth_eg.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/fmsynth_eg.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define CONVERT_INITVAL(lv) (int)((lv) * FMSYNTH_MAX_EGLEVEL)
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: set_egparams
- ****************************************************************************/
-
-static int set_egparams(int fs,
- FAR fmsynth_egparam_t *param,
- FAR struct fmsynth_eglevel_s *target_level,
- FAR struct fmsynth_eglevel_s *last_level)
-{
- param->initval = CONVERT_INITVAL(last_level->level);
- param->period = fs * target_level->period_ms / 1000;
- param->diff2next = CONVERT_INITVAL(target_level->level)
- - CONVERT_INITVAL(last_level->level);
-
- if (param->initval < -FMSYNTH_MAX_EGLEVEL ||
- param->initval > FMSYNTH_MAX_EGLEVEL || param->period < 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: create_fmsyntheg
- ****************************************************************************/
-
-FAR fmsynth_eg_t *create_fmsyntheg(FAR fmsynth_eg_t *eg)
-{
- int i;
-
- if (eg)
- {
- eg->state = EGSTATE_RELEASED;
- eg->state_counter = 0;
- for (i = 0; i < EGSTATE_MAX; i++)
- {
- eg->state_params[i].initval = 0;
- eg->state_params[i].period = 0;
- }
-
- eg->state_params[EGSTATE_RELEASED].initval = FMSYNTH_MAX_EGLEVEL;
- }
-
- return eg;
-}
-
-/****************************************************************************
- * name: fmsyntheg_create
- ****************************************************************************/
-
-FAR fmsynth_eg_t *fmsyntheg_create(void)
-{
- FAR fmsynth_eg_t *ret = (FAR fmsynth_eg_t *)malloc(sizeof(fmsynth_eg_t));
-
- return create_fmsyntheg(ret);
-}
-
-/****************************************************************************
- * name: fmsyntheg_delete
- ****************************************************************************/
-
-void fmsyntheg_delete(FAR fmsynth_eg_t *eg)
-{
- if (eg != NULL)
- {
- free(eg);
- }
-}
-
-/****************************************************************************
- * name: fmsyntheg_set_param
- ****************************************************************************/
-
-int fmsyntheg_set_param(FAR fmsynth_eg_t *eg,
- int fs, FAR fmsynth_eglevels_t *levels)
-{
- int errcnt = 0;
-
- if (fs <= 0)
- {
- return ERROR;
- }
-
- errcnt += set_egparams(fs, &eg->state_params[EGSTATE_ATTACK],
- &levels->attack, &levels->release);
-
- errcnt += set_egparams(fs, &eg->state_params[EGSTATE_DECAYBREAK],
- &levels->decaybrk, &levels->attack);
-
- errcnt += set_egparams(fs, &eg->state_params[EGSTATE_DECAY],
- &levels->decay, &levels->decaybrk);
-
- errcnt += set_egparams(fs, &eg->state_params[EGSTATE_SUSTAIN],
- &levels->sustain, &levels->decay);
-
- errcnt += set_egparams(fs, &eg->state_params[EGSTATE_RELEASE],
- &levels->release, &levels->sustain);
-
- eg->state_params[EGSTATE_RELEASED].initval =
- CONVERT_INITVAL(levels->release.level);
-
- return errcnt ? ERROR : OK;
-}
-
-/****************************************************************************
- * name: fmsyntheg_start
- ****************************************************************************/
-
-void fmsyntheg_start(FAR fmsynth_eg_t *eg)
-{
- eg->state = EGSTATE_ATTACK;
- eg->state_counter = 0;
-}
-
-/****************************************************************************
- * name: fmsyntheg_stop
- ****************************************************************************/
-
-void fmsyntheg_stop(FAR fmsynth_eg_t *eg)
-{
- eg->state = EGSTATE_RELEASED;
- eg->state_counter = 0;
-}
-
-/****************************************************************************
- * name: fmsyntheg_operate
- ****************************************************************************/
-
-int fmsyntheg_operate(FAR fmsynth_eg_t *eg)
-{
- int val;
- FAR fmsynth_egparam_t *param = &eg->state_params[eg->state];
-
- val = param->initval;
-
- if (eg->state != EGSTATE_RELEASED)
- {
- if (eg->state_counter >= eg->state_params[eg->state].period)
- {
- /* Reset the counter */
-
- eg->state_counter = 0;
-
- /* Search next available state */
-
- do
- {
- eg->state++;
- }
- while (eg->state < EGSTATE_RELEASED
- && eg->state_params[eg->state].period == 0);
-
- val = eg->state_params[eg->state].initval;
- }
- else
- {
- val = val + param->diff2next * eg->state_counter / param->period;
- eg->state_counter++;
- }
- }
-
- return val;
-}
diff --git a/audioutils/fmsynth/fmsynth_op.c b/audioutils/fmsynth/fmsynth_op.c
deleted file mode 100644
index a86e7402e..000000000
--- a/audioutils/fmsynth/fmsynth_op.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/fmsynth_op.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define PHASE_ADJUST(th) \
- (((th) < 0 ? (FMSYNTH_PI) - (th) : (th)) % (FMSYNTH_PI * 2))
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const short s_sintbl[] =
-{
- 0xff37, /* Extra data for linear completion */
-
- /* Actual sin table of half PI [256] */
-
- 0x0000, 0x00c9, 0x0192, 0x025b,
- 0x0324, 0x03ed, 0x04b6, 0x057e,
- 0x0647, 0x0710, 0x07d9, 0x08a1,
- 0x096a, 0x0a32, 0x0afb, 0x0bc3,
- 0x0c8b, 0x0d53, 0x0e1b, 0x0ee3,
- 0x0fab, 0x1072, 0x1139, 0x1200,
- 0x12c7, 0x138e, 0x1455, 0x151b,
- 0x15e1, 0x16a7, 0x176d, 0x1833,
- 0x18f8, 0x19bd, 0x1a82, 0x1b46,
- 0x1c0b, 0x1ccf, 0x1d93, 0x1e56,
- 0x1f19, 0x1fdc, 0x209f, 0x2161,
- 0x2223, 0x22e4, 0x23a6, 0x2467,
- 0x2527, 0x25e7, 0x26a7, 0x2767,
- 0x2826, 0x28e5, 0x29a3, 0x2a61,
- 0x2b1e, 0x2bdb, 0x2c98, 0x2d54,
- 0x2e10, 0x2ecc, 0x2f86, 0x3041,
- 0x30fb, 0x31b4, 0x326d, 0x3326,
- 0x33de, 0x3496, 0x354d, 0x3603,
- 0x36b9, 0x376f, 0x3824, 0x38d8,
- 0x398c, 0x3a3f, 0x3af2, 0x3ba4,
- 0x3c56, 0x3d07, 0x3db7, 0x3e67,
- 0x3f16, 0x3fc5, 0x4073, 0x4120,
- 0x41cd, 0x4279, 0x4325, 0x43d0,
- 0x447a, 0x4523, 0x45cc, 0x4674,
- 0x471c, 0x47c3, 0x4869, 0x490e,
- 0x49b3, 0x4a57, 0x4afa, 0x4b9d,
- 0x4c3f, 0x4ce0, 0x4d80, 0x4e20,
- 0x4ebf, 0x4f5d, 0x4ffa, 0x5097,
- 0x5133, 0x51ce, 0x5268, 0x5301,
- 0x539a, 0x5432, 0x54c9, 0x555f,
- 0x55f4, 0x5689, 0x571d, 0x57b0,
- 0x5842, 0x58d3, 0x5963, 0x59f3,
- 0x5a81, 0x5b0f, 0x5b9c, 0x5c28,
- 0x5cb3, 0x5d3d, 0x5dc6, 0x5e4f,
- 0x5ed6, 0x5f5d, 0x5fe2, 0x6067,
- 0x60eb, 0x616e, 0x61f0, 0x6271,
- 0x62f1, 0x6370, 0x63ee, 0x646b,
- 0x64e7, 0x6562, 0x65dd, 0x6656,
- 0x66ce, 0x6745, 0x67bc, 0x6831,
- 0x68a5, 0x6919, 0x698b, 0x69fc,
- 0x6a6c, 0x6adb, 0x6b4a, 0x6bb7,
- 0x6c23, 0x6c8e, 0x6cf8, 0x6d61,
- 0x6dc9, 0x6e30, 0x6e95, 0x6efa,
- 0x6f5e, 0x6fc0, 0x7022, 0x7082,
- 0x70e1, 0x7140, 0x719d, 0x71f9,
- 0x7254, 0x72ae, 0x7306, 0x735e,
- 0x73b5, 0x740a, 0x745e, 0x74b1,
- 0x7503, 0x7554, 0x75a4, 0x75f3,
- 0x7640, 0x768d, 0x76d8, 0x7722,
- 0x776b, 0x77b3, 0x77f9, 0x783f,
- 0x7883, 0x78c6, 0x7908, 0x7949,
- 0x7989, 0x79c7, 0x7a04, 0x7a41,
- 0x7a7c, 0x7ab5, 0x7aee, 0x7b25,
- 0x7b5c, 0x7b91, 0x7bc4, 0x7bf7,
- 0x7c29, 0x7c59, 0x7c88, 0x7cb6,
- 0x7ce2, 0x7d0e, 0x7d38, 0x7d61,
- 0x7d89, 0x7db0, 0x7dd5, 0x7df9,
- 0x7e1c, 0x7e3e, 0x7e5e, 0x7e7e,
- 0x7e9c, 0x7eb9, 0x7ed4, 0x7eef,
- 0x7f08, 0x7f20, 0x7f37, 0x7f4c,
- 0x7f61, 0x7f74, 0x7f86, 0x7f96,
- 0x7fa6, 0x7fb4, 0x7fc1, 0x7fcd,
- 0x7fd7, 0x7fe0, 0x7fe8, 0x7fef,
- 0x7ff5, 0x7ff9, 0x7ffc, 0x7ffe,
-
- 0x7fff, /* Extra data for linear completion */
-};
-
-static int local_fs;
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: pseudo_sin256
- ****************************************************************************/
-
-static int pseudo_sin256(int theta)
-{
- int short_sin;
- int rest;
- int phase;
- int tblidx;
-
- theta = PHASE_ADJUST(theta);
-
- rest = theta & 0x7f;
- phase = theta / (FMSYNTH_PI / 2);
- tblidx = (theta % (FMSYNTH_PI / 2)) >> 7;
-
- if (phase & 0x01)
- {
- tblidx = 257 - tblidx;
- short_sin = s_sintbl[tblidx];
- short_sin = short_sin
- + (((s_sintbl[tblidx - 1] - short_sin) * rest) >> 7);
- }
- else
- {
- short_sin = s_sintbl[tblidx + 1];
- short_sin = short_sin
- + (((s_sintbl[tblidx + 2] - short_sin) * rest) >> 7);
- }
-
- return phase & 0x02 ? -short_sin : short_sin;
-}
-
-/****************************************************************************
- * name: triangle_wave
- ****************************************************************************/
-
-static int triangle_wave(int theta)
-{
- int ret = 0;
- int phase;
- int offset;
- int slope;
-
- theta = PHASE_ADJUST(theta);
- phase = theta / (FMSYNTH_PI / 2);
- offset = theta % (FMSYNTH_PI / 2);
-
- switch (phase)
- {
- case 0:
- ret = 0;
- slope = SHRT_MAX;
- break;
- case 1:
- ret = SHRT_MAX;
- slope = -SHRT_MAX;
- break;
- case 2:
- ret = 0;
- slope = -SHRT_MAX;
- break;
- case 3:
- ret = -SHRT_MAX;
- slope = SHRT_MAX;
- break;
- default:
- ret = 0;
- slope = SHRT_MAX;
- break;
- }
-
- return ret + ((slope * offset) >> 15);
-}
-
-/****************************************************************************
- * name: sawtooth_wave
- ****************************************************************************/
-
-static int sawtooth_wave(int theta)
-{
- theta = PHASE_ADJUST(theta);
- return (theta >> 1) - SHRT_MAX;
-}
-
-/****************************************************************************
- * name: square_wave
- ****************************************************************************/
-
-static int square_wave(int theta)
-{
- theta = PHASE_ADJUST(theta);
- return theta < FMSYNTH_PI ? SHRT_MAX : -SHRT_MAX;
-}
-
-/****************************************************************************
- * name: update_parameters
- ****************************************************************************/
-
-static void update_parameters(FAR fmsynth_op_t *op)
-{
- if (local_fs != 0)
- {
- op->delta_phase = 2 * FMSYNTH_PI * op->sound_freq * op->freq_rate
- / (float)local_fs;
- }
- else
- {
- op->delta_phase = 0.f;
- }
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: fmsynthop_set_samplerate
- ****************************************************************************/
-
-int fmsynthop_set_samplerate(int fs)
-{
- if (fs < 0)
- {
- return ERROR;
- }
-
- local_fs = fs;
- return OK;
-}
-
-/****************************************************************************
- * name: create_fmsynthop
- ****************************************************************************/
-
-FAR fmsynth_op_t *create_fmsynthop(FAR fmsynth_op_t *op,
- FAR fmsynth_eg_t *eg)
-{
- if (op)
- {
- op->eg = eg;
-
- op->own_allocate = 0;
- op->wavegen = NULL;
- op->cascadeop = NULL;
- op->parallelop = NULL;
- op->feedback_ref = NULL;
- op->feedback_val = 0;
- op->feedbackrate = 0;
- op->last_sigval = 0;
- op->freq_rate = 1.f;
- op->sound_freq = 0.f;
- op->delta_phase = 0.f;
- op->current_phase = 0.f;
- }
-
- return op;
-}
-
-/****************************************************************************
- * name: fmsynthop_create
- ****************************************************************************/
-
-FAR fmsynth_op_t *fmsynthop_create(void)
-{
- FAR fmsynth_op_t *ret;
-
- ret = (FAR fmsynth_op_t *)malloc(sizeof(fmsynth_op_t));
-
- if (ret)
- {
- ret->eg = fmsyntheg_create();
- if (!ret->eg)
- {
- free(ret);
- return NULL;
- }
-
- create_fmsynthop(ret, ret->eg);
- ret->own_allocate = 1;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: fmsynthop_delete
- ****************************************************************************/
-
-void fmsynthop_delete(FAR fmsynth_op_t *op)
-{
- if (op != NULL && op->own_allocate == 1)
- {
- if (op->eg)
- {
- fmsyntheg_delete(op->eg);
- }
-
- free(op);
- }
-}
-
-/****************************************************************************
- * name: fmsynthop_select_opfunc
- ****************************************************************************/
-
-int fmsynthop_select_opfunc(FAR fmsynth_op_t *op, int type)
-{
- int ret = ERROR;
-
- if (op != NULL)
- {
- switch (type)
- {
- case FMSYNTH_OPFUNC_SIN:
- op->wavegen = pseudo_sin256;
- ret = OK;
- break;
-
- case FMSYNTH_OPFUNC_TRIANGLE:
- op->wavegen = triangle_wave;
- ret = OK;
- break;
-
- case FMSYNTH_OPFUNC_SAWTOOTH:
- op->wavegen = sawtooth_wave;
- ret = OK;
- break;
-
- case FMSYNTH_OPFUNC_SQUARE:
- op->wavegen = square_wave;
- ret = OK;
- break;
- }
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: fmsynthop_set_envelope
- ****************************************************************************/
-
-int fmsynthop_set_envelope(FAR fmsynth_op_t *op,
- FAR fmsynth_eglevels_t *levels)
-{
- if (local_fs >= 0 && op && levels)
- {
- return fmsyntheg_set_param(op->eg, local_fs, levels);
- }
-
- return ERROR;
-}
-
-/****************************************************************************
- * name: fmsynthop_cascade_subop
- ****************************************************************************/
-
-int fmsynthop_cascade_subop(FAR fmsynth_op_t *op,
- FAR fmsynth_op_t *subop)
-{
- FAR fmsynth_op_t *tmp;
-
- if (!op || !subop)
- {
- return ERROR;
- }
-
- for (tmp = op; tmp->cascadeop; tmp = tmp->cascadeop);
-
- tmp->cascadeop = subop;
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynthop_parallel_subop
- ****************************************************************************/
-
-int fmsynthop_parallel_subop(FAR fmsynth_op_t *op,
- FAR fmsynth_op_t *subop)
-{
- FAR fmsynth_op_t *tmp;
-
- if (!op || !subop)
- {
- return ERROR;
- }
-
- for (tmp = op; tmp->parallelop; tmp = tmp->parallelop);
-
- tmp->parallelop = subop;
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynthop_bind_feedback
- ****************************************************************************/
-
-int fmsynthop_bind_feedback(FAR fmsynth_op_t *op,
- FAR fmsynth_op_t *subop, float ratio)
-{
- if (!op || !subop)
- {
- return ERROR;
- }
-
- op->feedbackrate = (int)((float)FMSYNTH_MAX_EGLEVEL * ratio);
- op->feedback_ref = &subop->last_sigval;
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynthop_update_feedback
- ****************************************************************************/
-
-int fmsynthop_update_feedback(FAR fmsynth_op_t *op)
-{
- FAR fmsynth_op_t *tmp;
-
- for (tmp = op->cascadeop; tmp != NULL; tmp = tmp->parallelop)
- {
- fmsynthop_update_feedback(tmp);
- }
-
- if (op->feedback_ref)
- {
- op->feedback_val = *op->feedback_ref * op->feedbackrate
- / FMSYNTH_MAX_EGLEVEL;
- }
-
- return OK;
-}
-
-/****************************************************************************
- * name: fmsynthop_set_soundfreq
- ****************************************************************************/
-
-void fmsynthop_set_soundfreq(FAR fmsynth_op_t *op, float freq)
-{
- FAR fmsynth_op_t *tmp;
-
- op->sound_freq = freq;
- update_parameters(op);
-
- for (tmp = op->cascadeop; tmp != NULL; tmp = tmp->parallelop)
- {
- fmsynthop_set_soundfreq(tmp, freq);
- }
-}
-
-/****************************************************************************
- * name: fmsynthop_set_soundfreqrate
- ****************************************************************************/
-
-void fmsynthop_set_soundfreqrate(FAR fmsynth_op_t *op, float rate)
-{
- op->freq_rate = rate;
- update_parameters(op);
-}
-
-/****************************************************************************
- * name: fmsynthop_start
- ****************************************************************************/
-
-void fmsynthop_start(FAR fmsynth_op_t *op)
-{
- FAR fmsynth_op_t *tmp;
-
- fmsyntheg_start(op->eg);
-
- for (tmp = op->cascadeop; tmp; tmp = tmp->parallelop)
- {
- fmsynthop_start(tmp);
- }
-}
-
-/****************************************************************************
- * name: fmsynthop_stop
- ****************************************************************************/
-
-void fmsynthop_stop(FAR fmsynth_op_t *op)
-{
- FAR fmsynth_op_t *tmp;
-
- fmsyntheg_stop(op->eg);
-
- for (tmp = op->cascadeop; tmp; tmp = tmp->parallelop)
- {
- fmsynthop_stop(tmp);
- }
-}
-
-/****************************************************************************
- * name: fmsynthop_operate
- ****************************************************************************/
-
-int fmsynthop_operate(FAR fmsynth_op_t *op, int phase_time)
-{
- int val;
- int val2;
- int phase;
- FAR fmsynth_op_t *subop;
-
- op->current_phase = phase_time ? op->current_phase + op->delta_phase : 0.f;
-
- val = (int)op->current_phase;
- val2 = (val / (2 * FMSYNTH_PI));
-
- phase = (int)val + op->feedback_val;
- op->current_phase = op->current_phase - (float)(val2 * (2 * FMSYNTH_PI));
-
- subop = op->cascadeop;
-
- while (subop)
- {
- phase += fmsynthop_operate(subop, phase_time);
- subop = subop->parallelop;
- }
-
- op->last_sigval = fmsyntheg_operate(op->eg) * op->wavegen(phase)
- / FMSYNTH_MAX_EGLEVEL;
-
- return op->last_sigval;
-}
diff --git a/audioutils/fmsynth/test/.gitignore b/audioutils/fmsynth/test/.gitignore
deleted file mode 100644
index 34211c6ab..000000000
--- a/audioutils/fmsynth/test/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/fmsynth_alsa
-/fmsynth_test
-/fmsyntheg_test
-/fmsynthop_test
-/opfunctest
diff --git a/audioutils/fmsynth/test/Makefile b/audioutils/fmsynth/test/Makefile
deleted file mode 100644
index 74118d918..000000000
--- a/audioutils/fmsynth/test/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-############################################################################
-# apps/audioutils/fmsynth/test/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-SRCS = ../fmsynth_eg.c ../fmsynth_op.c ../fmsynth.c
-CFLAGS = -DFAR= -DCODE= -DOK=0 -DERROR=-1 -I .. -I ../../../include -g
-
-TARGETS = opfunctest fmsyntheg_test fmsynthop_test fmsynth_test fmsynth_alsa
-
-all: $(TARGETS)
-
-opfunctest: $(SRCS) opfunc_test.c
- gcc $(CFLAGS) -o $@ $^ -lm
-
-fmsyntheg_test: $(SRCS) fmsynth_eg_test.c
- gcc $(CFLAGS) -o $@ $^
-
-fmsynthop_test: $(SRCS) fmsynth_op_test.c
- gcc $(CFLAGS) -o $@ $^
-
-fmsynth_test: $(SRCS) fmsynth_test.c
- gcc $(CFLAGS) -o $@ $^
-
-fmsynth_alsa: $(SRCS) fmsynth_alsa_test.c
- gcc $(CFLAGS) -o $@ $^ -lasound
-
-clean:
- rm -rf $(TARGETS)
diff --git a/audioutils/fmsynth/test/fmsynth_alsa_test.c b/audioutils/fmsynth/test/fmsynth_alsa_test.c
deleted file mode 100644
index 4644ce1b0..000000000
--- a/audioutils/fmsynth/test/fmsynth_alsa_test.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/test/fmsynth_alsa_test.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FS (48000)
-
-#define CHANNEL_NUM (2)
-#define RESAMPLING_ALSA (1)
-#define LATENCY_ALSA (10000)
-
-#define SAMPLE_NUM (FS / 20)
-#define BUFF_LENGTH (SAMPLE_NUM * CHANNEL_NUM)
-
-#define CODE_C_FREQ (261.625565f)
-#define CODE_D_FREQ (293.6647674f)
-#define CODE_E_FREQ (329.6275561f)
-#define CODE_F_FREQ (349.2282305f)
-#define CODE_G_FREQ (391.9954347f)
-#define CODE_A_FREQ (440.f)
-#define CODE_B_FREQ (493.8833009f)
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static int16_t samples[BUFF_LENGTH];
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: init_alsa
- ****************************************************************************/
-
-static snd_pcm_t *init_alsa(int fs)
-{
- int ret;
- snd_pcm_t *hndl = NULL;
-
- ret = snd_pcm_open(&hndl, "default", SND_PCM_STREAM_PLAYBACK, 0);
- if (ret < 0)
- {
- printf("sdn_pcm_open error\n");
- return NULL;
- }
-
- ret = snd_pcm_set_params(hndl,
- SND_PCM_FORMAT_S16,
- SND_PCM_ACCESS_RW_INTERLEAVED,
- CHANNEL_NUM, fs, RESAMPLING_ALSA, LATENCY_ALSA);
- if (ret != 0)
- {
- printf("sdn_pcm_set_params error\n");
- snd_pcm_close(hndl);
- return NULL;
- }
-
- return hndl;
-}
-
-/****************************************************************************
- * name: set_nonblocking
- ****************************************************************************/
-
-static int set_nonblocking(struct termios *saved)
-{
- struct termios settings;
-
- tcgetattr(0, saved);
- settings = *saved;
-
- settings.c_lflag &= ~(ECHO | ICANON);
- settings.c_cc[VTIME] = 0;
- settings.c_cc[VMIN] = 1;
- tcsetattr(0, TCSANOW, &settings);
- fcntl(0, F_SETFL, O_NONBLOCK);
-
- return OK;
-}
-
-/****************************************************************************
- * name: store_setting
- ****************************************************************************/
-
-static void store_setting(struct termios *saved)
-{
- tcsetattr(0, TCSANOW, saved);
-}
-
-/****************************************************************************
- * name: set_levels
- ****************************************************************************/
-
-static fmsynth_eglevels_t *set_levels(fmsynth_eglevels_t *level,
- float atk_lvl, int atk_peri,
- float decbrk_lvl, int decbrk_peri,
- float dec_lvl, int dec_peri,
- float sus_lvl, int sus_peri,
- float rel_lvl, int rel_peri)
-{
- level->attack.level = atk_lvl;
- level->attack.period_ms = atk_peri;
- level->decaybrk.level = decbrk_lvl;
- level->decaybrk.period_ms = decbrk_peri;
- level->decay.level = dec_lvl;
- level->decay.period_ms = dec_peri;
- level->sustain.level = sus_lvl;
- level->sustain.period_ms = sus_peri;
- level->release.level = rel_lvl;
- level->release.period_ms = rel_peri;
-
- return level;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: main
- ****************************************************************************/
-
-int main(void)
-{
- int running;
- int dump_count = 0;
- int dump_enable = 0;
-
- fmsynth_eglevels_t levels;
- fmsynth_sound_t *snd1;
- fmsynth_op_t *envop;
- fmsynth_op_t *fbop;
- snd_pcm_t *hndl = NULL;
-
- struct termios save_param;
-
- hndl = init_alsa(FS);
- if (!hndl)
- {
- printf("Init alsa error\n");
- return -1;
- }
-
- /* Initialize FM synthesizer */
-
- fmsynth_initialize(FS);
-
- /* Operator setup */
-
- envop = fmsynthop_create();
- fbop = fmsynthop_create();
-
- set_levels(&levels, 0.6f, 100, 0.3f, 300, 0.1f, 500, 0.f, 0, 0.f, 70);
-
- fmsynthop_set_envelope(envop, &levels);
- fmsynthop_select_opfunc(envop, FMSYNTH_OPFUNC_SIN);
-
- fmsynthop_set_envelope(fbop, &levels);
- fmsynthop_select_opfunc(fbop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_bind_feedback(fbop, fbop, 0.6f);
-
- fmsynthop_parallel_subop(envop, fbop);
-
- /* Sound setup */
-
- snd1 = fmsynthsnd_create();
- fmsynthsnd_set_operator(snd1, envop);
- fmsynthsnd_set_soundfreq(snd1, CODE_C_FREQ);
-
- set_nonblocking(&save_param);
- running = 1;
- while (running)
- {
- switch (getchar())
- {
- case 'c':
- fmsynthsnd_set_soundfreq(snd1, CODE_C_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Do\n");
- break;
- case 'd':
- fmsynthsnd_set_soundfreq(snd1, CODE_D_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Le\n");
- break;
- case 'e':
- fmsynthsnd_set_soundfreq(snd1, CODE_E_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Mi\n");
- break;
- case 'f':
- fmsynthsnd_set_soundfreq(snd1, CODE_F_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Fha\n");
- break;
- case 'g':
- fmsynthsnd_set_soundfreq(snd1, CODE_G_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("So\n");
- break;
- case 'a':
- fmsynthsnd_set_soundfreq(snd1, CODE_A_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Ra\n");
- break;
- case 'b':
- fmsynthsnd_set_soundfreq(snd1, CODE_B_FREQ);
- if (dump_enable)
- {
- dump_count = FS;
- dump_enable = 0;
- printf("DUMP: ");
- }
-
- printf("Shi\n");
- break;
- case 'z':
- dump_enable = 1;
- printf("Dump next code\n");
- break;
- case 'q':
- running = 0;
- break;
- }
-
- fmsynth_rendering(snd1, samples, BUFF_LENGTH, CHANNEL_NUM, NULL, 0);
-
- if (dump_count)
- {
- for (int i = 0; i < BUFF_LENGTH; i += 2)
- {
- printf("%d\n", samples[i]);
- }
-
- dump_count -= SAMPLE_NUM;
- }
-
- snd_pcm_writei(hndl, samples, SAMPLE_NUM);
- }
-
- snd_pcm_drain(hndl);
- snd_pcm_close(hndl);
-
- fmsynthop_delete(envop);
- fmsynthop_delete(fbop);
-
- fmsynthsnd_delete(snd1);
-
- store_setting(&save_param);
-
- return 0;
-}
diff --git a/audioutils/fmsynth/test/fmsynth_eg_test.c b/audioutils/fmsynth/test/fmsynth_eg_test.c
deleted file mode 100644
index 1a0641231..000000000
--- a/audioutils/fmsynth/test/fmsynth_eg_test.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/test/fmsynth_eg_test.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FS (48000)
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: state_name
- ****************************************************************************/
-
-static const char *state_name(int s)
-{
- switch (s)
- {
- case EGSTATE_ATTACK:
- return "Attack ";
- case EGSTATE_DECAYBREAK:
- return "DecayBreak";
- case EGSTATE_DECAY:
- return "Decay ";
- case EGSTATE_SUSTAIN:
- return "Sustain ";
- case EGSTATE_RELEASE:
- return "Release ";
- case EGSTATE_RELEASED:
- case -1:
- return "RELEASED..";
- }
-
- return "";
-}
-
-/****************************************************************************
- * name: dump_eg
- ****************************************************************************/
-
-static void dump_eg(fmsynth_eg_t *env)
-{
- int i;
- fmsynth_egparam_t *last = &env->state_params[EGSTATE_RELEASED];
-
- printf("===== STATE : %s =======\n", state_name(env->state));
- for (i = -1; i < EGSTATE_RELEASED; i++)
- {
- printf(" [%s] %5d <--------------> [%s] %5d\n",
- state_name(i), last->initval,
- state_name(i + 1), env->state_params[i + 1].initval);
- printf(" per %d\n", env->state_params[i + 1].period);
- printf(" dlt %d\n", env->state_params[i + 1].diff2next);
- last = &env->state_params[i + 1];
- }
-
- printf("\n");
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: main
- ****************************************************************************/
-
-int main(void)
-{
- fmsynth_eg_t *eg;
- fmsynth_eglevels_t levels;
-
- levels.attack.level = 0.6f;
- levels.attack.period_ms = 10;
- levels.decaybrk.level = 0.3f;
- levels.decaybrk.period_ms = 20;
- levels.decay.level = 0.5f;
- levels.decay.period_ms = 15;
- levels.sustain.level = 0.65f;
- levels.sustain.period_ms = 5;
- levels.release.level = 0.f;
- levels.release.period_ms = 70;
-
- eg = fmsyntheg_create();
- fmsyntheg_set_param(eg, FS, &levels);
- dump_eg(eg);
-
- fmsyntheg_start(eg);
- dump_eg(eg);
-
- while (eg->state != EGSTATE_RELEASED)
- {
- printf("%d\n", fmsyntheg_operate(eg));
- }
-
- fmsyntheg_delete(eg);
-
- return 0;
-}
diff --git a/audioutils/fmsynth/test/fmsynth_op_test.c b/audioutils/fmsynth/test/fmsynth_op_test.c
deleted file mode 100644
index cf1eff42b..000000000
--- a/audioutils/fmsynth/test/fmsynth_op_test.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/test/fmsynth_op_test.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FS (48000)
-#define SOUNDFREQ (261.f)
-#define TEST_LOOP (FS * (30 + 10 + 100 + 30 + 1) / 1000)
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: set_levels
- ****************************************************************************/
-
-static fmsynth_eglevels_t *set_levels(fmsynth_eglevels_t *level,
- float atk_lvl, int atk_peri,
- float decbrk_lvl, int decbrk_peri,
- float dec_lvl, int dec_peri,
- float sus_lvl, int sus_peri,
- float rel_lvl, int rel_peri)
-{
- level->attack.level = atk_lvl;
- level->attack.period_ms = atk_peri;
- level->decaybrk.level = decbrk_lvl;
- level->decaybrk.period_ms = decbrk_peri;
- level->decay.level = dec_lvl;
- level->decay.period_ms = dec_peri;
- level->sustain.level = sus_lvl;
- level->sustain.period_ms = sus_peri;
- level->release.level = rel_lvl;
- level->release.period_ms = rel_peri;
-
- return level;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: main
- ****************************************************************************/
-
-int main(void)
-{
- int phase_time;
- fmsynth_eglevels_t levels;
-
- fmsynth_op_t *envop;
- fmsynth_op_t *fbop;
- fmsynth_op_t *triop;
- fmsynth_op_t *mainop;
- fmsynth_op_t *subop;
-
- fmsynth_op_t *conv1;
- fmsynth_op_t *conv2;
-
- phase_time = 0;
- fmsynthop_set_samplerate(FS);
-
- set_levels(&levels, 0.12f, 10, 0.06f, 20, 0.1f, 16, 0.1f, 5, 0.f, 70);
-
- envop = fmsynthop_create();
- fmsynthop_set_envelope(envop, &levels);
- fmsynthop_select_opfunc(envop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_set_soundfreq(envop, SOUNDFREQ);
- fmsynthop_start(envop);
-
- triop = fmsynthop_create();
- fmsynthop_select_opfunc(triop, FMSYNTH_OPFUNC_TRIANGLE);
- fmsynthop_set_soundfreq(triop, SOUNDFREQ);
- fmsynthop_start(triop);
-
- fbop = fmsynthop_create();
- fmsynthop_select_opfunc(fbop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_set_soundfreq(fbop, SOUNDFREQ);
- fmsynthop_bind_feedback(fbop, fbop, 0.6f);
- fmsynthop_start(fbop);
-
- mainop = fmsynthop_create();
- subop = fmsynthop_create();
- fmsynthop_select_opfunc(mainop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_select_opfunc(subop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_cascade_subop(mainop, subop);
- fmsynthop_set_soundfreq(mainop, SOUNDFREQ);
- fmsynthop_set_soundfreqrate(subop, 2.f);
- fmsynthop_start(mainop);
-
- printf("idx,EnvTest,FeedbackTest,CascadeTest,Triangle\n");
- while (phase_time < TEST_LOOP)
- {
- fmsynthop_update_feedback(envop);
- fmsynthop_update_feedback(fbop);
- fmsynthop_update_feedback(mainop);
- fmsynthop_update_feedback(triop);
-
- printf("%d,%d,%d,%d,%d\n",
- phase_time,
- fmsynthop_operate(envop, phase_time),
- fmsynthop_operate(fbop, phase_time),
- fmsynthop_operate(mainop, phase_time),
- fmsynthop_operate(triop, phase_time));
-
- phase_time++;
- }
-
- fmsynthop_delete(envop);
- fmsynthop_delete(fbop);
- fmsynthop_delete(mainop);
- fmsynthop_delete(subop);
-
- return 0;
-}
diff --git a/audioutils/fmsynth/test/fmsynth_test.c b/audioutils/fmsynth/test/fmsynth_test.c
deleted file mode 100644
index ae03f2e6c..000000000
--- a/audioutils/fmsynth/test/fmsynth_test.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/test/fmsynth_test.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FS (48000)
-#define SOUNDFREQ (3000.f)
-#define TEST_LENGTH ((FS / 1000) * (10 + 20 + 16 + 5 + 30))
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static int16_t my_sample[TEST_LENGTH];
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: set_levels
- ****************************************************************************/
-
-static fmsynth_eglevels_t *set_levels(fmsynth_eglevels_t *level,
- int atk_lvl, int atk_peri,
- int decbrk_lvl, int decbrk_peri,
- int dec_lvl, int dec_peri,
- int sus_lvl, int sus_peri,
- int rel_lvl, int rel_peri)
-{
- level->attack.level = atk_lvl;
- level->attack.period_ms = atk_peri;
- level->decaybrk.level = decbrk_lvl;
- level->decaybrk.period_ms = decbrk_peri;
- level->decay.level = dec_lvl;
- level->decay.period_ms = dec_peri;
- level->sustain.level = sus_lvl;
- level->sustain.period_ms = sus_peri;
- level->release.level = rel_lvl;
- level->release.period_ms = rel_peri;
-
- return level;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: main
- ****************************************************************************/
-
-int main(void)
-{
- int phase_time;
-
- fmsynth_eglevels_t levels;
- fmsynth_sound_t *snd1;
- fmsynth_op_t *envop;
- fmsynth_op_t *fbop;
-
- /* Initialize FM synthesizer */
-
- fmsynth_initialize(FS);
-
- /* Operator setup */
-
- envop = fmsynthop_create();
- fbop = fmsynthop_create();
-
- set_levels(&levels, 0.12f, 10, 0.06f, 20, 0.1f, 16, 0.1f, 5, 0.f, 70);
-
- fmsynthop_set_envelope(envop, &levels);
- fmsynthop_select_opfunc(envop, FMSYNTH_OPFUNC_SIN);
-
- fmsynthop_select_opfunc(fbop, FMSYNTH_OPFUNC_SIN);
- fmsynthop_bind_feedback(fbop, fbop, 0.6f);
-
- fmsynthop_parallel_subop(envop, fbop);
-
- /* Sound setup */
-
- snd1 = fmsynthsnd_create();
- fmsynthsnd_set_operator(snd1, envop);
- fmsynthsnd_set_soundfreq(snd1, SOUNDFREQ);
-
- fmsynth_rendering(snd1, my_sample, TEST_LENGTH, 1, NULL, 0);
-
- for (int i = 0; i < TEST_LENGTH; i++)
- {
- printf("%d\n", my_sample[i]);
- }
-
- fmsynthop_delete(envop);
- fmsynthop_delete(fbop);
-
- fmsynthsnd_delete(snd1);
-
- return 0;
-}
diff --git a/audioutils/fmsynth/test/opfunc_test.c b/audioutils/fmsynth/test/opfunc_test.c
deleted file mode 100644
index d972bf290..000000000
--- a/audioutils/fmsynth/test/opfunc_test.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
- * apps/audioutils/fmsynth/test/opfunc_test.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FS (48000)
-#define DUMP_PERIOD (FS * 3 / 2000)
-#define ACCURACY_TEST_PERIOD (FS * 3)
-
-#define HZ (4186)
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static opfunc_t func_sin;
-static opfunc_t func_tri;
-static opfunc_t func_saw;
-static opfunc_t func_sqa;
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: prepare_opfuncs
- ****************************************************************************/
-
-static void prepare_opfuncs(void)
-{
- fmsynth_op_t *op;
-
- op = fmsynthop_create();
-
- fmsynthop_select_opfunc(op, FMSYNTH_OPFUNC_SIN);
- func_sin = op->wavegen;
-
- fmsynthop_select_opfunc(op, FMSYNTH_OPFUNC_TRIANGLE);
- func_tri = op->wavegen;
-
- fmsynthop_select_opfunc(op, FMSYNTH_OPFUNC_SAWTOOTH);
- func_saw = op->wavegen;
-
- fmsynthop_select_opfunc(op, FMSYNTH_OPFUNC_SQUARE);
- func_sqa = op->wavegen;
-
- fmsynthop_delete(op);
-}
-
-/****************************************************************************
- * name: wavegen_dump
- ****************************************************************************/
-
-static void wavegen_dump(void)
-{
- int t;
- float deltaact;
-
- deltaact = (float)FMSYNTH_PI * 2. * (float)HZ / (float)FS;
-
- printf("===== Wave generator Dump ====\n");
- printf("SIN, TRIANGLE, SAWTOOTH, SQUARE\n");
- for (t = 0; t < DUMP_PERIOD; t++)
- {
- printf("%d, %d, %d, %d\n",
- func_sin((int)(deltaact * t)),
- func_tri((int)(deltaact * t)),
- func_saw((int)(deltaact * t)),
- func_sqa((int)(deltaact * t))
- );
- }
-
- printf("\n");
-}
-
-/****************************************************************************
- * name: sin_accuracy_test
- ****************************************************************************/
-
-static void sin_accuracy_test(void)
-{
- int t;
- float delta;
- float deltaact;
- float max_diff = 0.f;
- float ref_sin;
- int sin_val;
- float norm_sin;
- float diff;
-
- delta = M_PI * 2. * (float)HZ / (float)FS;
- deltaact = (float)FMSYNTH_PI * 2. * (float)HZ / (float)FS;
-
- printf("===== Local SIN function ACCURACY TEST ====\n");
- for (t = 0; t < ACCURACY_TEST_PERIOD; t++)
- {
- sin_val = func_sin((int)(deltaact * t));
- ref_sin = sinf(delta * t);
-
- norm_sin = (float)sin_val / (float)SHRT_MAX;
- printf("t=%d, operator-sin(%d)=%d, norm_sin=%f, sinf(%f)=%f ",
- t, (int)(deltaact * t), sin_val, norm_sin, delta * t, ref_sin);
-
- diff = fabsf(norm_sin - ref_sin);
- max_diff = max_diff < diff ? diff : max_diff;
-
- if (diff >= 0.005)
- {
- printf(" BIG-DIFF : %f\n", diff);
- }
- else
- {
- printf("\n");
- }
- }
-
- printf("\n\nMAX DIFF = %f\n\n", max_diff);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: main
- ****************************************************************************/
-
-int main(void)
-{
- prepare_opfuncs();
- sin_accuracy_test();
- wavegen_dump();
-
- return 0;
-}
diff --git a/audioutils/lame/.gitignore b/audioutils/lame/.gitignore
deleted file mode 100644
index 746d2f0dd..000000000
--- a/audioutils/lame/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-lame
diff --git a/audioutils/lame/CMakeLists.txt b/audioutils/lame/CMakeLists.txt
deleted file mode 100644
index f963cbf3d..000000000
--- a/audioutils/lame/CMakeLists.txt
+++ /dev/null
@@ -1,139 +0,0 @@
-# ##############################################################################
-# apps/audioutils/lame/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_AUDIOUTILS_LAME)
-
- # Determine destination path
- if(NOT DEFINED DST_PATH)
- set(DST_PATH ${CMAKE_CURRENT_BINARY_DIR}/lame)
- else()
- set(DST_PATH ${DST_PATH})
- endif()
-
- # Set configuration commands
- set(CFG_CMDS "")
- if(NOT "${CONFIG_ARCH}" STREQUAL "sim")
- list(APPEND CFG_CMDS "--host=${CONFIG_ARCH}")
- list(APPEND CFG_CMDS "--cross-prefix=${CROSSDEV}")
- endif()
-
- # The revision to check out. See the comment in Makefile: an unpinned
- # checkout stops linking on the day lame's trunk grows its next vector tier.
- # Raise this deliberately, together with the vector source list below.
-
- if(NOT DEFINED LAME_VERSION)
- set(LAME_VERSION 6720)
- endif()
-
- # # Download lame if no lame/configure found
- if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lame/configure")
- execute_process(
- COMMAND "svn" "checkout" "-r" "${LAME_VERSION}"
- "https://svn.code.sf.net/p/lame/svn/trunk/lame" "lame"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
- endif()
-
- # Set source path
- set(SRC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lame")
-
- # Add compiler flags
- set(CFLAGS -DHAVE_CONFIG_H -Dfast_log2=lame_fast_log2)
- set(CFLAGS
- ${CFLAGS}
- -Wno-address
- -Wno-array-parameter
- -Wno-builtin-declaration-mismatch
- -Wno-incompatible-pointer-types
- -Wno-implicit-function-declaration
- -Wno-shadow
- -Wno-stringop-overflow
- -Wno-unused-variable
- -Wno-unused-but-set-variable
- -msse)
-
- set(INCDIR ${INCDIR_PREFIX}${DST_PATH} ${INCDIR_PREFIX}${SRC_PATH}/include
- ${INCDIR_PREFIX}${SRC_PATH}/libmp3lame)
-
- # Set source files
- set(CSRCS
- "${SRC_PATH}/libmp3lame/bitstream.c"
- "${SRC_PATH}/libmp3lame/encoder.c"
- "${SRC_PATH}/libmp3lame/fft.c"
- "${SRC_PATH}/libmp3lame/gain_analysis.c"
- "${SRC_PATH}/libmp3lame/id3tag.c"
- "${SRC_PATH}/libmp3lame/lame.c"
- "${SRC_PATH}/libmp3lame/newmdct.c"
- "${SRC_PATH}/libmp3lame/psymodel.c"
- "${SRC_PATH}/libmp3lame/quantize.c"
- "${SRC_PATH}/libmp3lame/quantize_pvt.c"
- "${SRC_PATH}/libmp3lame/set_get.c"
- "${SRC_PATH}/libmp3lame/vbrquantize.c"
- "${SRC_PATH}/libmp3lame/reservoir.c"
- "${SRC_PATH}/libmp3lame/tables.c"
- "${SRC_PATH}/libmp3lame/takehiro.c"
- "${SRC_PATH}/libmp3lame/util.c"
- "${SRC_PATH}/libmp3lame/VbrTag.c"
- "${SRC_PATH}/libmp3lame/version.c"
- "${SRC_PATH}/libmp3lame/presets.c")
-
- if(CONFIG_HOST_X86 OR CONFIG_HOST_X86_64)
- list(
- APPEND
- CSRCS
- "${SRC_PATH}/libmp3lame/vector/xmm_quantize_sub.c"
- "${SRC_PATH}/libmp3lame/vector/xmm_choose_table.c"
- "${SRC_PATH}/libmp3lame/vector/xmm_quantize_lines.c"
- "${SRC_PATH}/libmp3lame/vector/xmm_calc_sfb_noise.c"
- "${SRC_PATH}/libmp3lame/vector/avx2_choose_table.c"
- "${SRC_PATH}/libmp3lame/vector/avx2_quantize_lines.c"
- "${SRC_PATH}/libmp3lame/vector/avx512_choose_table.c"
- "${SRC_PATH}/libmp3lame/vector/avx512_quantize_lines.c"
- "${SRC_PATH}/libmp3lame/vector/avx512_calc_sfb_noise.c")
- endif()
-
- # Add custom target to generate config_h
- set(CONFIG_H_FILE "${CMAKE_CURRENT_SOURCE_DIR}/lame/configure")
- set(CONFIG_OPTIONS
- --disable-cpml
- --disable-decoder
- --disable-efence
- --disable-frontend
- --disable-mp3x
- --disable-gtktest
- --disable-ipv6
- --disable-rpath
- --enable-static
- ${CFG_CMDS})
- add_custom_command(
- OUTPUT "${DST_PATH}/config.h"
- COMMAND ${CONFIG_H_FILE} ${CONFIG_OPTIONS}
- WORKING_DIRECTORY "${DST_PATH}"
- COMMENT "Generating config.h file")
- add_custom_target(generate_config_h DEPENDS "${DST_PATH}/config.h")
-
- nuttx_add_library(libmp3lame STATIC)
- add_dependencies(libmp3lame generate_config_h)
- target_sources(libmp3lame PRIVATE ${CSRCS})
- target_include_directories(libmp3lame PRIVATE ${INCDIR})
- target_compile_options(libmp3lame PRIVATE ${CFLAGS})
-
-endif()
diff --git a/audioutils/lame/Kconfig b/audioutils/lame/Kconfig
deleted file mode 100644
index 47adb3219..000000000
--- a/audioutils/lame/Kconfig
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config AUDIOUTILS_LAME
- bool "Enable LAME MP3 Encoder"
- default n
diff --git a/audioutils/lame/Make.defs b/audioutils/lame/Make.defs
deleted file mode 100644
index e1f47123f..000000000
--- a/audioutils/lame/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/lame/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_LAME),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/lame
-endif
diff --git a/audioutils/lame/Makefile b/audioutils/lame/Makefile
deleted file mode 100644
index cf2daf24e..000000000
--- a/audioutils/lame/Makefile
+++ /dev/null
@@ -1,132 +0,0 @@
-############################################################################
-# apps/audioutils/lame/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-# The revision to check out. lame's trunk grows vector tiers over time --
-# SSE2, then AVX2, then AVX-512 -- and each one adds sources that this file
-# and CMakeLists.txt have to name, so an unpinned checkout stops linking on
-# the day upstream adds the next one. Raise this deliberately, together with
-# the vector source list below.
-
-LAME_VERSION ?= 6720
-
-# Download lame if no lame/configure found
-lame-svn:
- $(Q) echo "svn checkout lame ..."
- $(Q) svn checkout -r $(LAME_VERSION) \
- https://svn.code.sf.net/p/lame/svn/trunk/lame lame
-
-ifeq ($(wildcard lame/configure),)
-context:: lame-svn
-distclean::
- $(call DELDIR, lame)
-endif
-
-ifeq ($(DST_PATH),)
- include $(APPDIR)/Make.defs
- # configure in place
- DST_PATH := lame
-else
- # configure out of tree
- DST_PATH := $(realpath $(DST_PATH))
- include $(DST_PATH)/Make.defs
- BIN := $(DST_PATH)/libmp3lame.a
- # enable Application.mk PREFIX
- PREFIX := $(DST_PATH)$(DELIM)
-endif
-
-ifneq ($(CONFIG_ARCH),sim)
- CFG_CMDS += --host=$(CONFIG_ARCH)
- CFG_CMDS += --cross-prefix=$(CROSSDEV)
-endif
-
-SRC_PATH := lame
-
-CFLAGS += -DHAVE_CONFIG_H -D'fast_log2=lame_fast_log2'
-CFLAGS += $(INCDIR_PREFIX)$(DST_PATH) \
- $(INCDIR_PREFIX)$(SRC_PATH)/include \
- $(INCDIR_PREFIX)$(SRC_PATH)/libmp3lame
-CFLAGS += -Wno-address -Wno-array-parameter \
- -Wno-builtin-declaration-mismatch \
- -Wno-incompatible-pointer-types \
- -Wno-implicit-function-declaration -Wno-shadow \
- -Wno-stringop-overflow -Wno-unused-variable \
- -Wno-unused-but-set-variable \
- -msse
-
-CSRCS += $(SRC_PATH)/libmp3lame/bitstream.c \
- $(SRC_PATH)/libmp3lame/encoder.c \
- $(SRC_PATH)/libmp3lame/fft.c \
- $(SRC_PATH)/libmp3lame/gain_analysis.c \
- $(SRC_PATH)/libmp3lame/id3tag.c \
- $(SRC_PATH)/libmp3lame/lame.c \
- $(SRC_PATH)/libmp3lame/newmdct.c \
- $(SRC_PATH)/libmp3lame/psymodel.c \
- $(SRC_PATH)/libmp3lame/quantize.c \
- $(SRC_PATH)/libmp3lame/quantize_pvt.c \
- $(SRC_PATH)/libmp3lame/set_get.c \
- $(SRC_PATH)/libmp3lame/vbrquantize.c \
- $(SRC_PATH)/libmp3lame/reservoir.c \
- $(SRC_PATH)/libmp3lame/tables.c \
- $(SRC_PATH)/libmp3lame/takehiro.c \
- $(SRC_PATH)/libmp3lame/util.c \
- $(SRC_PATH)/libmp3lame/VbrTag.c \
- $(SRC_PATH)/libmp3lame/version.c \
- $(SRC_PATH)/libmp3lame/presets.c
-
-# lame's configure enables the SSE2, AVX2 and AVX-512 dispatch paths whenever
-# the host compiler accepts their per-function target attributes, and the
-# scalar code then calls into them, so the whole group has to be built on an
-# x86 host. Other hosts keep lame's scalar implementation.
-
-ifneq ($(CONFIG_HOST_X86)$(CONFIG_HOST_X86_64),)
-CSRCS += $(SRC_PATH)/libmp3lame/vector/xmm_quantize_sub.c \
- $(SRC_PATH)/libmp3lame/vector/xmm_choose_table.c \
- $(SRC_PATH)/libmp3lame/vector/xmm_quantize_lines.c \
- $(SRC_PATH)/libmp3lame/vector/xmm_calc_sfb_noise.c \
- $(SRC_PATH)/libmp3lame/vector/avx2_choose_table.c \
- $(SRC_PATH)/libmp3lame/vector/avx2_quantize_lines.c \
- $(SRC_PATH)/libmp3lame/vector/avx512_choose_table.c \
- $(SRC_PATH)/libmp3lame/vector/avx512_quantize_lines.c \
- $(SRC_PATH)/libmp3lame/vector/avx512_calc_sfb_noise.c
-endif
-
-LAME_CONFIG_SCRIPT := $(CURDIR)$(DELIM)lame$(DELIM)configure
-
-$(DST_PATH)/config.h:
- $(Q)echo "lame configure... $(CONFIG_ARCH)"
- $(Q)cd $(DST_PATH) && $(LAME_CONFIG_SCRIPT) \
- --disable-cpml --disable-decoder --disable-efence \
- --disable-frontend --disable-mp3x --disable-gtktest \
- --disable-ipv6 --disable-rpath --enable-static \
- $(CFG_CMDS)
-
-context:: $(DST_PATH)/config.h
-
-ifneq ($(PREFIX),)
- @$(eval ALL_SRCS = $(CSRCS))
- @$(foreach src,$(ALL_SRCS),$(shell mkdir -p $(PREFIX)$(dir $(src))))
-endif
-
-distclean::
- $(Q)if [ -d $(DST_PATH) ]; then cd $(DST_PATH) && $(MAKE) distclean; fi
-
-include $(APPDIR)/Application.mk
diff --git a/audioutils/libmad/.gitignore b/audioutils/libmad/.gitignore
deleted file mode 100644
index e54b58b51..000000000
--- a/audioutils/libmad/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/libmad
-/*.zip
\ No newline at end of file
diff --git a/audioutils/libmad/CMakeLists.txt b/audioutils/libmad/CMakeLists.txt
deleted file mode 100644
index 354f42818..000000000
--- a/audioutils/libmad/CMakeLists.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-# ##############################################################################
-# apps/audioutils/libmad/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_AUDIOUTILS_LIBMAD)
-
- # Download and unpack libmad if no libmad found
- if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libmad/configure)
- set(VERSION "master")
- set(LIBMAD_URL
- "https://github.com/markjeee/libmad/archive/refs/heads/master.zip")
-
- file(DOWNLOAD ${LIBMAD_URL} ${CMAKE_CURRENT_SOURCE_DIR}/libmad.zip)
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E tar -xf ${CMAKE_CURRENT_SOURCE_DIR}/libmad.zip
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
- execute_process(
- COMMAND
- ${CMAKE_COMMAND} -E rename
- ${CMAKE_CURRENT_SOURCE_DIR}/libmad-${VERSION}
- ${CMAKE_CURRENT_SOURCE_DIR}/libmad)
-
- add_custom_target(
- distclean
- COMMAND ${CMAKE_COMMAND} -E remove_directory
- ${CMAKE_CURRENT_SOURCE_DIR}/libmad
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_SOURCE_DIR}/libmad.zip)
- endif()
-
- nuttx_add_library(libmad STATIC)
-
- file(GLOB LIBMAD_SRCS libmad/*.c)
- set(CSRCS ${LIBMAD_SRCS})
- set(CFLAGS -Wno-shadow -Wno-stringop-overflow -DFPM_DEFAULT -DSIZEOF_INT=4)
- set(INCDIR ${CMAKE_CURRENT_LIST_DIR}/libmad
- ${CMAKE_CURRENT_LIST_DIR}/libmad/msvc++)
-
- target_sources(libmad PRIVATE ${CSRCS})
- target_include_directories(libmad PRIVATE ${INCDIR})
- target_compile_options(libmad PRIVATE ${CFLAGS})
-
-endif()
diff --git a/audioutils/libmad/Kconfig b/audioutils/libmad/Kconfig
deleted file mode 100644
index 13732d4bf..000000000
--- a/audioutils/libmad/Kconfig
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config AUDIOUTILS_LIBMAD
- bool "Enable libmad"
- default n
diff --git a/audioutils/libmad/Make.defs b/audioutils/libmad/Make.defs
deleted file mode 100644
index b3ff27474..000000000
--- a/audioutils/libmad/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/libmad/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_LIBMAD),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/libmad
-endif
diff --git a/audioutils/libmad/Makefile b/audioutils/libmad/Makefile
deleted file mode 100644
index ea7fce751..000000000
--- a/audioutils/libmad/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-############################################################################
-# apps/audioutils/libmad/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CSRCS += $(wildcard libmad/*.c)
-CFLAGS += -DFPM_DEFAULT -DSIZEOF_INT=4
-CFLAGS += -Wno-shadow -Wno-stringop-overflow
-
-# Download and unpack libmad if no git repo found
-ifeq ($(wildcard libmad/.git),)
-VERSION ?= master
-libmad.zip:
- $(Q) curl -L https://github.com/markjeee/libmad/archive/refs/heads/master.zip -o libmad.zip
- $(Q) unzip -o libmad.zip
- $(Q) mv libmad-$(VERSION) libmad
-
-context:: libmad.zip
-
-distclean::
- $(call DELDIR, libmad)
- $(call DELFILE, libmad.zip)
-
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/audioutils/mml_parser/CMakeLists.txt b/audioutils/mml_parser/CMakeLists.txt
deleted file mode 100644
index 72d2f8cfb..000000000
--- a/audioutils/mml_parser/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-# ##############################################################################
-# apps/audioutils/mml_parser/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-if(CONFIG_AUDIOUTILS_MMLPARSER_LIB)
- target_sources(apps PRIVATE mml_parser.c)
-endif()
diff --git a/audioutils/mml_parser/Kconfig b/audioutils/mml_parser/Kconfig
deleted file mode 100644
index 2fe9d3681..000000000
--- a/audioutils/mml_parser/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config AUDIOUTILS_MMLPARSER_LIB
- bool "Music Macro Language(MML) Library"
- default n
- ---help---
- Enable support for the Music Macro Language library.
diff --git a/audioutils/mml_parser/Make.defs b/audioutils/mml_parser/Make.defs
deleted file mode 100644
index 39bad3019..000000000
--- a/audioutils/mml_parser/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/mml_parser/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_MMLPARSER_LIB),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/mml_parser
-endif
diff --git a/audioutils/mml_parser/mml_parser.c b/audioutils/mml_parser/mml_parser.c
deleted file mode 100644
index 033bbbfde..000000000
--- a/audioutils/mml_parser/mml_parser.c
+++ /dev/null
@@ -1,870 +0,0 @@
-/****************************************************************************
- * apps/audioutils/mml_parser/mml_parser.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#ifdef DEBUG_ON
-#include
-#endif
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define LENGTH_STATE_IDLE (0)
-#define LENGTH_STATE_NUMBERD (1)
-#define LENGTH_STATE_PLUS (2)
-
-#define CHORD_START '['
-#define CHORD_END ']'
-
-#define TUPLET_START '{'
-#define TUPLET_END '}'
-
-#ifdef DEBUG_ON
-#define DEBUG printf
-#else
-#define DEBUG(...)
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: skip_space
- ****************************************************************************/
-
-static char *skip_space(char *str)
-{
- while (isspace(*str))
- {
- str++;
- }
-
- return str;
-}
-
-/****************************************************************************
- * name: next_code
- ****************************************************************************/
-
-static char next_code(char **score)
-{
- char ret;
- *score = skip_space(*score);
- ret = **score;
- *score += 1;
- return ret;
-}
-
-/****************************************************************************
- * name: note_index
- ****************************************************************************/
-
-static int note_index(char code)
-{
- int i;
- const char *code_types = "C+D+EF+G+A+B";
-
- for (i = 0; i < 12; i++)
- {
- if (code_types[i] == code)
- {
- return i;
- }
- }
-
- return -1;
-}
-
-/****************************************************************************
- * name: halfscale
- ****************************************************************************/
-
-static int halfscale(char **score)
-{
- int ret = 0;
-
- while (1)
- {
- switch (**score)
- {
- case '+':
- case '#':
- ret++;
- break;
- case '-':
- ret--;
- break;
- default:
- return ret;
- }
-
- *score += 1;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: strlendigits
- ****************************************************************************/
-
-static int strlendigits(FAR const char *str)
-{
- int ret = 0;
-
- while (isdigit(*str))
- {
- str++;
- ret++;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: calc_samples
- ****************************************************************************/
-
-static int calc_samples(int fs, int tempo, int num, int dots)
-{
- int div = 0;
- int n = 0;
- int mul = 16;
-
- DEBUG("fs=%d, tempo=%d, num=%d, dots=%d\n", fs, tempo, num, dots);
-
- switch (num)
- {
- case 0:
- n = 3;
- break;
- case 1:
- n = 2;
- break;
- case 2:
- n = 1;
- break;
- case 4:
- n = 0;
- break;
- case 8:
- div = 1;
- break;
- case 16:
- div = 2;
- break;
- case 32:
- div = 3;
- break;
- case 64:
- div = 4;
- break;
- default:
- div = -1;
- break;
- }
-
- if (dots <= 4)
- {
- while (dots)
- {
- mul += (1 << (4 - dots));
- dots--;
- }
- }
- else
- {
- dots = -1;
- }
-
- if (div < 0 || dots < 0)
- {
- return -EINVAL;
- }
-
- return (((15 * fs * mul) << n) >> (2 + div)) / tempo;
-}
-
-/****************************************************************************
- * name: get_samples
- ****************************************************************************/
-
-static int get_samples(FAR struct music_macro_lang_s *mml,
- int samples, int num, int dots, bool plus_mode)
-{
- int len;
-
- num = num < 0 ? mml->def_length : num;
- len = calc_samples(mml->fs, mml->cur_tempo, num, dots);
-
- if (len > 0)
- {
- return plus_mode ? samples + len : len;
- }
-
- return len;
-}
-
-/****************************************************************************
- * name: is_qualifire
- ****************************************************************************/
-
-static bool is_qualifire(char c)
-{
- if (isdigit(c) || c == '.')
- {
- return true;
- }
-
- return false;
-}
-
-/****************************************************************************
- * name: sample_length
- ****************************************************************************/
-
-static int sample_length(FAR struct music_macro_lang_s *mml,
- FAR char **score)
-{
- int dots = 0;
- int samples = 0;
- int state = LENGTH_STATE_IDLE;
- bool plus_mode = false;
- bool parsing = true;
- int num = -1;
-
- samples = get_samples(mml, samples, num, dots, plus_mode);
-
- if (!is_qualifire(**score))
- {
- return samples;
- }
-
- while (parsing)
- {
- DEBUG("In Length parser\n");
- switch (state)
- {
- case LENGTH_STATE_IDLE:
- if (isdigit(**score))
- {
- DEBUG("state[IDLE]: Digits\n");
- num = atoi(*score);
- *score += strlendigits(*score);
- state = LENGTH_STATE_NUMBERD;
- }
- else if (**score == '.')
- {
- DEBUG("state[IDLE]: Dot\n");
- state = LENGTH_STATE_NUMBERD;
- dots++;
- *score += 1;
- }
- else
- {
- DEBUG("state[IDLE]: Other\n");
- samples = get_samples(mml, samples, num, dots, plus_mode);
- parsing = false;
- }
-
- case LENGTH_STATE_NUMBERD:
- if (**score == '.')
- {
- DEBUG("state[NUM]: Dot\n");
- dots++;
- *score += 1;
- }
- else if (**score == '+')
- {
- DEBUG("state[NUM]: PLUS\n");
- samples = get_samples(mml, samples, num, dots, plus_mode);
- if (samples < 0)
- {
- parsing = false;
- }
-
- plus_mode = true;
- num = -1;
- *score += 1;
- state = LENGTH_STATE_PLUS;
- }
- else
- {
- DEBUG("state[NUM]: Other\n");
- samples = get_samples(mml, samples, num, dots, plus_mode);
- parsing = false;
- }
-
- break;
-
- case LENGTH_STATE_PLUS:
- if (isdigit(**score))
- {
- num = atoi(*score);
- *score += strlendigits(*score);
- DEBUG("state[PLUS]: Digits num=%d, restscore=%s,"
- " parsing=%s\n",
- num, *score, parsing ? "True" : "False");
- state = LENGTH_STATE_NUMBERD;
- }
- else
- {
- DEBUG("state[PLUS]: Other\n");
- samples = -EINVAL;
- parsing = false;
- }
-
- break;
-
- default:
- parsing = false;
- samples = -EPROTO;
- break;
- }
-
- DEBUG("Out switch : state[%s]: Digits num=%d, restscore=%s,"
- " parse=%s\n",
- state == LENGTH_STATE_IDLE ? "IDLE" :
- state == LENGTH_STATE_NUMBERD ? "NUM" :
- state == LENGTH_STATE_PLUS ? "PLUS" : "Unknown",
- num, *score, parsing ? "True" : "False");
- }
-
- DEBUG("Out while\n");
-
- return samples;
-}
-
-/****************************************************************************
- * name: tuple_length
- ****************************************************************************/
-
-static int tuplet_length(FAR struct music_macro_lang_s *mml)
-{
- int ret;
-
- ret = mml->tuplet_length / mml->tuplet_notes;
- mml->cur_tuplet++;
- if (mml->cur_tuplet == mml->tuplet_notes)
- {
- /* Adjust surplus */
-
- ret = mml->tuplet_length - (ret * (mml->tuplet_notes - 1));
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_note
- ****************************************************************************/
-
-static int handle_note(FAR struct music_macro_lang_s *mml, char code,
- FAR char **score, FAR struct mml_result_s *result)
-{
- result->note_idx[0] = note_index(code) + halfscale(score)
- + mml->cur_octave * 12;
- result->length = sample_length(mml, score);
-
- return result->length < 0 ? MML_TYPE_NOTE_ERROR : MML_TYPE_NOTE;
-}
-
-/****************************************************************************
- * name: handle_rest
- ****************************************************************************/
-
-static int handle_rest(FAR struct music_macro_lang_s *mml,
- FAR char **score, FAR struct mml_result_s *result)
-{
- if (mml->state == MML_STATE_TUPLET)
- {
- DEBUG("Tuplet : TTL %d, CUR %d\n", mml->tuplet_notes, mml->cur_tuplet);
- result->length = tuplet_length(mml);
- return MML_TYPE_REST;
- }
- else
- {
- result->length = sample_length(mml, score);
- return result->length < 0 ? MML_TYPE_REST_ERROR : MML_TYPE_REST;
- }
-}
-
-/****************************************************************************
- * name: handle_tempo
- ****************************************************************************/
-
-static int handle_tempo(FAR struct music_macro_lang_s *mml,
- FAR char **score, FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_TEMPO;
-
- if (isdigit(**score))
- {
- mml->cur_tempo = result->length = atoi(*score);
- *score += strlendigits(*score);
- }
- else
- {
- ret = MML_TYPE_TEMPO_ERROR;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_length
- ****************************************************************************/
-
-static int handle_length(FAR struct music_macro_lang_s *mml,
- FAR char **score, FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_LENGTH_ERROR;
-
- DEBUG("length str : %c\n", **score);
- if (isdigit(**score))
- {
- mml->def_length = result->length = atoi(*score);
- *score += strlendigits(*score);
- ret = MML_TYPE_LENGTH;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_octave
- ****************************************************************************/
-
-static int handle_octave(FAR struct music_macro_lang_s *mml, char code,
- FAR char **score, FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_OCTAVE;
-
- switch (code)
- {
- case '>':
- mml->cur_octave++;
- result->length = mml->cur_octave;
- break;
-
- case '<':
- mml->cur_octave--;
- result->length = mml->cur_octave;
- break;
-
- default:
- if (isdigit(**score))
- {
- mml->cur_octave = result->length = atoi(*score);
- *score += strlendigits(*score);
- }
- else
- {
- ret = MML_TYPE_OCTAVE_ERROR;
- }
-
- break;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_volume
- ****************************************************************************/
-
-static int handle_volume(FAR struct music_macro_lang_s *mml,
- FAR char **score, FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_VOLUME;
-
- result->length = atoi(*score);
- *score += strlendigits(*score);
-
- if (result->length < 0 || result->length > 100)
- {
- ret = MML_TYPE_VOLUME_ERROR;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: skip_until
- ****************************************************************************/
-
-static char *skip_until(FAR char *score, char until)
-{
- while (*score != until && *score != '\0')
- {
- score++;
- }
-
- return score;
-}
-
-/****************************************************************************
- * name: count_tupletnotes
- ****************************************************************************/
-
-static int count_tupletnotes(FAR struct music_macro_lang_s *mml,
- FAR char *score)
-{
- const char *notes = "CDEFGABR";
-
- score = skip_space(score);
-
- while (*score != TUPLET_END)
- {
- if (strchr(notes, *score))
- {
- mml->tuplet_notes++;
- }
- else if (*score == CHORD_START)
- {
- score = skip_until(score, CHORD_END);
- mml->tuplet_notes++;
- }
-
- if (*score == '\0')
- {
- return -EINVAL;
- }
-
- score++;
- score = skip_space(score);
- }
-
- score++; /* Skip TUPLET_END */
- mml->tuplet_length = sample_length(mml, &score);
-
- return mml->tuplet_notes != 0 ? OK : -EINVAL;
-}
-
-/****************************************************************************
- * name: handle_starttuplet
- ****************************************************************************/
-
-static int handle_starttuplet(FAR struct music_macro_lang_s *mml,
- FAR char **score,
- FAR struct mml_result_s *result)
-{
- int ret;
-
- if (mml->state != MML_STATE_NORMAL)
- {
- return MML_TYPE_ILLIGAL_DOUBLE_TUPLET;
- }
-
- mml->tuplet_notes = 0;
- ret = count_tupletnotes(mml, *score);
- if (ret < 0 || mml->tuplet_notes == 0)
- {
- return MML_TYPE_TUPLET_ERROR;
- }
-
- mml->state = MML_STATE_TUPLET;
- mml->cur_tuplet = 0;
-
- result->length = mml->tuplet_length;
-
- return MML_TYPE_TUPLETSTART;
-}
-
-/****************************************************************************
- * name: handle_stoptuplet
- ****************************************************************************/
-
-static int handle_stoptuplet(FAR struct music_macro_lang_s *mml,
- FAR char **score,
- FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_TUPLETDONE;
-
- mml->state = MML_STATE_NORMAL;
-
- /* Just for skip of length block */
-
- sample_length(mml, score);
-
- if (mml->cur_tuplet != mml->tuplet_notes)
- {
- ret = MML_TYPE_ILLIGAL_TOOFEW_NOTES;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_tupletnote
- ****************************************************************************/
-
-static int handle_tupletnote(FAR struct music_macro_lang_s *mml, char code,
- FAR char **score,
- FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_NOTE;
-
- DEBUG("Tuplet : TTL %d, CUR %d\n", mml->tuplet_notes, mml->cur_tuplet);
- if (mml->cur_tuplet < mml->tuplet_notes)
- {
- result->note_idx[0] = note_index(code) + halfscale(score)
- + mml->cur_octave * 12;
- result->length = tuplet_length(mml);
- }
- else
- {
- ret = MML_TYPE_ILLIGAL_TOOMANY_NOTES;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_notes
- ****************************************************************************/
-
-static int handle_notes(FAR struct music_macro_lang_s *mml, char code,
- FAR char **score,
- FAR struct mml_result_s *result)
-{
- int ret;
-
- result->chord_notes = 1;
-
- if (mml->state == MML_STATE_TUPLET)
- {
- ret = handle_tupletnote(mml, code, score, result);
- }
- else
- {
- ret = handle_note(mml, code, score, result);
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: handle_startchord
- ****************************************************************************/
-
-static int handle_startchord(FAR struct music_macro_lang_s *mml,
- FAR char **score,
- FAR struct mml_result_s *result)
-{
- char code;
- int note_idx;
-
- code = next_code(score);
-
- while (code != CHORD_END && code != '\0')
- {
- DEBUG("CHORD: %c\n", code);
- note_idx = note_index(code);
- DEBUG("CHORD note_idx = %d\n", note_idx);
- if (note_idx >= 0)
- {
- note_idx += halfscale(score) + mml->cur_octave * 12;
-
- if (result->chord_notes < MAX_CHORD_NOTES)
- {
- result->note_idx[result->chord_notes] = note_idx;
- result->chord_notes++;
- }
-
- /* In case of chord notes are over than MAX_CHORD_NOTES,
- * just ignore overflowed notes. Not behave as an error.
- */
- }
- else
- {
- switch (code)
- {
- case 'O':
- case '>':
- case '<':
- if (handle_octave(mml, code, score, result) < 0)
- {
- return MML_TYPE_CHORD_ERROR;
- }
- break;
-
- default:
- return MML_TYPE_CHORD_ERROR;
- break;
- }
- }
-
- code = next_code(score);
- }
-
- if (code == '\0')
- {
- return MML_TYPE_CHORD_ERROR;
- }
-
- if (mml->state == MML_STATE_TUPLET)
- {
- result->length = tuplet_length(mml);
- }
- else
- {
- result->length = sample_length(mml, score);
- }
-
- return result->length < 0 ? MML_TYPE_CHORD_ERROR : MML_TYPE_CHORD;
-}
-
-/****************************************************************************
- * name: handle_tone
- ****************************************************************************/
-
-static int handle_tone(FAR struct music_macro_lang_s *mml,
- FAR char **score, FAR struct mml_result_s *result)
-{
- int ret = MML_TYPE_TONE_ERROR;
-
- if (isdigit(**score))
- {
- result->note_idx[0] = atoi(*score);
- *score += strlendigits(*score);
- ret = MML_TYPE_TONE;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: init_mml
- ****************************************************************************/
-
-int init_mml(FAR struct music_macro_lang_s *mml, int fs,
- int tempo, int octave, int length)
-{
- mml->fs = fs;
- mml->cur_tempo = tempo;
- mml->cur_octave = octave;
- mml->def_length = length;
-
- mml->state = MML_STATE_NORMAL;
- mml->cur_tuplet = 0;
- mml->tuplet_notes = 0;
- mml->tuplet_length = 0;
-
- return 0;
-}
-
-/****************************************************************************
- * name: parse_mml
- ****************************************************************************/
-
-int parse_mml(FAR struct music_macro_lang_s *mml, FAR char **score,
- FAR struct mml_result_s *result)
-{
- int ret;
- char code;
-
- code = next_code(score);
- DEBUG("code=%c\n", code);
- result->chord_notes = 0;
-
- switch (code)
- {
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'G':
- ret = handle_notes(mml, code, score, result);
- break;
-
- case 'R':
- ret = handle_rest(mml, score, result);
- break;
-
- case 'T':
- ret = handle_tempo(mml, score, result);
- break;
-
- case 'L':
- ret = handle_length(mml, score, result);
- break;
-
- case 'O':
- case '>':
- case '<':
- ret = handle_octave(mml, code, score, result);
- break;
-
- case 'V':
- ret = handle_volume(mml, score, result);
- break;
-
- case CHORD_START:
- ret = handle_startchord(mml, score, result);
- break;
-
- case TUPLET_START:
- ret = handle_starttuplet(mml, score, result);
- break;
-
- case TUPLET_END:
- ret = handle_stoptuplet(mml, score, result);
- break;
-
- case '@':
- ret = handle_tone(mml, score, result);
- break;
-
- case '\0':
- ret = MML_TYPE_EOF;
- *score -= 1; /* Backward */
- break;
-
- default:
- ret = MML_TYPE_ILLIGAL_COMPOSITION;
- break;
- }
-
- return ret;
-}
diff --git a/audioutils/morsey/.gitignore b/audioutils/morsey/.gitignore
deleted file mode 100644
index 26b43c946..000000000
--- a/audioutils/morsey/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-morsey
diff --git a/audioutils/morsey/Kconfig b/audioutils/morsey/Kconfig
deleted file mode 100644
index 4f8b2f98d..000000000
--- a/audioutils/morsey/Kconfig
+++ /dev/null
@@ -1,6 +0,0 @@
-config AUDIOUTILS_MORSEY
- bool "Morse code playing library"
- default n
- ---help---
- Simple library for parsing ASCII text into playable Morse code. Not
- necessarily restricted to audio.
diff --git a/audioutils/morsey/Make.defs b/audioutils/morsey/Make.defs
deleted file mode 100644
index 9fab9a304..000000000
--- a/audioutils/morsey/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/morsey/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_MORSEY),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/morsey
-endif
diff --git a/audioutils/morsey/Makefile b/audioutils/morsey/Makefile
deleted file mode 100644
index 04f454e64..000000000
--- a/audioutils/morsey/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-############################################################################
-# apps/audioutils/morsey/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CSRCS = $(MORSEY_DIR)/morsey.c
-
-MORSEY_DIR = morsey
-MORSEY_VERSION = v1.0.1
-MORSEY_MORSEY_H_SHA256 = 55f45e7b9a4d810f928ffe3ee9bea4cc318e28b1f49abf9512aee2638bd1dbfa
-MORSEY_MORSEY_C_SHA256 = 12babc90d3518e026c344c38dc3701287c41fd6b41a3ec96fb36c77907be78f8
-
-$(MORSEY_DIR):
- $(Q) echo "Cloning Morsey repo..."
- $(Q) git clone --depth=1 --branch=$(MORSEY_VERSION) https://github.com/linguini1/morsey.git
- $(Q) touch $(MORSEY_DIR)
- $(Q) echo "Checking Morsey hashes..."
- $(Q) $(APPDIR)/tools/check-hash.sh sha256 $(MORSEY_MORSEY_H_SHA256) $@/morsey.h
- $(Q) $(APPDIR)/tools/check-hash.sh sha256 $(MORSEY_MORSEY_C_SHA256) $@/morsey.c
-
-create_includes: $(MORSEY_DIR)/morsey.h
- $(Q) cp $< $(APPDIR)/include/audioutils
-
-context:: $(MORSEY_DIR)
- $(Q) $(MAKE) create_includes
-
-distclean::
- $(call DELFILE, $(APPDIR)/include/audioutils/morsey.h)
- $(call DELDIR, morsey)
-
-include $(APPDIR)/Application.mk
diff --git a/audioutils/nxaudio/CMakeLists.txt b/audioutils/nxaudio/CMakeLists.txt
deleted file mode 100644
index cd7c017ca..000000000
--- a/audioutils/nxaudio/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/audioutils/nxaudio/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_AUDIOUTILS_NXAUDIO_LIB)
- target_sources(apps PRIVATE nxaudio.c)
-endif()
diff --git a/audioutils/nxaudio/Kconfig b/audioutils/nxaudio/Kconfig
deleted file mode 100644
index e3828aff9..000000000
--- a/audioutils/nxaudio/Kconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config AUDIOUTILS_NXAUDIO_LIB
- bool "NX Audio Library"
- default n
- ---help---
- Enable support for the NX Audio library.
-
-if AUDIOUTILS_NXAUDIO_LIB
-
-config AUDIOUTILS_NXAUDIO_DEVPATH
- string "Audio Device file path"
- default "/dev/audio/pcm1"
- ---help---
- Audio device file path of target audio device.
-
-config AUDIOUTILS_NXAUDIO_MSGQNAME
- string "Message queue name"
- default "/tmp/fmaudio_mq"
- ---help---
- Message queue name (file path) to communicate with audio message loop.
-
-endif
diff --git a/audioutils/nxaudio/Make.defs b/audioutils/nxaudio/Make.defs
deleted file mode 100644
index 2677f926e..000000000
--- a/audioutils/nxaudio/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/nxaudio/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_NXAUDIO_LIB),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/nxaudio
-endif
diff --git a/audioutils/nxaudio/Makefile b/audioutils/nxaudio/Makefile
deleted file mode 100644
index 561cecc89..000000000
--- a/audioutils/nxaudio/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-############################################################################
-# apps/audioutils/nxaudio/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CSRCS = nxaudio.c
-
-include $(APPDIR)/Application.mk
diff --git a/audioutils/nxaudio/nxaudio.c b/audioutils/nxaudio/nxaudio.c
deleted file mode 100644
index 3871a1a93..000000000
--- a/audioutils/nxaudio/nxaudio.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/****************************************************************************
- * apps/audioutils/nxaudio/nxaudio.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: configure_audio
- ****************************************************************************/
-
-static int configure_audio(int fd, int ch, int fs, int bps, int chmap)
-{
- struct audio_caps_desc_s cap;
-
- cap.caps.ac_len = sizeof(struct audio_caps_s);
- cap.caps.ac_type = AUDIO_TYPE_OUTPUT;
- cap.caps.ac_channels = ch;
- cap.caps.ac_chmap = chmap;
- cap.caps.ac_controls.hw[0] = fs;
- cap.caps.ac_controls.b[2] = bps;
- cap.caps.ac_controls.b[3] = 0; /* Just set 0 */
-
- return ioctl(fd, AUDIOIOC_CONFIGURE, (unsigned long)(uintptr_t)&cap);
-}
-
-/****************************************************************************
- * name: create_audiomq
- ****************************************************************************/
-
-static mqd_t create_audiomq(const char *mqname, int fd, int buf_num)
-{
- mqd_t ret;
- struct mq_attr attr;
-
- attr.mq_maxmsg = buf_num;
- attr.mq_msgsize = sizeof(struct audio_msg_s);
- attr.mq_curmsgs = 0;
- attr.mq_flags = 0;
-
- ret = mq_open(mqname, O_RDWR | O_CREAT, 0644, &attr);
- if (ret >= (mqd_t)0)
- {
- int rr;
- if ((rr = ioctl(fd, AUDIOIOC_REGISTERMQ, (unsigned long)ret)) < 0)
- {
- printf("mq register failed: %d, %d\n", rr, errno);
- }
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: create_audio_buffers
- ****************************************************************************/
-
-static FAR struct ap_buffer_s **create_audio_buffers(int fd, int num, int sz)
-{
- int i;
- struct audio_buf_desc_s desc;
- FAR struct ap_buffer_s **ret;
-
- ret = (FAR struct ap_buffer_s **)calloc(num, sizeof(FAR void *));
-
- for (i = 0; i < num; i++)
- {
- desc.numbytes = sz;
- desc.u.pbuffer = &ret[i];
-
- ioctl(fd, AUDIOIOC_ALLOCBUFFER, (unsigned long)(uintptr_t)&desc);
- }
-
- return ret;
-}
-
-/****************************************************************************
- * name: free_audio_buffers
- ****************************************************************************/
-
-static void free_audio_buffers(FAR struct nxaudio_s *nxaudio)
-{
- int x;
- struct audio_buf_desc_s desc;
-
- for (x = 0; x < nxaudio->abufnum; x++)
- {
- if (nxaudio->abufs[x] != NULL)
- {
- desc.u.buffer = nxaudio->abufs[x];
- ioctl(nxaudio->fd, AUDIOIOC_FREEBUFFER,
- (unsigned long)(uintptr_t)&desc);
- }
- }
-
- free(nxaudio->abufs);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * name: fin_nxaudio
- ****************************************************************************/
-
-void fin_nxaudio(FAR struct nxaudio_s *nxaudio)
-{
- ioctl(nxaudio->fd, AUDIOIOC_SHUTDOWN, 0);
- ioctl(nxaudio->fd, AUDIOIOC_UNREGISTERMQ, (unsigned long)nxaudio->mq);
- ioctl(nxaudio->fd, AUDIOIOC_RELEASE, 0);
- free_audio_buffers(nxaudio);
- close(nxaudio->fd);
- mq_close(nxaudio->mq);
- mq_unlink(CONFIG_AUDIOUTILS_NXAUDIO_MSGQNAME);
-}
-
-/****************************************************************************
- * name: init_nxaudio
- ****************************************************************************/
-
-int init_nxaudio(FAR struct nxaudio_s *nxaudio,
- int fs, int bps, int chnum)
-{
- return init_nxaudio_devname(nxaudio, fs, bps, chnum,
- CONFIG_AUDIOUTILS_NXAUDIO_DEVPATH,
- CONFIG_AUDIOUTILS_NXAUDIO_MSGQNAME);
-}
-
-/****************************************************************************
- * name: init_nxaudio_devname
- ****************************************************************************/
-
-int init_nxaudio_devname(FAR struct nxaudio_s *nxaudio,
- int fs, int bps, int chnum,
- const char *devname, const char *mqname)
-{
- struct ap_buffer_info_s buf_info;
-
- nxaudio->fd = open(devname, O_RDWR | O_CLOEXEC);
- if (nxaudio->fd >= 0)
- {
- if (ioctl(nxaudio->fd, AUDIOIOC_RESERVE, 0) < 0)
- {
- close(nxaudio->fd);
- return -1;
- }
-
- /* Audio configuration: set channel num, FS and bps */
-
- configure_audio(nxaudio->fd, chnum, fs, bps, 0);
-
- nxaudio->chnum = chnum;
-
- ioctl(nxaudio->fd, AUDIOIOC_GETBUFFERINFO,
- (unsigned long)(uintptr_t)&buf_info);
-
- /* Create message queue to communicate with audio driver */
-
- nxaudio->mq = create_audiomq(mqname, nxaudio->fd,
- buf_info.nbuffers + 8);
-
- /* Create audio buffers to inject audio sample */
-
- nxaudio->abufs = create_audio_buffers(nxaudio->fd,
- buf_info.nbuffers, buf_info.buffer_size);
- nxaudio->abufnum = buf_info.nbuffers;
-
- return 0;
- }
- else
- {
- return -1;
- }
-}
-
-/****************************************************************************
- * name: nxaudio_enqbuffer
- ****************************************************************************/
-
-int nxaudio_enqbuffer(FAR struct nxaudio_s *nxaudio,
- FAR struct ap_buffer_s *apb)
-{
- struct audio_buf_desc_s desc;
-
- desc.numbytes = apb->nbytes;
- desc.u.buffer = apb;
-
- return ioctl(nxaudio->fd, AUDIOIOC_ENQUEUEBUFFER,
- (unsigned long)(uintptr_t)&desc);
-}
-
-/****************************************************************************
- * name: nxaudio_pause
- ****************************************************************************/
-
-int nxaudio_pause(FAR struct nxaudio_s *nxaudio)
-{
- return ioctl(nxaudio->fd, AUDIOIOC_PAUSE, 0);
-}
-
-/****************************************************************************
- * name: nxaudio_resume
- ****************************************************************************/
-
-int nxaudio_resume(FAR struct nxaudio_s *nxaudio)
-{
- return ioctl(nxaudio->fd, AUDIOIOC_RESUME, 0);
-}
-
-/****************************************************************************
- * name: nxaudio_setvolume
- ****************************************************************************/
-
-int nxaudio_setvolume(FAR struct nxaudio_s *nxaudio, uint16_t vol)
-{
- struct audio_caps_desc_s cap_desc;
-
- cap_desc.caps.ac_len = sizeof(struct audio_caps_s);
- cap_desc.caps.ac_type = AUDIO_TYPE_FEATURE;
- cap_desc.caps.ac_format.hw = AUDIO_FU_VOLUME;
- cap_desc.caps.ac_controls.hw[0] = vol;
-
- return ioctl(nxaudio->fd, AUDIOIOC_CONFIGURE,
- (unsigned long)(uintptr_t)&cap_desc);
-}
-
-/****************************************************************************
- * name: nxaudio_start
- ****************************************************************************/
-
-int nxaudio_start(FAR struct nxaudio_s *nxaudio)
-{
- return ioctl(nxaudio->fd, AUDIOIOC_START, 0);
-}
-
-/****************************************************************************
- * name: nxaudio_start
- ****************************************************************************/
-
-int nxaudio_stop(FAR struct nxaudio_s *nxaudio)
-{
- struct audio_msg_s term_msg;
-
- term_msg.msg_id = AUDIO_MSG_STOP;
- term_msg.u.data = 0;
- mq_send(nxaudio->mq, (FAR const char *)&term_msg, sizeof(term_msg), 0);
-
- ioctl(nxaudio->fd, AUDIOIOC_STOP, 0);
-
- return OK;
-}
-
-/****************************************************************************
- * name: nxaudio_msgloop
- ****************************************************************************/
-
-int nxaudio_msgloop(FAR struct nxaudio_s *nxaudio,
- FAR struct nxaudio_callbacks_s *cbs,
- unsigned long arg)
-{
- bool running = true;
- struct audio_msg_s msg;
- unsigned int prio;
- ssize_t size;
-
- if (!cbs)
- {
- return -1;
- }
-
- while (running)
- {
- size = mq_receive(nxaudio->mq, (FAR char *)&msg, sizeof(msg), &prio);
- if (size != sizeof(msg))
- {
- continue;
- }
-
- switch (msg.msg_id)
- {
- case AUDIO_MSG_DEQUEUE:
- if (cbs->dequeue)
- {
- cbs->dequeue(arg, msg.u.ptr);
- }
- break;
- case AUDIO_MSG_COMPLETE:
- if (cbs->complete)
- {
- cbs->complete(arg);
- }
- break;
-
- case AUDIO_MSG_STOP:
- running = false;
- break;
-
- case AUDIO_MSG_USER:
- if (cbs->user)
- {
- cbs->user(arg, &msg, &running);
- }
- break;
- default:
- break;
- }
- }
-
- return 0;
-}
diff --git a/audioutils/rtttl-c/.gitignore b/audioutils/rtttl-c/.gitignore
deleted file mode 100644
index 554f93513..000000000
--- a/audioutils/rtttl-c/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/rtttl-c
diff --git a/audioutils/rtttl-c/Kconfig b/audioutils/rtttl-c/Kconfig
deleted file mode 100644
index 8ea3355d5..000000000
--- a/audioutils/rtttl-c/Kconfig
+++ /dev/null
@@ -1,21 +0,0 @@
-config AUDIOUTILS_RTTTL_C
- bool "RTTTL parsing library"
- default n
- ---help---
- Simple library for parsing Ring Tone Text Transfer Language (RTTTL)
-
- Define how to make a sound:
-
- void
- play_tone(struct rtttl_tone tone)
- {
- /* TODO: Make a sound with
- * tone.frequency_100hz
- * tone.period_us
- * tone.duration_us
- */
- }
-
- and then play RTTTL string:
-
- rtttl_play("...", play_tone);
diff --git a/audioutils/rtttl-c/Make.defs b/audioutils/rtttl-c/Make.defs
deleted file mode 100644
index fa9aa98f8..000000000
--- a/audioutils/rtttl-c/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/audioutils/rtttl-c/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_AUDIOUTILS_RTTTL_C),)
-CONFIGURED_APPS += $(APPDIR)/audioutils/rtttl-c
-endif
diff --git a/audioutils/rtttl-c/Makefile b/audioutils/rtttl-c/Makefile
deleted file mode 100644
index aa290169d..000000000
--- a/audioutils/rtttl-c/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-############################################################################
-# apps/audioutils/rtttl-c/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-CSRCS = $(RTTTL_C_DIR)/rtttl.c
-
-RTTTL_C_DIR = rtttl-c
-RTTTL_C_VERSION = v0.1.0
-RTTTL_C_RTTTL_H_SHA256 = 6331174ae34a419ad427d9755f8ba9d3b6a92c09ecc4f36bbe07ec5e4d0cc007
-RTTTL_C_RTTTL_C_SHA256 = f0db64ef0b68136bac24616a3d62508bcc54ccdd68265d6447d99b264653b7b9
-
-$(RTTTL_C_DIR):
- $(Q) echo "Cloning rtttl-c repo..."
- $(Q) git clone --depth=1 --branch=$(RTTTL_C_VERSION) https://git.sr.ht/~qeef/rtttl-c
- $(Q) touch $(RTTTL_C_DIR)
- $(Q) echo "Checking rtttl-c hashes..."
- $(Q) $(APPDIR)/tools/check-hash.sh sha256 $(RTTTL_C_RTTTL_H_SHA256) $@/rtttl.h
- $(Q) $(APPDIR)/tools/check-hash.sh sha256 $(RTTTL_C_RTTTL_C_SHA256) $@/rtttl.c
-
-create_includes: $(RTTTL_C_DIR)/rtttl.h
- $(Q) cp $< $(APPDIR)/include/audioutils
-
-context:: $(RTTTL_C_DIR)
- $(Q) $(MAKE) create_includes
-
-distclean::
- $(call DELFILE, $(APPDIR)/include/audioutils/rtttl.h)
- $(call DELDIR, rtttl-c)
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore
deleted file mode 100644
index 9e1d2593e..000000000
--- a/benchmarks/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/Kconfig
diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt
deleted file mode 100644
index 9f3c66bf5..000000000
--- a/benchmarks/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-nuttx_add_subdirectory()
-
-nuttx_generate_kconfig(MENUDESC "Benchmark Applications")
diff --git a/benchmarks/Make.defs b/benchmarks/Make.defs
deleted file mode 100644
index cfe7377d9..000000000
--- a/benchmarks/Make.defs
+++ /dev/null
@@ -1,23 +0,0 @@
-############################################################################
-# apps/benchmarks/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(wildcard $(APPDIR)/benchmarks/*/Make.defs)
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
deleted file mode 100644
index 389f6c5a7..000000000
--- a/benchmarks/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-MENUDESC = "Benchmark Applications"
-
-include $(APPDIR)/Directory.mk
diff --git a/benchmarks/cachespeed/CMakeLists.txt b/benchmarks/cachespeed/CMakeLists.txt
deleted file mode 100644
index 18a2a39d4..000000000
--- a/benchmarks/cachespeed/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/cachespeed/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_CACHESPEED)
- nuttx_add_application(
- NAME
- ${CONFIG_BENCHMARK_CACHESPEED_PROGNAME}
- SRCS
- cachespeed_main.c
- STACKSIZE
- ${CONFIG_BENCHMARK_CACHESPEED_STACKSIZE}
- PRIORITY
- ${CONFIG_BENCHMARK_CACHESPEED_PRIORITY})
-endif()
diff --git a/benchmarks/cachespeed/Kconfig b/benchmarks/cachespeed/Kconfig
deleted file mode 100644
index 0b6f8fc78..000000000
--- a/benchmarks/cachespeed/Kconfig
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_CACHESPEED
- tristate "CACHE Speed Test"
- depends on ARCH_ICACHE && ARCH_DCACHE
- default n
- ---help---
- Enable a simple CACHE speed test.
-
-if BENCHMARK_CACHESPEED
-
-config BENCHMARK_CACHESPEED_PROGNAME
- string "Program name"
- default "cachespeed"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config BENCHMARK_CACHESPEED_PRIORITY
- int "CACHE speed test task priority"
- default 100
-
-config BENCHMARK_CACHESPEED_STACKSIZE
- int "CACHE speed test stack size"
- default DEFAULT_TASK_STACKSIZE
-
-config CACHESPEED_MONOTONIC_TIME
- bool "Using Clock Gettime"
- default n
- ---help---
- When you turn on this option, your test loop will go from 10000 -> 1000 times
- Please consider the following scenario:
- 1. By default (PERFTIME) will have a relatively high precision, but this also
- tends to cause failure in getting values on some smaller bytes, so reducing
- the precision with this option can make it easier to get data values.
- 2. whether to compare data with the content of other tools (using CLOCK
- GETTIME method), if so, it is recommended to turn on, so as to ensure that
- the data precision of both consistent.
-
-endif
-
diff --git a/benchmarks/cachespeed/Make.defs b/benchmarks/cachespeed/Make.defs
deleted file mode 100644
index 5a26c8938..000000000
--- a/benchmarks/cachespeed/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/cachespeed/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_CACHESPEED),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/cachespeed
-endif
diff --git a/benchmarks/cachespeed/Makefile b/benchmarks/cachespeed/Makefile
deleted file mode 100644
index 4491b514c..000000000
--- a/benchmarks/cachespeed/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-############################################################################
-# apps/benchmarks/cachespeed/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-#CACHE speed test
-
-ifneq ($(CONFIG_CACHESPEED_MONOTONIC_TIME),y)
- CFLAGS += -DCACHESPEED_PERFTIME
-endif
-
-PROGNAME = $(CONFIG_BENCHMARK_CACHESPEED_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_CACHESPEED_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_CACHESPEED_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_CACHESPEED)
-
-MAINSRC = cachespeed_main.c
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/cachespeed/cachespeed_main.c b/benchmarks/cachespeed/cachespeed_main.c
deleted file mode 100644
index c895c3b8f..000000000
--- a/benchmarks/cachespeed/cachespeed_main.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/cachespeed/cachespeed_main.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define CACHESPEED_PREFIX "CACHE Speed: "
-#define REPEAT_NUM 1000
-
-#ifdef CACHESPEED_PERFTIME
- #define TIME uint64_t
-
- #define CONVERT(cost) \
- do \
- { \
- struct timespec ts; \
- perf_convert(cost, &ts); \
- cost = ts.tv_sec * 1000000000 + ts.tv_nsec; \
- } while (0)
-
- #define TIMESTAMP(x) (x) = perf_gettime()
-#else
- #define TIME time_t
-
- #define CONVERT(cost)
-
- #define TIMESTAMP(x) \
- do \
- { \
- struct timespec ts; \
- clock_gettime(CLOCK_MONOTONIC, &ts); \
- x = ts.tv_sec * 1000000000 + ts.tv_nsec; \
- } while (0)
-#endif
-
-#define GET_DCACHE_LINE up_get_dcache_linesize()
-#define GET_ICACHE_LINE up_get_icache_linesize()
-#define GET_DCACHE_SIZE up_get_dcache_size()
-#define GET_ICACHE_SIZE up_get_icache_size()
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct cachespeed_s
-{
- uintptr_t addr;
- size_t alloc;
-};
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: setup
- ****************************************************************************/
-
-static void setup(FAR struct cachespeed_s *cs)
-{
- struct mallinfo info = mallinfo();
-
- /* Get the currently available memory from the system. We want the
- * memset range to be as large as possible in our tests to ensure
- * that the cache is filled with our dirty data
- */
-
- cs->alloc = info.fordblks / 2;
- cs->addr = (uintptr_t)malloc(cs->alloc);
- if (cs->addr == 0)
- {
- printf(CACHESPEED_PREFIX "Unable to request memory.\n");
- exit(EXIT_FAILURE);
- }
-
- /* Let's export the test message */
-
- printf(CACHESPEED_PREFIX "address src: %" PRIxPTR "\n", cs->addr);
-}
-
-/****************************************************************************
- * Name: teardown
- ****************************************************************************/
-
-static void teardown(FAR struct cachespeed_s *cs)
-{
- free((void *)cs->addr);
- printf(CACHESPEED_PREFIX "Done!\n");
-}
-
-/****************************************************************************
- * Name: report_line
- ****************************************************************************/
-
-static void report_line(size_t bytes, TIME cost)
-{
- double rate;
-
- /* There is a situation: if the time is 0, then the
- * calculated speed is wrong.
- */
-
- CONVERT(cost);
-
- if (cost == 0)
- {
- printf(CACHESPEED_PREFIX "%zu bytes cost time too small!\n", bytes);
- return;
- }
-
- /* rate = Test Data Size / Execution Time */
-
- rate = 1.00 * bytes * REPEAT_NUM / cost;
-
- printf("%zu Bytes: %4lf, %4" PRIu64", %4" PRIu64"\n\r",
- bytes, rate, cost / REPEAT_NUM, cost);
-}
-
-/****************************************************************************
- * Name: test_skeleton
- ****************************************************************************/
-
-static void test_skeleton(FAR struct cachespeed_s *cs,
- const size_t cache_size,
- const size_t cache_line_size, int align,
- void (*func)(uintptr_t, uintptr_t),
- const char *name)
-{
- size_t update_size;
- printf("** %s [rate, avg, cost] in nanoseconds(bytes/nesc) %s **\n",
- name, align ? "align" : "unalign");
-
- if (!align)
- {
- update_size = cache_line_size - 1;
- }
- else
- {
- update_size = cache_line_size;
- }
-
- for (size_t bytes = update_size;
- bytes <= cache_size; bytes = 2 * bytes)
- {
- irqstate_t irq;
- TIME start;
- TIME end;
- TIME cost = 0;
-
- /* Make sure that test with all the contents
- * of our address in the cache.
- */
-
- up_flush_dcache_all();
-
- irq = enter_critical_section();
- for (int i = 0; i < REPEAT_NUM; i++)
- {
- memset((void *)cs->addr, 1, cs->alloc);
- TIMESTAMP(start);
- func(cs->addr, (uintptr_t)(cs->addr + bytes));
- TIMESTAMP(end);
- cost += end - start;
- }
-
- leave_critical_section(irq);
- report_line(bytes, cost);
- }
-}
-
-/****************************************************************************
- * Name: cachespeed_common
- ****************************************************************************/
-
-static void cachespeed_common(struct cachespeed_s *cs)
-{
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 1,
- up_invalidate_dcache, "dcache invalidate");
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 0,
- up_invalidate_dcache, "dcache invalidate");
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 1,
- up_clean_dcache, "dcache clean");
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 0,
- up_clean_dcache, "dcache clean");
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 1,
- up_flush_dcache, "dcache flush");
- test_skeleton(cs, GET_DCACHE_SIZE, GET_DCACHE_LINE, 0,
- up_flush_dcache, "dcache flush");
- test_skeleton(cs, GET_ICACHE_SIZE, GET_ICACHE_LINE, 1,
- up_invalidate_icache, "icache invalidate");
- test_skeleton(cs, GET_ICACHE_SIZE, GET_ICACHE_LINE, 0,
- up_invalidate_icache, "icache invalidate");
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: cachespeed_main
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- struct cachespeed_s cs =
- {
- .addr = 0,
- .alloc = 0
- };
-
- setup(&cs);
- cachespeed_common(&cs);
- teardown(&cs);
- return 0;
-}
diff --git a/benchmarks/coremark-pro/.gitignore b/benchmarks/coremark-pro/.gitignore
deleted file mode 100644
index 617cd88b8..000000000
--- a/benchmarks/coremark-pro/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/coremark-pro
diff --git a/benchmarks/coremark-pro/CMakeLists.txt b/benchmarks/coremark-pro/CMakeLists.txt
deleted file mode 100644
index 5cd19227b..000000000
--- a/benchmarks/coremark-pro/CMakeLists.txt
+++ /dev/null
@@ -1,333 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/coremark-pro/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_COREMARK_PRO)
-
- set(COREMARKAPP_DIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro)
-
- if(NOT EXISTS ${COREMARKAPP_DIR})
- FetchContent_Declare(
- coremark_fetch
- URL https://github.com/eembc/coremark-pro/archive/refs/heads/main.zip
- SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/coremark/coremark-pro
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(coremark_fetch)
- if(NOT coremark_fetch_POPULATED)
- FetchContent_Populate(coremark_fetch)
- endif()
- endif()
-
- nuttx_add_library(coremark_pro STATIC)
-
- set(CSRCS
- coremark-pro/mith/src/md5.c
- coremark-pro/mith/src/mith_lib.c
- coremark-pro/mith/src/mith_workload.c
- coremark-pro/mith/src/th_bignum.c
- coremark-pro/mith/src/th_encode.c
- coremark-pro/mith/src/th_lib.c
- coremark-pro/mith/src/th_math.c
- coremark-pro/mith/src/th_rand.c)
-
- file(GLOB MITH_AL_SRCS coremark-pro/mith/al/src/*.c)
-
- list(APPEND CSRCS ${MITH_AL_SRCS})
-
- set(CFLAGS
- -Wno-undef
- -Wno-strict-prototypes
- -Wno-unused-variable
- -Wno-pointer-sign
- -Wno-unused-but-set-variable
- -Wno-shadow
- -DNDEBUG
- -DHOST_EXAMPLE_CODE=1
- -DHAVE_SYS_STAT_H=1
- -DGCC_INLINE_MACRO=1
- -DMAX_CONTEXTS=100
- -DEE_SIZEOF_INT=4
- -DUSE_FP128=0)
-
- set(INCDIR ${CMAKE_CURRENT_LIST_DIR}/coremark-pro/mith/include
- ${CMAKE_CURRENT_LIST_DIR}/coremark-pro/mith/al/include)
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT)
- list(APPEND CFLAGS -DUSE_SINGLE_CONTEXT=1 -DHAVE_PTHREAD=0
- -DUSE_NATIVE_PTHREAD=0)
- else()
- list(APPEND CFLAGS -DUSE_SINGLE_CONTEXT=0 -DHAVE_PTHREAD=1
- -DUSE_NATIVE_PTHREAD=1)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_SMP)
- list(APPEND CFLAGS -DHAVE_PTHREAD_SETAFFINITY_NP=1 -DHAVE_PTHREAD_SELF=1)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_64BIT)
- list(APPEND CFLAGS -DEE_SIZEOF_PTR=8 -DEE_PTR_ALIGN=8 -DEE_SIZEOF_LONG=8)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64)
-
- list(APPEND CFLAGS -DUSE_FP64=1 -DUSE_FP32=0)
- list(APPEND CSRCS coremark-pro/benchmarks/fp/linpack/ref/inputs_f64.c)
-
- else()
- list(APPEND CFLAGS -DUSE_FP32=1 -DUSE_FP64=0)
- list(APPEND CSRCS coremark-pro/benchmarks/fp/linpack/ref/inputs_f32.c)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_CORE_TEST)
- file(GLOB CORE_TEST_SRCS coremark-pro/benchmarks/core/*.c)
- set(CORE_TEST_CSRCS coremark-pro/workloads/core/core.c ${CORE_TEST_SRCS})
- nuttx_add_application(
- NAME
- core
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${CORE_TEST_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_CJPEG_TEST)
- file(GLOB CJPEG_SRCS coremark-pro/benchmarks/consumer_v2/cjpeg/*.c)
- set(CJPEG_CSRCS
- coremark-pro/workloads/cjpeg-rose7-preset/cjpeg-rose7-preset.c
- coremark-pro/benchmarks/consumer_v2/cjpeg/data/Rose256_bmp.c
- ${CJPEG_SRCS})
- nuttx_add_application(
- NAME
- cjpeg_rose7_preset
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${CJPEG_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_SHA_TEST)
- file(GLOB SHA_TEST_SRCS coremark-pro/benchmarks/darkmark/sha/*.c)
- set(SHA_TEST_CSRCS coremark-pro/workloads/sha-test/sha-test.c
- ${SHA_TEST_SRCS})
- nuttx_add_application(
- NAME
- sha_test
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SHA_TEST_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_ZIP_TEST)
- set(ZIP_TEST_CSRCS coremark-pro/workloads/zip-test/zip-test.c
- coremark-pro/benchmarks/darkmark/zip/zip_darkmark.c)
- set(ZIP_TEST_FLAGS ${CFLAGS} -Dgzclose_r=coremark_zip_gzclose_r
- -Dgzclose_w=coremark_zip_gzclose_w)
- set(ZIP_TEST_INCDIR ${INCDIR} ${NUTTX_APPS_DIR}/system/zlib/zlib)
- nuttx_add_application(
- NAME
- zip_test
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${ZIP_TEST_FLAGS}
- SRCS
- ${ZIP_TEST_CSRCS}
- INCLUDE_DIRECTORIES
- ${ZIP_TEST_INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST)
- set(ALG_MID_CSRCS
- coremark-pro/workloads/linear_alg-mid-100x100-sp/linear_alg-mid-100x100-sp.c
- coremark-pro/benchmarks/fp/linpack/linpack.c)
- nuttx_add_application(
- NAME
- linear_alg_mid_100x100_sp
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${ALG_MID_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_RADIX_TEST)
- if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64)
- file(GLOB RADIX_SRCS coremark-pro/benchmarks/fp/fft_radix2/ref/*.c)
- else()
- file(GLOB RADIX_SRCS coremark-pro/benchmarks/fp/fft_radix2/ref-sp/*.c)
- endif()
-
- set(RADIX_CSRCS
- coremark-pro/workloads/radix2-big-64k/radix2-big-64k.c
- coremark-pro/benchmarks/fp/fft_radix2/fft_radix2.c ${RADIX_SRCS})
- nuttx_add_application(
- NAME
- radix2_big_64k
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${RADIX_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST)
- if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64)
- file(GLOB MID_SRCS coremark-pro/benchmarks/fp/loops/ref/*.c)
- else()
- file(GLOB MID_SRCS coremark-pro/benchmarks/fp/loops/ref-sp/*.c)
- endif()
-
- set(MID_CSRCS
- coremark-pro/workloads/loops-all-mid-10k-sp/loops-all-mid-10k-sp.c
- coremark-pro/benchmarks/fp/loops/loops.c ${MID_SRCS})
- nuttx_add_application(
- NAME
- loops_all_mid_10k_sp
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${MID_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_NNET_TEST)
- if(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64)
- file(GLOB NNET_SRCS coremark-pro/benchmarks/fp/nnet/ref/*.c)
- else()
- file(GLOB NNET_SRCS coremark-pro/benchmarks/fp/nnet/ref-sp/*.c)
- endif()
- file(GLOB FP_NNET_SRCS coremark-pro/benchmarks/fp/nnet/*.c)
- set(NNET_CSRCS coremark-pro/workloads/nnet_test/nnet_test.c ${FP_NNET_SRCS}
- ${NNET_SRCS})
- nuttx_add_application(
- NAME
- nnet_test
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${NNET_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- if(CONFIG_BENCHMARK_COREMARK_PRO_PARSER_125K)
- file(GLOB PARSER_SRCS coremark-pro/benchmarks/darkmark/parser/*.c)
- set(PARSER_CSRCS coremark-pro/workloads/parser-125k/parser-125k.c
- ${PARSER_SRCS})
- nuttx_add_application(
- NAME
- parser_125k
- PRIORITY
- ${CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK_PRO}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${PARSER_CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR}
- DEPENDS
- coremark_pro)
- endif()
-
- target_sources(coremark_pro PRIVATE ${CSRCS})
- target_include_directories(coremark_pro PRIVATE ${INCDIR})
- target_compile_options(coremark_pro PRIVATE ${CFLAGS})
-
-endif()
diff --git a/benchmarks/coremark-pro/Kconfig b/benchmarks/coremark-pro/Kconfig
deleted file mode 100644
index a4027787f..000000000
--- a/benchmarks/coremark-pro/Kconfig
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BENCHMARK_COREMARK_PRO
- tristate "Coremark Pro Benchmark"
- default n
- depends on LIBC_FLOATINGPOINT
-
-if BENCHMARK_COREMARK_PRO
-
-config BENCHMARK_COREMARK_PRO_STACKSIZE
- int "Coremark Pro stack size"
- default 131072
-
-config BENCHMARK_COREMARK_PRO_PRIORITY
- int "Coremark Pro priority"
- default 100
-
-config BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT
- bool "use single context"
- default n
-
-config BENCHMARK_COREMARK_PRO_SMP
- bool "Relevant configurations in case of SMP"
- default n
- depends on SMP && !BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT
-
-config BENCHMARK_COREMARK_PRO_64BIT
- bool "Running on 64-bit operating systems"
- default n
-
-config BENCHMARK_COREMARK_PRO_USE_FP64
- bool "USE FP64 Data for Test"
- default n
-
-config BENCHMARK_COREMARK_PRO_CORE_TEST
- bool "Core Test"
- default n
-
-config BENCHMARK_COREMARK_PRO_CJPEG_TEST
- bool "cjpeg-rose7-preset"
- default n
- ---help---
- Before using this case, place the files in coremark-pro/benchmarks/libbmp
- and coremark-pro/benchmarks/libjpeg in /data/libbmp and /data/libjpeg
- respectively
-
-config BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST
- bool "Linear_alg_mid TEST"
- default n
-
-config BENCHMARK_COREMARK_PRO_SHA_TEST
- bool "SHA Test"
- default n
-
-config BENCHMARK_COREMARK_PRO_ZIP_TEST
- bool "Zip Test"
- depends on LIB_ZLIB
- default n
-
-choice
- prompt "Coremark Pro FP Test Case configuration"
- default BENCHMARK_COREMARK_PRO_RADIX_TEST
-
-config BENCHMARK_COREMARK_PRO_RADIX_TEST
- bool "Radix Test"
-
-config BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST
- bool "Loops-all-mid test"
-
-config BENCHMARK_COREMARK_PRO_NNET_TEST
- bool "Nnet Test"
-
-config BENCHMARK_COREMARK_PRO_PARSER_125K
- bool "Parser 125K Test"
-
-endchoice
-
-endif
diff --git a/benchmarks/coremark-pro/Make.defs b/benchmarks/coremark-pro/Make.defs
deleted file mode 100644
index 144f4ce3d..000000000
--- a/benchmarks/coremark-pro/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/coremark-pro/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/coremark-pro
-endif
diff --git a/benchmarks/coremark-pro/Makefile b/benchmarks/coremark-pro/Makefile
deleted file mode 100644
index ccc6d5bbb..000000000
--- a/benchmarks/coremark-pro/Makefile
+++ /dev/null
@@ -1,160 +0,0 @@
-############################################################################
-# apps/benchmarks/coremark-pro/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PRIORITY = $(CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_COREMARK_PRO)
-
-CFLAGS += -Wno-undef -Wno-strict-prototypes -Wno-unused-variable \
- -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-shadow
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark-pro/coremark-pro/mith/include
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark-pro/coremark-pro/mith/al/include
-CFLAGS += -DNDEBUG -DHOST_EXAMPLE_CODE=1 -DHAVE_SYS_STAT_H=1 \
- -DGCC_INLINE_MACRO=1 -DMAX_CONTEXTS=100 -DEE_SIZEOF_INT=4 \
- -DUSE_FP128=0
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT),)
- CFLAGS += -DUSE_SINGLE_CONTEXT=1 -DHAVE_PTHREAD=0 -DUSE_NATIVE_PTHREAD=0
-else
- CFLAGS += -DUSE_SINGLE_CONTEXT=0 -DHAVE_PTHREAD=1 -DUSE_NATIVE_PTHREAD=1
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_SMP),)
- CFLAGS += -DHAVE_PTHREAD_SETAFFINITY_NP=1 -DHAVE_PTHREAD_SELF=1
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_64BIT),)
- CFLAGS += -DEE_SIZEOF_PTR=8 -DEE_PTR_ALIGN=8 -DEE_SIZEOF_LONG=8
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
- CFLAGS += -DUSE_FP64=1 -DUSE_FP32=0
- CSRCS += coremark-pro/benchmarks/fp/linpack/ref/inputs_f64.c
-else
- CFLAGS += -DUSE_FP32=1 -DUSE_FP64=0
- CSRCS += coremark-pro/benchmarks/fp/linpack/ref/inputs_f32.c
-endif
-
-CSRCS += coremark-pro/mith/src/md5.c
-CSRCS += coremark-pro/mith/src/mith_lib.c
-CSRCS += coremark-pro/mith/src/mith_workload.c
-CSRCS += coremark-pro/mith/src/th_bignum.c
-CSRCS += coremark-pro/mith/src/th_encode.c
-CSRCS += coremark-pro/mith/src/th_lib.c
-CSRCS += coremark-pro/mith/src/th_math.c
-CSRCS += coremark-pro/mith/src/th_rand.c
-
-CSRCS += $(wildcard coremark-pro/mith/al/src/*.c)
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_CORE_TEST),)
- CSRCS += $(wildcard coremark-pro/benchmarks/core/*.c)
- MAINSRC += coremark-pro/workloads/core/core.c
- PROGNAME += core
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_CJPEG_TEST),)
- CSRCS += $(wildcard coremark-pro/benchmarks/consumer_v2/cjpeg/*.c)
- CSRCS += $(wildcard coremark-pro/benchmarks/consumer_v2/cjpeg/data/Rose256_bmp.c)
- MAINSRC += coremark-pro/workloads/cjpeg-rose7-preset/cjpeg-rose7-preset.c
- PROGNAME += cjpeg_rose7_preset
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_SHA_TEST),)
- CSRCS += $(wildcard coremark-pro/benchmarks/darkmark/sha/*.c)
- MAINSRC += coremark-pro/workloads/sha-test/sha-test.c
- PROGNAME += sha_test
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_ZIP_TEST),)
- CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/system/zlib/zlib
- CFLAGS += -Dgzclose_r=coremark_zip_gzclose_r -Dgzclose_w=coremark_zip_gzclose_w
- CSRCS += coremark-pro/benchmarks/darkmark/zip/zip_darkmark.c
- MAINSRC += coremark-pro/workloads/zip-test/zip-test.c
- PROGNAME += zip_test
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST),)
- CSRCS += coremark-pro/benchmarks/fp/linpack/linpack.c
- MAINSRC += coremark-pro/workloads/linear_alg-mid-100x100-sp/linear_alg-mid-100x100-sp.c
- PROGNAME += linear_alg_mid_100x100_sp
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_RADIX_TEST),)
- ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/fft_radix2/ref/*.c)
- else
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/fft_radix2/ref-sp/*.c)
- endif
-
- CSRCS += coremark-pro/benchmarks/fp/fft_radix2/fft_radix2.c
- MAINSRC += coremark-pro/workloads/radix2-big-64k/radix2-big-64k.c
- PROGNAME += radix2_big_64k
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST),)
- ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/loops/ref/*.c)
- else
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/loops/ref-sp/*.c)
- endif
-
- CSRCS += coremark-pro/benchmarks/fp/loops/loops.c
- MAINSRC += coremark-pro/workloads/loops-all-mid-10k-sp/loops-all-mid-10k-sp.c
- PROGNAME += loops_all_mid_10k_sp
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_NNET_TEST),)
- ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/ref/*.c)
- else
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/ref-sp/*.c)
- endif
-
- CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/*.c)
- MAINSRC += coremark-pro/workloads/nnet_test/nnet_test.c
- PROGNAME += nnet_test
-endif
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_PARSER_125K),)
- CSRCS += $(wildcard coremark-pro/benchmarks/darkmark/parser/*.c)
- MAINSRC += coremark-pro/workloads/parser-125k/parser-125k.c
- PROGNAME += parser_125k
-endif
-
-ifeq ($(wildcard coremark-pro/.git),)
-VERSION ?= main
-coremark-pro.zip:
- $(Q) curl -L https://github.com/eembc/coremark-pro/archive/refs/heads/main.zip -o coremark-pro.zip
- $(Q) unzip -o coremark-pro.zip
- $(Q) mv coremark-pro-$(VERSION) coremark-pro
-
-context:: coremark-pro.zip
-
-distclean::
- $(call DELDIR, coremark-pro)
- $(call DELFILE, coremark-pro.zip)
-
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/coremark/.gitignore b/benchmarks/coremark/.gitignore
deleted file mode 100644
index f8968384b..000000000
--- a/benchmarks/coremark/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/coremark
-/*.zip
diff --git a/benchmarks/coremark/CMakeLists.txt b/benchmarks/coremark/CMakeLists.txt
deleted file mode 100644
index 3aef2967a..000000000
--- a/benchmarks/coremark/CMakeLists.txt
+++ /dev/null
@@ -1,153 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/coremark/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_COREMARK)
-
- # ############################################################################
- # Config and Fetch Coremark application
- # ############################################################################
-
- set(COREMARKAPP_DIR ${CMAKE_CURRENT_LIST_DIR}/coremark)
-
- if(NOT EXISTS ${COREMARKAPP_DIR})
- FetchContent_Declare(
- coremark_fetch
- URL https://github.com/eembc/coremark/archive/main.zip SOURCE_DIR
- ${CMAKE_CURRENT_LIST_DIR}/coremark BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/coremark/coremark
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(coremark_fetch)
- if(NOT coremark_fetch_POPULATED)
- FetchContent_Populate(coremark_fetch)
- endif()
- endif()
-
- if(CONFIG_COREMARK_MULTITHREAD_OVERRIDE)
- set(COREMARK_NTHREADS ${CONFIG_COREMARK_MULTITHREAD_COUNT})
- endif()
-
- if(CONFIG_SMP_NCPUS)
- set(COREMARK_NTHREADS ${CONFIG_SMP_NCPUS})
- else()
- set(COREMARK_NTHREADS 1)
- endif()
-
- if(CONFIG_COREMARK_PRINT_ARGS)
- set(COREMARK_PRINT_ARGS 1)
- else()
- set(COREMARK_PRINT_ARGS 0)
- endif()
-
- # ############################################################################
- # Flags
- # ############################################################################
-
- if(CONFIG_COREMARK_MULTITHREAD_OVERRIDE)
- set(COREMARK_NTHREADS ${CONFIG_COREMARK_MULTITHREAD_COUNT})
- else()
- if(CONFIG_SMP_NCPUS)
- set(COREMARK_NTHREADS ${CONFIG_SMP_NCPUS})
- else()
- set(COREMARK_NTHREADS 1)
- endif()
- endif()
-
- if(CONFIG_COREMARK_PRINT_ARGS)
- set(COREMARK_PRINT_ARGS 1)
- else()
- set(COREMARK_PRINT_ARGS 0)
- endif()
-
- get_target_property(FLAGS_STR_LIST nuttx COMPILE_OPTIONS)
- list(JOIN FLAGS_STR_LIST " " FLAGS_STR)
-
- set(CFLAGS -Dcrc16=coremark_crc16 -Wno-strict-prototypes -Wno-undef)
-
- if("${CONFIG_COREMARK_MEM_METHOD}" STREQUAL "1")
- list(APPEND CFLAGS -DMEM_LOCATION=\"HEAP\")
- elseif("${CONFIG_COREMARK_MEM_METHOD}" STREQUAL "2")
- list(APPEND CFLAGS -DMEM_LOCATION=\"STACK\")
- else()
- list(APPEND CFLAGS -DMEM_LOCATION=\"GLOBAL\")
- endif()
-
- list(
- APPEND
- CFLAGS
- -DCALLGRIND_RUN=0
- -DCOMPILER_REQUIRES_SORT_RETURN=0
- -DCORE_DEBUG=${CONFIG_COREMARK_DEBUG}
- -DFLAGS_STR="${FLAGS_STR}"
- -DMEM_METHOD=${CONFIG_COREMARK_MEM_METHOD}
- -DMICA=0
- -DMULTITHREAD=${COREMARK_NTHREADS}
- -DPERFORMANCE_RUN=1
- -DPRINT_ARGS=${COREMARK_PRINT_ARGS}
- -DSEED_METHOD=${CONFIG_COREMARK_SEED_METHOD}
- -DUSE_CLOCK=1
- -DUSE_PTHREAD)
-
- if(CONFIG_COREMARK_ITERATIONS_OVERRIDE)
- list(APPEND CFLAGS -DITERATIONS=${CONFIG_COREMARK_ITERATIONS_COUNT})
- else()
- list(APPEND CFLAGS -DITERATIONS=0)
-
- endif()
-
- # ############################################################################
- # Sources
- # ############################################################################
-
- set(CSRCS
- ${COREMARKAPP_DIR}/core_main.c ${COREMARKAPP_DIR}/core_list_join.c
- ${COREMARKAPP_DIR}/core_matrix.c ${COREMARKAPP_DIR}/core_state.c
- ${COREMARKAPP_DIR}/core_util.c ${COREMARKAPP_DIR}/posix/core_portme.c)
-
- # ############################################################################
- # Include Directory
- # ############################################################################
-
- set(INCDIR ${COREMARKAPP_DIR} ${COREMARKAPP_DIR}/posix)
-
- # ############################################################################
- # Applications Configuration
- # ############################################################################
-
- nuttx_add_application(
- NAME
- ${CONFIG_COREMARK_PROGNAME}
- PRIORITY
- ${CONFIG_COREMARK_PRIORITY}
- STACKSIZE
- ${CONFIG_COREMARK_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_COREMARK}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR})
-
-endif()
diff --git a/benchmarks/coremark/Kconfig b/benchmarks/coremark/Kconfig
deleted file mode 100644
index 206be8eca..000000000
--- a/benchmarks/coremark/Kconfig
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BENCHMARK_COREMARK
- tristate "CoreMark Benchmark"
- select LIBC_FLOATINGPOINT
- default n
- ---help---
- Enable support for the EEMBC's CoreMark benchmark application.
-
-if BENCHMARK_COREMARK
-
-config COREMARK_PROGNAME
- string "CoreMark program name"
- default "coremark"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config COREMARK_PRIORITY
- int "CoreMark task priority"
- default 100
-
-config COREMARK_STACKSIZE
- int "CoreMark task stack size"
- default 4096
-
-config COREMARK_SEED_METHOD
- int "Coremark Seed Method"
- default 2
- ---help---
- Set Coremark Seed Method:
- 0: SEED_ARG
- 1: SEED_FUNC
- 2: SEED_VOLATILE
-
-config COREMARK_MEM_METHOD
- int "Coremark Memory Method"
- default 1
- ---help---
- Set Coremark Memory Method:
- 0: MEM_STATIC
- 1: MEM_MALLOC
- 2: MEM_STACK
-
-config COREMARK_DEBUG
- int "Coremark Core Debug"
- default 0
- ---help---
- Enable the Core Debug:
- 0: Disable
- 1: Enable
-
-config COREMARK_PRINT_ARGS
- bool "Print CoreMark arguments when executing"
- default n
- ---help---
- Print the command line arguments passed on to coremark.
-
-config COREMARK_MULTITHREAD_OVERRIDE
- bool "Override number of threads"
- default n
- ---help---
- Override the default number of threads to be executed.
- The default value is the same as the number of CPU cores.
-
-config COREMARK_MULTITHREAD_COUNT
- depends on COREMARK_MULTITHREAD_OVERRIDE
- int "Number of threads to be executed"
- default 1
-
-config COREMARK_ITERATIONS_OVERRIDE
- bool "Override number of iterations"
- default n
- ---help---
- Override the default number of iterations for the benchmark.
- The default value is defined by the application based on the system.
-
-config COREMARK_ITERATIONS_COUNT
- depends on COREMARK_ITERATIONS_OVERRIDE
- int "Number of iterations"
- default 100
-
-endif # BENCHMARK_COREMARK
diff --git a/benchmarks/coremark/Make.defs b/benchmarks/coremark/Make.defs
deleted file mode 100644
index 971b261df..000000000
--- a/benchmarks/coremark/Make.defs
+++ /dev/null
@@ -1,27 +0,0 @@
-############################################################################
-# apps/benchmarks/coremark/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_COREMARK),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/coremark
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark/coremark
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark/coremark/posix
-endif
diff --git a/benchmarks/coremark/Makefile b/benchmarks/coremark/Makefile
deleted file mode 100644
index c1b02e5f0..000000000
--- a/benchmarks/coremark/Makefile
+++ /dev/null
@@ -1,145 +0,0 @@
-############################################################################
-# apps/benchmarks/coremark/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-# Coremark application
-
-############################################################################
-# Flags
-############################################################################
-
-COREMARK_URL ?= "https://github.com/eembc/coremark/archive"
-
-COREMARK_VERSION = main
-COREMARK_ZIP = $(COREMARK_VERSION).zip
-
-COREMARK_UNPACKNAME = coremark
-UNPACK ?= unzip -q -o
-
-VPATH += $(COREMARK_UNPACKNAME)
-VPATH += $(COREMARK_UNPACKNAME)$(DELIM)posix
-DEPPATH += --dep-path $(COREMARK_UNPACKNAME)
-DEPPATH += --dep-path $(COREMARK_UNPACKNAME)$(DELIM)posix
-
-CFLAGS += -Dcrc16=coremark_crc16
-CFLAGS += -Wno-strict-prototypes -Wno-undef
-
-ifeq ($(CONFIG_COREMARK_MULTITHREAD_OVERRIDE),y)
-COREMARK_NTHREADS = $(CONFIG_COREMARK_MULTITHREAD_COUNT)
-else
-ifneq ($(CONFIG_SMP_NCPUS),)
-COREMARK_NTHREADS = $(CONFIG_SMP_NCPUS)
-else
-COREMARK_NTHREADS = 1
-endif
-endif
-
-ifeq ($(CONFIG_COREMARK_PRINT_ARGS),y)
-COREMARK_PRINT_ARGS = 1
-else
-COREMARK_PRINT_ARGS = 0
-endif
-
-ifeq ($(CONFIG_COREMARK_MEM_METHOD), 1)
-CFLAGS += ${DEFINE_PREFIX}MEM_LOCATION=\"HEAP\"
-else ifeq ($(CONFIG_COREMARK_MEM_METHOD), 2)
-CFLAGS += ${DEFINE_PREFIX}MEM_LOCATION=\"STACK\"
-else
-CFLAGS += ${DEFINE_PREFIX}MEM_LOCATION=\"GLOBAL\"
-endif
-
-CFLAGS += ${DEFINE_PREFIX}CALLGRIND_RUN=0
-CFLAGS += ${DEFINE_PREFIX}COMPILER_REQUIRES_SORT_RETURN=0
-CFLAGS += ${DEFINE_PREFIX}CORE_DEBUG=$(CONFIG_COREMARK_DEBUG)
-CFLAGS += ${DEFINE_PREFIX}FLAGS_STR=\""$(ARCHOPTIMIZATION)\""
-CFLAGS += ${DEFINE_PREFIX}MEM_METHOD=$(CONFIG_COREMARK_MEM_METHOD)
-CFLAGS += ${DEFINE_PREFIX}MICA=0
-CFLAGS += ${DEFINE_PREFIX}MULTITHREAD=$(COREMARK_NTHREADS)
-CFLAGS += ${DEFINE_PREFIX}PERFORMANCE_RUN=1
-CFLAGS += ${DEFINE_PREFIX}PRINT_ARGS=$(COREMARK_PRINT_ARGS)
-CFLAGS += ${DEFINE_PREFIX}SEED_METHOD=$(CONFIG_COREMARK_SEED_METHOD)
-CFLAGS += ${DEFINE_PREFIX}USE_CLOCK=1
-CFLAGS += ${DEFINE_PREFIX}USE_PTHREAD
-
-ifeq ($(CONFIG_COREMARK_ITERATIONS_OVERRIDE),y)
-CFLAGS += ${DEFINE_PREFIX}ITERATIONS=$(CONFIG_COREMARK_ITERATIONS_COUNT)
-else
-CFLAGS += ${DEFINE_PREFIX}ITERATIONS=0
-endif
-
-CFLAGS += ${DEFINE_PREFIX}crcu8=coremark_crcu8
-CFLAGS += ${DEFINE_PREFIX}crcu16=coremark_crcu16
-CFLAGS += ${DEFINE_PREFIX}crcu32=coremark_crcu32
-CFLAGS += ${DEFINE_PREFIX}crc16=coremark_crc16
-
-CSRCS += core_list_join.c
-CSRCS += core_matrix.c
-CSRCS += core_state.c
-CSRCS += core_util.c
-CSRCS += core_portme.c
-
-############################################################################
-# Targets
-############################################################################
-
-$(COREMARK_ZIP):
- @echo "Downloading: $(COREMARK_URL)/$(COREMARK_ZIP)"
- $(Q) curl -O -L $(COREMARK_URL)/$(COREMARK_ZIP)
-
-$(COREMARK_UNPACKNAME): $(COREMARK_ZIP)
- @echo "Unpacking: $(COREMARK_ZIP) -> $(COREMARK_UNPACKNAME)"
- $(Q) $(UNPACK) $(COREMARK_ZIP)
- $(Q) mv coremark-$(COREMARK_VERSION) $(COREMARK_UNPACKNAME)
- $(Q) patch -p0 < add_init_message.patch # Update init message
- $(Q) touch $(COREMARK_UNPACKNAME)
-
-clean::
- $(call DELFILE, $(OBJS))
-
-# Download and unpack tarball if no git repo found
-
-ifeq ($(wildcard $(COREMARK_UNPACKNAME)/.git),)
-context:: $(COREMARK_UNPACKNAME)
-
-distclean::
- $(call DELDIR, $(COREMARK_UNPACKNAME))
- $(call DELFILE, $(COREMARK_ZIP))
-endif
-
-############################################################################
-# Applications Configuration
-############################################################################
-
-MODULE = $(CONFIG_BENCHMARK_COREMARK)
-
-PROGNAME += $(CONFIG_COREMARK_PROGNAME)
-PRIORITY += $(CONFIG_COREMARK_PRIORITY)
-STACKSIZE += $(CONFIG_COREMARK_STACKSIZE)
-
-MAINSRC += core_main.c
-
-# Build with WebAssembly when CONFIG_INTERPRETERS_WAMR is enabled
-
-WASM_BUILD = both
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/coremark/add_init_message.patch b/benchmarks/coremark/add_init_message.patch
deleted file mode 100644
index 6ceecc063..000000000
--- a/benchmarks/coremark/add_init_message.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- coremark/posix/core_portme.c
-+++ coremark/posix/core_portme.c
-@@ -208,6 +208,9 @@ ee_u32 default_num_contexts = MULTITHREAD;
- void
- portable_init(core_portable *p, int *argc, char *argv[])
- {
-+
-+ ee_printf("Running CoreMark...\n");
-+
- #if PRINT_ARGS
- int i;
- for (i = 0; i < *argc; i++)
diff --git a/benchmarks/cyclictest/CMakeLists.txt b/benchmarks/cyclictest/CMakeLists.txt
deleted file mode 100644
index 59cfd2cf8..000000000
--- a/benchmarks/cyclictest/CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/cyclictest/CMakeLists.txt
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_CYCLICTEST)
-
- # ############################################################################
- # Config and Fetch Coremark application
- # ############################################################################
-
- set(CYCLICTEST_DIR ${CMAKE_CURRENT_LIST_DIR})
-
- # ############################################################################
- # Sources
- # ############################################################################
-
- set(CSRCS ${CYCLICTEST_DIR}/cyclictest.c)
-
- # ############################################################################
- # Applications Configuration
- # ############################################################################
-
- nuttx_add_application(
- NAME
- cyclictest
- PRIORITY
- ${CONFIG_CYCLICTEST_PRIORITY}
- STACKSIZE
- ${CONFIG_CYCLICTEST_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_CYCLICTEST}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR})
-
-endif()
diff --git a/benchmarks/cyclictest/Kconfig b/benchmarks/cyclictest/Kconfig
deleted file mode 100644
index 10f80734b..000000000
--- a/benchmarks/cyclictest/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BENCHMARK_CYCLICTEST
- bool "Cyclictest"
- default n
- ---help---
- Enable the cyclictest application.
-
-if BENCHMARK_CYCLICTEST
-
-config BENCHMARK_CYCLICTEST_PROGNAME
- string "Cyclictest App Name"
- default "cyclictest"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config BENCHMARK_CYCLICTEST_PRIORITY
- int "Cyclictest task priority"
- default 100
-
-config BENCHMARK_CYCLICTEST_STACKSIZE
- int "Cyclictest task stack size"
- default 4096
-
-endif # BENCHMARK_CYCLICTEST
diff --git a/benchmarks/cyclictest/Makefile b/benchmarks/cyclictest/Makefile
deleted file mode 100644
index b7f516919..000000000
--- a/benchmarks/cyclictest/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-############################################################################
-# apps/benchmarks/cyclictest/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-# spinlock_bench application
-
-############################################################################
-# Applications Configuration
-############################################################################
-
-MODULE = $(CONFIG_BENCHMARK_CYCLICTEST)
-
-PROGNAME += $(CONFIG_BENCHMARK_CYCLICTEST_PROGNAME)
-PRIORITY += $(CONFIG_BENCHMARK_CYCLICTEST_PRIORITY)
-STACKSIZE += $(CONFIG_BENCHMARK_CYCLICTEST_STACKSIZE)
-
-MAINSRC += cyclictest.c
-
-# Build with WebAssembly when CONFIG_INTERPRETERS_WAMR is enabled
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/cyclictest/cyclictest.c b/benchmarks/cyclictest/cyclictest.c
deleted file mode 100644
index fb9382dd5..000000000
--- a/benchmarks/cyclictest/cyclictest.c
+++ /dev/null
@@ -1,1115 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/cyclictest/cyclictest.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- * A NuttX port of the cyclictest rt-tests utility for Linux.
- * As of writing this piece of software (Feb 2025), clock_gettime
- * and clock_nanosleep are tightly tied to systemtick by default.
- * Yes, the time resolution can be achieved by using TICKLESS, but for high
- * resolution waiting and measurement we can use other methods.
- *
- * This piece of software includes configurable waiting methods:
- * - clock_nanosleep
- * - systemtick hook: it is assumed your BSP supports a board_timerhook
- * function where a sem_t g_waitsem is posted.
- * - WARNING: only one task (thread) can wait for the semaphore.
- * - NuttX Timer API: waiting for the timer to expire.
- * - WARNING: only one task (thread) can wait for the timer to expire.
- *
- * Available time measuring methods:
- * - clock_gettime
- * - NuttX Timer API
- *
- * Authors of the NuttX port: Stepan Pressl
- *
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-enum meas_method_e
-{
- M_GETTIME = 0,
- M_TIMER_API,
- M_COUNT
-};
-
-enum wait_method_e
-{
- W_NANOSLEEP = 0,
- W_DEVTIMER,
- W_COUNT
-};
-
-struct cyclictest_config_s
-{
- int clock;
- int distance;
- int duration;
- int histogram;
- int histofall;
- unsigned long interval;
- unsigned long loops;
- int threads;
- int policy;
- int prio;
- bool quiet;
- char *timer_dev;
- enum meas_method_e meas_method;
- enum wait_method_e wait_method;
-};
-
-struct thread_param_s
-{
- int prio;
- int policy;
- unsigned long interval;
- unsigned long max_cycles;
- struct thread_stats_s *stats;
- int clock;
-};
-
-struct thread_stats_s
-{
- long *hist_array;
- long hist_overflow;
- long min;
- long max;
- long act;
- double avg;
- unsigned long cycles;
- pthread_t id;
- int tid;
- bool ended;
-};
-
-static bool running;
-static struct cyclictest_config_s config;
-static int timerfd;
-static struct pollfd polltimer[1];
-
-static const struct option optargs[] =
-{
- {"clock", optional_argument, 0, 'c'},
- {"distance", optional_argument, 0, 'd'},
- {"duration", optional_argument, 0, 'D'},
- {"help", optional_argument, 0, 'e'},
- {"histogram", optional_argument, 0, 'h'},
- {"histofall", optional_argument, 0, 'H'},
- {"interval", optional_argument, 0, 'i'},
- {"loops", optional_argument, 0, 'l'},
- {"measurement", optional_argument, 0, 'm'},
- {"nanosleep", optional_argument, 0, 'n'},
- {"prio", optional_argument, 0, 'p'},
- {"quiet", optional_argument, 0, 'q'},
- {"threads", optional_argument, 0, 't'},
- {"timer-device", optional_argument, 0, 'T'},
- {"policy", optional_argument, 0, 'y'},
- {0, 0, 0, 0}
-};
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static void print_help(void)
-{
- puts(
- "The Cyclictest Benchmark Utility\n"
- "Usage:\n"
- " -c --clock [CLOCK]: selects the clock: 0 selects CLOCK_REALTIME, "
- "1 selects CLOCK_MONOTONIC (default).\n"
- " -d --distance [US]: The distance of thread intervals. "
- "Default is 500us.\n"
- " -D --duration [TIME]: Test duration length in seconds. "
- "Default is 0 (endless).\n"
- " -e --help: Display this help and quit.\n"
- " -h --histogram [US]: Output the histogram data to stdout. "
- "US is the maximum value to be printed.\n"
- " -H --histofall: Same as -h except that an additional histogram "
- "column\n"
- " is displayed at the right that contains summary data of all thread"
- " histograms.\n"
- " If cyclictest runs a single thread only, the -H option is "
- "equivalent to -h.\n"
- " -i --interval [US]: The thread interval. Default is 1000us.\n"
- " -l --loops [N]: The number of measurement loops. Default is 0 "
- "(endless).\n"
- " -m --measurement [METHOD]: Set the time measurement method:\n"
- " 0 selects clock_gettime, 1 uses the NuttX timer API.\n"
- " WARNING:\n"
- " If METHOD 1 is selected, you need to specify a timer device "
- "(e.g. /dev/timer0) in -T.\n"
- " -n --nanosleep [METHOD]: Set the waiting method: 0 selects "
- "clock_nanosleep,\n"
- " 1 waits for the POLLIN flag on a timer device. Default is 0.\n"
- " WARNING:\n"
- " Choosing 1 works only with one thread, "
- "the -t value is therefore set to 1.\n"
- " If METHOD 1 is selected, you need to specify a timer device "
- "(e.g. /dev/timer0) in -T.\n"
- " -p --prio: Set the priority of the first thread.\n"
- " -q --quiet: Print a summary only on exit.\n"
- " -t --threads [N]: The number of test threads to be created. "
- "Default is 1.\n"
- " -T --timer-device [DEV]: The measuring timer device.\n"
- " Must be specified when -m=1 or -n=1.\n"
- " -y --policy [NAME]: Set the scheduler policy, where NAME is \n"
- " fifo, rr, batch, idle, normal, other.\n"
- );
-}
-
-static long arg_decimal(char *arg)
-{
- long ret;
- char *endptr;
- ret = strtol(arg, &endptr, 10);
- if (endptr == arg)
- {
- return -1;
- }
-
- return ret;
-}
-
-static bool parse_args(int argc, char * const argv[])
-{
- int longindex;
- int opt;
- long decimal;
- while ((opt = getopt_long(argc, argv, "c:d:D:h:Hi:l:m:n:p:qt:T:",
- optargs, &longindex)) != -1)
- {
- switch (opt)
- {
- case 'c':
- decimal = arg_decimal(optarg);
- if (decimal < 0)
- {
- return false;
- }
- else if (decimal == CLOCK_MONOTONIC || decimal == CLOCK_REALTIME)
- {
- config.clock = decimal;
- }
- break;
- case 'd':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.distance = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'D':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.duration = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'e':
- return true;
- case 'h':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.histogram = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'H':
- config.histofall = true;
- break;
- case 'i':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.interval = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'l':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.loops = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'm':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.meas_method = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'n':
- decimal = arg_decimal(optarg);
- if (decimal >= 0)
- {
- config.wait_method = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'p':
- decimal = arg_decimal(optarg);
- if (decimal >= 0 && decimal <= 255)
- {
- config.prio = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'q':
- config.quiet = true;
- break;
- case 't':
- decimal = arg_decimal(optarg);
- if (decimal > 0)
- {
- config.threads = decimal;
- }
- else
- {
- return false;
- }
- break;
- case 'T':
- config.timer_dev = optarg;
- break;
- case 'y':
- if (strcmp(optarg, "other") == 0)
- {
- config.policy = SCHED_OTHER;
- }
- else if (strcmp(optarg, "normal") == 0)
- {
- config.policy = SCHED_NORMAL;
- }
- else if (strcmp(optarg, "batch") == 0)
- {
- config.policy = SCHED_BATCH;
- }
- else if (strcmp(optarg, "idle") == 0)
- {
- config.policy = SCHED_IDLE;
- }
- else if (strcmp(optarg, "fifo") == 0)
- {
- config.policy = SCHED_FIFO;
- }
- else if (strcmp(optarg, "rr") == 0)
- {
- config.policy = SCHED_RR;
- }
- else
- {
- return false;
- }
- break;
- case '?':
- return false;
- default:
- break;
- }
- }
-
- if (optind < argc)
- {
- return false;
- }
-
- return true;
-}
-
-static bool check_args_logic(void)
-{
- /* Check if -T option was passed */
-
- if (config.wait_method == W_DEVTIMER || config.meas_method == M_TIMER_API)
- {
- if (config.timer_dev == NULL)
- {
- fprintf(stderr, "Specify timer device!\n");
- return false;
- }
- }
-
- /* Works only with one thread */
-
- if (config.wait_method == W_DEVTIMER)
- {
- config.threads = 1;
- }
-
- /* If the priority was not loaded, default to number of threads. */
-
- if (config.prio == 0)
- {
- config.prio = config.threads;
- }
-
- if (config.wait_method >= W_COUNT)
- {
- return false;
- }
-
- if (config.meas_method >= M_COUNT)
- {
- return false;
- }
-
- return true;
-}
-
-static inline void tsnorm(struct timespec *ts)
-{
- while (ts->tv_nsec >= NSEC_PER_SEC)
- {
- ts->tv_nsec -= NSEC_PER_SEC;
- ts->tv_sec++;
- }
-}
-
-static inline int64_t timediff_us(struct timespec t1, struct timespec t2)
-{
- int64_t ret;
- ret = 1000000 * (t1.tv_sec - t2.tv_sec);
- ret += (t1.tv_nsec - t2.tv_nsec) / 1000;
- return ret;
-}
-
-static inline int64_t timediff_us_timer(struct timer_status_s after,
- struct timer_status_s before)
-{
- int64_t ret = 0;
- uint32_t t1;
- uint32_t t2;
- t1 = before.timeleft;
- t2 = after.timeleft;
- if (t2 < t1)
- {
- ret = t1 - t2;
- }
- else
- {
- ret = after.timeout - (t2 - t1);
- }
-
- return ret;
-}
-
-static inline int timerdev_getstatus(struct timer_status_s *st)
-{
- return ioctl(timerfd, TCIOC_GETSTATUS, (unsigned long)((uintptr_t)st));
-}
-
-static void *testthread(void *arg)
-{
- int ret;
- int32_t newint;
- int64_t diff = 0;
- struct timer_status_s stamp1;
- struct timer_status_s stamp2;
- struct timespec now;
- struct timespec next;
- struct timespec interval;
- struct timespec endtime;
- struct sched_param schedp;
- struct thread_param_s *param = (struct thread_param_s *)arg;
- struct thread_stats_s *stats = param->stats;
-
- stats->tid = gettid();
- stats->min = LONG_MAX;
- interval.tv_sec = param->interval / 1000000;
- interval.tv_nsec = (param->interval % 1000000) * 1000;
-
- /* Set priority and policy */
-
- schedp.sched_priority = param->prio;
- ret = pthread_setschedparam(pthread_self(), param->policy, &schedp);
- if (ret < 0)
- {
- goto threadend;
- }
-
- if (config.wait_method == W_DEVTIMER)
- {
- /* Start the timer here (we know the thread is only one) */
-
- ret = ioctl(timerfd, TCIOC_START);
- if (ret < 0)
- {
- perror("TCIOC_START");
- goto threadend;
- }
- }
-
- /* We can use clock_gettime for the endtime. */
-
- if ((ret = clock_gettime(param->clock, &now)) < 0)
- {
- goto threadend;
- }
-
- endtime.tv_sec = now.tv_sec + config.duration;
- endtime.tv_nsec = now.tv_nsec;
-
- while (running)
- {
- /* This initializes the stamp1.timeout field */
-
- if (config.meas_method == M_TIMER_API)
- {
- ret = timerdev_getstatus(&stamp1);
- if (ret < 0)
- {
- perror("TCIOC_GETSTAUS");
- goto threadend;
- }
- }
-
- switch (config.wait_method)
- {
- case W_NANOSLEEP:
- if (config.meas_method == M_TIMER_API)
- {
- /* If we measure using the TIMER_API, compute
- * the expected timestamp when the thread should wake up.
- */
-
- newint = stamp1.timeleft - param->interval;
- if (newint < 0)
- {
- stamp1.timeleft = stamp1.timeout + newint;
- }
- }
-
- next = now;
- next.tv_sec += interval.tv_sec;
- next.tv_nsec += interval.tv_nsec;
- tsnorm(&next);
- ret = clock_nanosleep(param->clock, TIMER_ABSTIME, &next, NULL);
- if (ret < 0)
- {
- goto threadend;
- }
- break;
- case W_DEVTIMER:
- if (config.meas_method == M_TIMER_API)
- {
- /* We suppose the timer resets itself when it
- * overflows. So the first timestamp is timeout.
- */
-
- stamp1.timeleft = stamp1.timeout;
- }
- else if (config.meas_method == M_GETTIME)
- {
- /* If we measure using the POSIX API, we must get the
- * microseconds in which the currently running timer
- * is supposed to timeout. We then convert this
- * to the timespec struct, indicating the start.
- */
-
- ret = timerdev_getstatus(&stamp1);
- if (ret < 0)
- {
- perror("TCIOC_GETSTATUS");
- goto threadend;
- }
-
- ret = clock_gettime(param->clock, &next);
- if (ret < 0)
- {
- goto threadend;
- }
-
- next.tv_sec += (stamp1.timeleft) / 1000000;
- next.tv_nsec += (stamp1.timeleft % 1000000) * 1000;
- tsnorm(&next);
- }
-
- if ((ret = poll(polltimer, 1, -1)) < 0)
- {
- goto threadend;
- }
- break;
- default:
- break;
- }
-
- /* Time Stamp 2 */
-
- switch (config.meas_method)
- {
- case M_GETTIME:
- if ((ret = clock_gettime(param->clock, &now)) < 0)
- {
- goto threadend;
- }
-
- diff = timediff_us(now, next);
- break;
- case M_TIMER_API:
- ret = timerdev_getstatus(&stamp2);
- if (ret < 0)
- {
- perror("TCIOC_GETSTAUS");
- goto threadend;
- }
-
- diff = timediff_us_timer(stamp2, stamp1);
- break;
- default:
- break;
- }
-
- stats->act = diff;
- if (diff < stats->min)
- {
- stats->min = diff;
- }
-
- if (diff > stats->max)
- {
- stats->max = diff;
- }
-
- stats->avg += (double) diff;
-
- if (config.histogram)
- {
- if (diff < config.histogram && diff >= 0)
- {
- stats->hist_array[diff] += 1;
- }
- else
- {
- stats->hist_overflow += 1;
- }
- }
-
- ++stats->cycles;
- if (param->max_cycles != 0 && stats->cycles >= param->max_cycles)
- {
- stats->ended = true;
- break;
- }
-
- if (config.duration != 0)
- {
- if ((ret = clock_gettime(param->clock, &now)) < 0)
- {
- goto threadend;
- }
-
- if (timediff_us(now, endtime) >= 0)
- {
- stats->ended = true;
- break;
- }
- }
- }
-
-threadend:
- return NULL;
-}
-
-static inline void init_thread_param(struct thread_param_s *param,
- unsigned long interval,
- unsigned long max_cycles,
- int policy,
- int prio,
- struct thread_stats_s *stats,
- int clock)
-{
- stats->avg = 0.0;
- stats->cycles = 0;
- stats->max = -LONG_MAX;
- stats->min = LONG_MAX;
- stats->hist_overflow = 0;
- stats->ended = false;
-
- param->interval = interval;
- param->max_cycles = max_cycles;
- param->policy = policy;
- param->prio = prio;
- param->stats = stats;
- param->clock = clock;
-}
-
-/* Copied from the original rt-tests/cyclictest.
- * This way, the output is compatible with the original cyclictest.
- */
-
-static void print_hist(struct thread_param_s *par[], int nthreads)
-{
- int i;
- int j;
- unsigned long long int log_entries[nthreads + 1];
- unsigned long maxmax;
- unsigned long alloverflows;
-
- bzero(log_entries, sizeof(log_entries));
-
- printf("# Histogram\n");
- for (i = 0; i < config.histogram; i++)
- {
- unsigned long long int allthreads = 0;
-
- printf("%06d ", i);
-
- for (j = 0; j < nthreads; j++)
- {
- unsigned long curr_latency = par[j]->stats->hist_array[i];
- printf("%06lu", curr_latency);
- if (j < nthreads - 1)
- {
- printf("\t");
- }
-
- log_entries[j] += curr_latency;
- allthreads += curr_latency;
- }
-
- if (config.histofall && nthreads > 1)
- {
- printf("\t%06llu", allthreads);
- log_entries[nthreads] += allthreads;
- }
-
- printf("\n");
- }
-
- printf("# Total:");
-
- for (j = 0; j < nthreads; j++)
- {
- printf(" %09llu", log_entries[j]);
- }
-
- if (config.histofall && nthreads > 1)
- {
- printf(" %09llu", log_entries[nthreads]);
- }
-
- printf("\n");
- printf("# Min Latencies:");
-
- for (j = 0; j < nthreads; j++)
- {
- printf(" %05lu", par[j]->stats->min);
- }
-
- printf("\n");
- printf("# Avg Latencies:");
-
- for (j = 0; j < nthreads; j++)
- {
- printf(" %05lu", par[j]->stats->cycles ?
- (long)(par[j]->stats->avg / par[j]->stats->cycles) : 0);
- }
-
- printf("\n");
- printf("# Max Latencies:");
-
- maxmax = 0;
- for (j = 0; j < nthreads; j++)
- {
- printf(" %05lu", par[j]->stats->max);
- if (par[j]->stats->max > maxmax)
- {
- maxmax = par[j]->stats->max;
- }
- }
-
- if (config.histofall && nthreads > 1)
- {
- printf(" %05lu", maxmax);
- }
-
- printf("\n");
- printf("# Histogram Overflows:");
-
- alloverflows = 0;
- for (j = 0; j < nthreads; j++)
- {
- printf(" %05lu", par[j]->stats->hist_overflow);
- alloverflows += par[j]->stats->hist_overflow;
- }
-
- if (config.histofall && nthreads > 1)
- {
- printf(" %05lu", alloverflows);
- }
-
- printf("\n");
-}
-
-/* Copied from the original rt-tests/cyclictest.
- * This way, the output is compatible with the original cyclictest.
- */
-
-static void print_stat(struct thread_param_s *par, int index)
-{
- struct thread_stats_s *stat = par->stats;
- char *fmt;
- fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
- "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld\n";
- printf(fmt, index, stat->tid, par->prio, par->interval, stat->cycles,
- stat->min, stat->act,
- stat->cycles ? (long)(stat->avg / stat->cycles) : 0, stat->max);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-int main(int argc, char *argv[])
-{
- int i;
- int ret;
- struct thread_param_s **params = NULL;
- struct thread_stats_s **stats = NULL;
- struct sigevent event;
- struct timer_notify_s tnotify;
- uint32_t maxtimeout_timer;
- uint32_t reqtimeout_timer;
-
- running = true;
- config.clock = CLOCK_MONOTONIC;
- config.distance = 500;
- config.duration = 0;
- config.histogram = 0;
- config.histofall = 0;
- config.interval = 1000;
- config.loops = 0;
- config.threads = 1;
- config.prio = 0;
- config.policy = SCHED_FIFO;
- config.meas_method = M_GETTIME;
- config.wait_method = W_NANOSLEEP;
- config.timer_dev = NULL;
- config.quiet = false;
-
- if (!parse_args(argc, argv))
- {
- print_help();
- return ERROR;
- }
-
- if (!check_args_logic())
- {
- print_help();
- return ERROR;
- }
-
- /* Timer must be configured */
-
- if (config.wait_method == W_DEVTIMER || config.meas_method == M_TIMER_API)
- {
- timerfd = open(config.timer_dev, O_RDWR);
- if (timerfd < 0)
- {
- perror("Failed to open the device timer");
- return ERROR;
- }
-
- /* Configure the timer notification */
-
- polltimer[0].fd = timerfd;
- polltimer[0].events = POLLIN;
-
- /* Fill in the notify struct
- * We do not want any signalling. But we must configure it,
- * because without it the timer will not start.
- */
-
- memset(&event, 0, sizeof(event));
- event.sigev_notify = SIGEV_NONE;
-
- tnotify.periodic = true;
- tnotify.pid = getpid();
- tnotify.event = event;
-
- /* Now set timeout of the timer.
- * This depends on several factors.
- *
- * If wait_method == W_DEVTIMER, the timeout is set to config.interval
- * (to achieve periodic operation). The extra time is measured by
- * NANOSLEEP or the timer itself. If the timer is used, the timer
- * zeroes itself when the timeout is reached, so we just get
- * the timer value after poll has stopped blocking.
- *
- * If wait_method != W_DEVTIMER, we must set the timeout to at least
- * the double of the maximum of all thread intervals
- * (if you're not sure, please consult Claude Shannon).
- *
- * This raises the question: what if wait_method == W_DEVTIMER
- * and meas_method == W_TIMER_API and the thread wakes up later
- * then the timer's timeout? The solution is to have a different
- * timer which runs slower and can measure overruns.
- * But this would overcomplicate things.
- */
-
- if (config.wait_method == W_DEVTIMER)
- {
- reqtimeout_timer = config.interval;
- }
- else
- {
- /* Multiply by 3 instead of 2, just to be sure */
-
- reqtimeout_timer = 3 * (config.interval +
- (config.threads - 1) * config.distance);
- }
-
- ret = ioctl(timerfd, TCIOC_MAXTIMEOUT,
- (unsigned long)((uintptr_t)&maxtimeout_timer));
- if (ret < 0)
- {
- perror("TCIOC_MAXTIMEOUT");
- goto errtimer;
- }
-
- if (reqtimeout_timer > maxtimeout_timer)
- {
- fprintf(stderr, "The timer cannot measure such periods!\n");
- goto errtimer;
- }
-
- ret = ioctl(timerfd, TCIOC_SETTIMEOUT,
- (unsigned long)reqtimeout_timer);
- if (ret < 0)
- {
- perror("TCIOC_SETTIMEOUT");
- goto errtimer;
- }
-
- ret = ioctl(timerfd, TCIOC_NOTIFICATION,
- (unsigned long)((uintptr_t)&tnotify));
- if (ret < 0)
- {
- perror("TCIOC_NOTIFICATION");
- goto errtimer;
- }
-
- /* If the timer is used only for measurement, start it here, otherwise
- * start it only in one thread.
- */
-
- if (config.wait_method != W_DEVTIMER)
- {
- ret = ioctl(timerfd, TCIOC_START);
- if (ret < 0)
- {
- perror("TCIOC_START");
- goto errtimer;
- }
- }
- }
-
- params = calloc(config.threads, sizeof(struct thread_param_s *));
- if (params == NULL)
- {
- perror("params");
- ret = ERROR;
- goto main_error;
- }
-
- stats = calloc(config.threads, sizeof(struct thread_stats_s *));
- if (stats == NULL)
- {
- perror("stats");
- ret = ERROR;
- goto main_error;
- }
-
- for (i = 0; i < config.threads; ++i)
- {
- params[i] = malloc(sizeof(struct thread_param_s));
- if (params == NULL)
- {
- perror("params[i]");
- ret = ERROR;
- goto main_error;
- }
-
- stats[i] = malloc(sizeof(struct thread_stats_s));
- if (params == NULL)
- {
- perror("stats[i]");
- ret = ERROR;
- goto main_error;
- }
-
- stats[i]->hist_array = calloc(config.histogram, sizeof(long));
- if (stats[i]->hist_array == NULL)
- {
- perror("hist_array");
- ret = ERROR;
- goto main_error;
- }
-
- init_thread_param(params[i], config.interval, config.loops,
- config.policy, config.prio, stats[i], config.clock);
-
- pthread_create(&stats[i]->id, NULL, testthread, params[i]);
- config.interval += config.distance;
- if (config.prio > 1)
- {
- config.prio--;
- }
- }
-
- while (running)
- {
- /* Periodically update the output */
-
- usleep(100 * 1000);
- int ended = 0;
- for (i = 0; i < config.threads; ++i)
- {
- if (!config.quiet)
- {
- print_stat(params[i], i);
- }
-
- if (stats[i]->ended)
- {
- ended += 1;
- }
- }
-
- if (ended == config.threads)
- {
- running = false;
- }
- else if (!config.quiet)
- {
- printf("\x1B[%dA", config.threads);
- }
- }
-
- for (i = 0; i < config.threads; ++i)
- {
- pthread_join(stats[i]->id, NULL);
- }
-
- if (config.histogram)
- {
- print_hist(params, config.threads);
- }
-
- ret = OK;
- if (config.wait_method == W_DEVTIMER || config.meas_method == M_TIMER_API)
- {
- ret = ioctl(timerfd, TCIOC_STOP);
- if (ret < 0)
- {
- perror("TCIOC_STOP");
- ret = ERROR;
- }
-
- close(timerfd);
- }
-
-main_error:
- if (stats != NULL)
- {
- for (i = 0; i < config.threads; ++i)
- {
- if (params[i] != NULL)
- {
- free(params[i]);
- }
-
- if (stats[i] != NULL)
- {
- if (stats[i]->hist_array != NULL)
- {
- free(stats[i]->hist_array);
- }
-
- free(stats[i]);
- }
- }
- }
-
- free(stats);
- return ret;
-
-errtimer:
- close(timerfd);
- return ERROR;
-}
diff --git a/benchmarks/dhrystone/.gitignore b/benchmarks/dhrystone/.gitignore
deleted file mode 100644
index 33030069c..000000000
--- a/benchmarks/dhrystone/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/dhrystone
-/dhrystone.zip
diff --git a/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch b/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch
deleted file mode 100644
index 7007764b2..000000000
--- a/benchmarks/dhrystone/0001-dry2.2-Fix-malloc-type-mismatch.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b5376f06c41e9460044500b24137928c83e06244 Mon Sep 17 00:00:00 2001
-From: chenrun1
-Date: Mon, 12 Jun 2023 23:07:37 +0800
-Subject: [PATCH 1/2] dry2.2:Fix 'malloc' type mismatch
-
-'extern char *malloc' is a form from the early days of c that is no longer recommended in modern C implementations. This type of declaration can lead to type mismatch problems
-
-Signed-off-by: chenrun1
----
- v2.2/dry.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/v2.2/dry.c b/v2.2/dry.c
-index 602572a..e0fa391 100644
---- dhrystone/v2.2/dry.c
-+++ dhrystone/v2.2/dry.c
-@@ -500,7 +500,7 @@ char Ch_1_Glob,
- int Arr_1_Glob [50];
- int Arr_2_Glob [50] [50];
-
--extern char *malloc ();
-+extern void *malloc ();
- Enumeration Func_1 ();
- /* forward declaration necessary since Enumeration may not simply be int */
-
---
-2.34.1
-
diff --git a/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch b/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch
deleted file mode 100644
index 1616abee1..000000000
--- a/benchmarks/dhrystone/0002-dhrystone-fix-redefine-warning.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From ed7f8720aed17febe5d802cda53b38b80d0d5164 Mon Sep 17 00:00:00 2001
-From: chenrun1
-Date: Fri, 29 Mar 2024 10:48:37 +0800
-Subject: [PATCH 2/2] dhrystone:fix redefine warning
-
-redefine:
-dhrystone/v2.2/dry.c:458: warning: "true" redefined
- 458 | #define true 1
- |
-In file included from /home/crafcat7/ext2/vela/vela-dev/nuttx/include/nuttx/fs/fs.h:34,
- from /home/crafcat7/ext2/vela/vela-dev/nuttx/include/stdio.h:34,
- from dhrystone/v2.2/dry.c:453:
-/home/crafcat7/ext2/vela/vela-dev/nuttx/include/stdbool.h:77: note: this is the location of the previous definition
- 77 | # define true (bool)1
- |
-dhrystone/v2.2/dry.c:459: warning: "false" redefined
-
-Signed-off-by: chenrun1
----
- v2.1/dhry.h | 8 ++++++++
- v2.2/dry.c | 7 +++++++
- 2 files changed, 15 insertions(+)
-
-diff --git a/v2.1/dhry.h b/v2.1/dhry.h
-index 404adb4..ee848d8 100644
---- dhrystone/v2.1/dhry.h
-+++ dhrystone/v2.1/dhry.h
-@@ -396,8 +396,16 @@
-
- #define Null 0
- /* Value of a Null pointer */
-+
-+#ifdef true
-+#undef true
- #define true 1
-+#endif
-+
-+#ifdef false
-+#undef false
- #define false 0
-+#endif
-
- typedef int One_Thirty;
- typedef int One_Fifty;
-diff --git a/v2.2/dry.c b/v2.2/dry.c
-index e0fa391..2994c13 100644
---- dhrystone/v2.2/dry.c
-+++ dhrystone/v2.2/dry.c
-@@ -455,8 +455,15 @@ struct tms time_info;
-
- #define Null 0
- /* Value of a Null pointer */
-+#ifdef true
-+#undef true
- #define true 1
-+#endif
-+
-+#ifdef false
-+#undef false
- #define false 0
-+#endif
-
- typedef int One_Thirty;
- typedef int One_Fifty;
---
-2.34.1
-
diff --git a/benchmarks/dhrystone/CMakeLists.txt b/benchmarks/dhrystone/CMakeLists.txt
deleted file mode 100644
index 166692d36..000000000
--- a/benchmarks/dhrystone/CMakeLists.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/dhrystone/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_DHRYSTONE)
-
- set(DHRYSTONE_DIR ${CMAKE_CURRENT_LIST_DIR}/dhrystone)
-
- if(NOT EXISTS ${DHRYSTONE_DIR})
- FetchContent_Declare(
- dhrystone_fetch
- URL https://github.com/Keith-S-Thompson/dhrystone/archive/refs/heads/master.zip
- SOURCE_DIR
- ${CMAKE_CURRENT_LIST_DIR}/dhrystone
- BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/coremark/dhrystone
- PATCH_COMMAND
- patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/0001-dry2.2-Fix-malloc-type-mismatch.patch &&
- patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/0002-dhrystone-fix-redefine-warning.patch
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(dhrystone_fetch)
- if(NOT dhrystone_fetch_POPULATED)
- FetchContent_Populate(dhrystone_fetch)
- endif()
- endif()
-
- set(CFLAGS
- -DMSC_CLOCK -Wno-maybe-uninitialized -Wno-implicit-int
- -Wno-strict-prototypes -Wno-implicit-function-declaration
- -Wno-return-type)
- set(SRCS dhrystone/v2.2/dry.c dhrystone/v2.1/dhry_2.c)
-
- nuttx_add_application(
- NAME
- ${CONFIG_BENCHMARK_DHRYSTONE_PROGNAME}
- PRIORITY
- ${CONFIG_BENCHMARK_DHRYSTONE_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_DHRYSTONE_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_DHRYSTONE}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-endif()
diff --git a/benchmarks/dhrystone/Kconfig b/benchmarks/dhrystone/Kconfig
deleted file mode 100644
index 92965c3b5..000000000
--- a/benchmarks/dhrystone/Kconfig
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_DHRYSTONE
- tristate "dhrystone benchmark"
- default n
- ---help---
- Dhrystone is one of the most common benchmark programs
- for measuring the computing power of processors and is commonly
- used to measure the performance of integer computing on processors.
-
-if BENCHMARK_DHRYSTONE
-
-config BENCHMARK_DHRYSTONE_PROGNAME
- string "Program Name"
- default "dhrystone"
-
-config BENCHMARK_DHRYSTONE_STACKSIZE
- int "utils dhrystone stack size"
- default DEFAULT_TASK_STACKSIZE
-
-config BENCHMARK_DHRYSTONE_PRIORITY
- int "Task PRIORITY"
- default 100
-
-endif
diff --git a/benchmarks/dhrystone/Make.defs b/benchmarks/dhrystone/Make.defs
deleted file mode 100644
index 2662abde0..000000000
--- a/benchmarks/dhrystone/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/dhrystone/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_DHRYSTONE),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/dhrystone
-endif
diff --git a/benchmarks/dhrystone/Makefile b/benchmarks/dhrystone/Makefile
deleted file mode 100644
index 6e175ac15..000000000
--- a/benchmarks/dhrystone/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-############################################################################
-# apps/benchmarks/dhrystone/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-#dhrystone
-
-PROGNAME = $(CONFIG_BENCHMARK_DHRYSTONE_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_DHRYSTONE_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_DHRYSTONE_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_DHRYSTONE)
-
-CFLAGS += -DMSC_CLOCK -Wno-implicit-int -Wno-strict-prototypes
-CFLAGS += -Wno-implicit-function-declaration -Wno-return-type
-CFLAGS += -Wno-maybe-uninitialized
-
-CSRCS += dhrystone/v2.1/dhry_2.c
-MAINSRC = dhrystone/v2.2/dry.c
-
-ifeq ($(wildcard dhrystone/.git),)
-VERSION ?= master
-dhrystone.zip:
- $(Q) curl -L https://github.com/Keith-S-Thompson/dhrystone/archive/refs/heads/master.zip -o dhrystone.zip
- $(Q) unzip -o dhrystone.zip
- $(Q) mv dhrystone-$(VERSION) dhrystone
- $(Q) patch -p0 < 0001-dry2.2-Fix-malloc-type-mismatch.patch
- $(Q) patch -p0 < 0002-dhrystone-fix-redefine-warning.patch
-
-context:: dhrystone.zip
-
-distclean::
- $(call DELDIR, dhrystone)
- $(call DELFILE, dhrystone.zip)
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/fio/.gitignore b/benchmarks/fio/.gitignore
deleted file mode 100644
index 97c3b30d0..000000000
--- a/benchmarks/fio/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/fio
diff --git a/benchmarks/fio/0001-external-fio-fix-compile-warning.patch b/benchmarks/fio/0001-external-fio-fix-compile-warning.patch
deleted file mode 100644
index 3161db25d..000000000
--- a/benchmarks/fio/0001-external-fio-fix-compile-warning.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From b51436a258fc010a0ac15b551a9b010e54fccb11 Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Tue, 30 May 2023 22:01:51 +0800
-Subject: [PATCH 01/10] external/fio: fix compile warning
-
-Signed-off-by: dongjiuzhu1
----
- backend.c | 2 +-
- init.c | 4 ++--
- server.c | 2 +-
- stat.c | 28 +++++++++++++++-------------
- zbd.c | 2 +-
- 5 files changed, 20 insertions(+), 18 deletions(-)
-
-diff --git fio/backend.c fio/backend.c
-index fe614f6e..0fa10657 100644
---- fio/backend.c
-+++ fio/backend.c
-@@ -1950,7 +1950,7 @@ static void *thread_main(void *data)
- * another thread is checking its io_u's for overlap
- */
- if (td_offload_overlap(td)) {
-- int res = pthread_mutex_lock(&overlap_check);
-+ res = pthread_mutex_lock(&overlap_check);
- assert(res == 0);
- }
- td_set_runstate(td, TD_FINISHING);
-diff --git fio/init.c fio/init.c
-index f6a8056a..de9d9d27 100644
---- fio/init.c
-+++ fio/init.c
-@@ -2524,12 +2524,12 @@ static void show_closest_option(const char *name)
- log_err("Did you mean %s?\n", l_opts[best_option].name);
- }
-
--static int parse_output_format(const char *optarg)
-+static int parse_output_format(const char *arg)
- {
- char *p, *orig, *opt;
- int ret = 0;
-
-- p = orig = strdup(optarg);
-+ p = orig = strdup(arg);
-
- output_format = 0;
-
-diff --git fio/server.c fio/server.c
-index b453be5f..23da2ecf 100644
---- fio/server.c
-+++ fio/server.c
-@@ -356,7 +356,7 @@ static int verify_convert_cmd(struct fio_net_cmd *cmd)
- }
-
- if (cmd->pdu_len > FIO_SERVER_MAX_FRAGMENT_PDU) {
-- log_err("fio: command payload too large: %u\n", cmd->pdu_len);
-+ log_err("fio: command payload too large: %"PRIu32"\n", cmd->pdu_len);
- return 1;
- }
-
-diff --git fio/stat.c fio/stat.c
-index 949af5ed..6a39ae6e 100644
---- fio/stat.c
-+++ fio/stat.c
-@@ -45,10 +45,12 @@ void update_rusage_stat(struct thread_data *td)
- &td->ru_end.ru_utime);
- ts->sys_time += mtime_since_tv(&td->ru_start.ru_stime,
- &td->ru_end.ru_stime);
-+#ifndef __NuttX__
- ts->ctx += td->ru_end.ru_nvcsw + td->ru_end.ru_nivcsw
- - (td->ru_start.ru_nvcsw + td->ru_start.ru_nivcsw);
- ts->minf += td->ru_end.ru_minflt - td->ru_start.ru_minflt;
- ts->majf += td->ru_end.ru_majflt - td->ru_start.ru_majflt;
-+#endif
-
- memcpy(&td->ru_start, &td->ru_end, sizeof(td->ru_end));
- }
-@@ -346,7 +348,7 @@ void show_group_stats(struct group_run_stats *rs, struct buf_output *out)
- const char *str[] = { " READ", " WRITE" , " TRIM"};
- int i;
-
-- log_buf(out, "\nRun status group %d (all jobs):\n", rs->groupid);
-+ log_buf(out, "\nRun status group %"PRIu32" (all jobs):\n", rs->groupid);
-
- for (i = 0; i < DDIR_RWDIR_CNT; i++) {
- const int i2p = is_power_of_2(rs->kb_base);
-@@ -595,7 +597,7 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
- char buf[64];
-
- snprintf(buf, sizeof(buf),
-- "%s prio %u/%u",
-+ "%s prio %"PRIu32"/%"PRIu32"",
- clat_type,
- ts->clat_prio[ddir][i].ioprio >> 13,
- ts->clat_prio[ddir][i].ioprio & 7);
-@@ -636,7 +638,7 @@ static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
-
- if (prio_samples > 0) {
- snprintf(prio_name, sizeof(prio_name),
-- "%s prio %u/%u (%.2f%% of IOs)",
-+ "%s prio %"PRIu32"/%"PRIu32" (%.2f%% of IOs)",
- clat_type,
- ts->clat_prio[ddir][i].ioprio >> 13,
- ts->clat_prio[ddir][i].ioprio & 7,
-@@ -896,7 +898,7 @@ static void show_block_infos(int nr_block_infos, uint32_t *block_infos,
- uint32_t block_info = percentiles[i];
- #define LINE_LENGTH 75
- char str[LINE_LENGTH];
-- int strln = snprintf(str, LINE_LENGTH, " %3.2fth=%u%c",
-+ int strln = snprintf(str, LINE_LENGTH, " %3.2fth=%"PRIu32"%c",
- plist[i].u.f, block_info,
- i == len - 1 ? '\n' : ',');
- assert(strln < LINE_LENGTH);
-@@ -1177,11 +1179,11 @@ static void show_thread_status_normal(struct thread_stat *ts,
- os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf));
-
- if (!ts->error) {
-- log_buf(out, "%s: (groupid=%d, jobs=%d): err=%2d: pid=%d: %s",
-+ log_buf(out, "%s: (groupid=%"PRIu32", jobs=%"PRIu32"): err=%2"PRIu32": pid=%d: %s",
- ts->name, ts->groupid, ts->members,
- ts->error, (int) ts->pid, time_buf);
- } else {
-- log_buf(out, "%s: (groupid=%d, jobs=%d): err=%2d (%s): pid=%d: %s",
-+ log_buf(out, "%s: (groupid=%"PRIu32", jobs=%"PRIu32"): err=%2"PRIu32" (%s): pid=%d: %s",
- ts->name, ts->groupid, ts->members,
- ts->error, ts->verror, (int) ts->pid,
- time_buf);
-@@ -1253,13 +1255,13 @@ static void show_thread_status_normal(struct thread_stat *ts,
- (unsigned long long) ts->drop_io_u[1],
- (unsigned long long) ts->drop_io_u[2]);
- if (ts->continue_on_error) {
-- log_buf(out, " errors : total=%llu, first_error=%d/<%s>\n",
-+ log_buf(out, " errors : total=%llu, first_error=%"PRIu32"/<%s>\n",
- (unsigned long long)ts->total_err_count,
- ts->first_error,
- strerror(ts->first_error));
- }
- if (ts->latency_depth) {
-- log_buf(out, " latency : target=%llu, window=%llu, percentile=%.2f%%, depth=%u\n",
-+ log_buf(out, " latency : target=%llu, window=%llu, percentile=%.2f%%, depth=%"PRIu32"\n",
- (unsigned long long)ts->latency_target,
- (unsigned long long)ts->latency_window,
- ts->latency_percentile.u.f,
-@@ -1589,9 +1591,9 @@ static void show_thread_status_terse_all(struct thread_stat *ts,
-
- /* General Info */
- if (ver == 2)
-- log_buf(out, "2;%s;%d;%d", ts->name, ts->groupid, ts->error);
-+ log_buf(out, "2;%s;%"PRIu32";%"PRIu32"", ts->name, ts->groupid, ts->error);
- else
-- log_buf(out, "%d;%s;%s;%d;%d", ver, fio_version_string,
-+ log_buf(out, "%d;%s;%s;%"PRIu32";%"PRIu32"", ver, fio_version_string,
- ts->name, ts->groupid, ts->error);
-
- /* Log Read Status, or mixed if unified_rw_rep = 1 */
-@@ -1644,7 +1646,7 @@ static void show_thread_status_terse_all(struct thread_stat *ts,
-
- /* Additional output if continue_on_error set - default off*/
- if (ts->continue_on_error)
-- log_buf(out, ";%llu;%d", (unsigned long long) ts->total_err_count, ts->first_error);
-+ log_buf(out, ";%llu;%"PRIu32"", (unsigned long long) ts->total_err_count, ts->first_error);
-
- /* Additional output if description is set */
- if (strlen(ts->description)) {
-@@ -2519,11 +2521,11 @@ void __show_run_stats(void)
- ts->unified_rw_rep = td->o.unified_rw_rep;
- } else if (ts->kb_base != td->o.kb_base && !kb_base_warned) {
- log_info("fio: kb_base differs for jobs in group, using"
-- " %u as the base\n", ts->kb_base);
-+ " %"PRIu32" as the base\n", ts->kb_base);
- kb_base_warned = true;
- } else if (ts->unit_base != td->o.unit_base && !unit_base_warned) {
- log_info("fio: unit_base differs for jobs in group, using"
-- " %u as the base\n", ts->unit_base);
-+ " %"PRIu32" as the base\n", ts->unit_base);
- unit_base_warned = true;
- }
-
-diff --git fio/zbd.c fio/zbd.c
-index 627fb968..114fb665 100644
---- fio/zbd.c
-+++ fio/zbd.c
-@@ -1491,7 +1491,7 @@ static struct fio_zone_info *zbd_replay_write_order(struct thread_data *td,
- }
-
- if (z->verify_block * min_bs >= z->capacity) {
-- log_err("%s: %d * %"PRIu64" >= %"PRIu64"\n",
-+ log_err("%s: %"PRIu32" * %"PRIu64" >= %"PRIu64"\n",
- f->file_name, z->verify_block, min_bs, z->capacity);
- /*
- * If the assertion below fails during a test run, adding
---
-2.34.1
-
diff --git a/benchmarks/fio/0002-external-fio-add-os-nuttx-support.patch b/benchmarks/fio/0002-external-fio-add-os-nuttx-support.patch
deleted file mode 100644
index d103fb719..000000000
--- a/benchmarks/fio/0002-external-fio-add-os-nuttx-support.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From 8f78b1199f814ad18e1902edf8d9fbf23b05b4d3 Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Mon, 5 Jun 2023 16:00:49 +0800
-Subject: [PATCH 02/10] external/fio: add os-nuttx support
-
-Signed-off-by: dongjiuzhu1
----
- os/os-nuttx.h | 39 +++++++++++++++++++++++++++++++++++++++
- os/os.h | 3 +++
- 2 files changed, 42 insertions(+)
- create mode 100644 os/os-nuttx.h
-
-diff --git fio/os/os-nuttx.h fio/os/os-nuttx.h
-new file mode 100644
-index 00000000..c81ea32c
---- /dev/null
-+++ fio/os/os-nuttx.h
-@@ -0,0 +1,39 @@
-+#ifndef FIO_OS_NUTTX_H
-+#define FIO_OS_NUTTX_H
-+
-+#include
-+#include
-+#include
-+#include
-+
-+#include
-+
-+#include "../file.h"
-+
-+#define FIO_OS os_nuttx
-+#define OS_MAP_ANON MAP_ANON
-+
-+#define fio_swap16(x) bswap16(x)
-+#define fio_swap32(x) bswap32(x)
-+#define fio_swap64(x) bswap64(x)
-+
-+static inline unsigned long long os_phys_mem(void)
-+{
-+ struct mallinfo info;
-+
-+ info = mallinfo();
-+ return (unsigned long long)info.arena;
-+}
-+
-+static inline int blockdev_invalidate_cache(struct fio_file *f)
-+{
-+ return ioctl(f->fd, BIOC_FLUSH, 0);
-+}
-+
-+static inline pid_t setsid(void)
-+{
-+ errno = ENOSYS;
-+ return -1;
-+}
-+
-+#endif
-diff --git fio/os/os.h fio/os/os.h
-index aba6813f..dddff7c1 100644
---- fio/os/os.h
-+++ fio/os/os.h
-@@ -24,6 +24,7 @@ enum {
- os_windows,
- os_android,
- os_dragonfly,
-+ os_nuttx,
-
- os_nr,
- };
-@@ -53,6 +54,8 @@ typedef enum {
- #include "os-windows.h"
- #elif defined (__DragonFly__)
- #include "os-dragonfly.h"
-+#elif defined (__NuttX__)
-+#include "os-nuttx.h"
- #else
- #error "unsupported os"
- #endif
---
-2.34.1
-
diff --git a/benchmarks/fio/0003-external-fio-modify-smaller-size-for-nuttx.patch b/benchmarks/fio/0003-external-fio-modify-smaller-size-for-nuttx.patch
deleted file mode 100644
index c869ffd81..000000000
--- a/benchmarks/fio/0003-external-fio-modify-smaller-size-for-nuttx.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From c39410be0f4516cd06f6d3597daf025db2efcba1 Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Mon, 5 Jun 2023 16:02:10 +0800
-Subject: [PATCH 03/10] external/fio: modify smaller size for nuttx
-
-Signed-off-by: dongjiuzhu1
----
- filehash.c | 2 ++
- lib/memcpy.c | 2 ++
- smalloc.c | 7 +++++++
- 3 files changed, 11 insertions(+)
-
-diff --git fio/filehash.c fio/filehash.c
-index 71ec7b18..f13740d2 100644
---- fio/filehash.c
-+++ fio/filehash.c
-@@ -11,7 +11,9 @@
- #define HASH_BUCKETS 512
- #define HASH_MASK (HASH_BUCKETS - 1)
-
-+#ifndef BLOOM_SIZE
- #define BLOOM_SIZE 16*1024*1024
-+#endif
-
- static unsigned int file_hash_size = HASH_BUCKETS * sizeof(struct flist_head);
-
-diff --git fio/lib/memcpy.c fio/lib/memcpy.c
-index a5521343..1b3466c1 100644
---- fio/lib/memcpy.c
-+++ fio/lib/memcpy.c
-@@ -9,7 +9,9 @@
- #include "../gettime.h"
- #include "../os/os.h"
-
-+#ifndef BUF_SIZE
- #define BUF_SIZE 32 * 1024 * 1024ULL
-+#endif
-
- #define NR_ITERS 64
-
-diff --git fio/smalloc.c fio/smalloc.c
-index 23243054..142e03d2 100644
---- fio/smalloc.c
-+++ fio/smalloc.c
-@@ -18,10 +18,17 @@
- #define SMALLOC_BPI (sizeof(unsigned int) * 8)
- #define SMALLOC_BPL (SMALLOC_BPB * SMALLOC_BPI)
-
-+#ifndef INITIAL_SIZE
- #define INITIAL_SIZE 16*1024*1024 /* new pool size */
-+#endif
-+
-+#ifndef INITIAL_POOLS
- #define INITIAL_POOLS 8 /* maximum number of pools to setup */
-+#endif
-
-+#ifndef MAX_POOLS
- #define MAX_POOLS 16
-+#endif
-
- #define SMALLOC_PRE_RED 0xdeadbeefU
- #define SMALLOC_POST_RED 0x5aa55aa5U
---
-2.34.1
-
diff --git a/benchmarks/fio/0004-external-fio-fix-runtime-error-by-asan.patch b/benchmarks/fio/0004-external-fio-fix-runtime-error-by-asan.patch
deleted file mode 100644
index 49750cdaa..000000000
--- a/benchmarks/fio/0004-external-fio-fix-runtime-error-by-asan.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 02df0c8355b0adf01696e831f319c60f9ae6efb7 Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Fri, 9 Jun 2023 14:39:49 +0800
-Subject: [PATCH 04/10] external/fio: fix runtime error by asan
-
-/home/djz/workspace/test/vela_new/external/fio/fio/arch/arch-x86-common.h:11:7: runtime error: store to
-misaligned address 0xf41f0d47 for type 'unsigned int', which requires 4 byte alignment
-0xf41f0d47: note: pointer points here
- 16 00 00 00 00 bc 0d 1f f4 00 d4 bd 1a 00 00 00 00 5c 2e 44 57 98 0d 1f f4 26 ab b8 56 18 0e 1f
- ^
-
-Signed-off-by: dongjiuzhu1
----
- arch/arch-x86-common.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git fio/arch/arch-x86-common.h fio/arch/arch-x86-common.h
-index f32835cc..fe97cf64 100644
---- fio/arch/arch-x86-common.h
-+++ fio/arch/arch-x86-common.h
-@@ -59,7 +59,7 @@ static inline void arch_init_amd(void)
- static inline void arch_init(char *envp[])
- {
- unsigned int level;
-- char str[13];
-+ char str[13] __attribute__((aligned(0x8)));
-
- arch_random = tsc_reliable = 0;
-
---
-2.34.1
-
diff --git a/benchmarks/fio/0005-external-fio-fix-compile-warning.patch b/benchmarks/fio/0005-external-fio-fix-compile-warning.patch
deleted file mode 100644
index 827d3f397..000000000
--- a/benchmarks/fio/0005-external-fio-fix-compile-warning.patch
+++ /dev/null
@@ -1,172 +0,0 @@
-From a69a23fb0cf6f9e0ad0cb857dda74e6e9b4bc6da Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Sat, 10 Jun 2023 18:34:17 +0800
-Subject: [PATCH 05/10] external/fio: fix compile warning
-
-io/compiler/compiler.h:25:25: warning: comparison of distinct pointer types lacks a cast
- 25 | (void)(&__dummy == &__dummy2); \
- | ^~
-fio/os/os.h:291:9: note: in expansion of macro 'typecheck'
- 291 | typecheck(uint32_t, val); \
- | ^~~~~~~~~
-fio/verify.c:1628:48: note: in expansion of macro 'cpu_to_le32'
- 1628 | s->rand.state32.s[0] = cpu_to_le32(td->random_state.state32.s1);
- | ^~~~~~~~~~~
-
-Signed-off-by: dongjiuzhu1
----
- client.c | 2 +-
- engines/fileoperations.c | 4 ++--
- eta.c | 6 +++---
- iolog.c | 2 +-
- os/os.h | 2 --
- verify.c | 6 +++---
- zbd.c | 2 +-
- 7 files changed, 11 insertions(+), 13 deletions(-)
-
-diff --git fio/client.c fio/client.c
-index 37da74bc..f9a3247e 100644
---- fio/client.c
-+++ fio/client.c
-@@ -1406,7 +1406,7 @@ static void client_flush_hist_samples(FILE *f, int hist_coarseness, void *sample
- entry = s->data.plat_entry;
- io_u_plat = entry->io_u_plat;
-
-- fprintf(f, "%lu, %u, %llu, ", (unsigned long) s->time,
-+ fprintf(f, "%lu, %"PRIu32", %llu, ", (unsigned long) s->time,
- io_sample_ddir(s), (unsigned long long) s->bs);
- for (j = 0; j < FIO_IO_U_PLAT_NR - stride; j += stride) {
- fprintf(f, "%llu, ", (unsigned long long)hist_sum(j, stride, io_u_plat, NULL));
-diff --git fio/engines/fileoperations.c fio/engines/fileoperations.c
-index 1db60da1..ed0456c0 100644
---- fio/engines/fileoperations.c
-+++ fio/engines/fileoperations.c
-@@ -109,7 +109,7 @@ static int stat_file(struct thread_data *td, struct fio_file *f)
- struct timespec start;
- int do_lat = !td->o.disable_lat;
- struct stat statbuf;
--#ifndef WIN32
-+#if !defined(WIN32) && !defined(__NuttX__)
- struct statx statxbuf;
- char *abspath;
- #endif
-@@ -137,7 +137,7 @@ static int stat_file(struct thread_data *td, struct fio_file *f)
- ret = lstat(f->file_name, &statbuf);
- break;
- case FIO_FILESTAT_STATX:
--#ifndef WIN32
-+#if !defined(WIN32) && !defined(__NuttX__)
- abspath = realpath(f->file_name, NULL);
- if (abspath) {
- ret = statx(-1, abspath, 0, STATX_ALL, &statxbuf);
-diff --git fio/eta.c fio/eta.c
-index 6017ca31..2df3bd5d 100644
---- fio/eta.c
-+++ fio/eta.c
-@@ -344,7 +344,7 @@ static void calc_rate(int unified_rw_rep, unsigned long mtime,
-
- static void calc_iops(int unified_rw_rep, unsigned long mtime,
- unsigned long long *io_iops,
-- unsigned long long *prev_io_iops, unsigned int *iops)
-+ unsigned long long *prev_io_iops, uint32_t *iops)
- {
- int i;
-
-@@ -594,7 +594,7 @@ void display_thread_status(struct jobs_eta *je)
- p += sprintf(p, "\n");
- }
-
-- p += sprintf(p, "Jobs: %d (f=%d)", je->nr_running, je->files_open);
-+ p += sprintf(p, "Jobs: %"PRIi32" (f=%"PRIi32")", je->nr_running, je->files_open);
-
- /* rate limits, if any */
- if (je->m_rate[0] || je->m_rate[1] || je->m_rate[2] ||
-@@ -611,7 +611,7 @@ void display_thread_status(struct jobs_eta *je)
- free(mr);
- } else if (je->m_iops[0] || je->m_iops[1] || je->m_iops[2] ||
- je->t_iops[0] || je->t_iops[1] || je->t_iops[2]) {
-- p += sprintf(p, ", %d-%d IOPS",
-+ p += sprintf(p, ", %"PRIi32"-%"PRIi32" IOPS",
- je->m_iops[0] + je->m_iops[1] + je->m_iops[2],
- je->t_iops[0] + je->t_iops[1] + je->t_iops[2]);
- }
-diff --git fio/iolog.c fio/iolog.c
-index aa9c3bb1..cdb24a2b 100644
---- fio/iolog.c
-+++ fio/iolog.c
-@@ -952,7 +952,7 @@ static void flush_hist_samples(FILE *f, int hist_coarseness, void *samples,
- entry_before = flist_first_entry(&entry->list, struct io_u_plat_entry, list);
- io_u_plat_before = entry_before->io_u_plat;
-
-- fprintf(f, "%lu, %u, %llu, ", (unsigned long) s->time,
-+ fprintf(f, "%lu, %"PRIu32", %llu, ", (unsigned long) s->time,
- io_sample_ddir(s), (unsigned long long) s->bs);
- for (j = 0; j < FIO_IO_U_PLAT_NR - stride; j += stride) {
- fprintf(f, "%llu, ", (unsigned long long)
-diff --git fio/os/os.h fio/os/os.h
-index dddff7c1..4d8c7537 100644
---- fio/os/os.h
-+++ fio/os/os.h
-@@ -262,7 +262,6 @@ static inline uint64_t fio_swap64(uint64_t val)
- __le16_to_cpu(val); \
- })
- #define le32_to_cpu(val) ({ \
-- typecheck(uint32_t, val); \
- __le32_to_cpu(val); \
- })
- #define le64_to_cpu(val) ({ \
-@@ -288,7 +287,6 @@ static inline uint64_t fio_swap64(uint64_t val)
- __cpu_to_le16(val); \
- })
- #define cpu_to_le32(val) ({ \
-- typecheck(uint32_t, val); \
- __cpu_to_le32(val); \
- })
- #define cpu_to_le64(val) ({ \
-diff --git fio/verify.c fio/verify.c
-index 0e1e4639..ea414749 100644
---- fio/verify.c
-+++ fio/verify.c
-@@ -341,7 +341,7 @@ static void log_verify_failure(struct verify_header *hdr, struct vcont *vc)
-
- offset = vc->io_u->verify_offset;
- offset += vc->hdr_num * hdr->len;
-- log_err("%.8s: verify failed at file %s offset %llu, length %u"
-+ log_err("%.8s: verify failed at file %s offset %llu, length %"PRIu32""
- " (requested block: offset=%llu, length=%llu, flags=%x)\n",
- vc->name, vc->io_u->file->file_name, offset, hdr->len,
- vc->io_u->verify_offset, vc->io_u->buflen, vc->io_u->flags);
-@@ -819,7 +819,7 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
- goto err;
- }
- if (hdr->len != hdr_len) {
-- log_err("verify: bad header length %u, wanted %u",
-+ log_err("verify: bad header length %"PRIu32", wanted %u",
- hdr->len, hdr_len);
- goto err;
- }
-@@ -854,7 +854,7 @@ static int verify_header(struct io_u *io_u, struct thread_data *td,
-
- crc = fio_crc32c(p, offsetof(struct verify_header, crc32));
- if (crc != hdr->crc32) {
-- log_err("verify: bad header crc %x, calculated %x",
-+ log_err("verify: bad header crc %"PRIx32", calculated %"PRIx32"",
- hdr->crc32, crc);
- goto err;
- }
-diff --git fio/zbd.c fio/zbd.c
-index 114fb665..3933ab2d 100644
---- fio/zbd.c
-+++ fio/zbd.c
-@@ -814,7 +814,7 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
- break;
-
- nrz = zbd_report_zones(td, f, offset, zones,
-- min((uint32_t)(nr_zones - j),
-+ min((unsigned)(nr_zones - j),
- ZBD_REPORT_MAX_ZONES));
- if (nrz < 0) {
- ret = nrz;
---
-2.34.1
-
diff --git a/benchmarks/fio/0006-external-fio-reinit-global-var-issue-when-run-multip.patch b/benchmarks/fio/0006-external-fio-reinit-global-var-issue-when-run-multip.patch
deleted file mode 100644
index 534f77724..000000000
--- a/benchmarks/fio/0006-external-fio-reinit-global-var-issue-when-run-multip.patch
+++ /dev/null
@@ -1,438 +0,0 @@
-From 6afb9af3dd7734d0f6bd090fba947ffaec43482b Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Mon, 5 Jun 2023 14:44:53 +0800
-Subject: [PATCH 06/10] external/fio: reinit global var issue when run multiple
- times
-
-Signed-off-by: dongjiuzhu1
----
- init.c | 386 +++++++++++++++++++++++++-----------------------------
- smalloc.c | 4 +
- 2 files changed, 186 insertions(+), 204 deletions(-)
-
-diff --git fio/init.c fio/init.c
-index de9d9d27..9dcad491 100644
---- fio/init.c
-+++ fio/init.c
-@@ -96,214 +96,191 @@ static bool did_arg;
- * Command line options. These will contain the above, plus a few
- * extra that only pertain to fio itself and not jobs.
- */
--static struct option l_opts[FIO_NR_OPTIONS] = {
-- {
-- .name = (char *) "output",
-- .has_arg = required_argument,
-- .val = 'o' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "latency-log",
-- .has_arg = required_argument,
-- .val = 'l' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "bandwidth-log",
-- .has_arg = no_argument,
-- .val = 'b' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "minimal",
-- .has_arg = no_argument,
-- .val = 'm' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "output-format",
-- .has_arg = required_argument,
-- .val = 'F' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "append-terse",
-- .has_arg = optional_argument,
-- .val = 'f',
-- },
-- {
-- .name = (char *) "version",
-- .has_arg = no_argument,
-- .val = 'v' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "help",
-- .has_arg = no_argument,
-- .val = 'h' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "cmdhelp",
-- .has_arg = optional_argument,
-- .val = 'c' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "enghelp",
-- .has_arg = optional_argument,
-- .val = 'i' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "showcmd",
-- .has_arg = no_argument,
-- .val = 's' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "readonly",
-- .has_arg = no_argument,
-- .val = 'r' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "eta",
-- .has_arg = required_argument,
-- .val = 'e' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "eta-interval",
-- .has_arg = required_argument,
-- .val = 'O' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "eta-newline",
-- .has_arg = required_argument,
-- .val = 'E' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "debug",
-- .has_arg = required_argument,
-- .val = 'd' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "parse-only",
-- .has_arg = no_argument,
-- .val = 'P' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "section",
-- .has_arg = required_argument,
-- .val = 'x' | FIO_CLIENT_FLAG,
-- },
-+static struct option l_opts[FIO_NR_OPTIONS];
-+static void fio_init_global(void)
-+{
-+ int i = 0;
-+
-+ l_opts[i].name = (char *) "output",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'o' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "latency-log",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'l' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "bandwidth-log",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'b' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "minimal",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'm' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "output-format",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'F' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "append-terse",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'f',
-+
-+ l_opts[i].name = (char *) "version",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'v' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "help",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'h' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "cmdhelp",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'c' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "enghelp",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'i' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "showcmd",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 's' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "readonly",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'r' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "eta",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'e' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "eta-interval",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'O' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "eta-newline",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'E' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "debug",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'd' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "parse-only",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'P' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "section",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'x' | FIO_CLIENT_FLAG,
-+
- #ifdef CONFIG_ZLIB
-- {
-- .name = (char *) "inflate-log",
-- .has_arg = required_argument,
-- .val = 'X' | FIO_CLIENT_FLAG,
-- },
-+ l_opts[i].name = (char *) "inflate-log",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'X' | FIO_CLIENT_FLAG,
- #endif
-- {
-- .name = (char *) "alloc-size",
-- .has_arg = required_argument,
-- .val = 'a' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "profile",
-- .has_arg = required_argument,
-- .val = 'p' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "warnings-fatal",
-- .has_arg = no_argument,
-- .val = 'w' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "max-jobs",
-- .has_arg = required_argument,
-- .val = 'j' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "terse-version",
-- .has_arg = required_argument,
-- .val = 'V' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "server",
-- .has_arg = optional_argument,
-- .val = 'S',
-- },
-+
-+ l_opts[i].name = (char *) "alloc-size",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'a' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "profile",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'p' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "warnings-fatal",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'w' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "max-jobs",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'j' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "terse-version",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'V' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "server",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'S',
-+
- #ifdef WIN32
-- {
-- .name = (char *) "server-internal",
-- .has_arg = required_argument,
-- .val = 'N',
-- },
-+ l_opts[i].name = (char *) "server-internal",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'N',
- #endif
-- { .name = (char *) "daemonize",
-- .has_arg = required_argument,
-- .val = 'D',
-- },
-- {
-- .name = (char *) "client",
-- .has_arg = required_argument,
-- .val = 'C',
-- },
-- {
-- .name = (char *) "remote-config",
-- .has_arg = required_argument,
-- .val = 'R',
-- },
-- {
-- .name = (char *) "cpuclock-test",
-- .has_arg = no_argument,
-- .val = 'T',
-- },
-- {
-- .name = (char *) "crctest",
-- .has_arg = optional_argument,
-- .val = 'G',
-- },
-- {
-- .name = (char *) "memcpytest",
-- .has_arg = optional_argument,
-- .val = 'M',
-- },
-- {
-- .name = (char *) "idle-prof",
-- .has_arg = required_argument,
-- .val = 'I',
-- },
-- {
-- .name = (char *) "status-interval",
-- .has_arg = required_argument,
-- .val = 'L' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = (char *) "trigger-file",
-- .has_arg = required_argument,
-- .val = 'W',
-- },
-- {
-- .name = (char *) "trigger-timeout",
-- .has_arg = required_argument,
-- .val = 'B',
-- },
-- {
-- .name = (char *) "trigger",
-- .has_arg = required_argument,
-- .val = 'H',
-- },
-- {
-- .name = (char *) "trigger-remote",
-- .has_arg = required_argument,
-- .val = 'J',
-- },
-- {
-- .name = (char *) "aux-path",
-- .has_arg = required_argument,
-- .val = 'K',
-- },
-- {
-- .name = (char *) "merge-blktrace-only",
-- .has_arg = no_argument,
-- .val = 'A' | FIO_CLIENT_FLAG,
-- },
-- {
-- .name = NULL,
-- },
--};
-+
-+ l_opts[i].name = (char *) "daemonize",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'D',
-+
-+ l_opts[i].name = (char *) "client",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'C',
-+
-+ l_opts[i].name = (char *) "remote-config",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'R',
-+
-+ l_opts[i].name = (char *) "cpuclock-test",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'T',
-+
-+ l_opts[i].name = (char *) "crctest",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'G',
-+
-+ l_opts[i].name = (char *) "memcpytest",
-+ l_opts[i].has_arg = optional_argument,
-+ l_opts[i++].val = 'M',
-+
-+ l_opts[i].name = (char *) "idle-prof",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'I',
-+
-+ l_opts[i].name = (char *) "status-interval",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'L' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = (char *) "trigger-file",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'W',
-+
-+ l_opts[i].name = (char *) "trigger-timeout",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'B',
-+
-+ l_opts[i].name = (char *) "trigger",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'H',
-+
-+ l_opts[i].name = (char *) "trigger-remote",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'J',
-+
-+ l_opts[i].name = (char *) "aux-path",
-+ l_opts[i].has_arg = required_argument,
-+ l_opts[i++].val = 'K',
-+
-+ l_opts[i].name = (char *) "merge-blktrace-only",
-+ l_opts[i].has_arg = no_argument,
-+ l_opts[i++].val = 'A' | FIO_CLIENT_FLAG,
-+
-+ l_opts[i].name = NULL,
-+
-+ thread_number = 0;
-+ nr_segments = 0;
-+ cur_segment = 0;
-+ stat_number = 0;
-+
-+ did_arg = false;
-+ ini_file = NULL;
-+ nr_clients = 0;
-+ thread_number = 0;
-+ prev_group_jobs = 0;
-+ memset(&def_thread, 0, sizeof(def_thread));
-+ memset(segments, 0, sizeof(segments));
-+ memset(cmd_optstr, 0, sizeof(cmd_optstr));
-+}
-
- void free_threads_shm(void)
- {
-@@ -3044,6 +3021,7 @@ int fio_init_options(void)
- f_out = stdout;
- f_err = stderr;
-
-+ fio_init_global();
- fio_options_fill_optstring();
- fio_options_dup_and_init(l_opts);
-
-diff --git fio/smalloc.c fio/smalloc.c
-index 142e03d2..a93290eb 100644
---- fio/smalloc.c
-+++ fio/smalloc.c
-@@ -215,6 +215,10 @@ void sinit(void)
- bool ret;
- int i;
-
-+ mp = NULL;
-+ nr_pools = 0;
-+ smalloc_pool_size = INITIAL_SIZE;
-+
- /*
- * sinit() can be called more than once if alloc-size is
- * set. But we want to allocate space for the struct pool
---
-2.34.1
-
diff --git a/benchmarks/fio/0007-external-fio-add-engine-init.patch b/benchmarks/fio/0007-external-fio-add-engine-init.patch
deleted file mode 100644
index 148bad36a..000000000
--- a/benchmarks/fio/0007-external-fio-add-engine-init.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From b167af3a9446506c6b3f48c0b03ae58bb3f1e9d4 Mon Sep 17 00:00:00 2001
-From: dongjiuzhu1
-Date: Sat, 10 Jun 2023 15:01:29 +0800
-Subject: [PATCH 07/10] external/fio: add engine init
-
-Signed-off-by: dongjiuzhu1
----
- engines/cpu.c | 2 +-
- engines/exec.c | 2 +-
- engines/falloc.c | 2 +-
- engines/fileoperations.c | 2 +-
- engines/ftruncate.c | 2 +-
- engines/mmap.c | 2 +-
- engines/net.c | 2 +-
- engines/null.c | 2 +-
- engines/sync.c | 2 +-
- libfio.c | 24 ++++++++++++++++++++++++
- 10 files changed, 33 insertions(+), 9 deletions(-)
-
-diff --git fio/engines/cpu.c fio/engines/cpu.c
-index ce74dbce..564a3d7a 100644
---- fio/engines/cpu.c
-+++ fio/engines/cpu.c
-@@ -326,7 +326,7 @@ static struct ioengine_ops ioengine = {
- .option_struct_size = sizeof(struct cpu_options),
- };
-
--static void fio_init fio_cpuio_register(void)
-+void fio_cpuio_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/exec.c fio/engines/exec.c
-index 20e50e00..a9025264 100644
---- fio/engines/exec.c
-+++ fio/engines/exec.c
-@@ -383,7 +383,7 @@ static struct ioengine_ops ioengine = {
- .option_struct_size = sizeof(struct exec_options),
- };
-
--static void fio_init fio_exec_register(void)
-+void fio_exec_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/falloc.c fio/engines/falloc.c
-index 4b05ed68..9fc3bd5b 100644
---- fio/engines/falloc.c
-+++ fio/engines/falloc.c
-@@ -101,7 +101,7 @@ static struct ioengine_ops ioengine = {
- .flags = FIO_SYNCIO
- };
-
--static void fio_init fio_syncio_register(void)
-+void fio_syncio_falloc_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/fileoperations.c fio/engines/fileoperations.c
-index ed0456c0..b302cda5 100644
---- fio/engines/fileoperations.c
-+++ fio/engines/fileoperations.c
-@@ -303,7 +303,7 @@ static struct ioengine_ops ioengine_filedelete = {
- };
-
-
--static void fio_init fio_fileoperations_register(void)
-+void fio_fileoperations_register(void)
- {
- register_ioengine(&ioengine_filecreate);
- register_ioengine(&ioengine_filestat);
-diff --git fio/engines/ftruncate.c fio/engines/ftruncate.c
-index c7ad038c..7ed859a4 100644
---- fio/engines/ftruncate.c
-+++ fio/engines/ftruncate.c
-@@ -41,7 +41,7 @@ static struct ioengine_ops ioengine = {
- .flags = FIO_SYNCIO | FIO_FAKEIO
- };
-
--static void fio_init fio_syncio_register(void)
-+void fio_syncio_ftruncate_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/mmap.c fio/engines/mmap.c
-index 55ba1ab3..a47b9686 100644
---- fio/engines/mmap.c
-+++ fio/engines/mmap.c
-@@ -327,7 +327,7 @@ static struct ioengine_ops ioengine = {
- #endif
- };
-
--static void fio_init fio_mmapio_register(void)
-+void fio_mmapio_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/net.c fio/engines/net.c
-index c6cec584..0f9fd6be 100644
---- fio/engines/net.c
-+++ fio/engines/net.c
-@@ -1450,7 +1450,7 @@ static int str_hostname_cb(void *data, const char *input)
- return 0;
- }
-
--static void fio_init fio_netio_register(void)
-+void fio_netio_register(void)
- {
- register_ioengine(&ioengine_rw);
- #ifdef CONFIG_LINUX_SPLICE
-diff --git fio/engines/null.c fio/engines/null.c
-index 68759c26..2b4695c4 100644
---- fio/engines/null.c
-+++ fio/engines/null.c
-@@ -176,7 +176,7 @@ static struct ioengine_ops ioengine = {
- .flags = FIO_DISKLESSIO | FIO_FAKEIO,
- };
-
--static void fio_init fio_null_register(void)
-+void fio_null_register(void)
- {
- register_ioengine(&ioengine);
- }
-diff --git fio/engines/sync.c fio/engines/sync.c
-index 339ba999..f1047114 100644
---- fio/engines/sync.c
-+++ fio/engines/sync.c
-@@ -490,7 +490,7 @@ static struct ioengine_ops ioengine_pvrw2 = {
- };
- #endif
-
--static void fio_init fio_syncio_register(void)
-+void fio_syncio_register(void)
- {
- register_ioengine(&ioengine_rw);
- register_ioengine(&ioengine_prw);
-diff --git fio/libfio.c fio/libfio.c
-index 1a891776..b634fbc7 100644
---- fio/libfio.c
-+++ fio/libfio.c
-@@ -350,6 +350,28 @@ static int endian_check(void)
- return 0;
- }
-
-+extern void fio_cpuio_register(void);
-+extern void fio_exec_register(void);
-+extern void fio_syncio_register(void);
-+extern void fio_syncio_ftruncate_register(void);
-+extern void fio_syncio_falloc_register(void);
-+extern void fio_fileoperations_register(void);
-+extern void fio_mmapio_register(void);
-+extern void fio_netio_register(void);
-+extern void fio_null_register(void);
-+void fio_engine_init(void)
-+{
-+ fio_cpuio_register();
-+ fio_exec_register();
-+ fio_syncio_register();
-+ fio_syncio_ftruncate_register();
-+ fio_syncio_falloc_register();
-+ fio_fileoperations_register();
-+ fio_mmapio_register();
-+ fio_netio_register();
-+ fio_null_register();
-+}
-+
- int initialize_fio(char *envp[])
- {
- long ps;
-@@ -431,6 +453,8 @@ int initialize_fio(char *envp[])
- page_mask = ps - 1;
-
- fio_keywords_init();
-+
-+ fio_engine_init();
- return 0;
- }
-
---
-2.34.1
-
diff --git a/benchmarks/fio/0008-fio-fix-memory-leak-run-cpuio.fio.patch b/benchmarks/fio/0008-fio-fix-memory-leak-run-cpuio.fio.patch
deleted file mode 100644
index 200927a18..000000000
--- a/benchmarks/fio/0008-fio-fix-memory-leak-run-cpuio.fio.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4104f7946da6a608f40dc6028d2f6570daad8ef0 Mon Sep 17 00:00:00 2001
-From: guohao15
-Date: Wed, 18 Oct 2023 11:09:12 +0800
-Subject: [PATCH 08/10] fio:fix memory leak run cpuio.fio
-
-Signed-off-by: guohao15
----
- init.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git fio/init.c fio/init.c
-index 9dcad491..57d8ae18 100644
---- fio/init.c
-+++ fio/init.c
-@@ -493,8 +493,11 @@ static struct thread_data *get_new_job(bool global, struct thread_data *parent,
- td->thread_number = thread_number;
- td->subjob_number = 0;
-
-- if (jobname)
-+ if (jobname) {
-+ if (td->o.name)
-+ free(td->o.name);
- td->o.name = strdup(jobname);
-+ }
-
- if (!parent->o.group_reporting || parent == &def_thread)
- stat_number++;
---
-2.34.1
-
diff --git a/benchmarks/fio/0009-fio-fix-memory-leak-ioengine-filecreate.patch b/benchmarks/fio/0009-fio-fix-memory-leak-ioengine-filecreate.patch
deleted file mode 100644
index b74e3a533..000000000
--- a/benchmarks/fio/0009-fio-fix-memory-leak-ioengine-filecreate.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From a7b806befaf11eccf7f769187717dda1ec352fdc Mon Sep 17 00:00:00 2001
-From: guohao15
-Date: Wed, 18 Oct 2023 21:14:05 +0800
-Subject: [PATCH 09/10] fio:fix memory leak ioengine=filecreate
-
-Signed-off-by: guohao15
----
- gettime.c | 2 +-
- init.c | 10 ++++++++++
- 2 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git fio/gettime.c fio/gettime.c
-index 14462420..2f0207d5 100644
---- fio/gettime.c
-+++ fio/gettime.c
-@@ -37,7 +37,7 @@ static pthread_key_t tv_tls_key;
-
- enum fio_cs fio_clock_source = FIO_PREFERRED_CLOCK_SOURCE;
- int fio_clock_source_set = 0;
--static enum fio_cs fio_clock_source_inited = CS_INVAL;
-+enum fio_cs fio_clock_source_inited = CS_INVAL;
-
- #ifdef FIO_DEBUG_TIME
-
-diff --git fio/init.c fio/init.c
-index 57d8ae18..c8f53e62 100644
---- fio/init.c
-+++ fio/init.c
-@@ -90,6 +90,10 @@ unsigned int *fio_warned = NULL;
- static char cmd_optstr[256];
- static bool did_arg;
-
-+extern enum fio_cs fio_clock_source;
-+extern int fio_clock_source_set;
-+extern enum fio_cs fio_clock_source_inited;
-+
- #define FIO_CLIENT_FLAG (1 << 16)
-
- /*
-@@ -277,6 +281,11 @@ static void fio_init_global(void)
- nr_clients = 0;
- thread_number = 0;
- prev_group_jobs = 0;
-+
-+ fio_clock_source = FIO_PREFERRED_CLOCK_SOURCE;
-+ fio_clock_source_set = 0;
-+ fio_clock_source_inited = CS_INVAL;
-+
- memset(&def_thread, 0, sizeof(def_thread));
- memset(segments, 0, sizeof(segments));
- memset(cmd_optstr, 0, sizeof(cmd_optstr));
-@@ -3073,6 +3082,7 @@ int parse_options(int argc, char *argv[])
-
- free(ini_file);
- fio_options_free(&def_thread);
-+ fio_dump_options_free(&def_thread);
- filesetup_mem_free();
-
- if (!thread_number) {
---
-2.34.1
-
diff --git a/benchmarks/fio/0010-fio-fix-memory-leak-ioengine-exec.patch b/benchmarks/fio/0010-fio-fix-memory-leak-ioengine-exec.patch
deleted file mode 100644
index f07b7e8ed..000000000
--- a/benchmarks/fio/0010-fio-fix-memory-leak-ioengine-exec.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 6b211dc0191f0ebef454fdc8f5602474bed65471 Mon Sep 17 00:00:00 2001
-From: guohao15
-Date: Wed, 18 Oct 2023 17:42:33 +0800
-Subject: [PATCH 10/10] fio:fix memory leak ioengine=exec
-
-Signed-off-by: guohao15
----
- engines/exec.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git fio/engines/exec.c fio/engines/exec.c
-index a9025264..fbefb99e 100644
---- fio/engines/exec.c
-+++ fio/engines/exec.c
-@@ -188,7 +188,13 @@ static int exec_background(struct thread_options *o, struct exec_options *eo)
- free(outfilename);
- free(errfilename);
- }
-+ for (int i = 0; i < arguments_nb_items; i++)
-+ free(arguments_array[i]);
-+ free(arguments_array);
- free(expanded_arguments);
-+ free(exec_cmd);
-+ free(outfilename);
-+ free(errfilename);
- return 0;
- }
-
---
-2.34.1
-
diff --git a/benchmarks/fio/CMakeLists.txt b/benchmarks/fio/CMakeLists.txt
deleted file mode 100644
index 5dae3f20d..000000000
--- a/benchmarks/fio/CMakeLists.txt
+++ /dev/null
@@ -1,171 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/fio/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_FIO)
-
- set(FIOAPP_DIR ${CMAKE_CURRENT_LIST_DIR}/fio)
-
- if(NOT EXISTS ${FIOAPP_DIR})
- FetchContent_Declare(
- fio_fetch
- URL https://github.com/ldorau/fio/archive/refs/heads/master.zip SOURCE_DIR
- ${CMAKE_CURRENT_LIST_DIR}/fio BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/fio/fio
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30
- PATCH_COMMAND
- patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0001-external-fio-fix-compile-warning.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0002-external-fio-add-os-nuttx-support.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0003-external-fio-modify-smaller-size-for-nuttx.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0004-external-fio-fix-runtime-error-by-asan.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0005-external-fio-fix-compile-warning.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0006-external-fio-reinit-global-var-issue-when-run-multip.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0007-external-fio-add-engine-init.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0008-fio-fix-memory-leak-run-cpuio.fio.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0009-fio-fix-memory-leak-ioengine-filecreate.patch
- COMMAND patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/fio <
- ${CMAKE_CURRENT_LIST_DIR}/0010-fio-fix-memory-leak-ioengine-exec.patch)
-
- FetchContent_GetProperties(fio_fetch)
- if(NOT fio_fetch_POPULATED)
- FetchContent_Populate(fio_fetch)
- endif()
- endif()
-
- file(GLOB LIB_SRCS ${FIOAPP_DIR}/lib/*.c)
- file(GLOB CRC_SRCS ${FIOAPP_DIR}/crc/*.c)
-
- set(CSRCS
- ${LIB_SRCS}
- ${CRC_SRCS}
- ${FIOAPP_DIR}/gettime.c
- ${FIOAPP_DIR}/ioengines.c
- ${FIOAPP_DIR}/init.c
- ${FIOAPP_DIR}/stat.c
- ${FIOAPP_DIR}/log.c
- ${FIOAPP_DIR}/time.c
- ${FIOAPP_DIR}/filesetup.c
- ${FIOAPP_DIR}/eta.c
- ${FIOAPP_DIR}/verify.c
- ${FIOAPP_DIR}/memory.c
- ${FIOAPP_DIR}/io_u.c
- ${FIOAPP_DIR}/parse.c
- ${FIOAPP_DIR}/fio_sem.c
- ${FIOAPP_DIR}/rwlock.c
- ${FIOAPP_DIR}/pshared.c
- ${FIOAPP_DIR}/options.c
- ${FIOAPP_DIR}/smalloc.c
- ${FIOAPP_DIR}/filehash.c
- ${FIOAPP_DIR}/profile.c
- ${FIOAPP_DIR}/debug.c
- ${FIOAPP_DIR}/server.c
- ${FIOAPP_DIR}/client.c
- ${FIOAPP_DIR}/iolog.c
- ${FIOAPP_DIR}/backend.c
- ${FIOAPP_DIR}/libfio.c
- ${FIOAPP_DIR}/flow.c
- ${FIOAPP_DIR}/cconv.c
- ${FIOAPP_DIR}/gettime-thread.c
- ${FIOAPP_DIR}/helpers.c
- ${FIOAPP_DIR}/json.c
- ${FIOAPP_DIR}/idletime.c
- ${FIOAPP_DIR}/td_error.c
- ${FIOAPP_DIR}/zbd.c
- ${FIOAPP_DIR}/profiles/tiobench.c
- ${FIOAPP_DIR}/profiles/act.c
- ${FIOAPP_DIR}/io_u_queue.c
- ${FIOAPP_DIR}/filelock.c
- ${FIOAPP_DIR}/steadystate.c
- ${FIOAPP_DIR}/workqueue.c
- ${FIOAPP_DIR}/rate-submit.c
- ${FIOAPP_DIR}/optgroup.c
- ${FIOAPP_DIR}/helper_thread.c
- ${FIOAPP_DIR}/zone-dist.c
- ${FIOAPP_DIR}/dedupe.c
- ${FIOAPP_DIR}/engines/exec.c
- ${FIOAPP_DIR}/engines/cpu.c
- ${FIOAPP_DIR}/engines/sync.c
- ${FIOAPP_DIR}/engines/ftruncate.c
- ${FIOAPP_DIR}/engines/falloc.c
- ${FIOAPP_DIR}/engines/fileoperations.c
- ${FIOAPP_DIR}/engines/mmap.c
- ${FIOAPP_DIR}/engines/null.c
- ${FIOAPP_DIR}/engines/net.c)
-
- set(CFLAGS
- -DCONFIG_GETTIMEOFDAY
- -DCONFIG_CLOCK_GETTIME
- -DCONFIG_HAVE_GETTID
- -DCONFIG_STATIC_ASSERT
- -DCONFIG_LITTLE_ENDIAN
- -DCONFIG_POSIX_FALLOCATE
- -DCONFIG_HAVE_BOOL
- -DFIO_INTERNAL
- -DCONFIG_NO_SHM
- -DFIO_VERSION=\"1.2.0\"
- -DFIO_USE_GENERIC_SWAP
- -DFIO_USE_GENERIC_INIT_RANDOM_STATE
- -DFIO_USE_GENERIC_BDEV_SIZE
- -DBLOOM_SIZE=1024*1024
- -DBUF_SIZE=512*1024
- -DMAX_POOLS=4
- -DINITIAL_POOLS=2
- -DINITIAL_SIZE=512*1024
- -DCONFIG_SEED_BUCKETS=8
- -DBITS_PER_LONG=32
- -DXXH32_digest=fio_XXH32_digest
- -DXXH32_update=fio_XXH32_update
- -DXXH32=fio_XXH32
- -Dparse_options=fio_parse_options
- -Dparse_option=fio_parse_option)
-
- set(INCDIR ${FIOAPP_DIR} ${FIOAPP_DIR}/arch ${FIOAPP_DIR}/crc
- ${FIOAPP_DIR}/os)
- include_directories(${INCDIR})
-
- if(CONFIG_ARCH_ARM)
- list(APPEND CFLAGS -D__ARM_ARCH_6__)
- endif()
-
- set(SRCS ${FIOAPP_DIR}/fio.c ${CSRCS})
- nuttx_add_application(
- NAME
- fio
- PRIORITY
- ${CONFIG_BENCHMARK_FIO_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_FIO_STACKSIZE}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-
-endif()
diff --git a/benchmarks/fio/Kconfig b/benchmarks/fio/Kconfig
deleted file mode 100644
index f77a8a8a8..000000000
--- a/benchmarks/fio/Kconfig
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_FIO
- tristate "Flexible I/O Tester"
- default n
- depends on LIBC_ELF && LIBC_DLFCN
- ---help---
- https://github.com/axboe/fio Fio spawns a number of threads or processes
- doing a particular type of I/O action as specified by the user.
-
-if BENCHMARK_FIO
-
-config BENCHMARK_FIO_PRIORITY
- int "fio task priority"
- default 100
-
-config BENCHMARK_FIO_STACKSIZE
- int "fio stack size"
- default 65536
-
-endif
diff --git a/benchmarks/fio/Make.defs b/benchmarks/fio/Make.defs
deleted file mode 100644
index 27c568349..000000000
--- a/benchmarks/fio/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/fio/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_FIO),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/fio
-endif
diff --git a/benchmarks/fio/Makefile b/benchmarks/fio/Makefile
deleted file mode 100644
index c7950873d..000000000
--- a/benchmarks/fio/Makefile
+++ /dev/null
@@ -1,89 +0,0 @@
-############################################################################
-# apps/benchmarks/fio/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = fio
-PRIORITY = $(CONFIG_BENCHMARK_FIO_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_FIO_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_FIO)
-MAINSRC = $(CURDIR)/fio/fio.c
-
-CFLAGS += -DCONFIG_GETTIMEOFDAY -DCONFIG_CLOCK_GETTIME -DCONFIG_HAVE_GETTID
-CFLAGS += -DCONFIG_STATIC_ASSERT -DCONFIG_LITTLE_ENDIAN -DCONFIG_POSIX_FALLOCATE
-CFLAGS += -DCONFIG_HAVE_BOOL -DFIO_INTERNAL -DCONFIG_NO_SHM
-CFLAGS += -DFIO_VERSION='"1.2.0"' -DFIO_USE_GENERIC_SWAP
-CFLAGS += -DFIO_USE_GENERIC_INIT_RANDOM_STATE -DFIO_USE_GENERIC_BDEV_SIZE
-
-CFLAGS += -DBLOOM_SIZE=1024*1024 -DBUF_SIZE=512*1024
-CFLAGS += -DMAX_POOLS=4 -DINITIAL_POOLS=2 -DINITIAL_SIZE=512*1024
-CFLAGS += -DCONFIG_SEED_BUCKETS=8 -DBITS_PER_LONG=32
-CFLAGS += -Ifio -Ifio/arch -Ifio/crc -Ifio/os
-CFLAGS += -DXXH32_digest=fio_XXH32_digest -DXXH32_update=fio_XXH32_update -DXXH32=fio_XXH32 \
- -Dparse_options=fio_parse_options -Dparse_option=fio_parse_option
-
-ifneq ($(CONFIG_ARCH_ARM),)
-CFLAGS += -D__ARM_ARCH_6__
-endif
-
-CSRCS += $(wildcard fio/lib/*.c)
-CSRCS += $(wildcard fio/crc/*.c)
-
-CSRCS += fio/gettime.c fio/ioengines.c fio/init.c fio/stat.c fio/log.c fio/time.c fio/filesetup.c \
- fio/eta.c fio/verify.c fio/memory.c fio/io_u.c fio/parse.c fio/fio_sem.c fio/rwlock.c \
- fio/pshared.c fio/options.c fio/smalloc.c fio/filehash.c fio/profile.c fio/debug.c \
- fio/server.c fio/client.c fio/iolog.c fio/backend.c fio/libfio.c fio/flow.c fio/cconv.c \
- fio/gettime-thread.c fio/helpers.c fio/json.c fio/idletime.c fio/td_error.c fio/zbd.c \
- fio/profiles/tiobench.c fio/profiles/act.c fio/io_u_queue.c fio/filelock.c fio/steadystate.c \
- fio/workqueue.c fio/rate-submit.c fio/optgroup.c fio/helper_thread.c fio/zone-dist.c \
- fio/dedupe.c
-
-CSRCS += fio/engines/exec.c fio/engines/cpu.c fio/engines/sync.c fio/engines/ftruncate.c \
- fio/engines/falloc.c fio/engines/fileoperations.c fio/engines/mmap.c \
- fio/engines/null.c fio/engines/net.c
-
-ifeq ($(wildcard fio/.git),)
-VERSION ?= master
-fio.zip:
- $(Q) curl -L https://github.com/ldorau/fio/archive/refs/heads/master.zip -o fio.zip
- $(Q) unzip -o fio.zip
- $(Q) mv fio-$(VERSION) fio
- $(Q) patch -p0 < 0001-external-fio-fix-compile-warning.patch
- $(Q) patch -p0 < 0002-external-fio-add-os-nuttx-support.patch
- $(Q) patch -p0 < 0003-external-fio-modify-smaller-size-for-nuttx.patch
- $(Q) patch -p0 < 0004-external-fio-fix-runtime-error-by-asan.patch
- $(Q) patch -p0 < 0005-external-fio-fix-compile-warning.patch
- $(Q) patch -p0 < 0006-external-fio-reinit-global-var-issue-when-run-multip.patch
- $(Q) patch -p0 < 0007-external-fio-add-engine-init.patch
- $(Q) patch -p0 < 0008-fio-fix-memory-leak-run-cpuio.fio.patch
- $(Q) patch -p0 < 0009-fio-fix-memory-leak-ioengine-filecreate.patch
- $(Q) patch -p0 < 0010-fio-fix-memory-leak-ioengine-exec.patch
-
-context:: fio.zip
-
-distclean::
- $(call DELDIR, fio)
- $(call DELFILE, fio.zip)
-
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/iozone/.gitignore b/benchmarks/iozone/.gitignore
deleted file mode 100644
index 35b179466..000000000
--- a/benchmarks/iozone/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/iozone
diff --git a/benchmarks/iozone/CMakeLists.txt b/benchmarks/iozone/CMakeLists.txt
deleted file mode 100644
index 0559ad63e..000000000
--- a/benchmarks/iozone/CMakeLists.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/iozone/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_IOZONE)
-
- # Define the directory and file paths
- set(IOZONE_VERSION "${CONFIG_BENCHMARK_IOZONE_VERSION}") # Adjust this as
- # needed
- set(IOZONE_DIR ${CMAKE_CURRENT_LIST_DIR}/iozone)
- set(IOZONE_ZIP ${IOZONE_DIR}.tgz)
- set(IOZONE_URL
- "https://www.iozone.org/src/current/iozone${IOZONE_VERSION}.tgz")
-
- # Download and unpack iozone if not already present
- if(NOT EXISTS ${IOZONE_DIR})
- FetchContent_Declare(
- iozone_fetch
- URL ${IOZONE_URL} SOURCE_DIR ${IOZONE_DIR}
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30
- PATCH_COMMAND patch -p1 -d ${IOZONE_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/iozone.patch)
-
- FetchContent_GetProperties(iozone_fetch)
- if(NOT iozone_fetch_POPULATED)
- FetchContent_Populate(iozone_fetch)
- endif()
- endif()
-
- # Define source files
- set(CSRCS ${IOZONE_DIR}/src/current/libbif.c)
- set(MAINSRC ${IOZONE_DIR}/src/current/iozone.c)
-
- # Define compile flags
- set(CFLAGS
- -Dunix
- -DHAVE_ANSIC_C
- -DHAVE_PREAD
- -DNAME=\"nuttx\"
- -DNO_MADVISE
- -DNO_FORK
- -D__FreeBSD__
- -DNO_THREADS
- -Wno-unused-parameter
- -Wno-unused-function
- -Wno-shadow
- -Wno-unused-but-set-variable
- -Wno-strict-prototypes
- -Wno-misleading-indentation
- -Wno-maybe-uninitialized
- -DMAXBUFFERSIZE=32*1024
- -DMAXSTREAMS=8
- -DMAXNAMESIZE=NAME_MAX
- -DRECLEN_START=1024)
-
- # Add application to the build
- set(SRCS ${IOZONE_DIR}/src/current/iozone.c ${CSRCS})
- nuttx_add_application(
- NAME
- iozone
- PRIORITY
- ${CONFIG_BENCHMARK_IOZONE_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_IOZONE_STACKSIZE}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-
-endif()
diff --git a/benchmarks/iozone/Kconfig b/benchmarks/iozone/Kconfig
deleted file mode 100644
index eedff6067..000000000
--- a/benchmarks/iozone/Kconfig
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_IOZONE
- tristate "IOzone, filesystem benchmark tool"
- default n
- ---help---
- https://www.iozone.org/
-
-if BENCHMARK_IOZONE
-
-config BENCHMARK_IOZONE_PROGNAME
- string "Program name"
- default "iozone"
-
-config BENCHMARK_IOZONE_PRIORITY
- int "IOzone task priority"
- default 100
-
-config BENCHMARK_IOZONE_STACKSIZE
- int "IOzone stack size"
- default 8192
-
-config BENCHMARK_IOZONE_VERSION
- string "iozone version"
- default "3_493"
-
-endif
diff --git a/benchmarks/iozone/Make.defs b/benchmarks/iozone/Make.defs
deleted file mode 100644
index b3712058a..000000000
--- a/benchmarks/iozone/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/iozone/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_IOZONE),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/iozone
-endif
diff --git a/benchmarks/iozone/Makefile b/benchmarks/iozone/Makefile
deleted file mode 100644
index 22985764c..000000000
--- a/benchmarks/iozone/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-############################################################################
-# apps/benchmarks/iozone/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = $(CONFIG_BENCHMARK_IOZONE_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_IOZONE_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_IOZONE_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_IOZONE)
-
-CFLAGS += -Dunix -DHAVE_ANSIC_C -DHAVE_PREAD -DNAME='"nuttx"'
-CFLAGS += -DNO_MADVISE -DNO_FORK -D__FreeBSD__ -DNO_THREADS
-CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wno-shadow
-CFLAGS += -Wno-unused-but-set-variable -Wno-strict-prototypes
-CFLAGS += -Wno-misleading-indentation -Wno-maybe-uninitialized
-
-CFLAGS += -DMAXBUFFERSIZE=32*1024 -DMAXSTREAMS=8 -DMAXNAMESIZE=NAME_MAX
-CFLAGS += -DRECLEN_START=1024
-
-CSRCS = iozone/src/current/libbif.c
-MAINSRC = iozone/src/current/iozone.c
-
-CONFIG_BENCHMARK_IOZONE_URL ?= "https://www.iozone.org/src/current/"
-
-IOZONE_UNPACKNAME = iozone
-IOZONE_VERSION = $(patsubst "%",%,$(strip $(CONFIG_BENCHMARK_IOZONE_VERSION)))
-IOZONE_ZIP = iozone$(IOZONE_VERSION).tgz
-
-$(IOZONE_ZIP):
- @echo "Downloading: $(IOZONE_ZIP)"
- $(Q) curl -O -L $(CONFIG_BENCHMARK_IOZONE_URL)/$(IOZONE_ZIP)
-
-$(IOZONE_UNPACKNAME): $(IOZONE_ZIP)
- @echo "Unpacking: $(IOZONE_ZIP) -> $(IOZONE_UNPACKNAME)"
- $(Q) tar zxvf $(IOZONE_ZIP)
- $(Q) mv iozone$(IOZONE_VERSION) $(IOZONE_UNPACKNAME)
- $(Q) echo "Patching $(IOZONE_UNPACKNAME)"
- $(Q) cat iozone.patch | patch -s -N -d $(IOZONE_UNPACKNAME) -p1
- $(Q) touch $(IOZONE_UNPACKNAME)
-
-# Download and unpack tarball if no git repo found
-ifeq ($(wildcard $(IOZONE_UNPACKNAME)/.git),)
-context:: $(IOZONE_UNPACKNAME)
-
-distclean::
- $(call DELDIR, $(IOZONE_UNPACKNAME))
- $(call DELFILE, $(IOZONE_ZIP))
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/iozone/iozone.patch b/benchmarks/iozone/iozone.patch
deleted file mode 100644
index e970c931f..000000000
--- a/benchmarks/iozone/iozone.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-diff --git a/src/current/iozone.c b/src/current/iozone.c
-index eda702d..59ee513 100644
---- a/src/current/iozone.c
-+++ b/src/current/iozone.c
-@@ -82,11 +82,12 @@ extern int h_errno; /* imported for errors */
- #endif
- #endif
-
-+#include
- #ifdef NO_FORK
-+pid_t no_fork(void);
- #define fork no_fork
- #endif
-
--#include
- #include
- #if defined (__LP64__) || defined(OSF_64) || defined(__alpha__) || defined(__arch64__) || defined(_LP64) || defined(__s390x__) || defined(__AMD64__)
- #define MODE "\tCompiled for 64 bit mode."
-@@ -870,16 +871,22 @@ struct master_neutral_command {
- /* At 8 Meg switch to large records */
- #define CROSSOVER (8*1024)
- /*maximum buffer size*/
-+#ifndef MAXBUFFERSIZE
- #define MAXBUFFERSIZE (8*1024*1024)
-+#endif
- #else
- /* At 16 Meg switch to large records */
- #define CROSSOVER (16*1024)
-+#ifndef MAXBUFFERSIZE
- /* Maximum buffer size*/
- #define MAXBUFFERSIZE (16*1024*1024)
- #endif
-+#endif
-
- /* Maximum number of children. Threads/procs/clients */
-+#ifndef MAXSTREAMS
- #define MAXSTREAMS 1024
-+#endif
-
- /* Minimum buffer size */
- #define MINBUFFERSIZE 128
-@@ -899,7 +906,9 @@ struct master_neutral_command {
-
-
- /* Maximum number of characters in filename */
-+#ifndef MAXNAMESIZE
- #define MAXNAMESIZE 1000
-+#endif
-
- /*
- * Define the typical output that the user will see on their
-@@ -953,7 +962,9 @@ struct master_neutral_command {
- /* Default maximum file size. This is 512 MBytes */
- #define KILOBYTES_END (1024*512)
- /* Default starting record size */
-+#ifndef RECLEN_START
- #define RECLEN_START 4096
-+#endif
- /* Default maximum record size */
- #define RECLEN_END (MAXBUFFERSIZE)
- /* Multiplier for each itteration on file and record size */
-@@ -1640,7 +1651,7 @@ char dummyfile1 [MAXNAMESIZE]; /* name of dummy file */
- char *filearray[MAXSTREAMS]; /* array of file names */
- int blkidx[MAXSTREAMS]; /* array of file names */
- char tfile[MAXNAMESIZE];
--char *buffer,*buffer1, *mbuffer,*mainbuffer;
-+static char *buffer,*buffer1, *mbuffer,*mainbuffer;
- FILE *pi,*r_traj_fd,*w_traj_fd;
- VOLATILE char *pbuffer;
- char *default_filename="iozone.tmp"; /*default name of temporary file*/
-@@ -1805,7 +1816,7 @@ int direct_flag;
- int current_client_number;
- long long chid;
- int file_lock;
--unsigned int pattern;
-+static unsigned int pattern;
- long long stride = STRIDE;
- long long delay,purge,fetchon;
- off64_t numrecs64 = (off64_t)NUMRECS;
-@@ -19219,7 +19230,7 @@ dump_throughput_cpu()
- long long x,y,i,j;
- char *port;
- char *label;
-- char print_str[300];
-+ char print_str[512];
- x=max_x;
- y=max_y;
-
-@@ -19288,7 +19299,7 @@ dump_throughput()
- long long x,y,i,j;
- char *port;
- char *label;
-- char print_str[300];
-+ char print_str[512];
- x=max_x;
- y=max_y;
-
-@@ -24340,7 +24351,7 @@ start_monitor(test)
- char *test;
- #endif
- {
-- char command_line[256];
-+ char command_line[512];
- if(strlen(imon_start)!=0)
- {
- if(imon_sync)
-@@ -24358,7 +24369,7 @@ stop_monitor(test)
- char *test;
- #endif
- {
-- char command_line[256];
-+ char command_line[512];
- if(strlen(imon_stop)!=0)
- {
- if(imon_sync)
-@@ -24867,6 +24878,9 @@ int main(void)
- /*
- ** Type definitions (for convenience).
- */
-+
-+#undef false
-+#undef true
- #if defined(Windows)
- int false = 0;
- int true = 1;
diff --git a/benchmarks/mtd/CMakeLists.txt b/benchmarks/mtd/CMakeLists.txt
deleted file mode 100644
index 975ed1001..000000000
--- a/benchmarks/mtd/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/mtd/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_MTD)
- nuttx_add_application(
- NAME
- mtd
- STACKSIZE
- ${CONFIG_DEFAULT_TASK_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_MTD}
- SRCS
- mtd.c)
-endif()
diff --git a/benchmarks/mtd/Kconfig b/benchmarks/mtd/Kconfig
deleted file mode 100644
index 0628e7835..000000000
--- a/benchmarks/mtd/Kconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_MTD
- tristate "MTD test and transfer rate benchmark"
- default n
- depends on BUILD_FLAT && MTD && LIBC_FLOATINGPOINT
- ---help---
- This testing/benchmark application performs an erase/write
- operation to evaluate write transfer rate and then reads the
- written content back to evaluate the read transfer rate. Finally,
- it compares the read data with the previously written data to
- ensure the MTD device is working as expected.
-
- NOTE: This application uses internal OS interfaces and so it is not
- available in the NuttX kernel build.
diff --git a/benchmarks/mtd/Make.defs b/benchmarks/mtd/Make.defs
deleted file mode 100644
index 9bf77e7b9..000000000
--- a/benchmarks/mtd/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/mtd/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_MTD),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/mtd/
-endif
diff --git a/benchmarks/mtd/mtd.c b/benchmarks/mtd/mtd.c
deleted file mode 100644
index b9d3d8a98..000000000
--- a/benchmarks/mtd/mtd.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/mtd/mtd.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- struct inode *inode;
- struct timespec start;
- struct timespec end;
- struct mtd_geometry_s geo;
- struct partition_info_s info;
- int ret;
- int x;
- double elapsed_time;
- double transfer_rate;
- size_t total_bytes_written = 0;
- size_t total_bytes_read = 0;
- char *buffer;
-
- /* Argument given? */
-
- if (argc < 2)
- {
- fprintf(stderr, "usage: mtd flash_block_device\n");
- return -1;
- }
-
- /* Find the inode of the block driver identified by 'source' */
-
- ret = open_blockdriver(argv[1], 0, &inode);
- if (ret < 0)
- {
- fprintf(stderr, "Failed to open %s\n", argv[1]);
- return ret;
- }
-
- /* Get the low-level format from the device. */
-
- ret = inode->u.i_bops->ioctl(inode, BIOC_PARTINFO, (unsigned long) &info);
- if (ret != OK)
- {
- fprintf(stderr, "Device is not a block device\n");
- goto errout_with_driver;
- }
-
- /* Get the MTD geometry */
-
- ret = inode->u.i_bops->ioctl(inode, MTDIOC_GEOMETRY, (unsigned long) &geo);
- if (ret != OK)
- {
- fprintf(stderr, "Device is not a MTD device");
- goto errout_with_driver;
- }
-
- /* Report the device structure */
-
- printf("FLASH device parameters:\n");
- printf(" Sector size: %10d\n", info.sectorsize);
- printf(" Sector count: %10d\n", info.numsectors);
- printf(" Erase block size: %10" PRIu32 "\n", geo.erasesize);
- printf(" Total size: %10d\n", info.sectorsize * info.numsectors);
-
- if (info.sectorsize != geo.erasesize)
- {
- fprintf(stderr, "Sector size does not match the erase block size.\n"
- "Please adjust the sector size to enable erasing and writing "
- "without using an intermediary read buffer.\n");
- goto errout_with_driver;
- }
-
- /* Allocate buffers to use */
-
- buffer = (char *)malloc(info.sectorsize);
- if (buffer == NULL)
- {
- fprintf(stderr, "Error allocating buffer\n");
- goto errout_with_driver;
- }
-
- /* Fill the buffer with known data */
-
- for (int i = 0; i < info.sectorsize; i++)
- {
- buffer[i] = (char)(i & 0xff);
- }
-
- /* Now write some data to the sector */
-
- printf("\nStarting write operation...\n");
-
- clock_gettime(CLOCK_MONOTONIC, &start);
- for (x = 0; x < info.numsectors; x++)
- {
- inode->u.i_bops->write(inode, (const unsigned char *)buffer, x, 1);
-
- total_bytes_written += info.sectorsize;
- }
-
- clock_gettime(CLOCK_MONOTONIC, &end);
-
- elapsed_time = (end.tv_sec - start.tv_sec) + \
- (end.tv_nsec - start.tv_nsec) / 1e9;
- transfer_rate = (total_bytes_written / elapsed_time) / 1024;
-
- printf("\nWrite operation completed in %.2f seconds\n", elapsed_time);
- printf("Total bytes written: %zu\n", total_bytes_written);
- printf("Transfer rate [write]: %.2f KiB/s\n", transfer_rate);
-
- /* Now read the data back to validate everything was written and can
- * be read.
- */
-
- printf("\nStarting read operation...\n");
-
- clock_gettime(CLOCK_MONOTONIC, &start);
-
- for (x = 0; x < info.numsectors; x++)
- {
- inode->u.i_bops->read(inode, (unsigned char *)buffer, x, 1);
-
- total_bytes_read += info.sectorsize;
- }
-
- clock_gettime(CLOCK_MONOTONIC, &end);
-
- elapsed_time = (end.tv_sec - start.tv_sec) + \
- (end.tv_nsec - start.tv_nsec) / 1e9;
- transfer_rate = (total_bytes_written / elapsed_time) / 1024;
-
- printf("\nRead operation completed in %.2f seconds\n", elapsed_time);
- printf("Total bytes read: %zu\n", total_bytes_read);
- printf("Transfer rate [read]: %.2f KiB/s\n", transfer_rate);
-
- /* Compare the read data with the written data */
-
- for (int i = 0; i < info.sectorsize; i++)
- {
- if (buffer[i] != (char)(i & 0xff))
- {
- printf("\nData mismatch at byte %d: expected %02X, got %02X\n",
- i, (unsigned char)(i & 0xff), (unsigned char)buffer[i]);
- goto errout_with_buffers;
- }
- }
-
- printf("\nData verification successful: read data matches written data\n");
-
-errout_with_buffers:
-
- /* Free the allocated buffers */
-
- free(buffer);
-
-errout_with_driver:
-
- /* Now close the block device and exit */
-
- close_blockdriver(inode);
- return 0;
-}
diff --git a/benchmarks/osperf/CMakeLists.txt b/benchmarks/osperf/CMakeLists.txt
deleted file mode 100644
index e47386d09..000000000
--- a/benchmarks/osperf/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/osperf/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_OSPERF)
- nuttx_add_application(
- NAME
- osperf
- SRCS
- osperf.c
- STACKSIZE
- ${CONFIG_BENCHMARK_OSPERF_STACKSIZE}
- PRIORITY
- ${CONFIG_BENCHMARK_OSPERF_PRIORITY})
-endif()
diff --git a/benchmarks/osperf/Kconfig b/benchmarks/osperf/Kconfig
deleted file mode 100644
index da03babd0..000000000
--- a/benchmarks/osperf/Kconfig
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_OSPERF
- tristate "System performance profiling"
- default n
- depends on PIPES
- depends on SCHED_HPWORK
- ---help---
- Measure the performance of core system functions, such as thread
- switching and the time required for semaphore execution
-
-if BENCHMARK_OSPERF
-
-config BENCHMARK_OSPERF_PRIORITY
- int "OS profiling task priority"
- default 100
-
-config BENCHMARK_OSPERF_STACKSIZE
- int "OS profiling stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/osperf/Make.defs b/benchmarks/osperf/Make.defs
deleted file mode 100644
index 1efa69044..000000000
--- a/benchmarks/osperf/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/osperf/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_OSPERF),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/osperf
-endif
diff --git a/benchmarks/osperf/osperf.c b/benchmarks/osperf/osperf.c
deleted file mode 100644
index 757fb4216..000000000
--- a/benchmarks/osperf/osperf.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/osperf/osperf.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct performance_time_s
-{
- clock_t start;
- clock_t end;
-};
-
-struct performance_thread_s
-{
- sem_t sem;
- struct performance_time_s time;
-};
-
-struct performance_entry_s
-{
- const char name[NAME_MAX];
- CODE size_t (*entry)(void);
-};
-
-/****************************************************************************
- * Private Functions Prototypes
- ****************************************************************************/
-
-static size_t pthread_create_performance(void);
-static size_t pthread_switch_performance(void);
-static size_t context_switch_performance(void);
-static size_t hpwork_performance(void);
-static size_t poll_performance(void);
-static size_t pipe_performance(void);
-static size_t semwait_performance(void);
-static size_t sempost_performance(void);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const struct performance_entry_s g_entry_list[] =
-{
- {"pthread-create", pthread_create_performance},
- {"pthread-switch", pthread_switch_performance},
- {"context-switch", context_switch_performance},
- {"hpwork", hpwork_performance},
- {"poll-write", poll_performance},
- {"pipe-rw", pipe_performance},
- {"semwait", semwait_performance},
- {"sempost", sempost_performance},
-};
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static int performance_thread_create(FAR void *(*entry)(FAR void *),
- FAR void *arg, int priority)
-{
- struct sched_param param;
- pthread_attr_t attr;
- pthread_t tid;
-
- param.sched_priority = priority;
- pthread_attr_init(&attr);
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
- pthread_attr_setschedparam(&attr, ¶m);
- pthread_create(&tid, &attr, entry, arg);
- DEBUGASSERT(tid > 0);
- return tid;
-}
-
-static void performance_start(FAR struct performance_time_s *result)
-{
- result->start = perf_gettime();
-}
-
-static void performance_end(FAR struct performance_time_s *result)
-{
- result->end = perf_gettime();
-}
-
-static size_t performance_gettime(FAR struct performance_time_s *result)
-{
- struct timespec ts;
- perf_convert(result->end - result->start, &ts);
- return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
-}
-
-/****************************************************************************
- * Pthread switch performance
- ****************************************************************************/
-
-static FAR void *pthread_switch_task(FAR void *arg)
-{
- FAR struct performance_thread_s *perf = arg;
- irqstate_t flags = enter_critical_section();
- sem_wait(&perf->sem);
- performance_end(&perf->time);
- leave_critical_section(flags);
- return NULL;
-}
-
-static size_t pthread_switch_performance(void)
-{
- struct performance_thread_s perf;
- pthread_t tid;
-
- sem_init(&perf.sem, 0, 0);
- tid = performance_thread_create(pthread_switch_task, &perf,
- CONFIG_BENCHMARK_OSPERF_PRIORITY + 1);
-
- performance_start(&perf.time);
- sem_post(&perf.sem);
- pthread_join(tid, NULL);
-
- return performance_gettime(&perf.time);
-}
-
-/****************************************************************************
- * Pthread create performance
- ****************************************************************************/
-
-static FAR void *pthread_create_task(FAR void *arg)
-{
- FAR struct performance_time_s *time = arg;
- performance_end(time);
- return NULL;
-}
-
-static size_t pthread_create_performance(void)
-{
- struct performance_time_s result;
- struct sched_param param;
- pthread_attr_t attr;
- pthread_t tid;
-
- sched_getparam(gettid(), ¶m);
- param.sched_priority++;
- pthread_attr_init(&attr);
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
- pthread_attr_setschedparam(&attr, ¶m);
-
- performance_start(&result);
- pthread_create(&tid, &attr, pthread_create_task, &result);
- pthread_join(tid, NULL);
-
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * Context create performance
- ****************************************************************************/
-
-static FAR void *context_switch_task(FAR void *arg)
-{
- FAR struct performance_time_s *time = arg;
- sched_yield();
- performance_end(time);
- return 0;
-}
-
-static size_t context_switch_performance(void)
-{
- struct performance_time_s time;
- int tid;
-
- tid = performance_thread_create(context_switch_task, &time,
- CONFIG_INIT_PRIORITY);
- sched_yield();
- performance_start(&time);
- sched_yield();
- pthread_join(tid, NULL);
- return performance_gettime(&time);
-}
-
-/****************************************************************************
- * wdog performance
- ****************************************************************************/
-
-static void work_handle(void *arg)
-{
- FAR struct performance_time_s *time = ((FAR void **)arg)[2];
- FAR sem_t *sem = ((void **)arg)[1];
- performance_end(time);
- sem_post(sem);
-}
-
-static size_t hpwork_performance(void)
-{
- struct performance_time_s result;
- struct work_s work;
- sem_t sem = SEM_INITIALIZER(0);
- int ret;
-
- FAR void *args = (void *[])
- {
- (FAR void *)&work,
- (FAR void *)&sem,
- (FAR void *)&result
- };
-
- memset(&result, 0, sizeof(result));
- memset(&work, 0, sizeof(work));
- performance_start(&result);
- ret = work_queue(HPWORK, &work, work_handle, args, 0);
- DEBUGASSERT(ret == 0);
-
- sem_wait(&sem);
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * poll-write performance
- ****************************************************************************/
-
-static FAR void *poll_task(FAR void *arg)
-{
- FAR void **argv = arg;
- FAR struct performance_time_s *time = argv[0];
- int pipefd = (int)(uintptr_t)argv[1];
-
- performance_start(time);
- write(pipefd, "a", 1);
- return 0;
-}
-
-static size_t poll_performance(void)
-{
- struct performance_time_s result;
- struct pollfd fds;
- FAR void *argv[2];
- int pipefd[2];
- int ret;
-
- ret = pipe(pipefd);
- DEBUGASSERT(ret == 0);
- fds.fd = pipefd[0];
- fds.events = POLLIN;
- argv[0] = (FAR char *)&result;
- argv[1] = (FAR char *)(uintptr_t)pipefd[1];
-
- ret = performance_thread_create(poll_task, argv, CONFIG_INIT_PRIORITY);
-
- poll(&fds, 1, -1);
- performance_end(&result);
-
- pthread_join(ret, NULL);
- close(pipefd[0]);
- close(pipefd[1]);
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * pipe performance
- ****************************************************************************/
-
-static size_t pipe_performance(void)
-{
- struct performance_time_s result;
- int pipefd[2];
- int ret;
- char r;
-
- ret = pipe(pipefd);
- DEBUGASSERT(ret == 0);
-
- performance_start(&result);
- write(pipefd[0], "a", 1);
- read(pipefd[1], &r, 1);
- performance_end(&result);
-
- close(pipefd[0]);
- close(pipefd[1]);
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * semwait_performance
- ****************************************************************************/
-
-static size_t semwait_performance(void)
-{
- struct performance_time_s result;
- sem_t sem;
-
- sem_init(&sem, 0, 2);
-
- performance_start(&result);
- sem_wait(&sem);
- performance_end(&result);
-
- sem_destroy(&sem);
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * sempost_performance
- ****************************************************************************/
-
-static size_t sempost_performance(void)
-{
- struct performance_time_s result;
- sem_t sem;
-
- sem_init(&sem, 0, 0);
-
- performance_start(&result);
- sem_post(&sem);
- performance_end(&result);
-
- sem_destroy(&sem);
- return performance_gettime(&result);
-}
-
-/****************************************************************************
- * performance_help
- ****************************************************************************/
-
-static void performance_help(void)
-{
- printf("Usage: performance [OPTIONS] [name]\n\n");
- printf("OPTIONS:\n");
- printf("\t-c, \tNumber of times to run each test\n");
- printf("\t-d, \tShow detail of each test\n");
- printf("\t-h, \tShow this help message\n");
- printf("\t-l, \tList all tests\n");
-}
-
-/****************************************************************************
- * performance_run
- ****************************************************************************/
-
-static void performance_run(const FAR struct performance_entry_s *item,
- size_t count, bool detail)
-{
- size_t total = 0;
- size_t max = 0;
- size_t min = 0;
- size_t i;
-
- for (i = 0; i < count; i++)
- {
- irqstate_t flags = enter_critical_section();
- size_t time = item->entry();
- leave_critical_section(flags);
-
- total += time;
- if (time > max)
- {
- max = time;
- }
-
- if (time < min || min == 0)
- {
- min = time;
- }
-
- if (detail)
- {
- printf("\t%zu: %zu\n", i, time);
- }
- }
-
- printf("%-*s %10zu %10zu %10zu\n", NAME_MAX, item->name, max, min,
- total / count);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-static const FAR
-struct performance_entry_s *find_entry(FAR const char *name)
-{
- size_t i;
-
- for (i = 0; i < nitems(g_entry_list); i++)
- {
- if (strcmp(name, g_entry_list[i].name) == 0)
- {
- return &g_entry_list[i];
- }
- }
-
- return NULL;
-}
-
-void performance_list(void)
-{
- size_t i;
-
- for (i = 0; i < nitems(g_entry_list); i++)
- {
- printf("%s\n", g_entry_list[i].name);
- }
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- const FAR struct performance_entry_s *item = NULL;
- bool detail = false;
- size_t count = 100;
- size_t i;
- int opt;
-
- while ((opt = getopt(argc, argv, "dc:hl")) != -1)
- {
- switch (opt)
- {
- case 'd':
- detail = true;
- break;
- case 'c':
- count = strtoul(optarg, NULL, 0);
- break;
- case 'h':
- performance_help();
- return EXIT_SUCCESS;
- case 'l':
- performance_list();
- return EXIT_SUCCESS;
- default:
- performance_help();
- return EXIT_FAILURE;
- }
- }
-
- if (optind < argc)
- {
- item = find_entry(argv[optind]);
- if (item == NULL)
- {
- printf("Can't find %s\n", argv[optind]);
- return EXIT_FAILURE;
- }
- }
-
- printf("OS performance args: count:%zu, detail:%s\n", count,
- detail ? "true" : "false");
-
- printf("==============================================================\n");
- printf("%-*s %10s %10s %10s\n", NAME_MAX, "Describe", "Max", "Min", "Avg");
-
- if (item != NULL)
- {
- performance_run(item, count, detail);
- return EXIT_SUCCESS;
- }
-
- for (i = 0; i < nitems(g_entry_list); i++)
- {
- item = &g_entry_list[i];
- performance_run(item, count, detail);
- }
-
- return EXIT_SUCCESS;
-}
diff --git a/benchmarks/ramspeed/CMakeLists.txt b/benchmarks/ramspeed/CMakeLists.txt
deleted file mode 100644
index a8b0df091..000000000
--- a/benchmarks/ramspeed/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/ramspeed/CMakeLists.txt
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_RAMSPEED)
- nuttx_add_application(
- NAME
- ${CONFIG_BENCHMARK_RAMSPEED_PROGNAME}
- SRCS
- ramspeed_main.c
- STACKSIZE
- ${CONFIG_BENCHMARK_RAMSPEED_STACKSIZE}
- PRIORITY
- ${CONFIG_BENCHMARK_RAMSPEED_PRIORITY})
-endif()
diff --git a/benchmarks/ramspeed/Make.defs b/benchmarks/ramspeed/Make.defs
deleted file mode 100644
index b78ae67fb..000000000
--- a/benchmarks/ramspeed/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/ramspeed/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_RAMSPEED),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/ramspeed
-endif
diff --git a/benchmarks/ramspeed/Makefile b/benchmarks/ramspeed/Makefile
deleted file mode 100644
index c11a67ff2..000000000
--- a/benchmarks/ramspeed/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-############################################################################
-# apps/benchmarks/ramspeed/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-# RAM speed test
-
-PROGNAME = $(CONFIG_BENCHMARK_RAMSPEED_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_RAMSPEED_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_RAMSPEED_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_RAMSPEED)
-
-MAINSRC = ramspeed_main.c
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/rt-tests/.gitignore b/benchmarks/rt-tests/.gitignore
deleted file mode 100644
index baa0c8710..000000000
--- a/benchmarks/rt-tests/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/rt-tests
-/*.zip
diff --git a/benchmarks/rt-tests/0001-rt-tests-cyclictest-Port-for-NuttX.patch b/benchmarks/rt-tests/0001-rt-tests-cyclictest-Port-for-NuttX.patch
deleted file mode 100644
index bb6d05fc7..000000000
--- a/benchmarks/rt-tests/0001-rt-tests-cyclictest-Port-for-NuttX.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From cbd7831e20f387a35e94a50b95e0b8db5c5e63dd Mon Sep 17 00:00:00 2001
-From: ouyangxiangzhen
-Date: Mon, 8 Jul 2024 10:43:14 +0800
-Subject: [PATCH] rt-tests/cyclictest: Port for NuttX
-
-VELAPLATFO-37815
-
-This patch ports cyclictest for NuttX.
-
-Change-Id: I918da053887aaba78910e230db0169239dba3b73
-Signed-off-by: ouyangxiangzhen
----
- src/cyclictest/cyclictest.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
-index c5c3389..0edb684 100644
---- a/src/cyclictest/cyclictest.c
-+++ b/src/cyclictest/cyclictest.c
-@@ -847,7 +847,11 @@ static void display_help(int error)
- static int use_nanosleep = MODE_CLOCK_NANOSLEEP;
- static int timermode = TIMER_ABSTIME;
- static int use_system;
-+#ifdef RTTESTS_PRIORITY
-+static int priority = RTTESTS_PRIORITY;
-+#else
- static int priority;
-+#endif
- static int policy = SCHED_OTHER; /* default policy if not specified */
- static int num_threads = 1;
- static int max_cycles;
-@@ -1224,7 +1228,7 @@ static void process_options(int argc, char *argv[], int max_cpus)
- if (distance == -1)
- distance = DEFAULT_DISTANCE;
-
-- if (priority < 0 || priority > 99)
-+ if (priority < 0 || priority > 255)
- error = 1;
-
- if (num_threads == -1)
---
-2.34.1
-
diff --git a/benchmarks/rt-tests/CMakeLists.txt b/benchmarks/rt-tests/CMakeLists.txt
deleted file mode 100644
index 9d7e9213f..000000000
--- a/benchmarks/rt-tests/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-############################################################################
-# apps/benchmarks/rt-tests/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-if(CONFIG_BENCHMARK_RTTESTS)
-
- if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rt-tests/.git)
- set(RTTESTS_URL
- "https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git")
- set(RTTESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rt-tests)
-
- execute_process(
- COMMAND git clone ${RTTESTS_URL} ${RTTESTS_DIR}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE GIT_CLONE_RESULT)
-
- if(NOT ${GIT_CLONE_RESULT} EQUAL 0)
- message(FATAL_ERROR "Failed to clone rt-tests repository")
- endif()
-
- execute_process(
- COMMAND cd ${RTTESTS_DIR} && git checkout -q ${RTTESTS_VERSION} && patch
- -p1 < ../0001-rt-tests-cyclictest-Port-for-NuttX.patch
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
- add_custom_target(distclean COMMAND ${CMAKE_COMMAND} -E remove_directory
- ${RTTESTS_DIR})
- endif()
-
- list(
- APPEND
- SRCS
- rt-tests/src/cyclictest/cyclictest.c
- rt-tests/src/lib/rt-error.c
- rt-tests/src/lib/histogram.c
- rt-tests/src/lib/rt-utils.c
- rt-tests/src/lib/rt-numa.c)
-
- list(
- APPEND
- CFLAGS
- -Irt-tests/src/include
- -I.
- -DVERSION=0.1
- -DSYS_gettid=0
- -Dgettid=rttest_gettid
- -D'syscall
- (x)
- =
- ((pid_t) (x))
- '
- -w
- -DRTTESTS_PRIORITY=${CONFIG_BENCHMARK_RTTESTS_PRIORITY}+1)
-
- nuttx_add_application(
- NAME
- cyclictest
- PRIORITY
- ${CONFIG_BENCHMARK_RTTESTS_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_RTTESTS_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_RTTESTS}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-endif()
diff --git a/benchmarks/rt-tests/Kconfig b/benchmarks/rt-tests/Kconfig
deleted file mode 100644
index 40650deb0..000000000
--- a/benchmarks/rt-tests/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_RTTESTS
- tristate "RT-Tests"
- default n
- depends on PIPES && ALLOW_GPL_COMPONENTS
- ---help---
- Measure the timer jitter
-
-if BENCHMARK_RTTESTS
-
-config BENCHMARK_RTTESTS_PRIORITY
- int "RT-Tests task priority"
- default 200
-
-config BENCHMARK_RTTESTS_STACKSIZE
- int "RT-Tests stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/rt-tests/Make.defs b/benchmarks/rt-tests/Make.defs
deleted file mode 100644
index 7c9c5849c..000000000
--- a/benchmarks/rt-tests/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/rt-tests/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_RTTESTS),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/rt-tests
-endif
diff --git a/benchmarks/rt-tests/Makefile b/benchmarks/rt-tests/Makefile
deleted file mode 100644
index 5497d732e..000000000
--- a/benchmarks/rt-tests/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-############################################################################
-# apps/benchmarks/rt-tests/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-############################################################################
-# Targets
-############################################################################
-
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = cyclictest
-PRIORITY = $(CONFIG_BENCHMARK_RTTESTS_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_RTTESTS_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_RTTESTS)
-
-RTTESTS_PATH = $(APPDIR)/benchmarks/rt-tests/rt-tests
-RTTESTS_URL = https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
-RTTESTS_VERSION = cadd661f984c0e6717e681fdaca1ce589b0ed964
-RTTESTS_GIT = rt-tests
-
-ifeq ($(wildcard rt-tests/.git),)
-rt-tests:
- @echo "Git Cloning: $(RTTESTS_URL)"
- $(Q) git clone $(RTTESTS_URL)
- @echo "Checkout commit: $(RTTESTS_VERSION)"
- $(Q) cd $(RTTESTS_PATH) && \
- git checkout -q $(RTTESTS_VERSION)
- @echo "Patching: Applying patch"
- $(Q) cd $(RTTESTS_PATH) && \
- patch -p1 < ../0001-rt-tests-cyclictest-Port-for-NuttX.patch
-
-context:: rt-tests
-endif
-
-distclean::
- $(call DELDIR, $(RTTESTS_GIT))
-
-MAINSRC = rt-tests/src/cyclictest/cyclictest.c
-CSRCS = rt-tests/src/lib/rt-error.c rt-tests/src/lib/histogram.c
-CSRCS += rt-tests/src/lib/rt-utils.c rt-tests/src/lib/rt-numa.c
-
-CFLAGS += -Irt-tests/src/include -I. -DVERSION=0.1
-CFLAGS += -DSYS_gettid=0 -Dgettid=rttest_gettid -D'syscall(x)=((pid_t)(x))'
-CFLAGS += -w -DRTTESTS_PRIORITY=$(CONFIG_BENCHMARK_RTTESTS_PRIORITY)+1
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/rt-tests/numa.h b/benchmarks/rt-tests/numa.h
deleted file mode 100644
index 6938e9eb9..000000000
--- a/benchmarks/rt-tests/numa.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/rt-tests/numa.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __NUMA_H__
-#define __NUMA_H__
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define CACHE_LINESIZE (64)
-#define numa_run_on_node(...) (-1)
-#define numa_node_of_cpu(...) (-1)
-#define numa_alloc_onnode(size, node) memalign(CACHE_LINESIZE, size)
-#define numa_free(ptr, size) free(ptr)
-#define numa_available() (-1)
-
-struct bitmask
-{
- unsigned long size; /* number of bits in the map */
- unsigned long *maskp;
-};
-
-static inline
-struct bitmask *numa_allocate_cpumask(void)
-{
- return NULL;
-}
-
-static inline void numa_bitmask_free(struct bitmask *mask)
-{
- return;
-}
-
-static inline int numa_sched_getaffinity(pid_t pid, struct bitmask *mask)
-{
- return -1;
-}
-
-static inline
-unsigned int numa_bitmask_isbitset(const struct bitmask *mask,
- unsigned int idx)
-{
- return mask->maskp[idx / sizeof(unsigned long)] &
- ((unsigned long)1 << (idx % sizeof(unsigned long)));
-}
-
-static inline
-struct bitmask *numa_bitmask_clearbit(struct bitmask *mask,
- unsigned int idx)
-{
- mask->maskp[idx / sizeof(unsigned long)] &=
- ~((unsigned long)1 << (idx % sizeof(unsigned long)));
- return mask;
-}
-
-static inline
-struct bitmask *numa_parse_cpustring_all(const char *s)
-{
- return NULL;
-}
-
-static inline
-unsigned int numa_bitmask_weight(const struct bitmask *bitmap)
-{
- unsigned int idx;
- unsigned int ret = 0;
- for (idx = 0; idx < bitmap->size / sizeof(unsigned long); idx++)
- {
- ret += popcountl(bitmap->maskp[idx]);
- }
- return ret;
-}
-
-#define numa_sched_setaffinity(...) (-1)
-
-#endif
diff --git a/benchmarks/sd_bench/Kconfig b/benchmarks/sd_bench/Kconfig
deleted file mode 100644
index 440e17064..000000000
--- a/benchmarks/sd_bench/Kconfig
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_SD_BENCH
- tristate "SD benchmark program"
- depends on ALLOW_BSD_COMPONENTS
- default n
- ---help---
- SD benchmark application based on https://github.com/PX4/PX4-Autopilot/blob/main/src/systemcmds/sd_bench/sd_bench.cpp
-
-if BENCHMARK_SD_BENCH
-
-config BENCHMARK_SD_BENCH_PROGNAME
- string "Program name"
- default "sdbench"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config BENCHMARK_SD_BENCH_PRIORITY
- int "SD bench task priority"
- default 100
-
-config BENCHMARK_SD_BENCH_STACKSIZE
- int "SD bench stack size"
- default DEFAULT_TASK_STACKSIZE
-
-config BENCHMARK_SD_BENCH_DEVICE
- string "SD / MMC mount point"
- default "/mnt"
-
-config TESTING_SD_MEM_ALIGN_BYTES
- int "Allocated memory alignment"
- ---help---
- Specifies the memory alignment (bytes) used for allocated buffers, when enabled with the -a argument.
- default 512
-
-endif
diff --git a/benchmarks/sd_bench/Make.defs b/benchmarks/sd_bench/Make.defs
deleted file mode 100644
index cb9a03819..000000000
--- a/benchmarks/sd_bench/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/sd_bench/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_SD_BENCH),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/sd_bench
-endif
diff --git a/benchmarks/sd_bench/Makefile b/benchmarks/sd_bench/Makefile
deleted file mode 100644
index 072a87c2e..000000000
--- a/benchmarks/sd_bench/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-############################################################################
-# apps/benchmarks/sd_bench/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = $(CONFIG_BENCHMARK_SD_BENCH_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_SD_BENCH_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_SD_BENCH_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_SD_BENCH)
-
-MAINSRC = sd_bench_main.c
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/sd_bench/sd_bench_main.c b/benchmarks/sd_bench/sd_bench_main.c
deleted file mode 100644
index 9822ac748..000000000
--- a/benchmarks/sd_bench/sd_bench_main.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/sd_bench/sd_bench_main.c
- *
- * SPDX-License-Identifier: BSD-3-Clause
- * SPDX-FileCopyrightText: 2016-2021 PX4 Development Team.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name PX4 nor the names of its contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/* Originally ported from PX4 https://github.com/PX4/PX4-Autopilot,
- * with the following additions:
- *
- * - Refactoring for NuttX code style.
- * - Test result output has been modified to display total MB written.
- */
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-/****************************************************************************
- * Private Definitions
- ****************************************************************************/
-
-#define BUFFER_ALIGN CONFIG_TESTING_SD_MEM_ALIGN_BYTES
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-typedef struct sdb_config
-{
- int num_runs;
- int run_duration;
- bool synchronized;
- bool aligned;
- size_t total_blocks_written;
-} sdb_config_t;
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const char *BENCHMARK_FILE =
- CONFIG_BENCHMARK_SD_BENCH_DEVICE "/sd_bench";
-
-static const size_t max_block = 65536;
-static const size_t min_block = 1;
-static const size_t default_block = 512;
-
-static const size_t max_runs = 10000;
-static const size_t min_runs = 1;
-static const size_t default_runs = 5;
-
-static const size_t max_duration = 60000;
-static const size_t min_duration = 1;
-static const size_t default_duration = 2000;
-
-static const bool default_keep_test = false;
-static const bool default_fsync = false;
-static const bool default_verify = true;
-static const bool default_aligned = false;
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-static void write_test(int fd, sdb_config_t *cfg, uint8_t *block,
- int block_size);
-static int read_test(int fd, sdb_config_t *cfg, uint8_t *block,
- int block_size);
-
-static uint64_t time_fsync_us(int fd);
-static struct timespec get_abs_time(void);
-static uint64_t get_elapsed_time_us(const struct timespec *start);
-static uint64_t time_fsync_us(int fd);
-static float ts_to_kb(uint64_t bytes, uint64_t elapsed);
-static float block_count_to_mb(size_t blocks, size_t block_size);
-static const char *print_bool(const bool value);
-static void usage(void);
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static struct timespec get_abs_time(void)
-{
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts;
-}
-
-static uint64_t get_time_delta_us(const struct timespec *start,
- const struct timespec *end)
-{
- uint64_t elapsed;
- elapsed = (end->tv_sec * NSEC_PER_SEC) + end->tv_nsec;
- elapsed -= (start->tv_sec * NSEC_PER_SEC) + start->tv_nsec;
- return elapsed / 1000.;
-}
-
-static uint64_t get_elapsed_time_us(const struct timespec *start)
-{
- struct timespec now = get_abs_time();
- return get_time_delta_us(start, &now);
-}
-
-static uint64_t time_fsync_us(int fd)
-{
- struct timespec start = get_abs_time();
- fsync(fd);
- return get_elapsed_time_us(&start);
-}
-
-static float ts_to_kb(uint64_t bytes, uint64_t elapsed)
-{
- return (bytes / 1024.) / (elapsed / 1e6);
-}
-
-static float block_count_to_mb(size_t blocks, size_t block_size)
-{
- return blocks * block_size / (float)(1024 * 1024);
-}
-
-static const char *print_bool(const bool value)
-{
- return value ? "true" : "false";
-}
-
-static void write_test(int fd, sdb_config_t *cfg, uint8_t *block,
- int block_size)
-{
- struct timespec start;
- struct timespec write_start;
- size_t written;
- size_t num_blocks;
- uint64_t max_write_time;
- uint64_t fsync_time;
- uint64_t write_time;
- uint64_t elapsed;
- uint64_t total_elapsed = 0.;
- size_t total_blocks = 0;
- size_t *blocknumber = (size_t *)(void *)&block[0];
-
- printf("\n");
- printf("Testing Sequential Write Speed...\n");
-
- cfg->total_blocks_written = 0;
-
- for (int run = 0; run < cfg->num_runs; ++run)
- {
- start = get_abs_time();
- num_blocks = 0;
- max_write_time = 0;
- fsync_time = 0;
-
- while (get_elapsed_time_us(&start) < cfg->run_duration)
- {
- *blocknumber = total_blocks + num_blocks;
- write_start = get_abs_time();
- written = write(fd, block, block_size);
- write_time = get_elapsed_time_us(&write_start);
-
- if (write_time > max_write_time)
- {
- max_write_time = write_time;
- }
-
- if ((int)written != block_size)
- {
- printf("Write error: %d\n", errno);
- return;
- }
-
- if (cfg->synchronized)
- {
- fsync_time += time_fsync_us(fd);
- }
-
- ++num_blocks;
- }
-
- /* Note: if testing a slow device (SD Card) and the OS buffers a lot,
- * fsync can take really long, and it looks like the process hangs.
- * But it does not and the reported result will still be correct.
- */
-
- if (!cfg->synchronized)
- {
- fsync_time += time_fsync_us(fd);
- }
-
- elapsed = get_elapsed_time_us(&start);
- printf(" Run %2i: %8.1f KB/s, max write time: %4.3f ms (%.1f KB/s), "
- "fsync: %4.3f ms\n", run + 1,
- ts_to_kb(block_size * num_blocks, elapsed),
- max_write_time / 1.e3,
- ts_to_kb(block_size, max_write_time), fsync_time / 1e3);
-
- total_elapsed += elapsed;
- total_blocks += num_blocks;
- }
-
- cfg->total_blocks_written = total_blocks;
- printf(" Avg : %8.1f KB/s, %3.3f MB written.\n",
- ts_to_kb(block_size * total_blocks, total_elapsed),
- block_count_to_mb(total_blocks, block_size));
-}
-
-static int read_test(int fd, sdb_config_t *cfg, uint8_t *block,
- int block_size)
-{
- uint8_t *read_block;
- uint64_t total_elapsed;
- size_t total_blocks;
- struct timespec start;
- size_t num_blocks;
- uint64_t max_read_time;
- uint64_t read_time;
- uint64_t elapsed;
- struct timespec read_start;
- size_t nread;
-
- printf("\n");
- printf("Testing Sequential Read Speed...\n");
-
- if (cfg->aligned)
- {
- read_block = (uint8_t *)memalign(BUFFER_ALIGN, block_size);
- }
- else
- {
- read_block = (uint8_t *)malloc(block_size);
- }
-
- if (!read_block)
- {
- printf("Failed to allocate memory block\n");
- return -1;
- }
-
- total_elapsed = 0.;
- total_blocks = 0;
- size_t *blocknumber = (size_t *)(void *) &read_block[0];
-
- for (int run = 0; run < cfg->num_runs; ++run)
- {
- start = get_abs_time();
- num_blocks = 0;
- max_read_time = 0;
-
- while (get_elapsed_time_us(&start) < cfg->run_duration
- && total_blocks + num_blocks < cfg->total_blocks_written)
- {
- read_start = get_abs_time();
- nread = read(fd, read_block, block_size);
- read_time = get_elapsed_time_us(&read_start);
-
- if (read_time > max_read_time)
- {
- max_read_time = read_time;
- }
-
- if ((int)nread != block_size)
- {
- printf("Read error\n");
- free(read_block);
- return -1;
- }
-
- if (*blocknumber != total_blocks + num_blocks)
- {
- printf("Read data error at block: %zu wrote:0x%04zx "
- "read:0x%04zx", total_blocks + num_blocks,
- total_blocks + num_blocks, *blocknumber);
- }
-
- for (unsigned int i = sizeof(*blocknumber);
- i < (block_size - sizeof(*blocknumber)); ++i)
- {
- if (block[i] != read_block[i])
- {
- printf("Read data error at offset: %zu wrote:0x%02x "
- "read:0x%02x", total_blocks + num_blocks + i,
- block[i], read_block[i]);
- }
- }
-
- ++num_blocks;
- }
-
- elapsed = get_elapsed_time_us(&start);
-
- if (num_blocks)
- {
- printf(" Run %2i: %8.1f KB/s, max read/verify time: %3.4f ms "
- "(%.1f KB/s)\n", run + 1,
- ts_to_kb(block_size * num_blocks, elapsed),
- max_read_time / 1e3,
- ts_to_kb(block_size, max_read_time));
-
- total_elapsed += elapsed;
- total_blocks += num_blocks;
- }
- }
-
- printf(" Avg : %8.1f KB/s, %3.3f MB and verified\n",
- ts_to_kb(block_size * total_blocks, total_elapsed),
- block_count_to_mb(total_blocks, block_size));
-
- free(read_block);
- return 0;
-}
-
-static void usage(void)
-{
- printf("Test the speed of an SD card or mount point\n");
- printf(CONFIG_BENCHMARK_SD_BENCH_PROGNAME
- ": [-b] [-r] [-d] [-k] [-s] [-a] [-v]\n");
- printf(" -b Block size per write (%zu-%zu), default %zu\n",
- min_block, max_block, default_block);
- printf(" -r Number of runs (%zu-%zu), default %zu\n",
- min_runs, max_runs, default_runs);
- printf(" -d Max duration of a test (ms) (%zu-%zu), default %zu\n",
- min_duration, max_duration, default_duration);
- printf(" -k Keep test file when finished, default %s\n",
- print_bool(default_keep_test));
- printf(" -s Call fsync after each block, false calls fsync\n"
- " only at the end of each run, default %s\n",
- print_bool(default_fsync));
- printf(" -a Test performance on aligned data, default %s\n",
- print_bool(default_aligned));
- printf(" -v Verify data and block number, default %s\n",
- print_bool(default_verify));
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-int main(int argc, char *argv[])
-{
- size_t block_size = default_block;
- bool verify = default_verify;
- bool keep = default_keep_test;
- int ch;
- int bench_fd;
- sdb_config_t cfg;
- uint8_t *block = NULL;
-
- cfg.synchronized = default_fsync;
- cfg.num_runs = default_runs;
- cfg.run_duration = default_duration;
- cfg.aligned = default_aligned;
-
- while ((ch = getopt(argc, argv, "b:r:d:ksav")) != EOF)
- {
- switch (ch)
- {
- case 'b':
- block_size = strtol(optarg, NULL, 0);
- break;
-
- case 'r':
- cfg.num_runs = strtol(optarg, NULL, 0);
- break;
-
- case 'd':
- cfg.run_duration = strtol(optarg, NULL, 0);
- break;
-
- case 'k':
- keep = !default_keep_test;
- break;
-
- case 's':
- cfg.synchronized = !default_fsync;
- break;
-
- case 'a':
- cfg.aligned = !default_aligned;
- break;
-
- case 'v':
- verify = !default_verify;
- break;
-
- default:
- usage();
- return -1;
- break;
- }
- }
-
- if (cfg.run_duration > max_duration || cfg.run_duration < min_duration)
- {
- printf("Duration outside of allowable range.\n");
- usage();
- exit(EXIT_FAILURE);
- }
-
- if (block_size > max_block || block_size < min_block)
- {
- printf("Bytes outside allowable range.\n");
- usage();
- exit(EXIT_FAILURE);
- }
-
- if (cfg.num_runs > max_runs || cfg.num_runs < min_runs)
- {
- printf("Runs outside allowable range.\n");
- usage();
- exit(EXIT_FAILURE);
- }
-
- cfg.run_duration *= 1000;
- bench_fd = open(BENCHMARK_FILE,
- O_CREAT | (verify ? O_RDWR : O_WRONLY) | O_TRUNC, 0666);
-
- if (bench_fd < 0)
- {
- printf("Can't open benchmark file %s (%d)\n",
- BENCHMARK_FILE, bench_fd);
- exit(EXIT_FAILURE);
- }
-
- if (cfg.aligned)
- {
- block = (uint8_t *)memalign(BUFFER_ALIGN, block_size);
- }
- else
- {
- block = (uint8_t *)malloc(block_size);
- }
-
- if (!block)
- {
- printf("Failed to allocate memory block\n");
- close(bench_fd);
- exit(EXIT_FAILURE);
- }
-
- for (int j = 0; j < block_size; ++j)
- {
- block[j] = (uint8_t)j;
- }
-
- printf("Using block size = %zu bytes, sync = %s\n", block_size,
- print_bool(cfg.synchronized));
-
- write_test(bench_fd, &cfg, block, block_size);
-
- if (verify)
- {
- fsync(bench_fd);
- lseek(bench_fd, 0, SEEK_SET);
- read_test(bench_fd, &cfg, block, block_size);
- }
-
- free(block);
- close(bench_fd);
-
- if (!keep)
- {
- unlink(BENCHMARK_FILE);
- }
-
- return 0;
-}
diff --git a/benchmarks/spinlock_bench/CMakeLists.txt b/benchmarks/spinlock_bench/CMakeLists.txt
deleted file mode 100644
index 80ed3afe0..000000000
--- a/benchmarks/spinlock_bench/CMakeLists.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/spinlock_bench/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_SPINLOCK)
-
- # ############################################################################
- # Config and Fetch Coremark application
- # ############################################################################
-
- set(SPINLOCKAPP_DIR ${CMAKE_CURRENT_LIST_DIR})
-
- # ############################################################################
- # Sources
- # ############################################################################
-
- set(CSRCS ${SPINLOCKAPP_DIR}/spinlock_bench.c)
-
- # ############################################################################
- # Applications Configuration
- # ############################################################################
-
- nuttx_add_application(
- NAME
- spinlock_bench
- PRIORITY
- ${CONFIG_SPINLOCK_PRIORITY}
- STACKSIZE
- ${CONFIG_SPINLOCK_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_SPINLOCK}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${CSRCS}
- INCLUDE_DIRECTORIES
- ${INCDIR})
-
-endif()
diff --git a/benchmarks/spinlock_bench/Kconfig b/benchmarks/spinlock_bench/Kconfig
deleted file mode 100644
index b872f5e84..000000000
--- a/benchmarks/spinlock_bench/Kconfig
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BENCHMARK_SPINLOCK
- bool "Spinlock Benchmark"
- depends on BUILD_FLAT
- default n
- ---help---
- Enable the Spinlock benchmark application.
-
-if BENCHMARK_SPINLOCK
-
-config SPINLOCK_PROGNAME
- string "spinlock benchmark"
- default "spinlock_bench"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config SPINLOCK_PRIORITY
- int "Spinlock task priority"
- default 100
-
-config SPINLOCK_STACKSIZE
- int "Spinlock task stack size"
- default 4096
-
-
-config SPINLOCK_MULTITHREAD
- int "Number of threads"
- default 40
- ---help---
- Override the default number of threads to be executed.
- The default value is 40.
-
-config SPINLOCK_ITERATIONS
- int "Number of iterations"
- default 100
- ---help---
- Default number of iterations for the benchmark on each thread.
- The default value is 100.
-
-endif # BENCHMARK_SPINLOCK
diff --git a/benchmarks/spinlock_bench/Make.defs b/benchmarks/spinlock_bench/Make.defs
deleted file mode 100644
index 6031b9eff..000000000
--- a/benchmarks/spinlock_bench/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/spinlock_bench/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_SPINLOCK),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/spinlock_bench
-endif
diff --git a/benchmarks/spinlock_bench/Makefile b/benchmarks/spinlock_bench/Makefile
deleted file mode 100644
index e1a3f86c6..000000000
--- a/benchmarks/spinlock_bench/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-############################################################################
-# apps/benchmarks/spinlock_bench/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-# spinlock_bench application
-
-############################################################################
-# Applications Configuration
-############################################################################
-
-MODULE = $(CONFIG_BENCHMARK_SPINLOCK)
-
-PROGNAME += $(CONFIG_SPINLOCK_PROGNAME)
-PRIORITY += $(CONFIG_SPINLOCK_PRIORITY)
-STACKSIZE += $(CONFIG_SPINLOCK_STACKSIZE)
-
-MAINSRC += spinlock_bench.c
-
-# Build with WebAssembly when CONFIG_INTERPRETERS_WAMR is enabled
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/spinlock_bench/spinlock_bench.c b/benchmarks/spinlock_bench/spinlock_bench.c
deleted file mode 100644
index bc8c8b5ed..000000000
--- a/benchmarks/spinlock_bench/spinlock_bench.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/spinlock_bench/spinlock_bench.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define TEST_NUM CONFIG_SPINLOCK_MULTITHREAD
-#define THREAD_NUM CONFIG_SPINLOCK_MULTITHREAD
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct thread_parmeter_s
-{
- FAR int *result;
- FAR spinlock_t *lock;
-};
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static FAR void *thread_spinlock(FAR void *parameter)
-{
- FAR int *result = ((FAR struct thread_parmeter_s *)parameter)->result;
- FAR spinlock_t *lock = ((FAR struct thread_parmeter_s *)parameter)->lock;
-
- int i;
-
- for (i = 0; i < TEST_NUM; i++)
- {
- spin_lock(lock);
- (*result)++;
- spin_unlock(lock);
- }
-
- return NULL;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-void main(void)
-{
- spinlock_t lock = SP_UNLOCKED;
- int result = 0;
- pthread_t thread[THREAD_NUM];
- struct thread_parmeter_s para;
- clock_t start;
- clock_t end;
-
- int status;
- int i;
-
- para.result = &result;
- para.lock = &lock;
-
- start = perf_gettime();
- for (i = 0; i < THREAD_NUM; ++i)
- {
- status = pthread_create(&thread[i], NULL,
- thread_spinlock, ¶);
- if (status != 0)
- {
- printf("spinlock_test: ERROR pthread_create failed, status=%d\n",
- status);
- ASSERT(false);
- }
- }
-
- for (i = 0; i < THREAD_NUM; ++i)
- {
- pthread_join(thread[i], NULL);
- }
-
- end = perf_gettime();
- assert(result == THREAD_NUM * TEST_NUM);
-
- printf("total_time: %lu\n", end - start);
-}
diff --git a/benchmarks/superpi/.gitignore b/benchmarks/superpi/.gitignore
deleted file mode 100644
index 06dd2c632..000000000
--- a/benchmarks/superpi/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/superpi
-/main.zip
diff --git a/benchmarks/superpi/CMakeLists.txt b/benchmarks/superpi/CMakeLists.txt
deleted file mode 100644
index 7ab8ed611..000000000
--- a/benchmarks/superpi/CMakeLists.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/superpi/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_SUPERPI)
-
- set(SUPERPI_UNPACK ${CMAKE_CURRENT_LIST_DIR}/superpi)
- set(SUPERPI_URL https://github.com/Fibonacci43/SuperPI/archive)
- set(SUPERPI_ZIP main.zip)
-
- if(NOT EXISTS ${SUPERPI_UNPACK})
-
- FetchContent_Declare(
- superpi_fetch
- URL ${SUPERPI_URL}/${SUPERPI_ZIP} SOURCE_DIR ${SUPERPI_UNPACK} BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/superpi/superpi
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(superpi_fetch)
- if(NOT superpi_fetch_POPULATED)
- FetchContent_Populate(superpi_fetch)
- endif()
-
- endif()
-
- nuttx_add_application(
- NAME
- ${CONFIG_BENCHMARK_SUPERPI_PROGNAME}
- STACKSIZE
- ${CONFIG_BENCHMARK_SUPERPI_STACKSIZE}
- PRIORITY
- ${CONFIG_BENCHMARK_SUPERPI_PRIORITY}
- SRCS
- ${SUPERPI_UNPACK}/pi_fftcs.c
- ${SUPERPI_UNPACK}/fftsg_h.c)
-
-endif()
diff --git a/benchmarks/superpi/Kconfig b/benchmarks/superpi/Kconfig
deleted file mode 100644
index 124f334f7..000000000
--- a/benchmarks/superpi/Kconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_SUPERPI
- tristate "SuperPI test"
- default n
-
-if BENCHMARK_SUPERPI
-
-config BENCHMARK_SUPERPI_PROGNAME
- string "Program Name"
- default "pi_css5"
-
-config BENCHMARK_SUPERPI_STACKSIZE
- int "SuperPI stack size"
- default DEFAULT_TASK_STACKSIZE
-
-config BENCHMARK_SUPERPI_PRIORITY
- int "Task PRIORITY"
- default 100
- ---help---
- The higher the priority value, the lower the priority.
-
-endif # BENCHMARK_SUPERPI
diff --git a/benchmarks/superpi/Make.defs b/benchmarks/superpi/Make.defs
deleted file mode 100644
index a5c1095d4..000000000
--- a/benchmarks/superpi/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/superpi/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_SUPERPI),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/superpi
-endif
diff --git a/benchmarks/superpi/Makefile b/benchmarks/superpi/Makefile
deleted file mode 100644
index fbdb445d3..000000000
--- a/benchmarks/superpi/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-############################################################################
-# apps/benchmarks/superpi/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-SUPERPI_UNPACK = superpi
-SUPERPI_URL = https://github.com/Fibonacci43/SuperPI/archive
-SUPERPI_VERSION = main
-SUPERPI_ZIP = $(SUPERPI_VERSION).zip
-UNPACK ?= unzip -q -o
-
-CSRCS += superpi/fftsg_h.c
-PROGNAME = $(CONFIG_BENCHMARK_SUPERPI_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_SUPERPI_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_SUPERPI_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_SUPERPI)
-MAINSRC = superpi/pi_fftcs.c
-
-$(SUPERPI_ZIP):
- @echo "Downloading: $(SUPERPI_URL)/$(SUPERPI_ZIP)"
- $(Q) curl -O -L $(SUPERPI_URL)/$(SUPERPI_ZIP)
-
-$(SUPERPI_UNPACK): $(SUPERPI_ZIP)
- @echo "Unpacking: $(SUPERPI_ZIP) -> $(SUPERPI_UNPACK)"
- $(Q) $(UNPACK) $(SUPERPI_ZIP)
- $(Q) mv SuperPI-$(SUPERPI_VERSION) $(SUPERPI_UNPACK)
- $(Q) touch $(SUPERPI_UNPACK)
-
-ifeq ($(wildcard $(SUPERPI_UNPACK)/.git),)
-context:: $(SUPERPI_UNPACK)
-
-distclean::
- $(call DELDIR, $(SUPERPI_UNPACK))
- $(call DELFILE, $(SUPERPI_ZIP))
-endif
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/tacle-bench/.gitignore b/benchmarks/tacle-bench/.gitignore
deleted file mode 100644
index 649ff84b9..000000000
--- a/benchmarks/tacle-bench/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/tacle-bench
-/*.zip
diff --git a/benchmarks/tacle-bench/0001-tacle-bench-add-makefile-and-all-in-one-main-file.patch b/benchmarks/tacle-bench/0001-tacle-bench-add-makefile-and-all-in-one-main-file.patch
deleted file mode 100644
index fb1e2e400..000000000
--- a/benchmarks/tacle-bench/0001-tacle-bench-add-makefile-and-all-in-one-main-file.patch
+++ /dev/null
@@ -1,1264 +0,0 @@
-From 6d0be04a4b4208447e75c369e9811d089f466739 Mon Sep 17 00:00:00 2001
-From: ouyangxiangzhen
-Date: Thu, 3 Apr 2025 11:59:02 +0800
-Subject: [PATCH] tacle-bench: add makefile and all-in-one main file
-
-The original taclebench is used for WCET analysis. This commit allows most taclebench test cases (except parallel test cases) to be compiled and executed.
-
-Change-Id: I707b8ac58d3ddc4b7974c5bedecac1a7b5c887f9
-Signed-off-by: ouyangxiangzhen
----
- Makefile | 12 +
- bench/app/lift/lift.c | 3 +
- bench/app/powerwindow/powerwindow.c | 3 +
- bench/kernel/binarysearch/binarysearch.c | 3 +
- bench/kernel/bitcount/bitcount.c | 3 +
- bench/kernel/bitonic/bitonic.c | 3 +
- bench/kernel/bsort/bsort.c | 3 +
- .../kernel/complex_updates/complex_updates.c | 3 +
- bench/kernel/cosf/cosf.c | 3 +
- bench/kernel/countnegative/countnegative.c | 3 +
- bench/kernel/cubic/cubic.c | 3 +
- bench/kernel/deg2rad/deg2rad.c | 3 +
- bench/kernel/fac/fac.c | 3 +
- bench/kernel/fft/fft.c | 3 +
- bench/kernel/filterbank/filterbank.c | 3 +
- bench/kernel/fir2dim/fir2dim.c | 3 +
- bench/kernel/iir/iir.c | 3 +
- bench/kernel/insertsort/insertsort.c | 3 +
- bench/kernel/isqrt/isqrt.c | 3 +
- bench/kernel/jfdctint/jfdctint.c | 3 +
- bench/kernel/lms/lms.c | 3 +
- bench/kernel/ludcmp/ludcmp.c | 3 +
- bench/kernel/matrix1/matrix1.c | 3 +
- bench/kernel/md5/md5.c | 3 +
- bench/kernel/minver/minver.c | 3 +
- bench/kernel/pm/pm.c | 3 +
- bench/kernel/prime/prime.c | 3 +
- bench/kernel/quicksort/quicksort.c | 3 +
- bench/kernel/rad2deg/rad2deg.c | 3 +
- bench/kernel/recursion/recursion.c | 3 +
- bench/kernel/sha/sha.c | 3 +
- bench/kernel/st/st.c | 3 +
- bench/sequential/adpcm_dec/adpcm_dec.c | 3 +
- bench/sequential/adpcm_enc/adpcm_enc.c | 3 +
- bench/sequential/ammunition/ammunition.c | 3 +
- bench/sequential/anagram/anagram.c | 3 +
- bench/sequential/audiobeam/audiobeam.c | 3 +
- .../cjpeg_transupp/cjpeg_transupp.c | 3 +
- bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c | 3 +
- bench/sequential/dijkstra/dijkstra.c | 3 +
- bench/sequential/epic/epic.c | 3 +
- bench/sequential/fmref/fmref.c | 3 +
- bench/sequential/g723_enc/g723_enc.c | 3 +
- bench/sequential/gsm_dec/gsm_dec.c | 3 +
- bench/sequential/gsm_enc/gsm_enc.c | 3 +
- bench/sequential/h264_dec/h264_dec.c | 3 +
- bench/sequential/huff_dec/huff_dec.c | 3 +
- bench/sequential/huff_enc/huff_enc.c | 3 +
- bench/sequential/mpeg2/mpeg2.c | 3 +
- bench/sequential/ndes/ndes.c | 3 +
- bench/sequential/petrinet/petrinet.c | 3 +
- bench/sequential/rijndael_dec/rijndael_dec.c | 3 +
- bench/sequential/rijndael_enc/rijndael_enc.c | 3 +
- bench/sequential/statemate/statemate.c | 3 +
- bench/sequential/susan/susan.c | 3 +
- bench/test/cover/cover.c | 3 +
- bench/test/duff/duff.c | 3 +
- bench/test/test3/test3.c | 3 +
- taclebench.c | 366 ++++++++++++++++++
- 59 files changed, 549 insertions(+)
- create mode 100644 Makefile
- create mode 100644 taclebench.c
-
-diff --git a/Makefile b/Makefile
-new file mode 100644
-index 0000000..75ca0a1
---- /dev/null
-+++ b/Makefile
-@@ -0,0 +1,12 @@
-+APP_SRCS := $(shell find bench/app -name "*.c")
-+# we just need only one wcclibm
-+KERNEL_SRCS := $(shell find bench/kernel -name "*.c" | grep -v -E 'wcclibm.c')
-+SEQUENTIAL_SRCS := $(shell find bench/sequential -name "*.c")
-+TEST_SRCS := $(shell find bench/test -name "*.c")
-+
-+all:
-+ cc -DALL_IN_ONE ${APP_SRCS} ${KERNEL_SRCS} ${SEQUENTIAL_SRCS} ${TEST_SRCS} bench/kernel/cosf/wcclibm.c taclebench.c -static -o taclebench -O3
-+
-+clean:
-+ rm -f taclebench
-+
-diff --git a/bench/app/lift/lift.c b/bench/app/lift/lift.c
-index 8c7795f..47ddf4f 100755
---- a/bench/app/lift/lift.c
-+++ b/bench/app/lift/lift.c
-@@ -123,6 +123,9 @@ void _Pragma( "entrypoint" ) lift_main()
- }
-
-
-+#ifdef ALL_IN_ONE
-+ #define main main_lift
-+#endif
- int main( void )
- {
- lift_init();
-diff --git a/bench/app/powerwindow/powerwindow.c b/bench/app/powerwindow/powerwindow.c
-index 1976506..9ea2e50 100644
---- a/bench/app/powerwindow/powerwindow.c
-+++ b/bench/app/powerwindow/powerwindow.c
-@@ -47,6 +47,9 @@ void powerwindow_Uint8inputarray_initialize( powerwindow_uint8_T *,
- void powerwindow_init();
- void powerwindow_main();
- int powerwindow_return();
-+#ifdef ALL_IN_ONE
-+ #define main main_powerwindow
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/binarysearch/binarysearch.c b/bench/kernel/binarysearch/binarysearch.c
-index c4087f5..69d1191 100755
---- a/bench/kernel/binarysearch/binarysearch.c
-+++ b/bench/kernel/binarysearch/binarysearch.c
-@@ -41,6 +41,9 @@ void binarysearch_init( void );
- int binarysearch_return( void );
- int binarysearch_binary_search( int );
- void binarysearch_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_binarysearch
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/bitcount/bitcount.c b/bench/kernel/bitcount/bitcount.c
-index dfae600..3ec9ff6 100755
---- a/bench/kernel/bitcount/bitcount.c
-+++ b/bench/kernel/bitcount/bitcount.c
-@@ -40,6 +40,9 @@ unsigned long bitcount_random( void );
- void bitcount_main();
- int bitcount_return();
- void bitcount_init();
-+#ifdef ALL_IN_ONE
-+ #define main main_bitcount
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/bitonic/bitonic.c b/bench/kernel/bitonic/bitonic.c
-index 09bb484..2f1cf6b 100755
---- a/bench/kernel/bitonic/bitonic.c
-+++ b/bench/kernel/bitonic/bitonic.c
-@@ -27,6 +27,9 @@ int bitonic_return( void );
- void bitonic_compare( int i, int j, int dir );
- void bitonic_merge( int lo, int cnt, int dir );
- void bitonic_sort( int lo, int cnt, int dir );
-+#ifdef ALL_IN_ONE
-+ #define main main_bitonic
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/bsort/bsort.c b/bench/kernel/bsort/bsort.c
-index 8a8b640..4ea2889 100755
---- a/bench/kernel/bsort/bsort.c
-+++ b/bench/kernel/bsort/bsort.c
-@@ -123,6 +123,9 @@ void _Pragma( "entrypoint" ) bsort_main( void )
- Main function
- */
-
-+#ifdef ALL_IN_ONE
-+ #define main main_bsort
-+#endif
- int main( void )
- {
- bsort_init();
-diff --git a/bench/kernel/complex_updates/complex_updates.c b/bench/kernel/complex_updates/complex_updates.c
-index 91e3ae6..9f07dfd 100755
---- a/bench/kernel/complex_updates/complex_updates.c
-+++ b/bench/kernel/complex_updates/complex_updates.c
-@@ -40,6 +40,9 @@
- void complex_updates_pin_down( float *pa, float *pb, float *pc, float *pd );
- void complex_updates_init( void );
- void complex_updates_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_complex_updates
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/cosf/cosf.c b/bench/kernel/cosf/cosf.c
-index b838546..392f7f9 100755
---- a/bench/kernel/cosf/cosf.c
-+++ b/bench/kernel/cosf/cosf.c
-@@ -29,6 +29,9 @@
- void cosf_init( void );
- void cosf_main( void );
- int cosf_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_cosf
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/countnegative/countnegative.c b/bench/kernel/countnegative/countnegative.c
-index 5835cab..7bc2765 100755
---- a/bench/kernel/countnegative/countnegative.c
-+++ b/bench/kernel/countnegative/countnegative.c
-@@ -39,6 +39,9 @@ void countnegative_init( void );
- int countnegative_return( void );
- void countnegative_sum( matrix );
- void countnegative_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_countnegative
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/kernel/cubic/cubic.c b/bench/kernel/cubic/cubic.c
-index f266394..b26177a 100755
---- a/bench/kernel/cubic/cubic.c
-+++ b/bench/kernel/cubic/cubic.c
-@@ -39,6 +39,9 @@ void cubic_solveCubic( float a, float b, float c, float d,
- void cubic_main( void );
- void cubic_init( void );
- int cubic_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_cubic
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/deg2rad/deg2rad.c b/bench/kernel/deg2rad/deg2rad.c
-index 5fc1817..3cd5f06 100755
---- a/bench/kernel/deg2rad/deg2rad.c
-+++ b/bench/kernel/deg2rad/deg2rad.c
-@@ -32,6 +32,9 @@
- void deg2rad_init( void );
- void deg2rad_main( void );
- int deg2rad_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_deg2rad
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/fac/fac.c b/bench/kernel/fac/fac.c
-index 606b8d1..ba6e2c4 100755
---- a/bench/kernel/fac/fac.c
-+++ b/bench/kernel/fac/fac.c
-@@ -27,6 +27,9 @@ int fac_fac( int n );
- void fac_init();
- int fac_return();
- void fac_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_fac
-+#endif
- int main( void );
- /*
- Declaration of global variables
-diff --git a/bench/kernel/fft/fft.c b/bench/kernel/fft/fft.c
-index 7aff936..f9a30f1 100755
---- a/bench/kernel/fft/fft.c
-+++ b/bench/kernel/fft/fft.c
-@@ -84,6 +84,9 @@ void fft_pin_down( int input_data[ ] );
- void fft_init( void );
- void fft_main( void );
- int fft_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_fft
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/kernel/filterbank/filterbank.c b/bench/kernel/filterbank/filterbank.c
-index c9ab6de..734336d 100755
---- a/bench/kernel/filterbank/filterbank.c
-+++ b/bench/kernel/filterbank/filterbank.c
-@@ -161,6 +161,9 @@ void filterbank_core( float r[ 256 ],
- Main function
- */
-
-+#ifdef ALL_IN_ONE
-+ #define main main_filterbank
-+#endif
- int main( void )
- {
- filterbank_init();
-diff --git a/bench/kernel/fir2dim/fir2dim.c b/bench/kernel/fir2dim/fir2dim.c
-index 054c144..bc94886 100755
---- a/bench/kernel/fir2dim/fir2dim.c
-+++ b/bench/kernel/fir2dim/fir2dim.c
-@@ -32,6 +32,9 @@ void fir2dim_pin_down( float *pimage, float *parray, float *pcoeff,
- void fir2dim_init();
- int fir2dim_return();
- void fir2dim_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_fir2dim
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/iir/iir.c b/bench/kernel/iir/iir.c
-index 2f085bd..2245602 100755
---- a/bench/kernel/iir/iir.c
-+++ b/bench/kernel/iir/iir.c
-@@ -55,6 +55,9 @@
- void iir_init( void );
- int iir_return( void );
- void iir_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_iir
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/insertsort/insertsort.c b/bench/kernel/insertsort/insertsort.c
-index 59d90a5..8ba006d 100755
---- a/bench/kernel/insertsort/insertsort.c
-+++ b/bench/kernel/insertsort/insertsort.c
-@@ -35,6 +35,9 @@ void insertsort_initialize( unsigned int *array );
- void insertsort_init( void );
- int insertsort_return( void );
- void insertsort_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_insertsort
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/kernel/isqrt/isqrt.c b/bench/kernel/isqrt/isqrt.c
-index 82b7a72..71d32ba 100755
---- a/bench/kernel/isqrt/isqrt.c
-+++ b/bench/kernel/isqrt/isqrt.c
-@@ -69,6 +69,9 @@ void isqrt_usqrt( unsigned long x, struct int_sqrt *q );
- void isqrt_init( void );
- void isqrt_main( void );
- int isqrt_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_isqrt
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/jfdctint/jfdctint.c b/bench/kernel/jfdctint/jfdctint.c
-index 0e2f4fb..9e65563 100755
---- a/bench/kernel/jfdctint/jfdctint.c
-+++ b/bench/kernel/jfdctint/jfdctint.c
-@@ -101,6 +101,9 @@
- void jfdctint_init();
- int jfdctint_return();
- void jfdctint_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_jfdctint
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/lms/lms.c b/bench/kernel/lms/lms.c
-index 42b1929..c8d33c5 100755
---- a/bench/kernel/lms/lms.c
-+++ b/bench/kernel/lms/lms.c
-@@ -194,6 +194,9 @@ int lms_return( void )
- }
-
-
-+#ifdef ALL_IN_ONE
-+ #define main main_lms
-+#endif
- int main()
- {
- lms_init();
-diff --git a/bench/kernel/ludcmp/ludcmp.c b/bench/kernel/ludcmp/ludcmp.c
-index 6c9127b..9af3fc0 100755
---- a/bench/kernel/ludcmp/ludcmp.c
-+++ b/bench/kernel/ludcmp/ludcmp.c
-@@ -35,6 +35,9 @@ void ludcmp_init( void );
- int ludcmp_return( void );
- int ludcmp_test( int n, double eps );
- void ludcmp_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_ludcmp
-+#endif
- int main( void );
-
- double ludcmp_a[ 50 ][ 50 ], ludcmp_b[ 50 ], ludcmp_x[ 50 ];
-diff --git a/bench/kernel/matrix1/matrix1.c b/bench/kernel/matrix1/matrix1.c
-index 2b23504..8d7e431 100755
---- a/bench/kernel/matrix1/matrix1.c
-+++ b/bench/kernel/matrix1/matrix1.c
-@@ -72,6 +72,9 @@
- void matrix1_pin_down( int A[ ], int B[ ], int C[ ] );
- void matrix1_init( void );
- void matrix1_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_matrix1
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/md5/md5.c b/bench/kernel/md5/md5.c
-index 09ab091..be2d270 100755
---- a/bench/kernel/md5/md5.c
-+++ b/bench/kernel/md5/md5.c
-@@ -201,6 +201,9 @@ void md5_init( void );
- int md5_return( void );
- int md5_bytesNeeded;
-
-+#ifdef ALL_IN_ONE
-+ #define main main_md5
-+#endif
- int main( void );
-
- unsigned char md5_PADDING[ 64 ] = {
-diff --git a/bench/kernel/minver/minver.c b/bench/kernel/minver/minver.c
-index f417d1f..30e975f 100755
---- a/bench/kernel/minver/minver.c
-+++ b/bench/kernel/minver/minver.c
-@@ -36,6 +36,9 @@ double minver_fabs( double n );
- void minver_init();
- int minver_return();
- void minver_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_minver
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/kernel/pm/pm.c b/bench/kernel/pm/pm.c
-index c046800..fb42960 100755
---- a/bench/kernel/pm/pm.c
-+++ b/bench/kernel/pm/pm.c
-@@ -734,6 +734,9 @@ int pm_kernel( pm_data_t *pmdata )
- Main function
- */
-
-+#ifdef ALL_IN_ONE
-+ #define main main_pm
-+#endif
- int main( void )
- {
- pm_init();
-diff --git a/bench/kernel/prime/prime.c b/bench/kernel/prime/prime.c
-index b694a6f..a3f7f55 100755
---- a/bench/kernel/prime/prime.c
-+++ b/bench/kernel/prime/prime.c
-@@ -32,6 +32,9 @@ void prime_initSeed();
- void prime_init ();
- int prime_return ();
- void prime_main ();
-+#ifdef ALL_IN_ONE
-+ #define main main_prime
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/quicksort/quicksort.c b/bench/kernel/quicksort/quicksort.c
-index 55b4c73..b46aeda 100755
---- a/bench/kernel/quicksort/quicksort.c
-+++ b/bench/kernel/quicksort/quicksort.c
-@@ -40,6 +40,9 @@ int quicksort_return( void );
- void quicksort_str( char *, unsigned long, unsigned long );
- void quicksort_vec( char *, unsigned long, unsigned long );
- void quicksort_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_quicksort
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/rad2deg/rad2deg.c b/bench/kernel/rad2deg/rad2deg.c
-index 380fe8b..72f1e14 100755
---- a/bench/kernel/rad2deg/rad2deg.c
-+++ b/bench/kernel/rad2deg/rad2deg.c
-@@ -33,6 +33,9 @@
- void rad2deg_init( void );
- void rad2deg_main( void );
- int rad2deg_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_rad2deg
-+#endif
- int main( void );
-
-
-diff --git a/bench/kernel/recursion/recursion.c b/bench/kernel/recursion/recursion.c
-index f0e7edd..462dd5e 100755
---- a/bench/kernel/recursion/recursion.c
-+++ b/bench/kernel/recursion/recursion.c
-@@ -32,6 +32,9 @@ int recursion_fib( int i );
- void recursion_main( void );
- void recursion_init( void );
- int recursion_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_recursion
-+#endif
- int main ( void );
-
-
-diff --git a/bench/kernel/sha/sha.c b/bench/kernel/sha/sha.c
-index fc1559a..def3990 100755
---- a/bench/kernel/sha/sha.c
-+++ b/bench/kernel/sha/sha.c
-@@ -215,6 +215,9 @@ int sha_return( void )
- return ( sum - 261944 != 0 );
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_sha
-+#endif
- int main ( void )
- {
- sha_init();
-diff --git a/bench/kernel/st/st.c b/bench/kernel/st/st.c
-index 8a716fe..c303945 100755
---- a/bench/kernel/st/st.c
-+++ b/bench/kernel/st/st.c
-@@ -38,6 +38,9 @@ void st_calc_Sum_Mean( float *, float *, float * );
- void st_calc_Var_Stddev( float *, float, float *, float * );
- void st_calc_LinCorrCoef( float *, float *, float, float, float * );
- void st_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_st
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/adpcm_dec/adpcm_dec.c b/bench/sequential/adpcm_dec/adpcm_dec.c
-index 5284bfa..2a11ded 100755
---- a/bench/sequential/adpcm_dec/adpcm_dec.c
-+++ b/bench/sequential/adpcm_dec/adpcm_dec.c
-@@ -54,6 +54,9 @@ int adpcm_dec_sin( int n );
- void adpcm_dec_init();
- int adpcm_dec_return();
- void adpcm_dec_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_adpcm_dec
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/adpcm_enc/adpcm_enc.c b/bench/sequential/adpcm_enc/adpcm_enc.c
-index 2f58d9a..540a81d 100755
---- a/bench/sequential/adpcm_enc/adpcm_enc.c
-+++ b/bench/sequential/adpcm_enc/adpcm_enc.c
-@@ -57,6 +57,9 @@ int adpcm_enc_abs( int n );
- void adpcm_enc_init( void );
- void adpcm_enc_main( void );
- int adpcm_enc_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_adpcm_enc
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/sequential/ammunition/ammunition.c b/bench/sequential/ammunition/ammunition.c
-index ba5e4c7..f5e9d79 100755
---- a/bench/sequential/ammunition/ammunition.c
-+++ b/bench/sequential/ammunition/ammunition.c
-@@ -42,6 +42,9 @@ int ammunition_arithm_test();
- void ammunition_init( void );
- int ammunition_return( void );
- void ammunition_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_ammunition
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/anagram/anagram.c b/bench/sequential/anagram/anagram.c
-index 90ee4a2..adaa715 100755
---- a/bench/sequential/anagram/anagram.c
-+++ b/bench/sequential/anagram/anagram.c
-@@ -652,6 +652,9 @@ void _Pragma( "entrypoint" ) anagram_main( void )
- Main function
- */
-
-+#ifdef ALL_IN_ONE
-+ #define main main_anagram
-+#endif
- int main( void )
- {
- anagram_init();
-diff --git a/bench/sequential/audiobeam/audiobeam.c b/bench/sequential/audiobeam/audiobeam.c
-index 3d7ee15..01ebd85 100755
---- a/bench/sequential/audiobeam/audiobeam.c
-+++ b/bench/sequential/audiobeam/audiobeam.c
-@@ -34,6 +34,9 @@
- void audiobeam_init();
- int audiobeam_return();
- void audiobeam_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_audiobeam
-+#endif
- int main( void );
- void audiobeam_preprocess_delays( struct audiobeam_PreprocessedDelays
- prep_delays[ ], float *delays );
-diff --git a/bench/sequential/cjpeg_transupp/cjpeg_transupp.c b/bench/sequential/cjpeg_transupp/cjpeg_transupp.c
-index c37ab95..a016b8e 100755
---- a/bench/sequential/cjpeg_transupp/cjpeg_transupp.c
-+++ b/bench/sequential/cjpeg_transupp/cjpeg_transupp.c
-@@ -46,6 +46,9 @@ void cjpeg_transupp_do_rot_180( j_compress_ptr );
- void cjpeg_transupp_do_rot_270( j_compress_ptr );
- void cjpeg_transupp_do_transverse( j_compress_ptr );
- void cjpeg_transupp_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_cjpeg_transupp
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c b/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
-index cb81d01..71b6835 100755
---- a/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
-+++ b/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
-@@ -71,6 +71,9 @@ int cjpeg_wrbmp_putc_modified( int character );
- void cjpeg_wrbmp_init();
- void cjpeg_wrbmp_main();
- int cjpeg_wrbmp_return();
-+#ifdef ALL_IN_ONE
-+ #define main main_cjpeg_wrbmp
-+#endif
- int main();
-
- /*
-diff --git a/bench/sequential/dijkstra/dijkstra.c b/bench/sequential/dijkstra/dijkstra.c
-index 7437c42..f71357b 100755
---- a/bench/sequential/dijkstra/dijkstra.c
-+++ b/bench/sequential/dijkstra/dijkstra.c
-@@ -63,6 +63,9 @@ void dijkstra_dequeue( int *node, int *dist, int *prev );
- int dijkstra_qcount( void );
- int dijkstra_find( int chStart, int chEnd );
- void dijkstra_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_dijkstra
-+#endif
- int main( void );
-
- void dijkstra_init( void )
-diff --git a/bench/sequential/epic/epic.c b/bench/sequential/epic/epic.c
-index dc781d4..a29d6fb 100755
---- a/bench/sequential/epic/epic.c
-+++ b/bench/sequential/epic/epic.c
-@@ -590,6 +590,9 @@ void epic_internal_filter( float *image, int x_dim, int y_dim, float *filt,
- void epic_reflect1( float *filt, int x_dim, int y_dim, int x_pos, int y_pos,
- float *result, int f_or_e );
- void epic_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_epic
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/fmref/fmref.c b/bench/sequential/fmref/fmref.c
-index c1b0611..80f65f9 100755
---- a/bench/sequential/fmref/fmref.c
-+++ b/bench/sequential/fmref/fmref.c
-@@ -72,6 +72,9 @@ int fmref_return( void )
- return 0;
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_fmref
-+#endif
- int main( void )
- {
- fmref_init();
-diff --git a/bench/sequential/g723_enc/g723_enc.c b/bench/sequential/g723_enc/g723_enc.c
-index fa46af3..27fd1cb 100755
---- a/bench/sequential/g723_enc/g723_enc.c
-+++ b/bench/sequential/g723_enc/g723_enc.c
-@@ -106,6 +106,9 @@ int g723_enc_pack_output(
- void g723_enc_init();
- int g723_enc_return();
- void g723_enc_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_g723_enc
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/sequential/gsm_dec/gsm_dec.c b/bench/sequential/gsm_dec/gsm_dec.c
-index 5c6cafd..ecaee90 100755
---- a/bench/sequential/gsm_dec/gsm_dec.c
-+++ b/bench/sequential/gsm_dec/gsm_dec.c
-@@ -110,6 +110,9 @@ void gsm_dec_Coefficients_27_39( word *LARpp_j_1, word *LARpp_j, word *LARp );
- gsm gsm_dec_create( void );
- void gsm_dec_init( void );
- void gsm_dec_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_gsm_dec
-+#endif
- int main( void );
-
- /* add.c */
-diff --git a/bench/sequential/gsm_enc/gsm_enc.c b/bench/sequential/gsm_enc/gsm_enc.c
-index 63ca392..85dc5c8 100755
---- a/bench/sequential/gsm_enc/gsm_enc.c
-+++ b/bench/sequential/gsm_enc/gsm_enc.c
-@@ -2216,6 +2216,9 @@ void _Pragma( "entrypoint" ) gsm_enc_main( void )
- gsm_enc_gsmdata + i * sizeof( gsm_frame ) );
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_gsm_enc
-+#endif
- int main( void )
- {
- gsm_enc_init();
-diff --git a/bench/sequential/h264_dec/h264_dec.c b/bench/sequential/h264_dec/h264_dec.c
-index db2b022..a4f26d3 100755
---- a/bench/sequential/h264_dec/h264_dec.c
-+++ b/bench/sequential/h264_dec/h264_dec.c
-@@ -36,6 +36,9 @@ void h264_dec_init ();
- int h264_dec_return ();
- void h264_dec_decode_one_macroblock( struct h264_dec_img_par *img );
- void h264_dec_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_h264_dec
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/huff_dec/huff_dec.c b/bench/sequential/huff_dec/huff_dec.c
-index 09e180c..f099760 100755
---- a/bench/sequential/huff_dec/huff_dec.c
-+++ b/bench/sequential/huff_dec/huff_dec.c
-@@ -77,6 +77,9 @@ void huff_dec_read_header( t_bin_val codes_table[ 257 ] );
- huff_dec_t_tree *huff_dec_tree_encoding( t_bin_val codes_table[ 257 ],
- huff_dec_t_tree heap[ 514 ] );
- void huff_dec_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_huff_dec
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/huff_enc/huff_enc.c b/bench/sequential/huff_enc/huff_enc.c
-index a2768dc..7e61011 100755
---- a/bench/sequential/huff_enc/huff_enc.c
-+++ b/bench/sequential/huff_enc/huff_enc.c
-@@ -85,6 +85,9 @@ void huff_enc_encode_codes_table( huff_enc_t_tree *tree,
- void huff_enc_create_codes_table( huff_enc_t_tree *tree,
- huff_enc_t_bin_val codes_table[ 257 ] );
- void huff_enc_main();
-+#ifdef ALL_IN_ONE
-+ #define main main_huff_enc
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/mpeg2/mpeg2.c b/bench/sequential/mpeg2/mpeg2.c
-index 62b8779..7d5cfbd 100755
---- a/bench/sequential/mpeg2/mpeg2.c
-+++ b/bench/sequential/mpeg2/mpeg2.c
-@@ -90,6 +90,9 @@ int mpeg2_bdist2( unsigned char *, unsigned char *, unsigned char *, int, int,
- int, int, int, int );
- int mpeg2_variance( unsigned char *, int );
- void mpeg2_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_mpeg2
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/ndes/ndes.c b/bench/sequential/ndes/ndes.c
-index 1e3e7d3..b7438f9 100755
---- a/bench/sequential/ndes/ndes.c
-+++ b/bench/sequential/ndes/ndes.c
-@@ -55,6 +55,9 @@ void ndes_ks( /*immense key, */int n, ndes_great *kn );
- void ndes_init( void );
- int ndes_return( void );
- void ndes_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_ndes
-+#endif
- int main( void );
-
- /*
-diff --git a/bench/sequential/petrinet/petrinet.c b/bench/sequential/petrinet/petrinet.c
-index 99b0cda..56a7e1e 100755
---- a/bench/sequential/petrinet/petrinet.c
-+++ b/bench/sequential/petrinet/petrinet.c
-@@ -41,6 +41,9 @@ int petrinet_main_iters_dummy_i = 0,
- void petrinet_init( void );
- int petrinet_return( void );
- void petrinet_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_petrinet
-+#endif
- int main( void );
-
-
-diff --git a/bench/sequential/rijndael_dec/rijndael_dec.c b/bench/sequential/rijndael_dec/rijndael_dec.c
-index fc065d1..a0ce4d5 100755
---- a/bench/sequential/rijndael_dec/rijndael_dec.c
-+++ b/bench/sequential/rijndael_dec/rijndael_dec.c
-@@ -179,6 +179,9 @@ void _Pragma( "entrypoint" ) rijndael_dec_main( void )
- rijndael_dec_decfile( &rijndael_dec_fin, ctx );
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_rijndael_dec
-+#endif
- int main()
- {
-
-diff --git a/bench/sequential/rijndael_enc/rijndael_enc.c b/bench/sequential/rijndael_enc/rijndael_enc.c
-index eaa7183..72e9393 100755
---- a/bench/sequential/rijndael_enc/rijndael_enc.c
-+++ b/bench/sequential/rijndael_enc/rijndael_enc.c
-@@ -222,6 +222,9 @@ void _Pragma( "entrypoint" ) rijndael_enc_main( void )
- rijndael_enc_encfile( &rijndael_enc_fin, ctx );
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_rijndael_enc
-+#endif
- int main( void )
- {
- rijndael_enc_init();
-diff --git a/bench/sequential/statemate/statemate.c b/bench/sequential/statemate/statemate.c
-index 1799905..b72a68d 100755
---- a/bench/sequential/statemate/statemate.c
-+++ b/bench/sequential/statemate/statemate.c
-@@ -1269,6 +1269,9 @@ void _Pragma ( "entrypoint" ) statemate_main( void )
- }
-
-
-+#ifdef ALL_IN_ONE
-+ #define main main_statemate
-+#endif
- int main ( void )
- {
- statemate_init();
-diff --git a/bench/sequential/susan/susan.c b/bench/sequential/susan/susan.c
-index 676bf61..807be77 100755
---- a/bench/sequential/susan/susan.c
-+++ b/bench/sequential/susan/susan.c
-@@ -2499,6 +2499,9 @@ int susan_return( void )
- return 0;
- }
-
-+#ifdef ALL_IN_ONE
-+ #define main main_susan
-+#endif
- int main( void )
- {
- susan_init();
-diff --git a/bench/test/cover/cover.c b/bench/test/cover/cover.c
-index 051fa91..6c5153f 100755
---- a/bench/test/cover/cover.c
-+++ b/bench/test/cover/cover.c
-@@ -693,6 +693,9 @@ void _Pragma( "entrypoint" ) cover_main( void )
- Main function
- */
-
-+#ifdef ALL_IN_ONE
-+ #define main main_cover
-+#endif
- int main( void )
- {
- cover_init();
-diff --git a/bench/test/duff/duff.c b/bench/test/duff/duff.c
-index 9fb49f1..83313ce 100755
---- a/bench/test/duff/duff.c
-+++ b/bench/test/duff/duff.c
-@@ -28,6 +28,9 @@ void duff_initialize( char *arr, int length );
- void duff_init();
- void duff_main( void );
- int duff_return( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_duff
-+#endif
- int main( void );
-
-
-diff --git a/bench/test/test3/test3.c b/bench/test/test3/test3.c
-index 0235738..6eaf8c2 100755
---- a/bench/test/test3/test3.c
-+++ b/bench/test/test3/test3.c
-@@ -154,6 +154,9 @@ void test3_func_2_0( void );
- void test3_func_1_0( void );
- void test3_func_0_0( void );
- void test3_main( void );
-+#ifdef ALL_IN_ONE
-+ #define main main_test3
-+#endif
- int main( void );
-
-
-diff --git a/taclebench.c b/taclebench.c
-new file mode 100644
-index 0000000..aaff1bb
---- /dev/null
-+++ b/taclebench.c
-@@ -0,0 +1,366 @@
-+#include
-+#include
-+
-+int main_epic(void);
-+int main_mpeg2(void);
-+int main_cjpeg_transupp(void);
-+int main_adpcm_enc(void);
-+int main_rijndael_dec(void);
-+int main_huff_enc(void);
-+int main_dijkstra(void);
-+int main_gsm_dec(void);
-+int main_ammunition(void);
-+int main_susan(void);
-+int main_ndes(void);
-+int main_petrinet(void);
-+int main_gsm_enc(void);
-+int main_h264_dec(void);
-+int main_rijndael_enc(void);
-+int main_huff_dec(void);
-+int main_anagram(void);
-+int main_g723_enc(void);
-+int main_adpcm_dec(void);
-+int main_cjpeg_wrbmp(void);
-+int main_statemate(void);
-+int main_fmref(void);
-+int main_audiobeam(void);
-+int main_test3(void);
-+int main_duff(void);
-+int main_cover(void);
-+int main_powerwindow(void);
-+int main_lift(void);
-+int main_fac(void);
-+int main_bsort(void);
-+int main_complex_updates(void);
-+int main_cosf(void);
-+int main_isqrt(void);
-+int main_minver(void);
-+int main_pm(void);
-+int main_lms(void);
-+int main_binarysearch(void);
-+int main_fft(void);
-+int main_sha(void);
-+int main_iir(void);
-+int main_matrix1(void);
-+int main_st(void);
-+int main_prime(void);
-+int main_deg2rad(void);
-+int main_filterbank(void);
-+int main_jfdctint(void);
-+int main_fir2dim(void);
-+int main_ludcmp(void);
-+int main_bitcount(void);
-+int main_md5(void);
-+int main_recursion(void);
-+int main_insertsort(void);
-+int main_cubic(void);
-+int main_rad2deg(void);
-+int main_quicksort(void);
-+int main_countnegative(void);
-+int main_bitonic(void);
-+
-+int main(void)
-+{
-+ struct timespec start_ts;
-+ struct timespec end_ts;
-+ clock_gettime(CLOCK_MONOTONIC, &start_ts);
-+
-+ if (main_epic() != 0)
-+ {
-+ printf("main_epic error\n");
-+ }
-+
-+ if (main_mpeg2() != 0)
-+ {
-+ printf("main_mpeg2 error\n");
-+ }
-+
-+ if (main_cjpeg_transupp() != 0)
-+ {
-+ printf("main_cjpeg_transupp error\n");
-+ }
-+
-+ if (main_adpcm_enc() != 0)
-+ {
-+ printf("main_adpcm_enc error\n");
-+ }
-+
-+ if (main_rijndael_dec() != 0)
-+ {
-+ printf("main_rijndael_dec error\n");
-+ }
-+
-+ if (main_huff_enc() != 0)
-+ {
-+ printf("main_huff_enc error\n");
-+ }
-+
-+ if (main_dijkstra() != 0)
-+ {
-+ printf("main_dijkstra error\n");
-+ }
-+
-+ if (main_gsm_dec() != 0)
-+ {
-+ printf("main_gsm_dec error\n");
-+ }
-+
-+ if (main_ammunition() != 0)
-+ {
-+ printf("main_ammunition error\n");
-+ }
-+
-+ if (main_susan() != 0)
-+ {
-+ printf("main_susan error\n");
-+ }
-+
-+ if (main_ndes() != 0)
-+ {
-+ printf("main_ndes error\n");
-+ }
-+
-+ if (main_petrinet() != 0)
-+ {
-+ printf("main_petrinet error\n");
-+ }
-+
-+ if (main_gsm_enc() != 0)
-+ {
-+ printf("main_gsm_enc error\n");
-+ }
-+
-+ if (main_h264_dec() != 0)
-+ {
-+ printf("main_h264_dec error\n");
-+ }
-+
-+ if (main_rijndael_enc() != 0)
-+ {
-+ printf("main_rijndael_enc error\n");
-+ }
-+
-+ if (main_huff_dec() != 0)
-+ {
-+ printf("main_huff_dec error\n");
-+ }
-+
-+ if (main_anagram() != 0)
-+ {
-+ printf("main_anagram error\n");
-+ }
-+
-+ if (main_g723_enc() != 0)
-+ {
-+ printf("main_g723_enc error\n");
-+ }
-+
-+ if (main_adpcm_dec() != 0)
-+ {
-+ printf("main_adpcm_dec error\n");
-+ }
-+
-+ if (main_cjpeg_wrbmp() != 0)
-+ {
-+ printf("main_cjpeg_wrbmp error\n");
-+ }
-+
-+ if (main_statemate() != 0)
-+ {
-+ printf("main_statemate error\n");
-+ }
-+
-+ if (main_fmref() != 0)
-+ {
-+ printf("main_fmref error\n");
-+ }
-+
-+ if (main_audiobeam() != 0)
-+ {
-+ printf("main_audiobeam error\n");
-+ }
-+
-+ if (main_test3() != 0)
-+ {
-+ printf("main_test3 error\n");
-+ }
-+
-+ if (main_duff() != 0)
-+ {
-+ printf("main_duff error\n");
-+ }
-+
-+ if (main_cover() != 0)
-+ {
-+ printf("main_cover error\n");
-+ }
-+
-+ if (main_powerwindow() != 0)
-+ {
-+ printf("main_powerwindow error\n");
-+ }
-+
-+ if (main_lift() != 0)
-+ {
-+ printf("main_lift error\n");
-+ }
-+
-+ if (main_fac() != 0)
-+ {
-+ printf("main_fac error\n");
-+ }
-+
-+ if (main_bsort() != 0)
-+ {
-+ printf("main_bsort error\n");
-+ }
-+
-+ if (main_complex_updates() != 0)
-+ {
-+ printf("main_complex_updates error\n");
-+ }
-+
-+ if (main_cosf() != 0)
-+ {
-+ printf("main_cosf error\n");
-+ }
-+
-+ if (main_isqrt() != 0)
-+ {
-+ printf("main_isqrt error\n");
-+ }
-+
-+ if (main_minver() != 0)
-+ {
-+ printf("main_minver error\n");
-+ }
-+
-+ if (main_pm() != 0)
-+ {
-+ printf("main_pm error\n");
-+ }
-+
-+ if (main_lms() != 0)
-+ {
-+ printf("main_lms error\n");
-+ }
-+
-+ if (main_binarysearch() != 0)
-+ {
-+ printf("main_binarysearch error\n");
-+ }
-+
-+ if (main_fft() != 0)
-+ {
-+ printf("main_fft error\n");
-+ }
-+
-+ if (main_sha() != 0)
-+ {
-+ printf("main_sha error\n");
-+ }
-+
-+ if (main_iir() != 0)
-+ {
-+ printf("main_iir error\n");
-+ }
-+
-+ if (main_matrix1() != 0)
-+ {
-+ printf("main_matrix1 error\n");
-+ }
-+
-+ if (main_st() != 0)
-+ {
-+ printf("main_st error\n");
-+ }
-+
-+ if (main_prime() != 0)
-+ {
-+ printf("main_prime error\n");
-+ }
-+
-+ if (main_deg2rad() != 0)
-+ {
-+ printf("main_deg2rad error\n");
-+ }
-+
-+ if (main_filterbank() != 0)
-+ {
-+ printf("main_filterbank error\n");
-+ }
-+
-+ if (main_jfdctint() != 0)
-+ {
-+ printf("main_jfdctint error\n");
-+ }
-+
-+ if (main_fir2dim() != 0)
-+ {
-+ printf("main_fir2dim error\n");
-+ }
-+
-+ if (main_ludcmp() != 0)
-+ {
-+ printf("main_ludcmp error\n");
-+ }
-+
-+ if (main_bitcount() != 0)
-+ {
-+ printf("main_bitcount error\n");
-+ }
-+
-+ if (main_md5() != 0)
-+ {
-+ printf("main_md5 error\n");
-+ }
-+
-+ if (main_recursion() != 0)
-+ {
-+ printf("main_recursion error\n");
-+ }
-+
-+ if (main_insertsort() != 0)
-+ {
-+ printf("main_insertsort error\n");
-+ }
-+
-+ if (main_cubic() != 0)
-+ {
-+ printf("main_cubic error\n");
-+ }
-+
-+ if (main_rad2deg() != 0)
-+ {
-+ printf("main_rad2deg error\n");
-+ }
-+
-+ if (main_quicksort() != 0)
-+ {
-+ printf("main_quicksort error\n");
-+ }
-+
-+ if (main_countnegative() != 0)
-+ {
-+ printf("main_countnegative error\n");
-+ }
-+
-+ if (main_bitonic() != 0)
-+ {
-+ printf("main_bitonic error\n");
-+ }
-+
-+ clock_gettime(CLOCK_MONOTONIC, &end_ts);
-+ long sec_diff = end_ts.tv_sec - start_ts.tv_sec;
-+ long nsec_diff = end_ts.tv_nsec - start_ts.tv_nsec;
-+
-+ if (nsec_diff < 0)
-+ {
-+ sec_diff -= 1;
-+ nsec_diff += 1000000000;
-+ }
-+
-+ printf("%ld.%09ld seconds\n", sec_diff, nsec_diff);
-+
-+ return 0;
-+}
---
-2.34.1
-
diff --git a/benchmarks/tacle-bench/CMakeLists.txt b/benchmarks/tacle-bench/CMakeLists.txt
deleted file mode 100644
index f443d45cd..000000000
--- a/benchmarks/tacle-bench/CMakeLists.txt
+++ /dev/null
@@ -1,199 +0,0 @@
-############################################################################
-# apps/benchmarks/tacle-bench/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-if(CONFIG_BENCHMARK_TACLEBENCH)
-
- set(SRCS tacle-bench/taclebench_main.c)
-
- set(TACLEBENCH_UNPACK ${CMAKE_CURRENT_LIST_DIR}/tacle-bench)
- set(TACLEBENCH_URL https://github.com/tacle/tacle-bench/archive)
- set(TACLEBENCH_ZIP master.zip)
-
- if(NOT EXISTS ${TACLEBENCH_UNPACK})
-
- FetchContent_Declare(
- taclebench_fetch
- URL ${TACLEBENCH_URL}/${TACLEBENCH_ZIP} SOURCE_DIR ${TACLEBENCH_UNPACK}
- BINARY_DIR ${CMAKE_BINARY_DIR}/apps/benchmarks/tacle-bench/tacle-bench
- PATCH_COMMAND
- patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/0001-tacle-bench-add-makefile-and-all-in-one-main-file.patch
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(taclebench_fetch)
- if(NOT taclebench_fetch_POPULATED)
- FetchContent_Populate(taclebench_fetch)
- endif()
-
- endif()
-
- # app
- list(
- APPEND
- SRCS
- tacle-bench/bench/app/powerwindow/powerwindow_const_params.c
- tacle-bench/bench/app/powerwindow/powerwindow_inputs.c
- tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_BackL.c
- tacle-bench/bench/app/powerwindow/powerwindow_debounce.c
- tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_DRV.c
- tacle-bench/bench/app/powerwindow/wcclib.c
- tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_BackR.c
- tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_Front.c
- tacle-bench/bench/app/powerwindow/powerwindow_controlexclusion.c
- tacle-bench/bench/app/powerwindow/powerwindow.c
- tacle-bench/bench/app/powerwindow/powerwindow_powerwindow_control.c
- tacle-bench/bench/app/lift/lift.c
- tacle-bench/bench/app/lift/liftlibio.c
- tacle-bench/bench/app/lift/liftlibcontrol.c)
-
- # kernel
- list(
- APPEND
- SRCS
- tacle-bench/bench/kernel/fac/fac.c
- tacle-bench/bench/kernel/bsort/bsort.c
- tacle-bench/bench/kernel/complex_updates/complex_updates.c
- tacle-bench/bench/kernel/cosf/cosf.c
- tacle-bench/bench/kernel/isqrt/isqrt.c
- tacle-bench/bench/kernel/isqrt/basicmath_libc.c
- tacle-bench/bench/kernel/minver/minver.c
- tacle-bench/bench/kernel/pm/pm_stdlib.c
- tacle-bench/bench/kernel/pm/pm_input.c
- tacle-bench/bench/kernel/pm/pm_libm.c
- tacle-bench/bench/kernel/pm/pm.c
- tacle-bench/bench/kernel/lms/lms.c
- tacle-bench/bench/kernel/binarysearch/binarysearch.c
- tacle-bench/bench/kernel/fft/fft_input.c
- tacle-bench/bench/kernel/fft/fft.c
- tacle-bench/bench/kernel/sha/memset.c
- tacle-bench/bench/kernel/sha/input_small.c
- tacle-bench/bench/kernel/sha/memhelper.c
- tacle-bench/bench/kernel/sha/memcpy.c
- tacle-bench/bench/kernel/sha/sha.c
- tacle-bench/bench/kernel/iir/iir.c
- tacle-bench/bench/kernel/matrix1/matrix1.c
- tacle-bench/bench/kernel/st/st.c
- tacle-bench/bench/kernel/prime/prime.c
- tacle-bench/bench/kernel/deg2rad/deg2rad.c
- tacle-bench/bench/kernel/filterbank/filterbank.c
- tacle-bench/bench/kernel/jfdctint/jfdctint.c
- tacle-bench/bench/kernel/fir2dim/fir2dim.c
- tacle-bench/bench/kernel/ludcmp/ludcmp.c
- tacle-bench/bench/kernel/bitcount/bitcount.c
- tacle-bench/bench/kernel/bitcount/bitcnt_2.c
- tacle-bench/bench/kernel/bitcount/bitcnt_1.c
- tacle-bench/bench/kernel/bitcount/bitcnt_3.c
- tacle-bench/bench/kernel/bitcount/bitcnt_4.c
- tacle-bench/bench/kernel/md5/md5.c
- tacle-bench/bench/kernel/recursion/recursion.c
- tacle-bench/bench/kernel/insertsort/insertsort.c
- tacle-bench/bench/kernel/cubic/cubic.c
- tacle-bench/bench/kernel/rad2deg/rad2deg.c
- tacle-bench/bench/kernel/quicksort/quicksortstdlib.c
- tacle-bench/bench/kernel/quicksort/input.c
- tacle-bench/bench/kernel/quicksort/quicksortlibm.c
- tacle-bench/bench/kernel/quicksort/quicksort.c
- tacle-bench/bench/kernel/countnegative/countnegative.c
- tacle-bench/bench/kernel/bitonic/bitonic.c)
-
- # sequential
- list(
- APPEND
- SRCS
- tacle-bench/bench/sequential/epic/epic.c
- tacle-bench/bench/sequential/mpeg2/mpeg2.c
- tacle-bench/bench/sequential/cjpeg_transupp/cjpeg_transupp.c
- tacle-bench/bench/sequential/adpcm_enc/adpcm_enc.c
- tacle-bench/bench/sequential/rijndael_dec/rijndael_dec.c
- tacle-bench/bench/sequential/rijndael_dec/input_small_enc.c
- tacle-bench/bench/sequential/rijndael_dec/aes.c
- tacle-bench/bench/sequential/rijndael_dec/rijndael_dec_libc.c
- tacle-bench/bench/sequential/huff_enc/huff_enc.c
- tacle-bench/bench/sequential/dijkstra/dijkstra.c
- tacle-bench/bench/sequential/dijkstra/input.c
- tacle-bench/bench/sequential/gsm_dec/gsm_dec.c
- tacle-bench/bench/sequential/ammunition/arithm.c
- tacle-bench/bench/sequential/ammunition/ammunition.c
- tacle-bench/bench/sequential/ammunition/bits.c
- tacle-bench/bench/sequential/ammunition/ammunition_libc.c
- tacle-bench/bench/sequential/susan/wccmalloc.c
- tacle-bench/bench/sequential/susan/wccfile.c
- tacle-bench/bench/sequential/susan/input.c
- tacle-bench/bench/sequential/susan/susan.c
- tacle-bench/bench/sequential/susan/wcclibm.c
- tacle-bench/bench/sequential/ndes/ndes.c
- tacle-bench/bench/sequential/petrinet/petrinet.c
- tacle-bench/bench/sequential/gsm_enc/gsm_enc.c
- tacle-bench/bench/sequential/h264_dec/h264_decinput.c
- tacle-bench/bench/sequential/h264_dec/h264_dec.c
- tacle-bench/bench/sequential/rijndael_enc/input_small.c
- tacle-bench/bench/sequential/rijndael_enc/rijndael_enc.c
- tacle-bench/bench/sequential/rijndael_enc/aes.c
- tacle-bench/bench/sequential/rijndael_enc/rijndael_enc_libc.c
- tacle-bench/bench/sequential/huff_dec/huff_dec.c
- tacle-bench/bench/sequential/anagram/anagram_stdlib.c
- tacle-bench/bench/sequential/anagram/anagram.c
- tacle-bench/bench/sequential/anagram/anagram_input.c
- tacle-bench/bench/sequential/g723_enc/g723_enc.c
- tacle-bench/bench/sequential/adpcm_dec/adpcm_dec.c
- tacle-bench/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
- tacle-bench/bench/sequential/cjpeg_wrbmp/input.c
- tacle-bench/bench/sequential/statemate/statemate.c
- tacle-bench/bench/sequential/fmref/fmref.c
- tacle-bench/bench/sequential/fmref/wcclibm.c
- tacle-bench/bench/sequential/audiobeam/audiobeamlibmalloc.c
- tacle-bench/bench/sequential/audiobeam/audiobeam.c
- tacle-bench/bench/sequential/audiobeam/audiobeamlibm.c
- tacle-bench/bench/sequential/audiobeam/audiobeaminput.c
- tacle-bench/bench/test/test3/test3.c
- tacle-bench/bench/test/duff/duff.c
- tacle-bench/bench/test/cover/cover.c)
-
- # only one wcclibm
- list(APPEND SRCS tacle-bench/bench/kernel/cosf/wcclibm.c)
-
- list(
- APPEND
- CFLAGS
- -DALL_IN_ONE
- -Wno-unknown-pragmas
- -Wno-strict-prototypes
- -Wno-array-bounds
- -Wno-shadow
- -Wno-stringop-overflow
- -Wno-maybe-uninitialized)
-
- nuttx_add_application(
- NAME
- taclebench
- PRIORITY
- ${CONFIG_BENCHMARK_TACLEBENCH_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_TACLEBENCH_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_TACLEBENCH}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-endif()
diff --git a/benchmarks/tacle-bench/Kconfig b/benchmarks/tacle-bench/Kconfig
deleted file mode 100644
index 5ac56bb3f..000000000
--- a/benchmarks/tacle-bench/Kconfig
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_TACLEBENCH
- tristate "TacleBench"
- default n
- ---help---
- A real-time benchmark from WCET'16.
-
-if BENCHMARK_TACLEBENCH
-
-config BENCHMARK_TACLEBENCH_PRIORITY
- int "TacleBench task priority"
- default 100
-
-config BENCHMARK_TACLEBENCH_STACKSIZE
- int "TacleBench stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/tacle-bench/Make.defs b/benchmarks/tacle-bench/Make.defs
deleted file mode 100644
index db0d4f777..000000000
--- a/benchmarks/tacle-bench/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/tacle-bench/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_TACLEBENCH),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/tacle-bench
-endif
diff --git a/benchmarks/tacle-bench/Makefile b/benchmarks/tacle-bench/Makefile
deleted file mode 100644
index b574c0f59..000000000
--- a/benchmarks/tacle-bench/Makefile
+++ /dev/null
@@ -1,184 +0,0 @@
-############################################################################
-# apps/benchmarks/tacle-bench/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-############################################################################
-# Targets
-############################################################################
-
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = taclebench
-PRIORITY = $(CONFIG_BENCHMARK_TACLEBENCH_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_TACLEBENCH_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_TACLEBENCH)
-
-TACLEBENCH_UNPACK = tacle-bench
-TACLEBENCH_URL = https://github.com/tacle/tacle-bench/archive
-TACLEBENCH_VERSION = master
-TACLEBENCH_ZIP = $(TACLEBENCH_UNPACK)-$(TACLEBENCH_VERSION).zip
-UNPACK ?= unzip -q -o
-
-$(TACLEBENCH_ZIP):
- @echo "Downloading: $(TACLEBENCH_URL)"
- $(Q) curl -L $(TACLEBENCH_URL)/$(TACLEBENCH_VERSION).zip -o $(TACLEBENCH_UNPACK)-$(TACLEBENCH_VERSION).zip
-
-$(TACLEBENCH_UNPACK): $(TACLEBENCH_ZIP)
- @echo "Unpacking: $(TACLEBENCH_ZIP) -> $(TACLEBENCH_UNPACK)"
- $(Q) $(UNPACK) $(TACLEBENCH_ZIP)
- $(Q) mv tacle-bench-$(TACLEBENCH_VERSION) $(TACLEBENCH_UNPACK)
- $(Q) touch $(TACLEBENCH_UNPACK)
- @echo "Patching: Applying patch"
- $(Q) cd tacle-bench && patch -p1 < ../0001-tacle-bench-add-makefile-and-all-in-one-main-file.patch
-
-ifeq ($(wildcard $(TACLEBENCH_UNPACK)/.git),)
-context:: $(TACLEBENCH_UNPACK)
-
-distclean::
- $(call DELDIR, $(TACLEBENCH_UNPACK))
- $(call DELFILE, $(TACLEBENCH_ZIP))
-endif
-
-# app
-CSRCS = tacle-bench/bench/app/powerwindow/powerwindow_const_params.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_inputs.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_BackL.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_debounce.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_DRV.c
-CSRCS += tacle-bench/bench/app/powerwindow/wcclib.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_BackR.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_PW_Control_PSG_Front.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_controlexclusion.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow.c
-CSRCS += tacle-bench/bench/app/powerwindow/powerwindow_powerwindow_control.c
-CSRCS += tacle-bench/bench/app/lift/lift.c
-CSRCS += tacle-bench/bench/app/lift/liftlibio.c
-CSRCS += tacle-bench/bench/app/lift/liftlibcontrol.c
-
-# kernel
-CSRCS += tacle-bench/bench/kernel/fac/fac.c
-CSRCS += tacle-bench/bench/kernel/bsort/bsort.c
-CSRCS += tacle-bench/bench/kernel/complex_updates/complex_updates.c
-CSRCS += tacle-bench/bench/kernel/cosf/cosf.c
-CSRCS += tacle-bench/bench/kernel/isqrt/isqrt.c
-CSRCS += tacle-bench/bench/kernel/isqrt/basicmath_libc.c
-CSRCS += tacle-bench/bench/kernel/minver/minver.c
-CSRCS += tacle-bench/bench/kernel/pm/pm_stdlib.c
-CSRCS += tacle-bench/bench/kernel/pm/pm_input.c
-CSRCS += tacle-bench/bench/kernel/pm/pm_libm.c
-CSRCS += tacle-bench/bench/kernel/pm/pm.c
-CSRCS += tacle-bench/bench/kernel/lms/lms.c
-CSRCS += tacle-bench/bench/kernel/binarysearch/binarysearch.c
-CSRCS += tacle-bench/bench/kernel/fft/fft_input.c
-CSRCS += tacle-bench/bench/kernel/fft/fft.c
-CSRCS += tacle-bench/bench/kernel/sha/memset.c
-CSRCS += tacle-bench/bench/kernel/sha/input_small.c
-CSRCS += tacle-bench/bench/kernel/sha/memhelper.c
-CSRCS += tacle-bench/bench/kernel/sha/memcpy.c
-CSRCS += tacle-bench/bench/kernel/sha/sha.c
-CSRCS += tacle-bench/bench/kernel/iir/iir.c
-CSRCS += tacle-bench/bench/kernel/matrix1/matrix1.c
-CSRCS += tacle-bench/bench/kernel/st/st.c
-CSRCS += tacle-bench/bench/kernel/prime/prime.c
-CSRCS += tacle-bench/bench/kernel/deg2rad/deg2rad.c
-CSRCS += tacle-bench/bench/kernel/filterbank/filterbank.c
-CSRCS += tacle-bench/bench/kernel/jfdctint/jfdctint.c
-CSRCS += tacle-bench/bench/kernel/fir2dim/fir2dim.c
-CSRCS += tacle-bench/bench/kernel/ludcmp/ludcmp.c
-CSRCS += tacle-bench/bench/kernel/bitcount/bitcount.c
-CSRCS += tacle-bench/bench/kernel/bitcount/bitcnt_2.c
-CSRCS += tacle-bench/bench/kernel/bitcount/bitcnt_1.c
-CSRCS += tacle-bench/bench/kernel/bitcount/bitcnt_3.c
-CSRCS += tacle-bench/bench/kernel/bitcount/bitcnt_4.c
-CSRCS += tacle-bench/bench/kernel/md5/md5.c
-CSRCS += tacle-bench/bench/kernel/recursion/recursion.c
-CSRCS += tacle-bench/bench/kernel/insertsort/insertsort.c
-CSRCS += tacle-bench/bench/kernel/cubic/cubic.c
-CSRCS += tacle-bench/bench/kernel/rad2deg/rad2deg.c
-CSRCS += tacle-bench/bench/kernel/quicksort/quicksortstdlib.c
-CSRCS += tacle-bench/bench/kernel/quicksort/input.c
-CSRCS += tacle-bench/bench/kernel/quicksort/quicksortlibm.c
-CSRCS += tacle-bench/bench/kernel/quicksort/quicksort.c
-CSRCS += tacle-bench/bench/kernel/countnegative/countnegative.c
-CSRCS += tacle-bench/bench/kernel/bitonic/bitonic.c
-
-# sequential
-CSRCS += tacle-bench/bench/sequential/epic/epic.c
-CSRCS += tacle-bench/bench/sequential/mpeg2/mpeg2.c
-CSRCS += tacle-bench/bench/sequential/cjpeg_transupp/cjpeg_transupp.c
-CSRCS += tacle-bench/bench/sequential/adpcm_enc/adpcm_enc.c
-CSRCS += tacle-bench/bench/sequential/rijndael_dec/rijndael_dec.c
-CSRCS += tacle-bench/bench/sequential/rijndael_dec/input_small_enc.c
-CSRCS += tacle-bench/bench/sequential/rijndael_dec/aes.c
-CSRCS += tacle-bench/bench/sequential/rijndael_dec/rijndael_dec_libc.c
-CSRCS += tacle-bench/bench/sequential/huff_enc/huff_enc.c
-CSRCS += tacle-bench/bench/sequential/dijkstra/dijkstra.c
-CSRCS += tacle-bench/bench/sequential/dijkstra/input.c
-CSRCS += tacle-bench/bench/sequential/gsm_dec/gsm_dec.c
-CSRCS += tacle-bench/bench/sequential/ammunition/arithm.c
-CSRCS += tacle-bench/bench/sequential/ammunition/ammunition.c
-CSRCS += tacle-bench/bench/sequential/ammunition/bits.c
-CSRCS += tacle-bench/bench/sequential/ammunition/ammunition_libc.c
-CSRCS += tacle-bench/bench/sequential/susan/wccmalloc.c
-CSRCS += tacle-bench/bench/sequential/susan/wccfile.c
-CSRCS += tacle-bench/bench/sequential/susan/input.c
-CSRCS += tacle-bench/bench/sequential/susan/susan.c
-CSRCS += tacle-bench/bench/sequential/susan/wcclibm.c
-CSRCS += tacle-bench/bench/sequential/ndes/ndes.c
-CSRCS += tacle-bench/bench/sequential/petrinet/petrinet.c
-CSRCS += tacle-bench/bench/sequential/gsm_enc/gsm_enc.c
-CSRCS += tacle-bench/bench/sequential/h264_dec/h264_decinput.c
-CSRCS += tacle-bench/bench/sequential/h264_dec/h264_dec.c
-CSRCS += tacle-bench/bench/sequential/rijndael_enc/input_small.c
-CSRCS += tacle-bench/bench/sequential/rijndael_enc/rijndael_enc.c
-CSRCS += tacle-bench/bench/sequential/rijndael_enc/aes.c
-CSRCS += tacle-bench/bench/sequential/rijndael_enc/rijndael_enc_libc.c
-CSRCS += tacle-bench/bench/sequential/huff_dec/huff_dec.c
-CSRCS += tacle-bench/bench/sequential/anagram/anagram_stdlib.c
-CSRCS += tacle-bench/bench/sequential/anagram/anagram.c
-CSRCS += tacle-bench/bench/sequential/anagram/anagram_input.c
-CSRCS += tacle-bench/bench/sequential/g723_enc/g723_enc.c
-CSRCS += tacle-bench/bench/sequential/adpcm_dec/adpcm_dec.c
-CSRCS += tacle-bench/bench/sequential/cjpeg_wrbmp/cjpeg_wrbmp.c
-CSRCS += tacle-bench/bench/sequential/cjpeg_wrbmp/input.c
-CSRCS += tacle-bench/bench/sequential/statemate/statemate.c
-CSRCS += tacle-bench/bench/sequential/fmref/fmref.c
-CSRCS += tacle-bench/bench/sequential/fmref/wcclibm.c
-CSRCS += tacle-bench/bench/sequential/audiobeam/audiobeamlibmalloc.c
-CSRCS += tacle-bench/bench/sequential/audiobeam/audiobeam.c
-CSRCS += tacle-bench/bench/sequential/audiobeam/audiobeamlibm.c
-CSRCS += tacle-bench/bench/sequential/audiobeam/audiobeaminput.c
-CSRCS += tacle-bench/bench/test/test3/test3.c
-CSRCS += tacle-bench/bench/test/duff/duff.c
-CSRCS += tacle-bench/bench/test/cover/cover.c
-
-# only one wcclibm is allowed
-CSRCS += tacle-bench/bench/kernel/cosf/wcclibm.c
-
-MAINSRC = tacle-bench/taclebench.c
-
-CFLAGS += -DALL_IN_ONE
-CFLAGS += -Wno-unknown-pragmas -Wno-strict-prototypes
-CFLAGS += -Wno-array-bounds -Wno-shadow
-CFLAGS += -Wno-stringop-overflow -Wno-maybe-uninitialized
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/tacle-bench/generate_taclebench_c.sh b/benchmarks/tacle-bench/generate_taclebench_c.sh
deleted file mode 100755
index c6b69e0bc..000000000
--- a/benchmarks/tacle-bench/generate_taclebench_c.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-############################################################################
-# apps/benchmarks/tacle-bench/generate_taclebench_c.sh
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-MAIN_C=tacle-bench/taclebench.c
-BENCH_PATH=tacle-bench/bench
-GENERATE_PATH=tacle-bench
-
-search_main() {
- local file="$1"
- local filename=$(basename "$file")
- local new_main="main_${filename%.*}"
-
- flag=0
-
- # try to modifiy main function declaration first
- if grep -q "int main();" "$file"; then
- flag=1
- sed -i 's/int main();/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main();/' "${file}"
- elif grep -q "int main( void );" "$file"; then
- flag=1
- sed -i 's/int main( void );/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main( void );/' "${file}"
- elif grep -q "int main ( void );" "$file"; then
- flag=1
- sed -i 's/int main ( void );/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main ( void );/' "${file}"
- fi
-
- # if no main function delaration, try to modify main function
- if [ "$flag" -eq 0 ]; then
- if grep -q "int main()$" "$file"; then
- flag=1
- sed -i 's/int main()$/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main()/' "${file}"
- elif grep -q "int main( void )$" "$file"; then
- flag=1
- sed -i 's/int main( void )$/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main( void )/' "${file}"
- elif grep -q "int main ( void )$" "$file"; then
- flag=1
- sed -i 's/int main ( void )$/#ifdef ALL_IN_ONE\n #define main '"${new_main}"'\n#endif\nint main ( void )/' "${file}"
- fi
- fi
-
- if [ "$flag" -eq 1 ]; then
- echo "int $new_main (void);" >> $${MAIN_C}.tmp
- echo " if ($new_main() != 0) { printf(\"$new_main error\n\"); }" >> $MAIN_C
- echo "" >> $MAIN_C
- else
- echo "Failed to modify main function in $file"
- fi
-}
-
-# search for c file
-find_c_files() {
- local dir="$1"
- find "$dir" -type f -name "*.c" | while read -r file; do
- search_main "$file"
- done
-}
-
-> ${MAIN_C}.tmp
-echo "#include " >> ${MAIN_C}.tmp
-echo "int main (void) {" >> $MAIN_C
-
-
-# exclude bench/parallel
-mv $BENCH_PATH/parallel ./parallel
-
-find_c_files "$BENCH_PATH"
-
-echo " return 0;" >> $MAIN_C
-echo "}" >> $MAIN_C
-
-cat $MAIN_C >> ${MAIN_C}.tmp
-
-mv ${MAIN_C}.tmp $MAIN_C
-# restore bench/parallel
-mv ./parallel $BENCH_PATH/parallel
diff --git a/benchmarks/test-tlb/.gitignore b/benchmarks/test-tlb/.gitignore
deleted file mode 100644
index 3c99f56ef..000000000
--- a/benchmarks/test-tlb/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/test-tlb
-/*.zip
diff --git a/benchmarks/test-tlb/0001-test-tlb-port-for-NuttX.patch b/benchmarks/test-tlb/0001-test-tlb-port-for-NuttX.patch
deleted file mode 100644
index 1a355cef6..000000000
--- a/benchmarks/test-tlb/0001-test-tlb-port-for-NuttX.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From fe4108f726a0e30d429f031a6006f030c5eda113 Mon Sep 17 00:00:00 2001
-From: ouyangxiangzhen
-Date: Thu, 6 Jun 2024 19:53:37 +0800
-Subject: [PATCH] test-tlb: port for NuttX
-
-VELAPLATFO-25227
-
-This commit ports the test-tlb test program to the NuttX. Additionally, it implements dynamic CPU frequency calculation.
-
-Change-Id: If1c15f36742d7ee5a7d13147b41b3372047dad08
-Signed-off-by: ouyangxiangzhen
----
- test-tlb.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++----
- 1 file changed, 63 insertions(+), 5 deletions(-)
-
-diff --git a/test-tlb.c b/test-tlb.c
-index 5c8aaa5..767794a 100644
---- a/test-tlb.c
-+++ b/test-tlb.c
-@@ -14,13 +14,58 @@
- #include
- #include
-
--#define PAGE_SIZE 4096
--
--#define FREQ 3.9
-
- static int test_hugepage = 0;
- static int random_list = 0;
-
-+/* Fix definition conflict */
-+#ifndef PAGE_SIZE
-+#define PAGE_SIZE 4096
-+#endif
-+
-+/* dynamic calculate freq */
-+#define MEASURE_GAP 500000
-+
-+#ifdef __x86_64__
-+static inline unsigned long rdcnt_relax(void)
-+{
-+ unsigned int lo,hi;
-+ asm volatile ("rdtsc" : "=a" (lo), "=d" (hi));
-+ return ((unsigned long)hi << 32) | (unsigned long)lo;
-+}
-+#elif defined(__aarch64__)
-+static inline unsigned long rdcnt_relax(void)
-+{
-+ unsigned long time;
-+ asm volatile("mrs %0, cntvct_el0" : "=r"(time));
-+ return time;
-+}
-+#else
-+#error "Unsupported architecture for dynamic frequencies measuring"
-+#endif
-+
-+static inline unsigned long rdcnt(void)
-+{
-+ return rdcnt_relax();
-+}
-+
-+static unsigned long measure_freq(void)
-+{
-+ unsigned long cycles_per_useconds;
-+ unsigned long start;
-+ unsigned long end;
-+
-+ start = rdcnt();
-+ usleep(MEASURE_GAP);
-+ end = rdcnt();
-+
-+ cycles_per_useconds = (end - start) / MEASURE_GAP;
-+
-+ printf("cycles_per_microseconds: %lu\n", cycles_per_useconds);
-+
-+ return cycles_per_useconds;
-+}
-+
- static void die(const char *fmt, ...)
- {
- va_list argp;
-@@ -69,7 +114,7 @@ static unsigned long warmup(void *map)
-
- static double do_test(void *map)
- {
-- unsigned long count = 0, offset = 0, usec;
-+ unsigned long volatile count = 0, offset = 0, usec;
- struct timeval start, end;
- struct itimerval itval = {
- .it_interval = { 0, 0 },
-@@ -190,7 +235,14 @@ static void *create_map(void *map, unsigned long size, unsigned long stride)
- if (map) {
- if (test_hugepage)
- return map;
-+
-+#ifdef __NuttX__
-+ if (munmap(map, size) != 0)
-+ die("munmap failed\n");
-+ map = NULL;
-+#else
- flags |= MAP_FIXED;
-+#endif
- }
-
- mapsize = size;
-@@ -237,9 +289,14 @@ int main(int argc, char **argv)
- const char *arg;
- void *map;
- double cycles;
-+ unsigned long freq;
-
- srandom(time(NULL));
-
-+ /* Fix segmentation fault when execution without any arguments in NuttX */
-+ if (argc < 3)
-+ die("bad arguments: test-tlb [-H] ");
-+
- while ((arg = argv[1]) != NULL) {
- if (*arg != '-')
- break;
-@@ -261,6 +318,7 @@ int main(int argc, char **argv)
- argv++;
- }
-
-+ freq = measure_freq();
- size = get_num(argv[1]);
- stride = get_num(argv[2]);
- if (stride < 4 || size < stride)
-@@ -281,6 +339,6 @@ int main(int argc, char **argv)
- }
-
- printf("%6.2fns (~%.1f cycles)\n",
-- cycles, cycles*FREQ);
-+ cycles, cycles * freq);
- return 0;
- }
---
-2.34.1
-
diff --git a/benchmarks/test-tlb/CMakeLists.txt b/benchmarks/test-tlb/CMakeLists.txt
deleted file mode 100644
index 866583e69..000000000
--- a/benchmarks/test-tlb/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-############################################################################
-# apps/benchmarks/test-tlb/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-if(CONFIG_BENCHMARK_TESTTLB)
-
- set(SRCS test-tlb/test-tlb.c)
-
- set(TESTTLB_UNPACK ${CMAKE_CURRENT_LIST_DIR}/test-tlb)
- set(TESTTLB_URL https://github.com/torvalds/test-tlb/archive)
- set(TESTTLB_ZIP master.zip)
-
- if(NOT EXISTS ${TESTTLB_UNPACK})
-
- FetchContent_Declare(
- testtlb_fetch
- URL ${TESTTLB_URL}/${TESTTLB_ZIP} SOURCE_DIR ${TESTTLB_UNPACK} BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/test-tlb/test-tlb
- PATCH_COMMAND patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/0001-test-tlb-port-for-NuttX.patch
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(testtlb_fetch)
- if(NOT testtlb_fetch_POPULATED)
- FetchContent_Populate(testtlb_fetch)
- endif()
-
- endif()
-
- nuttx_add_application(
- NAME
- testtlb
- PRIORITY
- ${CONFIG_BENCHMARK_TESTTLB_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_TESTTLB_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_TESTTLB}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-endif()
diff --git a/benchmarks/test-tlb/Kconfig b/benchmarks/test-tlb/Kconfig
deleted file mode 100644
index 111c5a9a5..000000000
--- a/benchmarks/test-tlb/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_TESTTLB
- tristate "Memory Latency profiling"
- depends on ALLOW_GPL_COMPONENTS
- default n
- ---help---
- Measure the memory latency
-
-if BENCHMARK_TESTTLB
-
-config BENCHMARK_TESTTLB_PRIORITY
- int "TestTLB task priority"
- default 100
-
-config BENCHMARK_TESTTLB_STACKSIZE
- int "TestTLB stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/test-tlb/Make.defs b/benchmarks/test-tlb/Make.defs
deleted file mode 100644
index e7f275ef0..000000000
--- a/benchmarks/test-tlb/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/test-tlb/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_TESTTLB),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/test-tlb
-endif
diff --git a/benchmarks/test-tlb/Makefile b/benchmarks/test-tlb/Makefile
deleted file mode 100644
index ca0b5f1ad..000000000
--- a/benchmarks/test-tlb/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-############################################################################
-# apps/benchmarks/test-tlb/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = testtlb
-PRIORITY = $(CONFIG_BENCHMARK_TESTTLB_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_TESTTLB_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_TESTTLB)
-
-TESTTLB_UNPACK = test-tlb
-TESTTLB_GIT = github.com/torvalds/test-tlb
-TESTTLB_URL = https://github.com/torvalds/test-tlb/archive
-TESTTLB_VERSION = master
-TESTTLB_ZIP = $(TESTTLB_UNPACK)-$(TESTTLB_VERSION).zip
-UNPACK ?= unzip -q -o
-
-$(TESTTLB_ZIP):
- @echo "Downloading: $(TESTTLB_URL)"
- $(Q) curl -L $(TESTTLB_URL)/$(TESTTLB_VERSION).zip -o $(TESTTLB_UNPACK)-$(TESTTLB_VERSION).zip
-
-$(TESTTLB_UNPACK): $(TESTTLB_ZIP)
- @echo "Unpacking: $(TESTTLB_ZIP) -> $(TESTTLB_UNPACK)"
- $(Q) $(UNPACK) $(TESTTLB_ZIP)
- $(Q) mv test-tlb-$(TESTTLB_VERSION) $(TESTTLB_UNPACK)
- $(Q) touch $(TESTTLB_UNPACK)
- @echo "Patching: Applying patch"
- $(Q) cd test-tlb && patch -p1 < ../0001-test-tlb-port-for-NuttX.patch
-
-ifeq ($(wildcard $(TESTTLB_UNPACK)/.git),)
-context:: $(TESTTLB_UNPACK)
-
-distclean::
- $(call DELDIR, $(TESTTLB_UNPACK))
- $(call DELFILE, $(TESTTLB_ZIP))
-endif
-
-MAINSRC = test-tlb/test-tlb.c
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/tinymembench/.gitignore b/benchmarks/tinymembench/.gitignore
deleted file mode 100644
index 0a80bd78b..000000000
--- a/benchmarks/tinymembench/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/tinymembench
-/*.zip
diff --git a/benchmarks/tinymembench/0001-tinymembench-fix-compiling-error-for-NuttX.patch b/benchmarks/tinymembench/0001-tinymembench-fix-compiling-error-for-NuttX.patch
deleted file mode 100644
index 1c9c7a052..000000000
--- a/benchmarks/tinymembench/0001-tinymembench-fix-compiling-error-for-NuttX.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From f478ab0f728bea1ed352844339f8bdc87f7792fa Mon Sep 17 00:00:00 2001
-From: ouyangxiangzhen
-Date: Fri, 31 May 2024 19:58:48 +0800
-Subject: [PATCH] tinymembench: fix compiling error for NuttX
-
-This patch fix compilation error: Resolve conflict between `util.c` function fmin and math library function fmin
-
-Signed-off-by: ouyangxiangzhen
----
- util.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/util.c b/util.c
-index a0d562c..539049f 100644
---- a/util.c
-+++ b/util.c
-@@ -303,7 +303,7 @@ double gettime(void)
- return (double)((int64_t)tv.tv_sec * 1000000 + tv.tv_usec) / 1000000.;
- }
-
--double fmin(double a, double b)
-+__attribute__((weak)) double fmin(double a, double b)
- {
- return a < b ? a : b;
- }
---
-2.34.1
-
diff --git a/benchmarks/tinymembench/CMakeLists.txt b/benchmarks/tinymembench/CMakeLists.txt
deleted file mode 100644
index 1bbcf96ab..000000000
--- a/benchmarks/tinymembench/CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-############################################################################
-# apps/benchmarks/tinymembench/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-if(CONFIG_BENCHMARK_TINY_MEMBENCH)
-
- set(TINYMB_UNPACK ${CMAKE_CURRENT_LIST_DIR}/tinymembench)
- set(TINYMB_URL https://github.com/ssvb/tinymembench/archive)
- set(TINYMB_ZIP master.zip)
-
- if(NOT EXISTS ${TINYMB_UNPACK})
-
- FetchContent_Declare(
- tinymb_fetch
- URL ${TINYMB_URL}/${TINYMB_ZIP} SOURCE_DIR ${TINYMB_UNPACK} BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/benchmarks/tinymembench/tinymembench
- PATCH_COMMAND
- patch -p0 -d ${CMAKE_CURRENT_LIST_DIR} <
- ${CMAKE_CURRENT_LIST_DIR}/0001-tinymembench-fix-compiling-error-for-NuttX.patch
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(tinymb_fetch)
- if(NOT tinymb_fetch_POPULATED)
- FetchContent_Populate(tinymb_fetch)
- endif()
-
- endif()
-
- list(APPEND CFLAGS -Wno-unused-but-set-variable -Wno-unused-variable
- -Wno-strict-prototypes)
-
- set(SRCS tinymembench/main.c)
-
- list(
- APPEND
- SRCS
- tinymembench/aarch64-asm.S
- tinymembench/arm-neon.S
- tinymembench/x86-sse2.S
- tinymembench/mips-32.S
- tinymembench/asm-opt.c
- tinymembench/util.c)
-
- nuttx_add_application(
- NAME
- tinymembench
- PRIORITY
- ${CONFIG_BENCHMARK_TINY_MEMBENCH_PRIORITY}
- STACKSIZE
- ${CONFIG_BENCHMARK_TINY_MEMBENCH_STACKSIZE}
- MODULE
- ${CONFIG_BENCHMARK_TINY_MEMBENCH}
- COMPILE_FLAGS
- ${CFLAGS}
- SRCS
- ${SRCS})
-endif()
diff --git a/benchmarks/tinymembench/Kconfig b/benchmarks/tinymembench/Kconfig
deleted file mode 100644
index 7a6521dab..000000000
--- a/benchmarks/tinymembench/Kconfig
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_TINY_MEMBENCH
- tristate "TinyMemBench"
- default n
- ---help---
- Measure the memory bandwidth and latency
-
-if BENCHMARK_TINY_MEMBENCH
-
-config BENCHMARK_TINY_MEMBENCH_PRIORITY
- int "TinyMemBench task priority"
- default 100
-
-config BENCHMARK_TINY_MEMBENCH_STACKSIZE
- int "TinyMemBench stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/tinymembench/Make.defs b/benchmarks/tinymembench/Make.defs
deleted file mode 100644
index d32e7385f..000000000
--- a/benchmarks/tinymembench/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/benchmarks/tinymembench/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_TINY_MEMBENCH),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/tinymembench
-endif
diff --git a/benchmarks/tinymembench/Makefile b/benchmarks/tinymembench/Makefile
deleted file mode 100644
index 37b616753..000000000
--- a/benchmarks/tinymembench/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-############################################################################
-# apps/benchmarks/tinymembench/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = tinymembench
-PRIORITY = $(CONFIG_BENCHMARK_TINY_MEMBENCH_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_TINY_MEMBENCH_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_TINY_MEMBENCH)
-
-TINYMB_UNPACK = tinymembench
-TINYMB_GIT = github.com/ssvb/tinymembench
-TINYMB_URL = https://github.com/ssvb/tinymembench/archive
-TINYMB_VERSION = master
-TINYMB_ZIP = $(TINYMB_UNPACK)-$(TINYMB_VERSION).zip
-UNPACK ?= unzip -q -o
-
-$(TINYMB_ZIP):
- @echo "Downloading: $(TINYMB_URL)"
- $(Q) curl -L $(TINYMB_URL)/$(TINYMB_VERSION).zip -o $(TINYMB_UNPACK)-$(TINYMB_VERSION).zip
-
-$(TINYMB_UNPACK): $(TINYMB_ZIP)
- @echo "Unpacking: $(TINYMB_ZIP) -> $(TINYMB_UNPACK)"
- $(Q) $(UNPACK) $(TINYMB_ZIP)
- $(Q) mv tinymembench-$(TINYMB_VERSION) $(TINYMB_UNPACK)
- $(Q) touch $(TINYMB_UNPACK)
- @echo "Patching: Applying patch"
- $(Q) cd tinymembench && patch -p1 < ../0001-tinymembench-fix-compiling-error-for-NuttX.patch
-
-ifeq ($(wildcard $(TINYMB_UNPACK)/.git),)
-context:: $(TINYMB_UNPACK)
-
-distclean::
- $(call DELDIR, $(TINYMB_UNPACK))
- $(call DELFILE, $(TINYMB_ZIP))
-endif
-
-ASRCS += $(TINYMB_UNPACK)/aarch64-asm.S
-ASRCS += $(TINYMB_UNPACK)/arm-neon.S
-ASRCS += $(TINYMB_UNPACK)/x86-sse2.S
-ASRCS += $(TINYMB_UNPACK)/mips-32.S
-
-CSRCS += $(TINYMB_UNPACK)/asm-opt.c
-CSRCS += $(TINYMB_UNPACK)/util.c
-
-MAINSRC = $(TINYMB_UNPACK)/main.c
-
-CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable
-CFLAGS += -Wno-strict-prototypes
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/whetstone/CMakeLists.txt b/benchmarks/whetstone/CMakeLists.txt
deleted file mode 100644
index 1bcc0f256..000000000
--- a/benchmarks/whetstone/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# ##############################################################################
-# apps/benchmarks/whetstone/CMakeLists.txt
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BENCHMARK_WHETSTONE)
- nuttx_add_application(
- NAME
- ${CONFIG_BENCHMARK_WHETSTONE_PROGNAME}
- SRCS
- whetstone.c
- STACKSIZE
- ${CONFIG_BENCHMARK_WHETSTONE_STACKSIZE}
- PRIORITY
- ${CONFIG_BENCHMARK_WHETSTONE_PRIORITY})
-endif()
diff --git a/benchmarks/whetstone/Kconfig b/benchmarks/whetstone/Kconfig
deleted file mode 100644
index 10df1429e..000000000
--- a/benchmarks/whetstone/Kconfig
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-config BENCHMARK_WHETSTONE
- tristate "Double Precision Benchmark"
- default n
- depends on ALLOW_CUSTOM_PERMISSIVE_COMPONENTS
- ---help---
- Enable a Whetstone test.
-
- This benchmark is based on the C converted version from
- https://www.netlib.org/benchmark/whetstone.c which has a
- custom permissive license requiring attribution.
-
-if BENCHMARK_WHETSTONE
-
-config BENCHMARK_WHETSTONE_PROGNAME
- string "Program name"
- default "whetstone"
- ---help---
- This is the name of the program that will be used when the NSH ELF
- program is installed.
-
-config BENCHMARK_WHETSTONE_PRIORITY
- int "Whetstone test task priority"
- default 100
-
-config BENCHMARK_WHETSTONE_STACKSIZE
- int "Whetstone test stack size"
- default DEFAULT_TASK_STACKSIZE
-
-endif
diff --git a/benchmarks/whetstone/Make.defs b/benchmarks/whetstone/Make.defs
deleted file mode 100644
index d9fa9f1af..000000000
--- a/benchmarks/whetstone/Make.defs
+++ /dev/null
@@ -1,23 +0,0 @@
-############################################################################
-# apps/benchmarks/whetstone/Make.defs
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BENCHMARK_WHETSTONE),)
-CONFIGURED_APPS += $(APPDIR)/benchmarks/whetstone
-endif
diff --git a/benchmarks/whetstone/Makefile b/benchmarks/whetstone/Makefile
deleted file mode 100644
index 1bdf6dfd6..000000000
--- a/benchmarks/whetstone/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-############################################################################
-# apps/benchmarks/whetstone/Makefile
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-# WHETSTONE speed test
-
-PROGNAME = $(CONFIG_BENCHMARK_WHETSTONE_PROGNAME)
-PRIORITY = $(CONFIG_BENCHMARK_WHETSTONE_PRIORITY)
-STACKSIZE = $(CONFIG_BENCHMARK_WHETSTONE_STACKSIZE)
-MODULE = $(CONFIG_BENCHMARK_WHETSTONE)
-
-MAINSRC = whetstone.c
-
-include $(APPDIR)/Application.mk
diff --git a/benchmarks/whetstone/whetstone.c b/benchmarks/whetstone/whetstone.c
deleted file mode 100644
index dbc8247fd..000000000
--- a/benchmarks/whetstone/whetstone.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/****************************************************************************
- * apps/benchmarks/whetstone/whetstone.c
- *
- * SPDX-License-Identifier: LicenseRef-Painter-Engineering-Whetstone
- *
- * Converted Whetstone Double Precision Benchmark
- * Version 1.2 22 March 1998
- *
- * (c) Copyright 1998 Painter Engineering, Inc.
- * All Rights Reserved.
- *
- * Permission is granted to use, duplicate, and
- * publish this text and program as long as it
- * includes this entire comment block and limited
- * rights reference.
- *
- * Converted by Rich Painter, Painter Engineering, Inc. based on the
- * www.netlib.org benchmark/whetstoned version obtained 16 March 1998.
- *
- * A novel approach was used here to keep the look and feel of the
- * FORTRAN version. Altering the FORTRAN-based array indices,
- * starting at element 1, to start at element 0 for C, would require
- * numerous changes, including decrementing the variable indices by 1.
- * Instead, the array e1[] was declared 1 element larger in C. This
- * allows the FORTRAN index range to function without any literal or
- * variable indices changes. The array element e1[0] is simply never
- * used and does not alter the benchmark results.
- *
- * The major FORTRAN comment blocks were retained to minimize
- * differences between versions. Modules N5 and N12, like in the
- * FORTRAN version, have been eliminated here.
- *
- * An optional command-line argument has been provided [-c] to
- * offer continuous repetition of the entire benchmark.
- * An optional argument for setting an alternate loop count is also
- * provided. Define PRINTOUT to cause the pout() function to print
- * outputs at various stages. Final timing measurements should be
- * made with the PRINTOUT undefined.
- *
- * Questions and comments may be directed to the author at
- * r.painter@ieee.org
- ****************************************************************************/
-
-/****************************************************************************
- * Benchmark #2 -- Double Precision Whetstone (A001)
- *
- * o This is a REAL*8 version of
- * the Whetstone benchmark program.
- *
- * o DO-loop semantics are ANSI-66 compatible.
- *
- * o Final measurements are to be made with all
- * WRITE statements and FORMAT sttements removed.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-/* standard C library headers required */
-
-#include
-#include
-#include
-#include
-
-/* the following is optional depending on the timing function used */
-
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* map the FORTRAN math functions, etc. to the C versions */
-
-#define DSIN sin
-#define DCOS cos
-#define DATAN atan
-#define DLOG log
-#define DEXP exp
-#define DSQRT sqrt
-#define IF if
-#define USAGE "usage: whetdc [-c] [loops]\n"
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/* function prototypes */
-
-void pout(long n, long j, long k, double x1,
- double x2, double x3, double x4);
-void pa(double e[]);
-void p0(void);
-void p3(double x, double y, FAR double *z);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/* COMMON t,t1,t2,e1(4),j,k,l */
-
-double t;
-double t1;
-double t2;
-double e1[5];
-int j;
-int k;
-int l;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- /* used in the FORTRAN version */
-
- long loop;
- long i;
- long n1;
- long n2;
- long n3;
- long n4;
- long n6;
- long n7;
- long n8;
- long n9;
- long n10;
- long n11;
- double x1;
- double x2;
- double x3;
- double x4;
- double x;
- double y;
- double z;
- int ii;
- int jj;
-
- /* added for this version */
-
- long loopstart;
- long startmsec;
- long finimsec;
- float KIPS;
- int continuous;
- struct timespec ts;
-
- loopstart = 1000; /* see the note about loop below */
- continuous = 0;
-
- ii = 1; /* start at the first arg (temp use of ii here) */
- while (ii < argc)
- {
- if (strncmp(argv[ii], "-c", 2) == 0 || argv[ii][0] == 'c')
- {
- continuous = 1;
- }
- else if (atol(argv[ii]) > 0)
- {
- loopstart = atol(argv[ii]);
- }
- else
- {
- fprintf(stderr, USAGE);
- return 1;
- }
-
- ii++;
- }
-
-LCONT:
-
- /* Start benchmark timing at this point. */
-
- clock_gettime(CLOCK_REALTIME, &ts);
- startmsec = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
-
- /* The actual benchmark starts here. */
-
- t = .499975;
- t1 = 0.50025;
- t2 = 2.0;
-
- /* With loopcount loop=10, one million Whetstone instructions
- * will be executed in EACH MAJOR loop..A MAJOR loop IS EXECUTED
- * 'ii' TIMES TO INCREASE WALL-CLOCK TIMING ACCURACY.
- *
- * loop = 1000;
- */
-
- loop = loopstart;
- ii = 1;
-
- jj = 1;
-
-IILOOP:
- n1 = 0;
- n2 = 12 * loop;
- n3 = 14 * loop;
- n4 = 345 * loop;
- n6 = 210 * loop;
- n7 = 32 * loop;
- n8 = 899 * loop;
- n9 = 616 * loop;
- n10 = 0;
- n11 = 93 * loop;
-
- /* Module 1: Simple identifiers */
-
- x1 = 1.0;
- x2 = -1.0;
- x3 = -1.0;
- x4 = -1.0;
-
- for (i = 1; i <= n1; i++)
- {
- x1 = (x1 + x2 + x3 - x4) * t;
- x2 = (x1 + x2 - x3 + x4) * t;
- x3 = (x1 - x2 + x3 + x4) * t;
- x4 = (-x1 + x2 + x3 + x4) * t;
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n1, n1, n1, x1, x2, x3, x4);
- }
-#endif
-
- /* Module 2: Array elements */
-
- e1[1] = 1.0;
- e1[2] = -1.0;
- e1[3] = -1.0;
- e1[4] = -1.0;
-
- for (i = 1; i <= n2; i++)
- {
- e1[1] = (e1[1] + e1[2] + e1[3] - e1[4]) * t;
- e1[2] = (e1[1] + e1[2] - e1[3] + e1[4]) * t;
- e1[3] = (e1[1] - e1[2] + e1[3] + e1[4]) * t;
- e1[4] = (-e1[1] + e1[2] + e1[3] + e1[4]) * t;
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n2, n3, n2, e1[1], e1[2], e1[3], e1[4]);
- }
-#endif
-
- /* Module 3: Array as parameter */
-
- for (i = 1; i <= n3; i++)
- {
- pa(e1);
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n3, n2, n2, e1[1], e1[2], e1[3], e1[4]);
- }
-#endif
-
- /* Module 4: Conditional jumps */
-
- j = 1;
- for (i = 1; i <= n4; i++)
- {
- if (j == 1)
- {
- j = 2;
- }
- else
- {
- j = 3;
- }
-
- if (j > 2)
- {
- j = 0;
- }
- else
- {
- j = 1;
- }
-
- if (j < 1)
- {
- j = 1;
- }
- else
- {
- j = 0;
- }
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n4, j, j, x1, x2, x3, x4);
- }
-#endif
-
-/* Module 5: Omitted
- * Module 6: Integer arithmetic
- */
-
- j = 1;
- k = 2;
- l = 3;
-
- for (i = 1; i <= n6; i++)
- {
- j = j * (k - j) * (l - k);
- k = l * k - (l - j) * k;
- l = (l - k) * (k + j);
- e1[l - 1] = j + k + l;
- e1[k - 1] = j * k * l;
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n6, j, k, e1[1], e1[2], e1[3], e1[4]);
- }
-#endif
-
- /* Module 7: Trigonometric functions */
-
- x = 0.5;
- y = 0.5;
-
- for (i = 1; i <= n7; i++)
- {
- x = t * DATAN(t2 * DSIN(x) * DCOS(x) /
- (DCOS(x + y) + DCOS(x - y) - 1.0));
- y = t * DATAN(t2 * DSIN(y) * DCOS(y) /
- (DCOS(x + y) + DCOS(x - y) - 1.0));
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n7, j, k, x, x, y, y);
- }
-#endif
-
- /* Module 8: Procedure calls */
-
- x = 1.0;
- y = 1.0;
- z = 1.0;
-
- for (i = 1; i <= n8; i++)
- {
- p3(x, y, &z);
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n8, j, k, x, y, z, z);
- }
-#endif
-
- /* Module 9: Array references */
-
- j = 1;
- k = 2;
- l = 3;
- e1[1] = 1.0;
- e1[2] = 2.0;
- e1[3] = 3.0;
-
- for (i = 1; i <= n9; i++)
- {
- p0();
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n9, j, k, e1[1], e1[2], e1[3], e1[4]);
- }
-#endif
-
- /* Module 10: Integer arithmetic */
-
- j = 2;
- k = 3;
-
- for (i = 1; i <= n10; i++)
- {
- j = j + k;
- k = j + k;
- j = k - j;
- k = k - j - j;
- }
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n10, j, k, x1, x2, x3, x4);
- }
-#endif
-
- /* Module 11: Standard functions */
-
- x = 0.75;
-
- for (i = 1; i <= n11; i++)
- x = DSQRT(DEXP(DLOG(x) / t1));
-
-#ifdef PRINTOUT
- IF (jj == ii)
- {
- pout(n11, j, k, x, x, x, x);
- }
-#endif
-
- /* THIS IS THE END OF THE MAJOR loop. */
-
- if (++jj <= ii)
- {
- goto IILOOP;
- }
-
- /* Stop benchmark timing at this point. */
-
- clock_gettime(CLOCK_REALTIME, &ts);
- finimsec = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
-
- /* Performance in Whetstone KIP's per second is given by
- *
- * (100*loop*ii)/TIME
- *
- * where TIME is in seconds.
- */
-
- printf("\n");
- if (finimsec - startmsec <= 0)
- {
- printf("Insufficient duration- Increase the loop count\n");
- return 1;
- }
-
- printf("Loops: %ld, Iterations: %d, Duration: %ld millisecond.\n",
- loop, ii, finimsec - startmsec);
-
- KIPS = (100.0 * loop * ii) / ((float)(finimsec - startmsec) * 1000);
- if (KIPS >= 1000.0)
- {
- printf("C Converted Double Precision Whetstones: %.1f MIPS\n",
- KIPS / 1000.0);
- }
- else
- {
- printf("C Converted Double Precision Whetstones: %.1f KIPS\n", KIPS);
- }
-
- if (continuous)
- {
- goto LCONT;
- }
-
- return 0;
-}
-
-void
-pa(double e[])
-{
- j = 0;
-
-L10:
- e[1] = (e[1] + e[2] + e[3] - e[4]) * t;
- e[2] = (e[1] + e[2] - e[3] + e[4]) * t;
- e[3] = (e[1] - e[2] + e[3] + e[4]) * t;
- e[4] = (-e[1] + e[2] + e[3] + e[4]) / t2;
- j += 1;
-
- if (j < 6)
- {
- goto L10;
- }
-}
-
-void
-p0(void)
-{
- e1[j] = e1[k];
- e1[k] = e1[l];
- e1[l] = e1[j];
-}
-
-void p3(double x, double y, FAR double *z)
-{
- double x1;
- double y1;
-
- x1 = x;
- y1 = y;
- x1 = t * (x1 + y1);
- y1 = t * (x1 + y1);
- *z = (x1 + y1) / t2;
-}
-
-#ifdef PRINTOUT
-void
-pout(long n, long j, long k, double x1, double x2, double x3, double x4)
-{
- printf("%7ld %7ld %7ld %12.4e %12.4e %12.4e %12.4e\n",
- n, j, k, x1, x2, x3, x4);
-}
-#endif
diff --git a/boot/CMakeLists.txt b/boot/CMakeLists.txt
deleted file mode 100644
index 4a418db7c..000000000
--- a/boot/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/boot/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-nuttx_add_subdirectory()
-
-nuttx_generate_kconfig(MENUDESC "Bootloader Utilities")
diff --git a/boot/Make.defs b/boot/Make.defs
index 78765dbdb..b0e6794f6 100644
--- a/boot/Make.defs
+++ b/boot/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/boot/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
diff --git a/boot/Makefile b/boot/Makefile
index 3bbae8765..e20a7c4a3 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/boot/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
diff --git a/boot/mcuboot/CMakeLists.txt b/boot/mcuboot/CMakeLists.txt
deleted file mode 100644
index 49c02a133..000000000
--- a/boot/mcuboot/CMakeLists.txt
+++ /dev/null
@@ -1,113 +0,0 @@
-# ##############################################################################
-# apps/boot/mcuboot/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BOOT_MCUBOOT)
- nuttx_add_library(mcuboot)
-
- if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/mcuboot)
- FetchContent_Declare(
- mcuboot
- DOWNLOAD_NAME "${CONFIG_MCUBOOT_VERSION}.tar.gz"
- DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
- URL "https://github.com/mcu-tools/mcuboot/archive/${CONFIG_MCUBOOT_VERSION}.tar.gz"
- SOURCE_DIR
- ${CMAKE_CURRENT_LIST_DIR}/mcuboot
- BINARY_DIR
- ${CMAKE_BINARY_DIR}/apps/boot/mcuboot/mcuboot
- DOWNLOAD_NO_PROGRESS true
- TIMEOUT 30)
-
- FetchContent_GetProperties(mcuboot)
-
- if(NOT mcuboot_POPULATED)
- FetchContent_Populate(mcuboot)
- endif()
- endif()
-
- set(SRCS
- mcuboot/boot/bootutil/src/boot_record.c
- mcuboot/boot/bootutil/src/bootutil_area.c
- mcuboot/boot/bootutil/src/bootutil_img_hash.c
- mcuboot/boot/bootutil/src/bootutil_loader.c
- mcuboot/boot/bootutil/src/bootutil_misc.c
- mcuboot/boot/bootutil/src/bootutil_public.c
- mcuboot/boot/bootutil/src/caps.c
- mcuboot/boot/bootutil/src/encrypted.c
- mcuboot/boot/bootutil/src/fault_injection_hardening.c
- mcuboot/boot/bootutil/src/fault_injection_hardening_delay_rng_mbedtls.c
- mcuboot/boot/bootutil/src/image_ed25519.c
- mcuboot/boot/bootutil/src/image_rsa.c
- mcuboot/boot/bootutil/src/image_validate.c
- mcuboot/boot/bootutil/src/loader.c
- mcuboot/boot/bootutil/src/swap_misc.c
- mcuboot/boot/bootutil/src/swap_move.c
- mcuboot/boot/bootutil/src/swap_scratch.c
- mcuboot/boot/bootutil/src/tlv.c)
-
- list(APPEND SRCS mcuboot/boot/nuttx/src/flash_map_backend/flash_map_backend.c)
-
- if(CONFIG_MCUBOOT_BOOTLOADER)
- nuttx_add_application(
- NAME
- mcuboot_loader
- SRCS
- ${CMAKE_CURRENT_LIST_DIR}/mcuboot/boot/nuttx/main.c
- INCLUDE_DIRECTORIES
- mcuboot/boot/bootutil/include
- mcuboot/boot/nuttx/include
- STACKSIZE
- ${CONFIG_DEFAULT_TASK_STACKSIZE}
- PRIORITY
- SCHED_PRIORITY_DEFAULT)
- endif()
-
- if(CONFIG_MCUBOOT_WATCHDOG)
- list(APPEND SRCS mcuboot/boot/nuttx/src/watchdog/watchdog.c)
- endif()
-
- if(CONFIG_MCUBOOT_USE_TINYCRYPT)
- list(
- APPEND
- SRCS
- mcuboot/ext/tinycrypt/lib/source/aes_encrypt.c
- mcuboot/ext/tinycrypt/lib/source/aes_decrypt.c
- mcuboot/ext/tinycrypt/lib/source/ctr_mode.c
- mcuboot/ext/tinycrypt/lib/source/hmac.c
- mcuboot/ext/tinycrypt/lib/source/ecc_dh.c
- mcuboot/ext/tinycrypt/lib/source/sha256.c
- mcuboot/ext/tinycrypt/lib/source/utils.c)
- target_include_directories(mcuboot
- PRIVATE mcuboot/ext/tinycrypt/lib/include)
- endif()
-
- set(INCDIR ${CMAKE_CURRENT_LIST_DIR}/mcuboot/boot/nuttx/include
- ${CMAKE_CURRENT_LIST_DIR}/mcuboot/boot/bootutil/include)
- target_include_directories(mcuboot PRIVATE ${INCDIR})
-
- target_compile_options(mcuboot PRIVATE -Wno-undef)
- target_sources(mcuboot PRIVATE ${SRCS})
-
- set_property(
- TARGET nuttx
- APPEND
- PROPERTY NUTTX_INCLUDE_DIRECTORIES ${INCDIR})
-endif()
diff --git a/boot/mcuboot/Kconfig b/boot/mcuboot/Kconfig
index 656861d73..70a41eb7c 100644
--- a/boot/mcuboot/Kconfig
+++ b/boot/mcuboot/Kconfig
@@ -12,21 +12,9 @@ menuconfig BOOT_MCUBOOT
if BOOT_MCUBOOT
-config MCUBOOT_REPOSITORY
- string "MCUboot GIT repository"
- default "github.com/mcu-tools/mcuboot"
- ---help---
- Specifies the location of MCUboot GIT repository . This
- is by default MCUboot main GIT repository, but it can be changed
- to user's fork if required.
-
config MCUBOOT_VERSION
string "MCUboot version"
- default "e36d3c8d6ca5e0ed1f510f2a7d110f405a7c396b"
- ---help---
- Defines MCUboot version to be downloaded. Either release tag
- or commit hash should be specified. Using newer MCUboot version
- may cause compatibility issues.
+ default "bb927ac014787992f2d8b42c7bd5d05eb4c17e05"
config MCUBOOT_ENABLE_LOGGING
bool "Enable MCUboot logging"
@@ -112,6 +100,46 @@ config MCUBOOT_DIRECT_XIP_REVERT
depends on MCUBOOT_DIRECT_XIP
default n
+config MCUBOOT_UPDATE_AGENT_EXAMPLE
+ bool "MCUboot update agent example"
+ default n
+ depends on NET_TCP
+ ---help---
+ Example application that implements an update agent that downloads
+ an application firmware image from a given URL and saves it to the
+ secondary slot as a pending update.
+
+if MCUBOOT_UPDATE_AGENT_EXAMPLE
+
+config MCUBOOT_UPDATE_AGENT_EXAMPLE_UPDATE_URL
+ string "URL for update image"
+ default ""
+
+config MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_BUFFER_SIZE
+ int "Download buffer size in bytes"
+ default 512
+
+config MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
+ bool "Calculate MD5 of update image"
+ default n
+ depends on CODECS_HASH_MD5
+
+config MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_MD5_HASH
+ string "Expected MD5 sum of update image"
+ default ""
+ depends on MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
+
+endif # MCUBOOT_UPDATE_AGENT_EXAMPLE
+
+config MCUBOOT_SLOT_CONFIRM_EXAMPLE
+ tristate "MCUboot slot confirm example"
+ default n
+ ---help---
+ Example application for confirming a newly installed application
+ application firmware image using MCUboot public APIs.
+ This application should be used as the OTA update package of the
+ MCUBOOT_UPDATE_AGENT_EXAMPLE example.
+
config MCUBOOT_WATCHDOG
bool "Watchdog feeding support"
default n
diff --git a/boot/mcuboot/Make.defs b/boot/mcuboot/Make.defs
index 446a785e2..ea684ad19 100644
--- a/boot/mcuboot/Make.defs
+++ b/boot/mcuboot/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/boot/mcuboot/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -20,17 +18,24 @@
#
############################################################################
-ifneq ($(CONFIG_BOOT_MCUBOOT),)
+ifeq ($(CONFIG_BOOT_MCUBOOT),y)
CONFIGURED_APPS += $(APPDIR)/boot/mcuboot
# It allows import of NuttX implementation headers for MCUboot interfaces.
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/boot/mcuboot/mcuboot/boot/nuttx/include
-CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/boot/mcuboot/mcuboot/boot/nuttx/include
+CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/boot/nuttx/include}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/boot/nuttx/include}
# It allows import of MCUboot's bootutil library headers.
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/boot/mcuboot/mcuboot/boot/bootutil/include
-CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/boot/mcuboot/mcuboot/boot/bootutil/include
+CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/boot/bootutil/include}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/boot/bootutil/include}
+
+# It allows import of MCUboot's crypto backend library headers.
+
+ifeq ($(CONFIG_MCUBOOT_USE_TINYCRYPT),y)
+CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/ext/tinycrypt/lib/include/}
+CXXFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)/boot/mcuboot/mcuboot/ext/tinycrypt/lib/include/}
+endif
endif
diff --git a/boot/mcuboot/Makefile b/boot/mcuboot/Makefile
index 6c036147f..9914fee0c 100644
--- a/boot/mcuboot/Makefile
+++ b/boot/mcuboot/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/boot/mcuboot/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -22,67 +20,78 @@
include $(APPDIR)/Make.defs
-MCUBOOT_VERSION := $(patsubst "%",%,$(CONFIG_MCUBOOT_VERSION))
-MCUBOOT_REPOSITORY := $(patsubst "%",%,$(CONFIG_MCUBOOT_REPOSITORY))
-MCUBOOT_TARBALL = $(MCUBOOT_VERSION).tar.gz
-MCUBOOT_UNPACK = mcuboot
-MCUBOOT_SRCDIR = $(MCUBOOT_UNPACK)$(DELIM)boot$(DELIM)bootutil$(DELIM)src
+MCUBOOT_VERSION := $(patsubst "%",%,$(CONFIG_MCUBOOT_VERSION))
+MCUBOOT_TARBALL = $(MCUBOOT_VERSION).tar.gz
+MCUBOOT_UNPACK = mcuboot
+MCUBOOT_SRCDIR = $(MCUBOOT_UNPACK)$(DELIM)boot$(DELIM)bootutil$(DELIM)src
DEPPATH += --dep-path $(MCUBOOT_UNPACK)$(DELIM)src
DEPPATH += --dep-path $(MCUBOOT_SRCDIR)
VPATH += :$(MCUBOOT_UNPACK)$(DELIM)src
VPATH += :$(MCUBOOT_SRCDIR)
+ifneq ($(CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE),)
+MAINSRC += mcuboot_agent_main.c
+
+PROGNAME += mcuboot_agent
+PRIORITY += SCHED_PRIORITY_DEFAULT
+STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
+endif
+
+ifneq ($(CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE),)
+MAINSRC += mcuboot_confirm_main.c
+
+PROGNAME += mcuboot_confirm
+PRIORITY += SCHED_PRIORITY_DEFAULT
+STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
+endif
+
ifneq ($(CONFIG_MCUBOOT_BOOTLOADER),)
-MAINSRC += $(MCUBOOT_UNPACK)/boot/nuttx/main.c
+MAINSRC += mcuboot/boot/nuttx/main.c
PROGNAME += mcuboot_loader
PRIORITY += SCHED_PRIORITY_DEFAULT
STACKSIZE += $(CONFIG_DEFAULT_TASK_STACKSIZE)
endif
-CFLAGS += -Wno-undef -Wno-unused-but-set-variable
+CFLAGS += -Wno-undef
-CSRCS := $(MCUBOOT_UNPACK)/boot/bootutil/src/boot_record.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/bootutil_area.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/bootutil_img_hash.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/bootutil_loader.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/bootutil_misc.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/bootutil_public.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/caps.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/encrypted.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/fault_injection_hardening.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/fault_injection_hardening_delay_rng_mbedtls.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/image_ed25519.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/image_rsa.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/image_validate.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/loader.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/swap_misc.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/swap_move.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/swap_scratch.c \
- $(MCUBOOT_UNPACK)/boot/bootutil/src/tlv.c \
- $(MCUBOOT_UNPACK)/boot/nuttx/src/flash_map_backend/flash_map_backend.c
+CSRCS := mcuboot/boot/bootutil/src/boot_record.c \
+ mcuboot/boot/bootutil/src/bootutil_misc.c \
+ mcuboot/boot/bootutil/src/bootutil_public.c \
+ mcuboot/boot/bootutil/src/caps.c \
+ mcuboot/boot/bootutil/src/encrypted.c \
+ mcuboot/boot/bootutil/src/fault_injection_hardening.c \
+ mcuboot/boot/bootutil/src/fault_injection_hardening_delay_rng_mbedtls.c \
+ mcuboot/boot/bootutil/src/image_ec.c \
+ mcuboot/boot/bootutil/src/image_ec256.c \
+ mcuboot/boot/bootutil/src/image_ed25519.c \
+ mcuboot/boot/bootutil/src/image_rsa.c \
+ mcuboot/boot/bootutil/src/image_validate.c \
+ mcuboot/boot/bootutil/src/loader.c \
+ mcuboot/boot/bootutil/src/swap_misc.c \
+ mcuboot/boot/bootutil/src/swap_move.c \
+ mcuboot/boot/bootutil/src/swap_scratch.c \
+ mcuboot/boot/bootutil/src/tlv.c \
+ mcuboot/boot/nuttx/src/flash_map_backend/flash_map_backend.c
ifneq ($(CONFIG_MCUBOOT_WATCHDOG),)
-CSRCS += $(MCUBOOT_UNPACK)/boot/nuttx/src/watchdog/watchdog.c
+CSRCS += mcuboot/boot/nuttx/src/watchdog/watchdog.c
endif
ifneq ($(CONFIG_MCUBOOT_USE_TINYCRYPT),)
-CSRCS += $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/aes_encrypt.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/aes_decrypt.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/ctr_mode.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/hmac.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/ecc_dh.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/sha256.c \
- $(MCUBOOT_UNPACK)/ext/tinycrypt/lib/source/utils.c
-
-CFLAGS += ${INCDIR_PREFIX}mcuboot/ext/tinycrypt/lib/include
-CXXFLAGS += ${INCDIR_PREFIX}mcuboot/ext/tinycrypt/lib/include
+CSRCS += mcuboot/ext/tinycrypt/lib/source/aes_encrypt.c \
+ mcuboot/ext/tinycrypt/lib/source/aes_decrypt.c \
+ mcuboot/ext/tinycrypt/lib/source/ctr_mode.c \
+ mcuboot/ext/tinycrypt/lib/source/hmac.c \
+ mcuboot/ext/tinycrypt/lib/source/ecc_dh.c \
+ mcuboot/ext/tinycrypt/lib/source/sha256.c \
+ mcuboot/ext/tinycrypt/lib/source/utils.c
endif
$(MCUBOOT_TARBALL):
- $(Q) echo "Downloading MCUboot-$(MCUBOOT_VERSION) from $(MCUBOOT_REPOSITORY)"
- $(Q) curl -O -L --proto-default https $(MCUBOOT_REPOSITORY)/archive/$(MCUBOOT_TARBALL)
+ $(Q) echo "Downloading MCUboot-$(MCUBOOT_VERSION)"
+ $(Q) curl -O -L https://github.com/mcu-tools/mcuboot/archive/$(MCUBOOT_TARBALL)
$(MCUBOOT_UNPACK): $(MCUBOOT_TARBALL)
$(Q) echo "Unpacking: $(MCUBOOT_TARBALL) -> $(MCUBOOT_UNPACK)"
@@ -90,13 +99,10 @@ $(MCUBOOT_UNPACK): $(MCUBOOT_TARBALL)
$(Q) mv mcuboot-$(MCUBOOT_VERSION) $(MCUBOOT_UNPACK)
$(Q) touch $(MCUBOOT_UNPACK)
-# Download and unpack tarball if no git repo found
-ifeq ($(wildcard $(MCUBOOT_UNPACK)/.git),)
context:: $(MCUBOOT_UNPACK)
distclean::
$(call DELFILE, $(MCUBOOT_TARBALL))
$(call DELDIR, $(MCUBOOT_UNPACK))
-endif
include $(APPDIR)/Application.mk
diff --git a/boot/mcuboot/README.md b/boot/mcuboot/README.md
new file mode 100644
index 000000000..39a693545
--- /dev/null
+++ b/boot/mcuboot/README.md
@@ -0,0 +1,52 @@
+# Boot / `mcuboot` MCUboot
+
+## Description
+
+The NuttX port of MCUboot secure boot library expects that the platform provides a Flash storage with the following partitions:
+- `CONFIG_MCUBOOT_PRIMARY_SLOT_PATH`: MTD partition for the application firmware image PRIMARY slot;
+- `CONFIG_MCUBOOT_SECONDARY_SLOT_PATH`: MTD partition for the application firmware image SECONDARY slot;
+- `CONFIG_MCUBOOT_SCRATCH_PATH`: MTD partition for the Scratch area;
+
+Also, these are optional features that may be enabled:
+
+- `CONFIG_MCUBOOT_WATCHDOG`: If `CONFIG_WATCHDOG` is enabled, MCUboot shall reset the watchdog timer indicated by `CONFIG_MCUBOOT_WATCHDOG_DEVPATH` to the current timeout value, preventing any imminent watchdog timeouts.
+
+The porting layer of MCUboot library consists of the following interfaces:
+- ``, for enabling MCUboot to manage the application firmware image slots in the device storage.
+- ``, for configuration of MCUboot's features.
+- ``, for providing logging capabilities.
+- ``, for providing MCUboot access to the OS memory management interfaces.
+- ``, for configuration of the system's flash area organization.
+
+The NuttX port of MCUboot is implemented at application-level and requires minimal knowledge about characteristics of the underlying storage device. This is achieved by means of the `BCH` and `FTL` subsystems, which enable MCUboot to manage MTD partitions via character device drivers using standard POSIX filesystem operations (e.g. `open()` / `close()` / `read()` / `write()`).
+
+## Creating MCUboot-compatible application firmware images
+
+One common use case for MCUboot is to integrate it to a firmware update agent, which is an important component of a secure firmware update subsystem. Through MCUboot APIs an application is able to install a newly received application firmware image and, once this application firmware image is assured to be valid, the application may confirm it as a stable image. In case that application firmware image is deemed bogus, MCUboot provides an API for invalidating that update, which will induce a rollback procedure to the most recent stable application firmware image.
+
+The `CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE` example demonstrates this workflow by downloading an application firmware image from a webserver, installing it and triggering the firmware update process for the next boot after a system reset. There is also the `CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE`, which is a fairly simple example that just calls an MCUboot API for confirming the executing application firmware image as stable.
+
+## Using MCUboot on NuttX as a secure boot solution
+
+NuttX port for MCUboot also enables the creation of a secure bootloader application requiring minimal platform-specific implementation. The logical implementation for the secure boot is performed at application-level by the MCUboot library. Once MCUboot validates the application firmware image, it delegates the loading and execution of the application firmware image to a platform-specific routine, which is accessed via `boardctl(BOARDIOC_BOOT_IMAGE)` call. Each platform must then provide an implementation for the `board_boot_image()` for executing the required actions in order to boot a new application firmware image (e.g. deinitialize peripherals, load the Program Counter register with the application firmware image entry point address).
+
+The MCUboot bootloader application may be enabled by selecting the `CONFIG_MCUBOOT_BOOTLOADER` option.
+
+## Assumptions
+
+### IOCTL MTD commands
+
+The implementation of `` expects that the MTD driver for a given image partition handles the following `ioctl` commands:
+- `MTDIOC_GEOMETRY`, for retrieving information about the geometry of the MTD, required for the configuration of the size of each flash area.
+- `MTDIOC_ERASESTATE`, for retrieving the byte value of an erased cell of the MTD, required for the implementation of `flash_area_erased_val()` interface.
+
+### Write access alignment
+
+Through `flash_area_align()` interface MCUboot expects that the implementation provides the shortest data length that may be written via `flash_area_write()` interface. The NuttX implementation passes through the `BCH` and `FTL` layers, which appropriately handle the write alignment restrictions of the underlying MTD. So The NuttX implementation of `flash_area_align()` is able to return a fixed value of 1 byte, even if the MTD does not support byte operations.
+
+## Limitations
+
+### `` functions are not multitasking-safe
+
+MCUboot's documentation imposes no restrictions regarding the usage of its public interfaces, which doesn't mean they are thread-safe.
+But, regarding NuttX implementation of the ``, it is safe to state that they are **not** multitasking-safe. NuttX implementation manages the MTD partitions via character device drivers. As file-descriptors cannot be shared between different tasks, if one task calls `flash_area_open` and another task calls `flash_area_` passing the same `struct flash_area` instance, it will result in failure.
diff --git a/examples/mcuboot/update_agent/mcuboot_agent_main.c b/boot/mcuboot/mcuboot_agent_main.c
similarity index 90%
rename from examples/mcuboot/update_agent/mcuboot_agent_main.c
rename to boot/mcuboot/mcuboot_agent_main.c
index 697825acb..0a33b08b9 100644
--- a/examples/mcuboot/update_agent/mcuboot_agent_main.c
+++ b/boot/mcuboot/mcuboot_agent_main.c
@@ -1,7 +1,5 @@
/****************************************************************************
- * apps/examples/mcuboot/update_agent/mcuboot_agent_main.c
- *
- * SPDX-License-Identifier: Apache-2.0
+ * apps/boot/mcuboot/mcuboot_agent_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -40,7 +38,7 @@
#include
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
#include "netutils/md5.h"
#endif
#include "netutils/netlib.h"
@@ -53,14 +51,14 @@
* Preprocessor Definitions
****************************************************************************/
-#define DL_BUFFER_SIZE CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_BUFFER_SIZE
+#define DL_BUFFER_SIZE CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_BUFFER_SIZE
-#define DL_UPDATE_URL CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_UPDATE_URL
+#define DL_UPDATE_URL CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_UPDATE_URL
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
# define MD5_HASH_LENGTH 32
# define MD5_DIGEST_LENGTH 16
-# define MD5_EXPECTED_HASH CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_MD5_HASH
+# define MD5_EXPECTED_HASH CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_MD5_HASH
#endif
/****************************************************************************
@@ -72,7 +70,7 @@ struct download_context_s
FAR const struct flash_area *fa;
uint32_t fa_offset;
ssize_t image_size;
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
MD5_CTX md5_ctx;
#endif
};
@@ -140,7 +138,7 @@ static int sink_callback(FAR char **buffer, int offset, int datend,
ctx->fa_offset += length;
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
md5_update(&ctx->md5_ctx,
(FAR const unsigned char *)&((*buffer)[offset]),
length);
@@ -164,7 +162,7 @@ static int download_firmware_image(FAR const char *url)
int ret;
struct webclient_context client_ctx;
struct download_context_s dl_ctx;
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
uint8_t digest[MD5_DIGEST_LENGTH];
char hash[MD5_HASH_LENGTH + 1];
int i;
@@ -174,7 +172,7 @@ static int download_firmware_image(FAR const char *url)
dl_ctx.fa_offset = 0;
dl_ctx.image_size = -1;
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
md5_init(&dl_ctx.md5_ctx);
#endif
@@ -204,13 +202,12 @@ static int download_firmware_image(FAR const char *url)
goto exit_close;
}
-#ifdef CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT_DL_VERIFY_MD5
+#ifdef CONFIG_MCUBOOT_UPDATE_AGENT_EXAMPLE_DL_VERIFY_MD5
md5_final(digest, &dl_ctx.md5_ctx);
for (i = 0; i < MD5_DIGEST_LENGTH; i++)
{
- snprintf(&hash[i * 2], sizeof(hash) - i * 2,
- "%02x", digest[i]);
+ sprintf(&hash[i * 2], "%02x", digest[i]);
}
hash[MD5_HASH_LENGTH] = '\0';
diff --git a/examples/mcuboot/slot_confirm/mcuboot_confirm_main.c b/boot/mcuboot/mcuboot_confirm_main.c
similarity index 94%
rename from examples/mcuboot/slot_confirm/mcuboot_confirm_main.c
rename to boot/mcuboot/mcuboot_confirm_main.c
index 2f296b081..c11e8d0fb 100644
--- a/examples/mcuboot/slot_confirm/mcuboot_confirm_main.c
+++ b/boot/mcuboot/mcuboot_confirm_main.c
@@ -1,7 +1,5 @@
/****************************************************************************
- * apps/examples/mcuboot/slot_confirm/mcuboot_confirm_main.c
- *
- * SPDX-License-Identifier: Apache-2.0
+ * apps/boot/mcuboot/mcuboot_confirm_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/boot/miniboot/CMakeLists.txt b/boot/miniboot/CMakeLists.txt
deleted file mode 100644
index 2c488cec7..000000000
--- a/boot/miniboot/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# ##############################################################################
-# apps/boot/miniboot/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BOOT_MINIBOOT)
- nuttx_add_application(
- NAME
- miniboot
- SRCS
- miniboot_main.c)
-endif()
diff --git a/boot/miniboot/Kconfig b/boot/miniboot/Kconfig
deleted file mode 100644
index c65509ca9..000000000
--- a/boot/miniboot/Kconfig
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BOOT_MINIBOOT
- bool "Minimal bootloader"
- default n
- select BOARDCTL_BOOT_IMAGE
- ---help---
- Enable support for the minimal NuttX based bootloader.
-
-if BOOT_MINIBOOT
-
-config MINIBOOT_SLOT_PATH
- string "Application firmware image slot path"
- default "/dev/ota0"
- ---help---
- The path to the application firmware image slot character
- device driver.
- Default: /dev/ota0
-
-config MINIBOOT_HEADER_SIZE
- hex "Application firmware image header size"
- default 0x200
-
-endif # BOOT_MINIBOOT
diff --git a/boot/miniboot/Make.defs b/boot/miniboot/Make.defs
deleted file mode 100644
index 0f082485d..000000000
--- a/boot/miniboot/Make.defs
+++ /dev/null
@@ -1,25 +0,0 @@
-############################################################################
-# apps/boot/miniboot/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BOOT_MINIBOOT),)
-CONFIGURED_APPS += $(APPDIR)/boot/miniboot
-endif
diff --git a/boot/miniboot/Makefile b/boot/miniboot/Makefile
deleted file mode 100644
index c5c4de340..000000000
--- a/boot/miniboot/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-############################################################################
-# apps/boot/miniboot/Makefile
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-include $(APPDIR)/Make.defs
-
-PROGNAME = miniboot
-PRIORITY = SCHED_PRIORITY_DEFAULT
-STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
-
-MAINSRC = miniboot_main.c
-
-include $(APPDIR)/Application.mk
diff --git a/boot/miniboot/miniboot_main.c b/boot/miniboot/miniboot_main.c
deleted file mode 100644
index ce490c45b..000000000
--- a/boot/miniboot/miniboot_main.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
- * apps/boot/miniboot/miniboot_main.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: miniboot_main
- *
- * Description:
- * Minimal bootloader entry point.
- *
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- struct boardioc_boot_info_s info;
-
- syslog(LOG_INFO, "*** miniboot ***\n");
-
-#ifdef CONFIG_BOARDCTL_FINALINIT
- /* Perform architecture-specific final-initialization (if configured) */
-
- boardctl(BOARDIOC_FINALINIT, 0);
-#endif
-
- /* Call board specific image boot */
-
- info.path = CONFIG_MINIBOOT_SLOT_PATH;
- info.header_size = CONFIG_MINIBOOT_HEADER_SIZE;
-
- return boardctl(BOARDIOC_BOOT_IMAGE, (uintptr_t)&info);
-}
diff --git a/boot/nxboot/CMakeLists.txt b/boot/nxboot/CMakeLists.txt
deleted file mode 100644
index 1ea82b7a8..000000000
--- a/boot/nxboot/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# ##############################################################################
-# apps/boot/nxboot/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BOOT_NXBOOT)
- nuttx_add_library(nxboot)
- set(SRCS loader/boot.c loader/flash.c)
-
- if(BOOT_NXBOOT)
- nuttx_add_application(NAME nxboot_loader SRCS nxboot_main.c
- INCLUDE_DIRECTORIES include)
- endif()
-
- target_include_directories(nxboot PUBLIC include)
- target_sources(nxboot PRIVATE ${SRCS})
-endif()
diff --git a/boot/nxboot/Kconfig b/boot/nxboot/Kconfig
deleted file mode 100644
index f8222e0f0..000000000
--- a/boot/nxboot/Kconfig
+++ /dev/null
@@ -1,159 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-menuconfig BOOT_NXBOOT
- bool "NuttX bootloader"
- default n
- select BCH
- ---help---
- Enable support for the minimal NuttX based bootloader.
-
-if BOOT_NXBOOT
-
-config NXBOOT_PRIMARY_SLOT_PATH
- string "Application firmware primary image slot path"
- default "/dev/ota0"
- ---help---
- The path to the application firmware image primary slot character
- device driver. The image runs from this location.
- Default: /dev/ota0
-
-config NXBOOT_SECONDARY_SLOT_PATH
- string "Application firmware secondary image slot path"
- default "/dev/ota1"
- ---help---
- The path to the application firmware image primary slot character
- device driver. This is either update or recovery slot.
- Default: /dev/ota1
-
-config NXBOOT_TERTIARY_SLOT_PATH
- string "Application firmware tertiary image slot path"
- default "/dev/ota2"
- ---help---
- The path to the application firmware image primary slot character
- device driver. This is either update or recovery slot.
- Default: /dev/ota2
-
-config NXBOOT_HEADER_SIZE
- hex "Application firmware image header size"
- default 0x200
- ---help---
- The nxboot bootloader itself requires only a few bytes of header
- data. Increase this value, if you need to store additional
- application-specific meta data.
- Note that this size should be aligned with the program memory write
- page size!
-
-config NXBOOT_PLATFORM_IDENTIFIER
- hex "A unique platform identifier"
- default 0x0
- ---help---
- This is a unique platform identifier used by the bootloader to
- verify whether the image should be run on a given platform. An update
- (or even a firmware uploaded via a programmer) is rejected if the
- value in image's header doesn't match this option.
-
-config NXBOOT_BOOTLOADER
- bool "Build nxboot bootloader application"
- default n
- select BOARDCTL
- select BOARDCTL_BOOT_IMAGE
- ---help---
- This option builds and links a bootloader application. This application
- ("nxboot_loader_main") should be the entry function for NuttX.
- It checks for a possible update/revert operation, performs it and boots
- the correct image.
-
-if NXBOOT_BOOTLOADER
-
-config NXBOOT_COPY_TO_RAM
- bool "Copy bootable image to RAM before calling board boot-image function"
- default n
- ---help---
- The is a board and/or arch specific option that may be used when running
- directly from flash, especially if external flash, even in XIP mode, is too
- slow.
- Running from RAM usually results in faster execution but the board must, of
- course, have sufficient RAM available for the application image, stack
- and heap.
-
-config NXBOOT_RAMSTART
- hex "Start address in RAM that the application is to be loaded"
- default 0x0
- depends on NXBOOT_COPY_TO_RAM
- ---help---
- This will be board specific. A check of the board's linker script
- may be informative. For example the SAMA5D2-XULT eval board's uboot
- linker script - boards/arm/sama5/sama5d2-xult/scripts/uboot.ld - has:
-
- sdram (W!RX) : ORIGIN = 0x20008000, LENGTH = 256M - 32K
-
- This shows the load address to be 0x20008000 and would be the address
- to use here if the same linker script is to be be used for NXboot.
-
- Typically the address is the base address of the RAM to be used, plus the
- size of the NXboot image itself. The example above has reserved
- 32KiB (0x8000) for this from the 256MiB available on the board at
- address 0x20000000.
-
-config NXBOOT_SWRESET_ONLY
- bool "Perform update/revert only on SW reset"
- default n
- select BOARDCTL_RESET_CAUSE
- ---help---
- This option ensures the update/revert is performed only for following
- reset causes:
- BOARDIOC_RESETCAUSE_CPU_SOFT: software reset
- BOARDIOC_RESETCAUSE_CPU_RWDT: watchdog error
- BOARDIOC_RESETCAUSE_PIN: reset button
-
- This way the board can keep its image (even if not confirmed) during
- for example power shutdown and perform update/revent only if expected
- based on user/maintainer input.
-
-config NXBOOT_PREVENT_DOWNGRADE
- bool "Perform update only for newer version"
- default n
- ---help---
- NXboot uses Semantic Version 2.0.0 (without build metadata). By default
- the update is performed for every version that doesn't match the
- currently running one. If NXBOOT_PREVENT_DOWNGRADE selected, update is
- performed only for newer versions (according to Semantic Version
- preference rules).
-
- WARNING: NXboot currently implements preferences only for
- MAJOR.MINOR.PATCH and ignores prerelease.
-
-config NXBOOT_PROGRESS
- bool
- default n
-
-config NXBOOT_PRINTF_PROGRESS
- bool "Enable progress messages to be sent to STDOUT"
- default y
- select NXBOOT_PROGRESS
- ---help---
- This will display progress during typically lengthy operations:
- - Calculating checksums
- - copying images between slots
-
- Note: the NXboot binary will be approximately 2KiB larger with this enabled.
-
-choice
- prompt "Choose preferred progress indication type"
- depends on NXBOOT_PRINTF_PROGRESS
- default NXBOOT_PRINTF_PROGRESS_PERCENT
-
-config NXBOOT_PRINTF_PROGRESS_DOTS
- bool "Display progress using sequential dots"
-
-config NXBOOT_PRINTF_PROGRESS_PERCENT
- bool "Display progress using percentage remaining"
-
-endchoice
-
-endif # NXBOOT_BOOTLOADER
-
-endif # BOOT_NXBOOT
diff --git a/boot/nxboot/Make.defs b/boot/nxboot/Make.defs
deleted file mode 100644
index 4a472724d..000000000
--- a/boot/nxboot/Make.defs
+++ /dev/null
@@ -1,28 +0,0 @@
-############################################################################
-# apps/boot/nxboot/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-
-ifneq ($(CONFIG_BOOT_NXBOOT),)
-CONFIGURED_APPS += $(APPDIR)/boot/nxboot
-
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/boot/nxboot/include
-
-endif
diff --git a/boot/nxboot/include/nxboot.h b/boot/nxboot/include/nxboot.h
deleted file mode 100644
index 3d92e9753..000000000
--- a/boot/nxboot/include/nxboot.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/****************************************************************************
- * apps/boot/nxboot/include/nxboot.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __BOOT_NXBOOT_INCLUDE_NXBOOT_H
-#define __BOOT_NXBOOT_INCLUDE_NXBOOT_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define ERROR -1
-
-#define NXBOOT_PRIMARY_SLOT_NUM (0)
-#define NXBOOT_SECONDARY_SLOT_NUM (1)
-#define NXBOOT_TERTIARY_SLOT_NUM (2)
-
-#define NXBOOT_HEADER_MAGIC 0x534f584e /* NXOS. The NX images, both
- * uploaded directly to primary
- * partition via debugger and to
- * update via some application
- * are used with this magic. If
- * this image is uploaded to
- * primary flash, it is considered
- * valid.
- */
-#define NXBOOT_HEADER_MAGIC_INT 0xaca0abb0 /* NXOS internal. This is used
- * for internal bootloader
- * handling and operations. It is
- * switch internally to distinguish
- * between images uploaded via
- * debugger or the ones updated
- * after the bootloader performed
- * its operation. The first two
- * bits are reserved to point
- * what partition is a recovery
- * for this image.
- */
-
-#define NXBOOT_HEADER_MAGIC_INT_MASK 0xfffffff0
-#define NXBOOT_RECOVERY_PTR_MASK 0x3
-
-#define NXBOOT_HEADER_PRERELEASE_MAXLEN 94
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-enum nxboot_update_type
-{
- NXBOOT_UPDATE_TYPE_NONE = 0, /* No action to do */
- NXBOOT_UPDATE_TYPE_UPDATE = 1, /* Update will take place upon reboot */
- NXBOOT_UPDATE_TYPE_REVERT = 2, /* Revert will take place upon reboot */
-};
-
-/* Versioning is according to Semantic Versioning 2.0.0
- * refer to (https://semver.org/spec/v2.0.0.html)
- */
-
-struct nxboot_img_version
-{
- uint16_t major; /* MAJOR version */
- uint16_t minor; /* MINOR version */
- uint16_t patch; /* PATCH version */
-
- char pre_release[NXBOOT_HEADER_PRERELEASE_MAXLEN]; /* Additional pre-release version */
-};
-
-struct nxboot_hdr_version
-{
- uint8_t major;
- uint8_t minor;
-};
-
-struct nxboot_img_header
-{
- uint32_t magic; /* Header magic */
- struct nxboot_hdr_version hdr_version; /* Version of the header */
-
- uint16_t header_size; /* Length of the header in bytes */
- uint32_t crc; /* CRC32 of image (excluding the previous
- * fields in header, but including the following
- * ones).
- */
- uint32_t size; /* Image size (excluding the header) */
- uint64_t identifier; /* Platform identifier. An image is rejected
- * if it does not match the one set for
- * the bootloader in NXBOOT_PLATFORM_IDENTIFIER.
- */
- uint32_t extd_hdr_ptr; /* Address of the next extended header.
- * This is a hook for future additional headers.
- */
-
- struct nxboot_img_version img_version; /* Image version */
-};
-
-static_assert(CONFIG_NXBOOT_HEADER_SIZE > sizeof(struct nxboot_img_header),
- "CONFIG_NXBOOT_HEADER_SIZE has to be larger than"
- "sizeof(struct nxboot_img_header)");
-
-struct nxboot_state
-{
- int update; /* Number of update slot */
- int recovery; /* Number of recovery slot */
- bool recovery_valid; /* True if recovery image contains valid recovery */
- bool recovery_present; /* True if the image in primary has a recovery */
- bool primary_confirmed; /* True if primary slot is confirmed */
- enum nxboot_update_type next_boot; /* nxboot_update_type with next operation */
-};
-
-enum progress_type_e
-{
- nxboot_info = 0, /* Prefixes arg. string with "INFO:" */
- nxboot_error, /* Prefixes arg. string with "ERR:" */
- nxboot_progress_start, /* Prints arg. string with no newline to allow ..... sequence to follow */
- nxboot_progress_dot, /* Prints of a "." to the ..... progress sequence */
- nxboot_progress_percent, /* Displays progress as % remaining */
- nxboot_progress_end, /* Flags end of a "..." progrees sequence and prints newline */
-};
-
-enum progress_msg_e
-{
- startup_msg = 0,
- power_reset,
- soft_reset,
- found_bootable_image,
- no_bootable_image,
- boardioc_image_boot_fail,
- ramcopy_started,
- recovery_revert,
- recovery_create,
- update_from_update,
- validate_primary,
- validate_recovery,
- validate_update,
- recovery_created,
- recovery_invalid,
- update_failed,
-};
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef CONFIG_NXBOOT_PROGRESS
-void nxboot_progress(int type, ...);
-#else
-#define nxboot_progress(type, ...) do {} while (0)
-#endif
-
-/****************************************************************************
- * Name: nxboot_get_state
- *
- * Description:
- * Gets the current bootloader state and stores it in the nxboot_state
- * structure passed as an argument. This function may be used to determine
- * which slot is update slot and where should application save incoming
- * firmware.
- *
- * Input parameters:
- * state: The pointer to nxboot_state structure. The state is stored here.
- *
- * Returned Value:
- * OK (0) on success, ERROR (-1) and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_get_state(struct nxboot_state *state);
-
-/****************************************************************************
- * Name: nxboot_open_update_partition
- *
- * Description:
- * Gets the current bootloader state and opens the partition to which an
- * update image should be stored. It returns the valid file descriptor to
- * this partition, the user is responsible for writing to it and closing
- * if afterwards.
- *
- * Returned Value:
- * Valid file descriptor on success, ERROR (-1) and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_open_update_partition(void);
-
-/****************************************************************************
- * Name: nxboot_get_confirm
- *
- * Description:
- * This function can be used to determine whether primary image is
- * confirmed or not. This provides more direct access to confirm
- * state compared to nxboot_get_state function that returns the full
- * state of the bootloader.
- *
- * Returned Value:
- * 1 if confirmed, OK (0) on success, ERROR (-1) and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_get_confirm(void);
-
-/****************************************************************************
- * Name: nxboot_confirm
- *
- * Description:
- * Confirms the image currently located in primary partition and marks
- * its copy in update partition as a recovery.
- *
- * Returned Value:
- * OK (0) on success, ERROR (-1) and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_confirm(void);
-
-/****************************************************************************
- * Name: nxboot_perform_update
- *
- * Description:
- * Checks for the possible firmware update and performs it by copying
- * update image to primary slot or recovery image to primary slot in case
- * of the revert. In any situation, this function ends with the valid
- * image in primary slot.
- *
- * This is an entry point function that should be called from the
- * bootloader application.
- *
- * Input parameters:
- * check_only: Only repairs corrupted update, but do not start another one
- *
- * Returned Value:
- * OK (0) on success, ERROR (-1) and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_perform_update(bool check_only);
-
-/****************************************************************************
- * Name: nxboot_ramcopy
- *
- * Description:
- * Copies the (already) validate bootable image to RAM memory
- *
- * NOTE - no checking that the RAM location is correct, nor that the
- * image size is appropriate for that RAM address!
- *
- * Input parameters:
- * none
- *
- * Returned Value:
- * OK (0) on success, ERROR (-1) on fail
- *
- ****************************************************************************/
-
-int nxboot_ramcopy(void);
-
-#endif /* __BOOT_NXBOOT_INCLUDE_NXBOOT_H */
diff --git a/boot/nxboot/loader/boot.c b/boot/nxboot/loader/boot.c
deleted file mode 100644
index c4f936d23..000000000
--- a/boot/nxboot/loader/boot.c
+++ /dev/null
@@ -1,933 +0,0 @@
-/****************************************************************************
- * apps/boot/nxboot/loader/boot.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include "flash.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifdef CONFIG_NXBOOT_PREVENT_DOWNGRADE
- # warning "Downgrade prevention currently ignores prerelease."
-#endif
-
-#define IS_INTERNAL_MAGIC(magic) ((magic & NXBOOT_HEADER_MAGIC_INT_MASK) \
- == NXBOOT_HEADER_MAGIC_INT)
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-static inline void get_image_header(int fd, struct nxboot_img_header *header)
-{
- int ret;
- ret = flash_partition_read(fd, header, sizeof *header, 0);
- if (ret < 0)
- {
- /* Something went wrong, treat the partition as empty. */
-
- memset(header, 0, sizeof *header);
- }
-}
-
-static inline bool validate_image_header(struct nxboot_img_header *header)
-{
- return (header->magic == NXBOOT_HEADER_MAGIC ||
- IS_INTERNAL_MAGIC(header->magic)) &&
- header->identifier == CONFIG_NXBOOT_PLATFORM_IDENTIFIER;
-}
-
-static uint32_t calculate_crc(int fd, struct nxboot_img_header *header)
-{
- char *buf;
- int remain;
- int readsiz;
- off_t off;
- uint32_t crc;
- struct flash_partition_info info;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- int total_size;
-#endif
-
- if (flash_partition_info(fd, &info) < 0)
- {
- return false;
- }
-
- buf = malloc(info.blocksize);
- if (!buf)
- {
- return false;
- }
-
- crc = 0xffffffff;
- off = offsetof(struct nxboot_img_header, crc) + sizeof crc;
- remain = header->size + header->header_size - off;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- total_size = remain;
-#endif
- while (remain > 0)
- {
- readsiz = remain > info.blocksize ? info.blocksize : remain;
- if (flash_partition_read(fd, buf, readsiz, off) != 0)
- {
- free(buf);
- return 0xffffffff;
- }
-
- off += readsiz;
- remain -= readsiz;
- crc = crc32part((uint8_t *)buf, readsiz, crc);
- if ((remain % 25) == 0)
- {
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- nxboot_progress(nxboot_progress_percent,
- ((total_size - remain) * 100) / total_size);
-#else
- nxboot_progress(nxboot_progress_dot);
-#endif
- }
- }
-
- free(buf);
- return ~crc;
-}
-
-static int copy_partition(int from, int where, struct nxboot_state *state,
- bool update)
-{
- struct nxboot_img_header header;
- struct flash_partition_info info_from;
- struct flash_partition_info info_where;
- uint32_t magic;
- int readsiz;
- int remain;
- int blocksize;
- off_t off;
- char *buf;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- int total_size;
-#endif
-
- get_image_header(from, &header);
-
- if (flash_partition_info(from, &info_from) < 0)
- {
- return ERROR;
- }
-
- if (flash_partition_info(where, &info_where) < 0)
- {
- return ERROR;
- }
-
- remain = header.size + header.header_size;
- if (remain > info_where.size)
- {
- return ERROR;
- }
-
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- total_size = remain;
-#endif
- blocksize = info_where.blocksize;
-
- buf = malloc(blocksize);
- if (!buf)
- {
- return ERROR;
- }
-
- /* Flip header's magic. We go from standard to internal in case of
- * image update and from internal to standard in case of recovery
- * creation or revert operation.
- */
-
- magic = IS_INTERNAL_MAGIC(header.magic) ?
- NXBOOT_HEADER_MAGIC : NXBOOT_HEADER_MAGIC_INT;
-
- if (update)
- {
- /* This is update operation, add pointer to recovery image to the
- * image's magic.
- */
-
- magic |= state->update;
- }
-
- if (flash_partition_read(from, buf, blocksize, 0) < 0)
- {
- free(buf);
- return ERROR;
- }
-
- memcpy(buf + offsetof(struct nxboot_img_header, magic), &magic,
- sizeof magic);
- if (flash_partition_write(where, buf, blocksize, 0) < 0)
- {
- free(buf);
- return ERROR;
- }
-
- off = blocksize;
- remain -= blocksize;
-
- while (remain > 0)
- {
- readsiz = remain > blocksize ? blocksize : remain;
- if (flash_partition_read(from, buf, readsiz, off) < 0)
- {
- free(buf);
- return ERROR;
- }
-
- if (flash_partition_write(where, buf, readsiz, off) < 0)
- {
- free(buf);
- return ERROR;
- }
-
- off += readsiz;
- remain -= readsiz;
- if ((remain % 25) == 0)
- {
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- nxboot_progress(nxboot_progress_percent,
- 100 - ((100 * remain) / total_size));
-#else
- nxboot_progress(nxboot_progress_dot);
-#endif
- }
- }
-
- free(buf);
- return OK;
-}
-
-static bool validate_image(int fd)
-{
- struct nxboot_img_header header;
-
- get_image_header(fd, &header);
- if (!validate_image_header(&header))
- {
- return false;
- }
-
- syslog(LOG_INFO, "Validating image.\n");
- return calculate_crc(fd, &header) == header.crc;
-}
-
-static bool compare_versions(struct nxboot_img_version *v1,
- struct nxboot_img_version *v2)
-{
-#ifndef CONFIG_NXBOOT_PREVENT_DOWNGRADE
- int i;
- if (v1->major != v2->major ||
- v1->minor != v2->minor ||
- v1->patch != v2->patch)
- {
- return false;
- }
-
- for (i = 0; i < NXBOOT_HEADER_PRERELEASE_MAXLEN; i++)
- {
- if (v1->pre_release[i] != v2->pre_release[i])
- {
- return false;
- }
- }
-
- return true;
-#else
- if (v1->major > v2->major ||
- v1->minor > v2->minor ||
- v1->patch > v2->patch)
- {
- return true;
- }
-
- if (v1->major == v2->major &&
- v1->minor == v2->minor &&
- v1->patch == v2->patch)
- {
- /* TODO: compare prerelease */
- }
-
- return false;
-#endif
-}
-
-static enum nxboot_update_type
- get_update_type(struct nxboot_state *state,
- int primary, int update, int recovery,
- struct nxboot_img_header *primary_header,
- struct nxboot_img_header *update_header,
- struct nxboot_img_header *recovery_header)
-{
- nxboot_progress(nxboot_progress_start, validate_primary);
- bool primary_valid = validate_image(primary);
- nxboot_progress(nxboot_progress_end);
-
- nxboot_progress(nxboot_progress_start, validate_update);
- if (update_header->magic == NXBOOT_HEADER_MAGIC && validate_image(update))
- {
- if (primary_header->crc != update_header->crc ||
- !compare_versions(&primary_header->img_version,
- &update_header->img_version) || !primary_valid)
- {
- nxboot_progress(nxboot_progress_end);
- return NXBOOT_UPDATE_TYPE_UPDATE;
- }
-
- flash_partition_erase_first_sector(update);
- }
-
- nxboot_progress(nxboot_progress_end);
-
- if (IS_INTERNAL_MAGIC(recovery_header->magic) && state->recovery_valid &&
- ((IS_INTERNAL_MAGIC(primary_header->magic) &&
- !state->primary_confirmed) || !primary_valid))
- {
- return NXBOOT_UPDATE_TYPE_REVERT;
- }
-
- return NXBOOT_UPDATE_TYPE_NONE;
-}
-
-static int perform_update(struct nxboot_state *state, bool check_only)
-{
- int successful;
- int update;
- int recovery;
- int primary;
- int secondary;
- int tertiary;
- bool primary_valid;
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- secondary = flash_partition_open(CONFIG_NXBOOT_SECONDARY_SLOT_PATH);
- if (secondary < 0)
- {
- flash_partition_close(primary);
- return ERROR;
- }
-
- tertiary = flash_partition_open(CONFIG_NXBOOT_TERTIARY_SLOT_PATH);
- if (tertiary < 0)
- {
- flash_partition_close(primary);
- flash_partition_close(secondary);
- return ERROR;
- }
-
- if (state->update == NXBOOT_SECONDARY_SLOT_NUM)
- {
- update = secondary;
- recovery = tertiary;
- }
- else
- {
- update = tertiary;
- recovery = secondary;
- }
-
- nxboot_progress(nxboot_progress_start, validate_primary);
- if (state->next_boot == NXBOOT_UPDATE_TYPE_REVERT &&
- (!check_only || !validate_image(primary)))
- {
- nxboot_progress(nxboot_progress_end);
- if (state->recovery_valid)
- {
- syslog(LOG_INFO, "Reverting image to recovery.\n");
- nxboot_progress(nxboot_progress_start, recovery_revert);
- copy_partition(recovery, primary, state, false);
- nxboot_progress(nxboot_progress_end);
- }
- }
- else
- {
- nxboot_progress(nxboot_progress_end);
- nxboot_progress(nxboot_progress_start, validate_primary);
- primary_valid = validate_image(primary);
- nxboot_progress(nxboot_progress_end);
- if (primary_valid && check_only)
- {
- /* Skip if primary image is valid (does not mather whether
- * confirmed or not) and check_only option is set.
- */
-
- goto perform_update_done;
- }
-
- if ((!state->recovery_present || !state->recovery_valid) &&
- state->primary_confirmed && primary_valid)
- {
- /* Save current image as recovery only if it is valid and
- * confirmed. We have to check this in case of restart
- * during update process.
- * If board is restarted during update, primary slot contains
- * non-valid image and we do not want to copy this image to
- * recovery slot.
- * There also might be a case where primary image is valid
- * but not confirmed (timing of board reset right after
- * update is uploaded to secondary). Still we do not want
- * to upload this to recovery.
- */
-
- syslog(LOG_INFO, "Creating recovery image.\n");
- nxboot_progress(nxboot_progress_start, recovery_create);
- copy_partition(primary, recovery, state, false);
- flash_partition_flush(recovery);
- nxboot_progress(nxboot_progress_end);
- nxboot_progress(nxboot_progress_start, validate_recovery);
- successful = validate_image(recovery);
- nxboot_progress(nxboot_progress_end);
- if (!successful)
- {
- syslog(LOG_INFO,
- "New recovery is not valid,stop update.\n");
- nxboot_progress(nxboot_info, recovery_invalid);
- goto perform_update_done;
- }
-
- syslog(LOG_INFO, "Recovery image created.\n");
- nxboot_progress(nxboot_info, recovery_created);
- }
-
- nxboot_progress(nxboot_progress_start, validate_update);
- successful = validate_image(update);
- nxboot_progress(nxboot_progress_end);
- if (successful)
- {
- /* Perform update only if update slot contains valid image. */
-
- syslog(LOG_INFO, "Updating from update image.\n");
- nxboot_progress(nxboot_progress_start, update_from_update);
- if (copy_partition(update, primary, state, true) >= 0)
- {
- flash_partition_flush(primary);
-
- /* Erase the first sector of update partition. This marks the
- * partition as updated so we don't end up in an update loop.
- * The sector is written back again during the image
- * confirmation.
- */
-
- flash_partition_erase_first_sector(update);
- }
-
- nxboot_progress(nxboot_progress_end);
- }
- }
-
-perform_update_done:
- flash_partition_close(primary);
- flash_partition_close(secondary);
- flash_partition_close(tertiary);
- return OK;
-}
-
-#ifdef CONFIG_NXBOOT_COPY_TO_RAM
-int nxboot_ramcopy(void)
-{
- int ret = OK;
- int primary;
- struct nxboot_img_header header;
- ssize_t bytes;
- static uint8_t *buf;
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- get_image_header(primary, &header);
- buf = malloc(header.size);
- if (!buf)
- {
- ret = ERROR;
- goto exit_with_error;
- }
-
- bytes = pread(primary, buf, header.size, header.header_size);
- if (bytes != header.size)
- {
- ret = ERROR;
- goto exit_with_error;
- }
-
- memcpy((uint32_t *)CONFIG_NXBOOT_RAMSTART, buf, header.size);
-
-exit_with_error:
- flash_partition_close(primary);
- free(buf);
-
- return ret;
-}
-#endif
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: nxboot_get_state
- *
- * Description:
- * Gets the current bootloader state and stores it in the nxboot_state
- * structure passed as an argument. This function may be used to determine
- * which slot is update slot and where should application save incoming
- * firmware.
- *
- * Input parameters:
- * state: The pointer to nxboot_state structure. The state is stored here.
- *
- * Returned Value:
- * 0 on success, -1 and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_get_state(struct nxboot_state *state)
-{
- int primary;
- int secondary;
- int tertiary;
- int update;
- int recovery;
- int recovery_pointer;
- struct nxboot_img_header primary_header;
- struct nxboot_img_header secondary_header;
- struct nxboot_img_header tertiary_header;
- struct nxboot_img_header *update_header;
- struct nxboot_img_header *recovery_header;
-
- memset(state, 0, sizeof *state);
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- secondary = flash_partition_open(CONFIG_NXBOOT_SECONDARY_SLOT_PATH);
- if (secondary < 0)
- {
- flash_partition_close(primary);
- return ERROR;
- }
-
- tertiary = flash_partition_open(CONFIG_NXBOOT_TERTIARY_SLOT_PATH);
- if (tertiary < 0)
- {
- flash_partition_close(primary);
- flash_partition_close(secondary);
- return ERROR;
- }
-
- get_image_header(primary, &primary_header);
- get_image_header(secondary, &secondary_header);
- get_image_header(tertiary, &tertiary_header);
-
- /* Determine which partition is for update and which is a recovery.
- * This depends on many factors, but in general a partition with
- * NXBOOT_HEADER_MAGIC is an update partition and partition with
- * NXBOOT_HEADER_MAGIC_INT is a recovery.
- *
- * A special case is when both partitions have NXBOOT_HEADER_MAGIC_INT,
- * then we look into a recovery pointer in primary header magic and
- * determine the recovery from it.
- */
-
- update = secondary;
- recovery = tertiary;
- update_header = &secondary_header;
- recovery_header = &tertiary_header;
- state->update = NXBOOT_SECONDARY_SLOT_NUM;
- state->recovery = NXBOOT_TERTIARY_SLOT_NUM;
-
- if (tertiary_header.magic == NXBOOT_HEADER_MAGIC)
- {
- update = tertiary;
- recovery = secondary;
- update_header = &tertiary_header;
- recovery_header = &secondary_header;
- state->recovery = NXBOOT_SECONDARY_SLOT_NUM;
- state->update = NXBOOT_TERTIARY_SLOT_NUM;
- }
- else if (IS_INTERNAL_MAGIC(secondary_header.magic) &&
- IS_INTERNAL_MAGIC(tertiary_header.magic))
- {
- if (IS_INTERNAL_MAGIC(primary_header.magic))
- {
- recovery_pointer = primary_header.magic & NXBOOT_RECOVERY_PTR_MASK;
- if (recovery_pointer == NXBOOT_SECONDARY_SLOT_NUM &&
- primary_header.crc == secondary_header.crc)
- {
- update = tertiary;
- recovery = secondary;
- update_header = &tertiary_header;
- recovery_header = &secondary_header;
- state->recovery = NXBOOT_SECONDARY_SLOT_NUM;
- state->update = NXBOOT_TERTIARY_SLOT_NUM;
- }
- }
- else if (primary_header.crc == secondary_header.crc)
- {
- update = tertiary;
- recovery = secondary;
- update_header = &tertiary_header;
- recovery_header = &secondary_header;
- state->recovery = NXBOOT_SECONDARY_SLOT_NUM;
- state->update = NXBOOT_TERTIARY_SLOT_NUM;
- }
- }
- else if (IS_INTERNAL_MAGIC(secondary_header.magic))
- {
- update = tertiary;
- recovery = secondary;
- update_header = &tertiary_header;
- recovery_header = &secondary_header;
- state->recovery = NXBOOT_SECONDARY_SLOT_NUM;
- state->update = NXBOOT_TERTIARY_SLOT_NUM;
- }
-
- nxboot_progress(nxboot_progress_start, validate_recovery);
- state->recovery_valid = validate_image(recovery);
- nxboot_progress(nxboot_progress_end);
- state->recovery_present = primary_header.crc == recovery_header->crc;
-
- /* The image is confirmed if it has either NXBOOT_HEADER_MAGIC or a
- * recovery exists.
- */
-
- if (primary_header.magic == NXBOOT_HEADER_MAGIC)
- {
- state->primary_confirmed = true;
- }
- else if (IS_INTERNAL_MAGIC(primary_header.magic))
- {
- recovery_pointer = primary_header.magic & NXBOOT_RECOVERY_PTR_MASK;
- if (recovery_pointer == NXBOOT_SECONDARY_SLOT_NUM &&
- IS_INTERNAL_MAGIC(secondary_header.magic))
- {
- state->primary_confirmed =
- primary_header.crc == secondary_header.crc;
- }
- else if (recovery_pointer == NXBOOT_TERTIARY_SLOT_NUM &&
- IS_INTERNAL_MAGIC(tertiary_header.magic))
- {
- state->primary_confirmed =
- primary_header.crc == tertiary_header.crc;
- }
- }
-
- state->next_boot = get_update_type(state, primary, update, recovery,
- &primary_header, update_header,
- recovery_header);
-
- flash_partition_close(primary);
- flash_partition_close(secondary);
- flash_partition_close(tertiary);
- return OK;
-}
-
-/****************************************************************************
- * Name: nxboot_open_update_partition
- *
- * Description:
- * Gets the current bootloader state and opens the partition to which an
- * update image should be stored. It returns the valid file descriptor to
- * this partition, the user is responsible for writing to it and closing
- * if afterwards.
- *
- * Returned Value:
- * Valid file descriptor on success, -1 and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_open_update_partition(void)
-{
- char *path;
- struct nxboot_state state;
-
- nxboot_get_state(&state);
-
- path = state.update == NXBOOT_SECONDARY_SLOT_NUM ?
- CONFIG_NXBOOT_SECONDARY_SLOT_PATH : CONFIG_NXBOOT_TERTIARY_SLOT_PATH;
-
- return flash_partition_open(path);
-}
-
-/****************************************************************************
- * Name: nxboot_get_confirm
- *
- * Description:
- * This function can be used to determine whether primary image is
- * confirmed or not. This provides more direct access to confirm
- * state compared to nxboot_get_state function that returns the full
- * state of the bootloader.
- *
- * Returned Value:
- * 1 means confirmed, 0 not confirmed, -1 and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_get_confirm(void)
-{
- int primary;
- int recovery;
- int recovery_pointer;
- char *path;
- int ret = OK;
- struct nxboot_img_header primary_header;
- struct nxboot_img_header recovery_header;
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- get_image_header(primary, &primary_header);
-
- if (primary_header.magic == NXBOOT_HEADER_MAGIC)
- {
- close(primary);
- return 1;
- }
- else if (IS_INTERNAL_MAGIC(primary_header.magic))
- {
- recovery_pointer = primary_header.magic & NXBOOT_RECOVERY_PTR_MASK;
- if (recovery_pointer != 0)
- {
- path = recovery_pointer == NXBOOT_SECONDARY_SLOT_NUM ?
- CONFIG_NXBOOT_SECONDARY_SLOT_PATH :
- CONFIG_NXBOOT_TERTIARY_SLOT_PATH;
-
- recovery = flash_partition_open(path);
- if (recovery < 0)
- {
- close(primary);
- return ERROR;
- }
-
- get_image_header(recovery, &recovery_header);
- if (primary_header.crc == recovery_header.crc)
- {
- ret = 1;
- }
-
- close(recovery);
- }
- }
-
- close(primary);
- return ret;
-}
-
-/****************************************************************************
- * Name: nxboot_confirm
- *
- * Description:
- * Confirms the image currently located in primary partition and marks
- * its copy in update partition as a recovery.
- *
- * Returned Value:
- * 0 on success, -1 and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_confirm(void)
-{
- int ret;
- int update;
- int primary;
- int remain;
- int readsiz;
- char *path;
- char *buf;
- off_t off;
- struct nxboot_state state;
- struct flash_partition_info info_update;
-
- ret = OK;
- nxboot_get_state(&state);
- if (state.primary_confirmed)
- {
- return OK;
- }
-
- path = state.update == NXBOOT_SECONDARY_SLOT_NUM ?
- CONFIG_NXBOOT_SECONDARY_SLOT_PATH : CONFIG_NXBOOT_TERTIARY_SLOT_PATH;
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- update = flash_partition_open(path);
- if (update < 0)
- {
- flash_partition_close(primary);
- return ERROR;
- }
-
- /* Confirm the image by creating a recovery. The recovery image is
- * already present in the update slot, but without the first erase
- * page. Therefore, just copy the first erase page to the update slot.
- */
-
- if (flash_partition_info(update, &info_update) < 0)
- {
- ret = ERROR;
- goto confirm_done;
- }
-
- /* Write by write pages to avoid large array buffering. */
-
- buf = malloc(info_update.blocksize);
- remain = info_update.erasesize;
- off = 0;
-
- while (remain > 0)
- {
- readsiz = remain > info_update.blocksize ?
- info_update.blocksize : remain;
- if (flash_partition_read(primary, buf, readsiz, off) < 0)
- {
- free(buf);
- ret = ERROR;
- goto confirm_done;
- }
-
- if (flash_partition_write(update, buf, readsiz, off) < 0)
- {
- free(buf);
- ret = ERROR;
- goto confirm_done;
- }
-
- off += readsiz;
- remain -= readsiz;
- }
-
- free(buf);
-
-confirm_done:
- flash_partition_close(primary);
- flash_partition_close(update);
-
- return ret;
-}
-
-/****************************************************************************
- * Name: nxboot_perform_update
- *
- * Description:
- * Checks for the possible firmware update and performs it by copying
- * update image to primary slot or recovery image to primary slot in case
- * of the revert. In any situation, this function ends with the valid
- * image in primary slot.
- *
- * This is an entry point function that should be called from the
- * bootloader application.
- *
- * Input parameters:
- * check_only: Only repairs corrupted update, but do not start another one
- *
- * Returned Value:
- * 0 on success, -1 and sets errno on failure.
- *
- ****************************************************************************/
-
-int nxboot_perform_update(bool check_only)
-{
- int ret;
- int primary;
- struct nxboot_state state;
-
- ret = nxboot_get_state(&state);
- if (ret < 0)
- {
- return ERROR;
- }
-
- if (state.next_boot != NXBOOT_UPDATE_TYPE_NONE)
- {
- /* We either want to update or revert. */
-
- ret = perform_update(&state, check_only);
- if (ret < 0)
- {
- /* Update process failed, raise error and try to boot into
- * primary.
- */
-
- syslog(LOG_ERR, "Update process failed: %s\n", strerror(errno));
- nxboot_progress(nxboot_error, update_failed);
- }
- }
-
- /* Check whether there is a valid image in the primary slot. Validates
- * both the header and the full image CRC to ensure integrity before
- * booting.
- */
-
- primary = flash_partition_open(CONFIG_NXBOOT_PRIMARY_SLOT_PATH);
- if (primary < 0)
- {
- return ERROR;
- }
-
- if (!validate_image(primary))
- {
- ret = ERROR;
- }
-
- flash_partition_close(primary);
-
- return ret;
-}
-
diff --git a/boot/nxboot/loader/flash.c b/boot/nxboot/loader/flash.c
deleted file mode 100644
index ab6a24320..000000000
--- a/boot/nxboot/loader/flash.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/****************************************************************************
- * apps/boot/nxboot/loader/flash.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include "flash.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: flash_partition_open
- *
- * Description:
- * Opens the partition based on a given name and returns the file
- * descriptor to it.
- *
- * Input parameters:
- * path: Path to the device.
- *
- * Returned Value:
- * Valid file descriptor on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_open(const char *path)
-{
- int fd;
-
- fd = open(path, O_RDWR | O_DIRECT);
- if (fd < 0)
- {
- syslog(LOG_ERR, "Could not open %s partition: %s\n",
- path, strerror(errno));
- return ERROR;
- }
-
- return fd;
-}
-
-/****************************************************************************
- * Name: flash_partition_flush
- *
- * Description:
- * Flushes any buffered writes to the underlying storage. This ensures
- * data is physically committed to flash before the caller proceeds.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_flush(int fd)
-{
- return fsync(fd);
-}
-
-/****************************************************************************
- * Name: flash_partition_close
- *
- * Description:
- * Closes opened partition.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_close(int fd)
-{
- return close(fd);
-}
-
-/****************************************************************************
- * Name: flash_partition_write
- *
- * Description:
- * Writes count data pointed to by buf at offset off to a partition
- * referenced by file descriptor fd.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * buf: The pointer to data to be written.
- * count: Number of bytes to be written.
- * off: Write offset in bytes.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_write(int fd, const void *buf, size_t count, off_t off)
-{
- int ret;
- off_t pos;
- size_t size;
- ssize_t nbytes;
- struct mtd_geometry_s geometry;
-
- ret = ioctl(fd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geometry));
- if (ret < 0)
- {
- syslog(LOG_ERR, "ioctl MTDIOC_GEOMETRY failed: %s\n", strerror(errno));
- return ERROR;
- }
-
- size = geometry.erasesize * geometry.neraseblocks;
- if (count + off > size)
- {
- syslog(LOG_ERR, "Trying to write outside of flash area.\n");
- return ERROR;
- }
-
- pos = lseek(fd, off, SEEK_SET);
- if (pos != off)
- {
- syslog(LOG_ERR, "Could not seek to %" PRIdOFF ": %s\n",
- off, strerror(errno));
- return ERROR;
- }
-
- nbytes = write(fd, buf, count);
- if (nbytes != count)
- {
- syslog(LOG_ERR, "Write to offset %" PRIdOFF " failed %s\n",
- off, strerror(errno));
- return ERROR;
- }
-
- return OK;
-}
-
-/****************************************************************************
- * Name: flash_partition_read
- *
- * Description:
- * Read count data to buffer buf at offset off from a partition
- * referenced by file descriptor fd.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * buf: The pointer where read data are stored.
- * count: Number of bytes to be read.
- * off: Read offset in bytes.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_read(int fd, void *buf, size_t count, off_t off)
-{
- int ret;
- off_t pos;
- size_t size;
- ssize_t nbytes;
- struct mtd_geometry_s geometry;
-
- ret = ioctl(fd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geometry));
- if (ret < 0)
- {
- syslog(LOG_ERR, "ioctl MTDIOC_GEOMETRY failed: %s\n", strerror(errno));
- return ERROR;
- }
-
- size = geometry.erasesize * geometry.neraseblocks;
- if (count + off > size)
- {
- syslog(LOG_ERR, "Trying to read outside of flash area.\n");
- return ERROR;
- }
-
- pos = lseek(fd, off, SEEK_SET);
- if (pos != off)
- {
- syslog(LOG_ERR, "Could not seek to %" PRIdOFF ": %s\n",
- off, strerror(errno));
- return ERROR;
- }
-
- nbytes = read(fd, buf, count);
- if (nbytes != count)
- {
- syslog(LOG_ERR, "Read from offset %" PRIdOFF " failed %s\n",
- off, strerror(errno));
- return ERROR;
- }
-
- return OK;
-}
-
-/****************************************************************************
- * Name: flash_partition_erase
- *
- * Description:
- * Erases the entire partition.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_erase(int fd)
-{
- int ret;
-
- ret = ioctl(fd, MTDIOC_BULKERASE, 0);
- if (ret < 0)
- {
- syslog(LOG_ERR, "Could not erase the partition: %s\n",
- strerror(errno));
- return ERROR;
- }
-
- return OK;
-}
-
-/****************************************************************************
- * Name: flash_partition_erase_first_sector
- *
- * Description:
- * Erases the first sector of the partition
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_erase_first_sector(int fd)
-{
- int ret;
- struct mtd_erase_s erase;
-
- erase.startblock = 0;
- erase.nblocks = 1;
-
- ret = ioctl(fd, MTDIOC_ERASESECTORS, &erase);
- if (ret < 0)
- {
- syslog(LOG_ERR, "Could not erase the partition: %s\n",
- strerror(errno));
- return ERROR;
- }
-
- return OK;
-}
-
-/****************************************************************************
- * Name: flash_partition_info
- *
- * Description:
- * Returns the size of one block.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * info: Pointer to flash_partition_info structure where info is filled.
- *
- * Returned Value:
- * Size of the block on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_info(int fd, struct flash_partition_info *info)
-{
- int ret;
- struct mtd_geometry_s geometry;
-
- ret = ioctl(fd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&geometry));
- if (ret < 0)
- {
- syslog(LOG_ERR, "ioctl MTDIOC_GEOMETRY failed: %s\n",
- strerror(errno));
- return ERROR;
- }
-
- info->blocksize = geometry.blocksize;
- info->size = geometry.erasesize * geometry.neraseblocks;
- info->neraseblocks = geometry.neraseblocks;
- info->erasesize = geometry.erasesize;
-
- return OK;
-}
diff --git a/boot/nxboot/loader/flash.h b/boot/nxboot/loader/flash.h
deleted file mode 100644
index 69906490d..000000000
--- a/boot/nxboot/loader/flash.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
- * apps/boot/nxboot/loader/flash.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __BOOT_NXBOOT_LOADER_FLASH_H
-#define __BOOT_NXBOOT_LOADER_FLASH_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-struct flash_partition_info
-{
- int size;
- int blocksize;
- int neraseblocks;
- int erasesize;
-};
-
-/****************************************************************************
- * Public Functions Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: flash_partition_open
- *
- * Description:
- * Opens the partition based on a given name and returns the file
- * descriptor to it.
- *
- * Input parameters:
- * path: Path to the device.
- *
- * Returned Value:
- * Valid file descriptor on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_open(const char *path);
-
-/****************************************************************************
- * Name: flash_partition_close
- *
- * Description:
- * Closes opened partition.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_close(int fd);
-
-/****************************************************************************
- * Name: flash_partition_flush
- *
- * Description:
- * Flushes any buffered writes to the underlying storage.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_flush(int fd);
-
-/****************************************************************************
- * Name: flash_partition_write
- *
- * Description:
- * Writes count data pointed to by buf at offset off to a partition
- * referenced by file descriptor fd.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * buf: The pointer to data to be written.
- * count: Number of bytes to be written.
- * off: Write offset in bytes.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_write(int fd, const void *buf, size_t count, off_t off);
-
-/****************************************************************************
- * Name: flash_partition_read
- *
- * Description:
- * Read count data to buffer buf at offset off from a partition
- * referenced by file descriptor fd.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * buf: The pointer where read data are stored.
- * count: Number of bytes to be read.
- * off: Read offset in bytes.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_read(int fd, void *buf, size_t count, off_t off);
-
-/****************************************************************************
- * Name: flash_partition_erase
- *
- * Description:
- * Erases the entire partition.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_erase(int fd);
-
-/****************************************************************************
- * Name: flash_partition_erase_first_sector
- *
- * Description:
- * Erases the first sector of the partition
- *
- * Input parameters:
- * fd: Valid file descriptor.
- *
- * Returned Value:
- * 0 on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_erase_first_sector(int fd);
-
-/****************************************************************************
- * Name: flash_partition_info
- *
- * Description:
- * Returns the size of one block.
- *
- * Input parameters:
- * fd: Valid file descriptor.
- * info: Pointer to flash_partition_info structure where info is filled.
- *
- * Returned Value:
- * Size of the block on success, -1 on failure.
- *
- ****************************************************************************/
-
-int flash_partition_info(int fd, struct flash_partition_info *info);
-
-#endif /* __BOOT_NXBOOT_LOADER_FLASH_H */
diff --git a/boot/nxboot/nxboot_main.c b/boot/nxboot/nxboot_main.c
deleted file mode 100644
index 0682b92c7..000000000
--- a/boot/nxboot/nxboot_main.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/****************************************************************************
- * apps/boot/nxboot/nxboot_main.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-#ifdef CONFIG_NXBOOT_PROGRESS
-static bool g_progress_started = false;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
-static bool g_progress_percent_started = false;
-#endif
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS
-
-# ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
-static const char backtab[] =
-{
- ASCII_BS, ASCII_BS, ASCII_BS, ASCII_BS, '\0',
-};
-# endif
-
-static const char *progress_msgs[] =
-{
- [startup_msg] = "*** nxboot ***",
- [power_reset] = "Power Reset detected, check images only",
- [soft_reset] = "Soft reset detected, check for update",
- [found_bootable_image] = "Found bootable image, boot from primary",
- [no_bootable_image] = "No bootable image found",
- [boardioc_image_boot_fail] = "Board failed to boot bootable image",
- [ramcopy_started] = "Copying bootable image to RAM",
- [recovery_revert] = "Reverting image to recovery",
- [recovery_create] = "Creating recovery image",
- [update_from_update] = "Updating from update image",
- [validate_primary] = "Validating primary image",
- [validate_recovery] = "Validating recovery image",
- [validate_update] = "Validating update image",
- [recovery_created] = "Recovery image created",
- [recovery_invalid] = "Recovery image invalid, update stopped",
- [update_failed] = "Update failed",
-};
-#endif /* CONFIG_NXBOOT_PRINTF_PROGRESS */
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: nxboot_progress
- *
- * Description:
- * If enabled, this function prints progress messages to stdout.
- * Messages are handled via integer enums, allowing this function to be
- * easily replaced if required with no changes needed to the underlying
- * code
- *
- * Input Parameters:
- * type - the progress message type to be printed, as per progress_type_e:
- * - nxboot_info: Prefixes arg. string with "INFO:"
- * - nxboot_error: Prefixes arg. string with "ERR:"
- * - nxboot_progress_start: Prints arg. string with no newline
- * to allow a ..... sequence
- * or % remaining to follow
- * - nxboot_progress_dot: Prints a "." to the ..... sequence
- * - nxboot_progress_percent: Displays progress as % remaining
- * - nxboot_progress_end, Flags end of a progrees sequence
- *
- * ... - variadic argument:
- * - the enum (int) reference to the message string or
- * - the % remaining in the case of type: nxboot_progress_percent
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-#ifdef CONFIG_NXBOOT_PROGRESS
-void nxboot_progress(int type, ...)
-{
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS
- va_list arg;
-
- va_start(arg, type);
-
- switch (type)
- {
- case nxboot_info:
- {
- int idx = va_arg(arg, int);
- assert(progress_msgs[idx]);
- if (strlen(progress_msgs[idx]) == 0)
- {
- syslog(LOG_ERR, "No progress message for idx: %d\n", idx);
- break;
- }
-
- dprintf(STDOUT_FILENO, "%s\n", progress_msgs[idx]);
- }
- break;
- case nxboot_error:
- {
- int idx = va_arg(arg, int);
- assert(progress_msgs[idx]);
- if (strlen(progress_msgs[idx]) == 0)
- {
- syslog(LOG_ERR, "No progress message for idx: %d\n", idx);
- break;
- }
-
- dprintf(STDOUT_FILENO, "ERROR: %s\n", progress_msgs[idx]);
- }
- break;
- case nxboot_progress_start:
- {
- int idx = va_arg(arg, int);
- assert(progress_msgs[idx]);
- if (strlen(progress_msgs[idx]) == 0)
- {
- syslog(LOG_ERR, "No progress message for idx: %d\n", idx);
- break;
- }
-
- dprintf(STDOUT_FILENO, "%s", progress_msgs[idx]);
- g_progress_started = true;
- }
- break;
- case nxboot_progress_dot:
- {
- assert(g_progress_started);
- if (!g_progress_started)
- {
- syslog(LOG_ERR, "Progress dot requested "
- "but no previous progress start\n");
- }
- else
- {
- dprintf(STDOUT_FILENO, ".");
- }
- }
- break;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- case nxboot_progress_percent:
- {
- assert(g_progress_started);
- if (!g_progress_started)
- {
- syslog(LOG_ERR, "Progress percent requested "
- "but no previous progress start\n");
- }
- else
- {
- int percent = va_arg(arg, int);
- if (!g_progress_percent_started)
- {
- g_progress_percent_started = true;
- dprintf(STDOUT_FILENO, ": ");
- }
- else
- {
- dprintf(STDOUT_FILENO, "%s", backtab);
- }
-
- dprintf(STDOUT_FILENO, "%3d%%", MIN(percent, 100));
- }
- }
- break;
-#endif
- case nxboot_progress_end:
- {
- assert(g_progress_started);
- if (!g_progress_started)
- {
- syslog(LOG_ERR, "Progress dot stop requested "
- "but no previous progress start\n");
- }
- else
- {
- dprintf(STDOUT_FILENO, "\n");
- }
-
- g_progress_started = false;
-#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS_PERCENT
- g_progress_percent_started = false;
-#endif
- }
- break;
- default:
- {
- assert(false);
- syslog(LOG_ERR, "Invalid progress message type: %d\n", type);
- dprintf(STDOUT_FILENO, "progress: unknown type!\n");
- }
- break;
- }
-
- va_end(arg);
-#endif /* CONFIG_NXBOOT_PRINTF_PROGRESS */
-}
-#endif
-
-/****************************************************************************
- * Name: nxboot_main
- *
- * Description:
- * NuttX bootloader entry point.
- *
- ****************************************************************************/
-
-int main(int argc, FAR char *argv[])
-{
- int ret;
- struct boardioc_boot_info_s info;
- bool check_only;
-#ifdef CONFIG_NXBOOT_SWRESET_ONLY
- FAR struct boardioc_reset_cause_s cause;
-#endif
-
-#ifdef CONFIG_BOARDCTL_FINALINIT
- /* Perform architecture-specific final-initialization (if configured) */
-
- boardctl(BOARDIOC_FINALINIT, 0);
-#endif
-
- syslog(LOG_INFO, "*** nxboot ***\n");
- nxboot_progress(nxboot_info, startup_msg);
-
-#ifdef CONFIG_NXBOOT_SWRESET_ONLY
- check_only = true;
- ret = boardctl(BOARDIOC_RESET_CAUSE, (uintptr_t)&cause);
- if (ret >= 0)
- {
- if (cause.cause == BOARDIOC_RESETCAUSE_CPU_SOFT ||
- cause.cause == BOARDIOC_RESETCAUSE_CPU_RWDT ||
- cause.cause == BOARDIOC_RESETCAUSE_PIN)
- {
- check_only = false;
- nxboot_progress(nxboot_info, soft_reset);
- }
- else
- {
- syslog(LOG_INFO, "Power reset detected, performing check only.\n");
- nxboot_progress(nxboot_info, power_reset);
- }
- }
-#else
- check_only = false;
-#endif
-
- if (nxboot_perform_update(check_only) < 0)
- {
- syslog(LOG_ERR, "Could not find bootable image.\n");
- nxboot_progress(nxboot_error, no_bootable_image);
- return OK;
- }
-
- syslog(LOG_INFO, "Found bootable image, boot from primary.\n");
- nxboot_progress(nxboot_info, found_bootable_image);
-
-#ifdef CONFIG_NXBOOT_COPY_TO_RAM
- syslog(LOG_INFO, "Copying image to RAM.\n");
- nxboot_ramcopy();
-#endif
-
- /* Call board specific image boot */
-
- info.path = CONFIG_NXBOOT_PRIMARY_SLOT_PATH;
- info.header_size = CONFIG_NXBOOT_HEADER_SIZE;
-
- ret = boardctl(BOARDIOC_BOOT_IMAGE, (uintptr_t)&info);
-
- /* Only get here if the board boot fails */
-
- nxboot_progress(nxboot_error, boardioc_image_boot_fail);
-
- return ret;
-}
diff --git a/boot/nxboot/tools/nximage.py b/boot/nxboot/tools/nximage.py
deleted file mode 100644
index 6795b4b99..000000000
--- a/boot/nxboot/tools/nximage.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/env python3
-############################################################################
-# apps/boot/nxboot/tools/nximage.py
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-############################################################################
-"""Python script that prepares the NuttX image to be used with NX bootloader"""
-
-import argparse
-import io
-import os
-import struct
-import zlib
-
-import semantic_version
-
-
-class NxImage:
- def __init__(
- self,
- path: str,
- result: str,
- version: str,
- header_size: int,
- identifier: int,
- ) -> None:
- self.path = path
- self.result = result
- self.size = os.stat(path).st_size
- self.version = semantic_version.Version(version)
- self.header_size = header_size
- self.identifier = identifier
- self.crc = 0
- self.extd_hdr_ptr = 0
-
- def __repr__(self) -> str:
- repr = (
- ""
- )
- return repr
-
- def add_header(self) -> None:
- with open(self.path, "r+b") as src, open(self.result, "w+b") as dest:
- dest.write(b"\x4e\x58\x4f\x53")
- dest.write(struct.pack(" argparse.Namespace:
- """Parse passed arguments and return result."""
- parser = argparse.ArgumentParser(description="Tool for Nuttx Bootloader")
- parser.add_argument(
- "--version",
- default="0.0.0",
- help="Image version according to Semantic Versioning 2.0.0.",
- )
- parser.add_argument(
- "--header_size",
- type=lambda x: int(x, 0),
- default=0x200,
- help="Size of the image header.",
- )
- parser.add_argument(
- "--identifier",
- type=lambda x: int(x, 0),
- default=0x0,
- help="Platform identifier. An image is rejected if its identifier doesn't match the one set in bootloader.",
- )
- parser.add_argument(
- "-v",
- action="store_true",
- help="Verbose output. This prints information about the created image.",
- )
- parser.add_argument(
- "PATH",
- default="nuttx.bin",
- help="Path to the NuttX image.",
- )
- parser.add_argument(
- "RESULT",
- default="nuttx.img",
- help="Path where the resulting NuttX image is stored.",
- )
- return parser.parse_args()
-
-
-def main() -> None:
- args = parse_args()
- image = NxImage(
- args.PATH,
- args.RESULT,
- args.version,
- args.header_size,
- args.identifier,
- )
- image.add_header()
- if args.v:
- print(image)
-
-
-if __name__ == "__main__":
- main()
diff --git a/boot/nxboot/tools/requirements.txt b/boot/nxboot/tools/requirements.txt
deleted file mode 100644
index 62b4122af..000000000
--- a/boot/nxboot/tools/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-argparse>=1.4.0
-semantic_version>=2.10.0
diff --git a/builtin/CMakeLists.txt b/builtin/CMakeLists.txt
deleted file mode 100644
index 3d8b244e4..000000000
--- a/builtin/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# ##############################################################################
-# apps/builtin/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_BUILTIN)
-
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
- # generate registry
- get_property(nuttx_app_libs GLOBAL PROPERTY NUTTX_APPS_LIBRARIES)
- get_property(only_registers GLOBAL PROPERTY NUTTX_APPS_ONLY_REGISTER)
- list(APPEND nuttx_app_libs ${only_registers})
- set(builtin_list_string)
- set(builtin_proto_string)
- foreach(module ${nuttx_app_libs})
-
- # builtin_list.h Example: { "hello", SCHED_PRIORITY_DEFAULT, 2048,
- # hello_main },
- #
- get_target_property(APP_MAIN ${module} APP_MAIN)
- get_target_property(APP_NAME ${module} APP_NAME)
- get_target_property(APP_PRIORITY ${module} APP_PRIORITY)
- get_target_property(APP_STACK ${module} APP_STACK)
- set(builtin_list_string
- "${builtin_list_string}\{ \"${APP_NAME}\", ${APP_PRIORITY}, ${APP_STACK}, ${APP_MAIN} \}, \n"
- )
-
- # builtin_proto.h Example: int hello_main(int argc, char *argv[]);
- set(builtin_proto_string
- "${builtin_proto_string}int ${APP_MAIN}(int argc, char *argv[]);\n")
-
- endforeach()
-
- configure_file(builtin_proto.h.in builtin_proto.h)
- configure_file(builtin_list.h.in builtin_list.h)
-
- set(CSRCS)
-
- list(APPEND CSRCS builtin_list.c exec_builtin.c builtin_list.h
- builtin_proto.h)
-
- # target_sources(apps PRIVATE ${CSRCS})
- nuttx_add_library(apps_builtin ${CSRCS})
-
-endif()
diff --git a/builtin/Make.defs b/builtin/Make.defs
index 47d1bf960..b41625c1c 100644
--- a/builtin/Make.defs
+++ b/builtin/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/builtin/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -20,6 +18,6 @@
#
############################################################################
-ifneq ($(CONFIG_BUILTIN),)
+ifeq ($(CONFIG_BUILTIN),y)
CONFIGURED_APPS += $(APPDIR)/builtin
endif
diff --git a/builtin/Makefile b/builtin/Makefile
index a5de31f6c..eaefd7748 100644
--- a/builtin/Makefile
+++ b/builtin/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/builtin/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -30,30 +28,18 @@ CSRCS = builtin_list.c exec_builtin.c
PDATLIST = $(strip $(call RWILDCARD, registry, *.pdat))
BDATLIST = $(strip $(call RWILDCARD, registry, *.bdat))
-ifeq ($(CONFIG_WINDOWS_NATIVE),y)
- PDATLIST := $(subst /,\,$(PDATLIST))
- BDATLIST := $(subst /,\,$(BDATLIST))
-endif
builtin_list.c: builtin_list.h builtin_proto.h
registry$(DELIM).updated:
$(Q) touch registry$(DELIM).updated
-define CONFILE
- if [ -n "$(strip $(2))" ]; then cat $(2) >> $1; fi
-endef
-
builtin_list.h: registry$(DELIM).updated
ifeq ($(BDATLIST),)
$(call DELFILE, builtin_list.h)
$(Q) touch builtin_list.h
else
- $(shell echo '' > builtin_list.h)
- $(call SPLITVARIABLE,BDA,$(BDATLIST),50) \
- $(foreach BATCH, $(BDA_TOTAL), \
- $(shell $(call CONFILE, builtin_list.h, $(BDA_$(BATCH)))) \
- )
+ $(call CATFILE, builtin_list.h, $(BDATLIST))
endif
builtin_proto.h: registry$(DELIM).updated
@@ -61,11 +47,7 @@ ifeq ($(PDATLIST),)
$(call DELFILE, builtin_proto.h)
$(Q) touch builtin_proto.h
else
- $(shell echo '' > builtin_proto.h)
- $(call SPLITVARIABLE,PDA,$(PDATLIST),50) \
- $(foreach BATCH, $(PDA_TOTAL), \
- $(shell $(call CONFILE, builtin_proto.h, $(PDA_$(BATCH)))) \
- )
+ $(call CATFILE, builtin_proto.h, $(PDATLIST))
endif
depend:: builtin_list.h builtin_proto.h
diff --git a/builtin/builtin_list.c b/builtin/builtin_list.c
index 9605b097c..d7a7d02d2 100644
--- a/builtin/builtin_list.c
+++ b/builtin/builtin_list.c
@@ -1,8 +1,6 @@
/****************************************************************************
* apps/builtin/builtin_list.c
*
- * SPDX-License-Identifier: Apache-2.0
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
@@ -27,11 +25,6 @@
#include
#include
-#include
-
-#include
-
-#include "builtin_proto.h"
/****************************************************************************
* Private Types
@@ -45,17 +38,15 @@
* Public Data
****************************************************************************/
+#include "builtin_proto.h"
+
const struct builtin_s g_builtins[] =
{
-# include "builtin_list.h"
-#ifdef CONFIG_SCHED_USER_IDENTITY
- { NULL, 0, 0, 0, 0, 0, 0 }
-#else
+# include "builtin_list.h"
{ NULL, 0, 0, 0 }
-#endif
};
-const int g_builtin_count = nitems(g_builtins);
+const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);
/****************************************************************************
* Private Data
diff --git a/builtin/builtin_list.h.in b/builtin/builtin_list.h.in
deleted file mode 100644
index b81626aa6..000000000
--- a/builtin/builtin_list.h.in
+++ /dev/null
@@ -1 +0,0 @@
-${builtin_list_string}
diff --git a/builtin/builtin_proto.h.in b/builtin/builtin_proto.h.in
deleted file mode 100644
index abb9dcee1..000000000
--- a/builtin/builtin_proto.h.in
+++ /dev/null
@@ -1 +0,0 @@
-${builtin_proto_string}
diff --git a/builtin/exec_builtin.c b/builtin/exec_builtin.c
index b87133243..1cacdd4ad 100644
--- a/builtin/exec_builtin.c
+++ b/builtin/exec_builtin.c
@@ -1,8 +1,6 @@
/****************************************************************************
* apps/builtin/exec_builtin.c
*
- * SPDX-License-Identifier: Apache-2.0
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
@@ -29,7 +27,7 @@
#include
#include
#include
-#include
+#include
#include "builtin/builtin.h"
@@ -45,9 +43,13 @@
* New application is run in a separate task context (and thread).
*
* Input Parameter:
- * filename - Name of the linked-in binary to be started.
- * argv - Argument list
- * param - Parameters for execute.
+ * filename - Name of the linked-in binary to be started.
+ * argv - Argument list
+ * redirfile - If output is redirected, this parameter will be non-NULL
+ * and will provide the full path to the file.
+ * oflags - If output is redirected, this parameter will provide the
+ * open flags to use. This will support file replacement
+ * of appending to an existing file.
*
* Returned Value:
* This is an end-user function, so it follows the normal convention:
@@ -57,12 +59,12 @@
****************************************************************************/
int exec_builtin(FAR const char *appname, FAR char * const *argv,
- FAR const struct nsh_param_s *param)
+ FAR const char *redirfile, int oflags)
{
FAR const struct builtin_s *builtin;
posix_spawnattr_t attr;
posix_spawn_file_actions_t file_actions;
- struct sched_param sched;
+ struct sched_param param;
pid_t pid;
int index;
int ret;
@@ -101,14 +103,14 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
/* Set the correct task size and priority */
- sched.sched_priority = builtin->priority;
- ret = posix_spawnattr_setschedparam(&attr, &sched);
+ param.sched_priority = builtin->priority;
+ ret = posix_spawnattr_setschedparam(&attr, ¶m);
if (ret != 0)
{
goto errout_with_actions;
}
- ret = posix_spawnattr_setstacksize(&attr, builtin->stacksize);
+ ret = task_spawnattr_setstacksize(&attr, builtin->stacksize);
if (ret != 0)
{
goto errout_with_actions;
@@ -142,67 +144,19 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
#endif
- if (param)
+ /* Is output being redirected? */
+
+ if (redirfile)
{
- /* Is input being redirected? */
+ /* Set up to close open redirfile and set to stdout (1) */
- if (param->file_in)
+ ret = posix_spawn_file_actions_addopen(&file_actions, 1,
+ redirfile, oflags, 0644);
+ if (ret != 0)
{
- /* Set up to close open redirfile and set to stdin (0) */
-
- ret = posix_spawn_file_actions_addopen(&file_actions, 0,
- param->file_in,
- param->oflags_in, 0);
- if (ret != 0)
- {
- serr("ERROR: posix_spawn_file_actions_addopen failed: %d\n",
- ret);
- goto errout_with_actions;
- }
+ serr("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret);
+ goto errout_with_actions;
}
-#ifdef CONFIG_NSH_PIPELINE
- else if (param->fd_in != -1)
- {
- ret = posix_spawn_file_actions_adddup2(&file_actions,
- param->fd_in, 0);
- if (ret != 0)
- {
- serr("ERROR: posix_spawn_file_actions_adddup2 failed: %d\n",
- ret);
- goto errout_with_actions;
- }
- }
-#endif
-
- /* Is output being redirected? */
-
- if (param->file_out)
- {
- /* Set up to close open redirfile and set to stdout (1) */
-
- ret = posix_spawn_file_actions_addopen(&file_actions, 1,
- param->file_out,
- param->oflags_out, 0644);
- if (ret != 0)
- {
- serr("ERROR: posix_spawn_file_actions_addopen failed: %d\n",
- ret);
- goto errout_with_actions;
- }
- }
-#ifdef CONFIG_NSH_PIPELINE
- else if (param->fd_out != -1)
- {
- ret = posix_spawn_file_actions_adddup2(&file_actions,
- param->fd_out, 1);
- if (ret != 0)
- {
- serr("ERROR: posix_spawn_file_actions_adddup2 failed: %d\n",
- ret);
- goto errout_with_actions;
- }
- }
-#endif
}
#ifdef CONFIG_LIBC_EXECFUNCS
@@ -215,7 +169,8 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
/* Start the built-in */
pid = task_spawn(builtin->name, builtin->main, &file_actions,
- &attr, argv ? &argv[1] : NULL, NULL);
+ &attr, (argv) ? &argv[1] : (FAR char * const *)NULL,
+ (FAR char * const *)NULL);
ret = pid < 0 ? -pid : 0;
}
diff --git a/canutils/CMakeLists.txt b/canutils/CMakeLists.txt
deleted file mode 100644
index aa4a02ed9..000000000
--- a/canutils/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# ##############################################################################
-# apps/canutils/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-nuttx_add_subdirectory()
-
-nuttx_generate_kconfig(MENUDESC "CAN Utilities")
diff --git a/canutils/Make.defs b/canutils/Make.defs
index b68638da8..77a6c4d3a 100644
--- a/canutils/Make.defs
+++ b/canutils/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/canutils/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
diff --git a/canutils/Makefile b/canutils/Makefile
index 68a1d93b2..d8d9f1ddd 100644
--- a/canutils/Makefile
+++ b/canutils/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/canutils/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
diff --git a/canutils/candump/CMakeLists.txt b/canutils/candump/CMakeLists.txt
deleted file mode 100644
index be4f27f0b..000000000
--- a/canutils/candump/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# ##############################################################################
-# apps/canutils/candump/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-
-if(CONFIG_CANUTILS_CANDUMP)
-
- set(LIBCANUTILS_DIR ${NUTTX_APPS_DIR}/canutils/libcanutils)
-
- nuttx_add_application(
- NAME
- candump
- STACKSIZE
- ${CONFIG_CANUTILS_CANDUMP_STACKSIZE}
- MODULE
- ${CONFIG_CANUTILS_CANDUMP}
- SRCS
- candump.c
- INCLUDE_DIRECTORIES
- ${LIBCANUTILS_DIR})
-
-endif()
diff --git a/canutils/candump/Kconfig b/canutils/candump/Kconfig
index 45a46118b..eaf41db5b 100644
--- a/canutils/candump/Kconfig
+++ b/canutils/candump/Kconfig
@@ -6,7 +6,8 @@
config CANUTILS_CANDUMP
tristate "SocketCAN candump tool"
default n
- depends on NET_CAN && CANUTILS_LIBCANUTILS && ENABLE_ALL_SIGNALS
+ depends on NET_CAN
+ select CANUTILS_LIBCANUTILS
---help---
Enable the SocketCAN candump tool ported from
https://github.com/linux-can/can-utils
diff --git a/canutils/candump/Make.defs b/canutils/candump/Make.defs
index d781a87b5..bf15862fe 100644
--- a/canutils/candump/Make.defs
+++ b/canutils/candump/Make.defs
@@ -1,7 +1,6 @@
############################################################################
# apps/canutils/candump/Make.defs
-#
-# SPDX-License-Identifier: Apache-2.0
+# Adds selected applications to apps/ build
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
diff --git a/canutils/candump/Makefile b/canutils/candump/Makefile
index d8861496f..869cbced4 100644
--- a/canutils/candump/Makefile
+++ b/canutils/candump/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/canutils/candump/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -30,7 +28,7 @@ PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = $(CONFIG_CANUTILS_CANDUMP_STACKSIZE)
MODULE = $(CONFIG_CANUTILS_CANDUMP)
-CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/canutils/libcanutils
+CFLAGS += ${shell $(INCDIR) "$(CC)" $(APPDIR)/canutils/libcanutils}
MAINSRC = candump.c
include $(APPDIR)/Application.mk
diff --git a/canutils/candump/candump.c b/canutils/candump/candump.c
index 58958a46f..7b3074cc3 100644
--- a/canutils/candump/candump.c
+++ b/canutils/candump/candump.c
@@ -1,8 +1,9 @@
-/****************************************************************************
- * apps/canutils/candump/candump.c
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
+/*
+ * candump.c
*
- * SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
- * SPDX-FileCopyrightText: 2002-2007 Volkswagen Group Electronic Research
+ * Copyright (c) 2002-2009 Volkswagen Group Electronic Research
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,11 +40,7 @@
*
* Send feedback to
*
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
+ */
#include
#include
@@ -65,14 +62,11 @@
#include
#include
+#include
#include "terminal.h"
#include "lib.h"
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
/* for hardware timestamps - since Linux 2.6.30 */
#ifndef SO_TIMESTAMPING
#define SO_TIMESTAMPING 37
@@ -105,10 +99,7 @@
const char col_on [MAXCOL][19] = {BLUE, RED, GREEN, BOLD, MAGENTA, CYAN};
const char col_off [] = ATTRESET;
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
+static char *cmdlinename[MAXSOCK];
static __u32 dropcnt[MAXSOCK];
static __u32 last_dropcnt[MAXSOCK];
static char devname[MAXIFNAMES][IFNAMSIZ+1];
@@ -212,7 +203,7 @@ int idx2dindex(int ifidx, int socket) {
if (max_devname_len < (int)strlen(ifr.ifr_name))
max_devname_len = strlen(ifr.ifr_name);
- strlcpy(devname[i], ifr.ifr_name, sizeof(devname[i]));
+ strcpy(devname[i], ifr.ifr_name);
#ifdef DEBUG
printf("new index %d (%s)\n", i, devname[i]);
@@ -238,7 +229,7 @@ int main(int argc, char **argv)
unsigned char logfrmt = 0;
int count = 0;
int rcvbuf_size = 0;
- int opt;
+ int opt, ret;
int currmax, numfilter;
int join_filter;
char *ptr, *nptr;
@@ -403,6 +394,8 @@ int main(int argc, char **argv)
return 1;
}
+ cmdlinename[i] = ptr; /* save pointer to cmdline name of this socket */
+
if (nptr)
nbytes = nptr - ptr; /* interface name is up the first ',' */
else
@@ -625,7 +618,7 @@ int main(int argc, char **argv)
if (timeout_current)
*timeout_current = timeout_config;
- if ((select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
+ if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
//perror("select");
running = 0;
continue;
diff --git a/canutils/canlib/CMakeLists.txt b/canutils/canlib/CMakeLists.txt
deleted file mode 100644
index 9f8af63e1..000000000
--- a/canutils/canlib/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-# ##############################################################################
-# apps/canutils/canlib/CMakeLists.txt
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more contributor
-# license agreements. See the NOTICE file distributed with this work for
-# additional information regarding copyright ownership. The ASF licenses this
-# file to you under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-#
-# ##############################################################################
-if(CONFIG_CANUTILS_CANLIB)
-
- target_sources(
- apps PRIVATE canlib_getbaud.c canlib_setbaud.c canlib_getloopback.c
- canlib_setloopback.c canlib_getsilent.c canlib_setsilent.c)
-
-endif()
diff --git a/canutils/canlib/Make.defs b/canutils/canlib/Make.defs
index 61e591c18..48c1437b3 100644
--- a/canutils/canlib/Make.defs
+++ b/canutils/canlib/Make.defs
@@ -1,8 +1,6 @@
############################################################################
# apps/canutils/canlib/Make.defs
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
@@ -20,6 +18,6 @@
#
############################################################################
-ifneq ($(CONFIG_CANUTILS_CANLIB),)
+ifeq ($(CONFIG_CANUTILS_CANLIB),y)
CONFIGURED_APPS += $(APPDIR)/canutils/canlib
endif
diff --git a/canutils/canlib/Makefile b/canutils/canlib/Makefile
index 64ecdb0a3..54fc23f66 100644
--- a/canutils/canlib/Makefile
+++ b/canutils/canlib/Makefile
@@ -1,8 +1,6 @@
############################################################################
# apps/canutils/canlib/Makefile
#
-# SPDX-License-Identifier: Apache-2.0
-#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
diff --git a/canutils/canlib/canlib_getbaud.c b/canutils/canlib/canlib_getbaud.c
index 61ebb4de9..f8e2655c9 100644
--- a/canutils/canlib/canlib_getbaud.c
+++ b/canutils/canlib/canlib_getbaud.c
@@ -1,8 +1,6 @@
/****************************************************************************
* apps/canutils/canlib/canlib_getbaud.c
*
- * SPDX-License-Identifier: Apache-2.0
- *
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
@@ -24,10 +22,15 @@
* Included Files
****************************************************************************/
-#include
-#include
-#include
+#include
+#include
+
+#include