├── .github ├── dependabot.yml └── workflows │ ├── example.yml │ ├── gh-pages.yml │ └── pack.yml ├── .gitignore ├── ARM.CMSIS-Compiler.pdsc ├── LICENSE ├── README.md ├── documentation ├── README.md ├── doxygen │ ├── compiler.dxy.in │ ├── gen_doc.sh │ ├── linkchecker.rc │ ├── src │ │ ├── history.md │ │ ├── images │ │ │ ├── blocks.pptx │ │ │ ├── overview.png │ │ │ ├── retarget_io_file.png │ │ │ ├── retarget_io_std.png │ │ │ └── retarget_low_level_io.png │ │ ├── mainpage.md │ │ ├── ref_retarget_fs.txt │ │ ├── ref_retarget_os.txt │ │ ├── ref_retarget_os_armclib.txt │ │ ├── ref_retarget_os_newlib.txt │ │ ├── ref_retarget_stderr.txt │ │ ├── ref_retarget_stdin.txt │ │ ├── ref_retarget_stdout.txt │ │ ├── ref_retarget_tty.txt │ │ ├── rt_io.md │ │ ├── rt_os.md │ │ ├── templates.md │ │ ├── templates_file.md │ │ ├── templates_os.md │ │ ├── templates_stderr.md │ │ ├── templates_stdin.md │ │ ├── templates_stdout.md │ │ └── templates_tty.md │ └── style_template │ │ ├── cmsis_logo_white_small.png │ │ ├── darkmode_toggle.js │ │ ├── dropdown.png │ │ ├── extra_navtree.css │ │ ├── extra_search.css │ │ ├── extra_stylesheet.css │ │ ├── extra_tabs.css │ │ ├── footer.html │ │ ├── footer.js.in │ │ ├── header.html │ │ ├── layout.xml │ │ ├── navtree.js │ │ ├── resize.js │ │ ├── search.css │ │ ├── tab_b.png │ │ ├── tab_topnav.png │ │ ├── tabs.js │ │ └── version.css ├── index.html └── version.js ├── example ├── README.md ├── RTE │ └── Device │ │ └── CMSDK_CM3_VHT │ │ ├── RTE_Device.h │ │ ├── RTE_Device.h.base@1.0.0 │ │ ├── ac6_arm.sct │ │ ├── ac6_arm.sct.base@1.0.0 │ │ ├── gcc_arm.ld │ │ ├── gcc_arm.ld.base@1.1.0 │ │ ├── regions_CMSDK_CM3_VHT.h │ │ ├── startup_CMSDK_CM3.c │ │ ├── startup_CMSDK_CM3.c.base@1.1.0 │ │ ├── system_CMSDK_CM3.c │ │ └── system_CMSDK_CM3.c.base@1.1.0 ├── build.py ├── cdefault.yml ├── fvp-config.txt ├── main.c ├── requirements.txt ├── retarget.cproject.yml ├── retarget.csolution.yml ├── stdout_USART.c └── vcpkg-configuration.json ├── gen_pack.sh ├── include ├── armcc │ └── retarget_os.h ├── gcc │ └── retarget_os.h ├── retarget_fs.h ├── retarget_stderr.h ├── retarget_stdin.h ├── retarget_stdout.h └── retarget_tty.h ├── source ├── armcc │ ├── retarget_io.c │ └── retarget_os_rtos2.c ├── clang │ └── retarget_syscalls.c ├── gcc │ ├── retarget_lock_rtos2.c │ └── retarget_syscalls.c ├── iar │ ├── retarget_io.c │ └── retarget_os_rtos2.c ├── retarget_fs_bkpt.c ├── stderr_bkpt.c ├── stderr_evr.c ├── stderr_itm.c ├── stdin_bkpt.c ├── stdin_itm.c ├── stdout_bkpt.c ├── stdout_evr.c ├── stdout_itm.c ├── tty_bkpt.c └── tty_itm.c └── template ├── file_interface └── retarget_fs.c ├── os_interface ├── armcc │ └── retarget_os.c └── gcc │ ├── retarget_lock.c │ └── retarget_syscalls.c └── stdio ├── stderr_user.c ├── stdin_user.c ├── stdout_user.c └── tty_user.c /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | open-pull-requests-limit: 10 8 | rebase-strategy: disabled 9 | -------------------------------------------------------------------------------- /.github/workflows/example.yml: -------------------------------------------------------------------------------- 1 | name: Example 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | paths: 6 | - .github/workflows/example.yml 7 | - example/**/* 8 | - include/**/* 9 | - source/**/* 10 | - ARM.CMSIS-Compiler.pdsc 11 | push: 12 | branches: [main] 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.ref }} 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | example: 20 | runs-on: ubuntu-latest 21 | 22 | env: 23 | ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }} 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - uses: actions/setup-python@v5 29 | with: 30 | python-version: '3.10' 31 | cache: 'pip' 32 | 33 | - name: Python requirements 34 | run: | 35 | pip install -r ./example/requirements.txt 36 | 37 | - name: Cache packs 38 | uses: actions/cache@v4 39 | with: 40 | key: packs-${{ github.run_id }} 41 | restore-keys: | 42 | packs- 43 | path: /home/runner/.cache/arm/packs 44 | 45 | - name: Install LLVM dependencies and tools 46 | working-directory: /home/runner 47 | run: | 48 | sudo apt-get update 49 | sudo apt-get install libtinfo5 50 | 51 | - name: Prepare vcpkg env 52 | uses: JonatanAntoni/actions/vcpkg@main 53 | with: 54 | config: ./example/vcpkg-configuration.json 55 | 56 | - name: Install required packs 57 | run: | 58 | cpackget add ARM.CMSIS-Compiler.pdsc 59 | curl -LO https://github.com/ARM-software/CMSIS_6/releases/download/dev%2Fv6.0.0-dev53/packlist.txt 60 | cpackget add -a -f packlist.txt 61 | 62 | - name: Activate Arm tool license 63 | run: | 64 | if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then 65 | armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }} 66 | else 67 | armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0 68 | fi 69 | 70 | - uses: ammaraskar/gcc-problem-matcher@master 71 | 72 | - name: Initialize CodeQL 73 | uses: github/codeql-action/init@v3 74 | with: 75 | languages: cpp 76 | queries: security-and-quality 77 | 78 | - name: Build and run example 79 | working-directory: ./example 80 | run: | 81 | build_steps=(build) 82 | if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then 83 | build_steps+=(run) 84 | fi 85 | ./build.py --verbose -c AC6 -c GCC -c Clang clean ${build_steps[@]} 86 | 87 | - name: Perform CodeQL Analysis 88 | if: ${{ !cancelled() }} 89 | uses: github/codeql-action/analyze@v3 90 | 91 | - name: Deactivate Arm tool license 92 | if: always() 93 | run: | 94 | if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then 95 | armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }} 96 | else 97 | armlm deactivate --product KEMDK-COM0 98 | fi -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy static content to GitHub Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: [gh-pages] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: false 23 | 24 | jobs: 25 | # Single deploy job since we're just deploying 26 | deploy: 27 | environment: 28 | name: github-pages 29 | url: ${{ steps.deployment.outputs.page_url }} 30 | runs-on: ubuntu-latest 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v4 34 | 35 | - name: Setup Pages 36 | uses: actions/configure-pages@v5 37 | 38 | - name: Upload artifact 39 | uses: actions/upload-pages-artifact@v3 40 | with: 41 | # Upload entire repository 42 | path: '.' 43 | 44 | - name: Deploy to GitHub Pages 45 | id: deployment 46 | uses: actions/deploy-pages@v4 47 | -------------------------------------------------------------------------------- /.github/workflows/pack.yml: -------------------------------------------------------------------------------- 1 | name: Build documentation and pack 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | push: 6 | branches: [main] 7 | release: 8 | types: [published] 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | pack: 16 | name: Generate pack 17 | runs-on: ubuntu-22.04 18 | steps: 19 | - uses: actions/checkout@v4 20 | with: 21 | fetch-depth: 0 22 | 23 | - name: Fetch tags 24 | if: github.event_name == 'release' 25 | run: | 26 | git fetch --tags --force 27 | 28 | - uses: Open-CMSIS-Pack/gen-pack-action@main 29 | with: 30 | doxygen-version: 1.9.6 31 | packchk-version: 1.4.1 32 | gen-doc-script: ./documentation/doxygen/gen_doc.sh 33 | doc-path: ./documentation/html 34 | gen-pack-script: ./gen_pack.sh --no-preprocess 35 | gen-pack-output: ./output 36 | gh-pages-branch: gh-pages 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | documentation/html 2 | documentation/doxygen/compiler.dxy 3 | output 4 | build 5 | 6 | example/out 7 | example/tmp 8 | example/RTE/_**/* 9 | 10 | *.cbuild-idx.yml 11 | *.cbuild.yml 12 | *.cprj 13 | .clangd 14 | linkchecker-out.csv 15 | 16 | # Output of the go coverage tool 17 | *.out 18 | 19 | *.bak 20 | *.syso 21 | *.log 22 | documentation/doxygen/src/history.txt 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CMSIS-Compiler Support 2 | 3 | ## About 4 | 5 | **CMSIS-Compiler** software components allow embedded software developers to retarget standard I/O streams and 6 | file operations to specific platform and enable thread safe operations using RTOS interface. 7 | 8 | [CMSIS-Compiler documentation](https://arm-software.github.io/CMSIS-Compiler) explains available functionality and APIs. 9 | 10 | > **Note** 11 | > - CMSIS-Compiler replaces and extends retargeting functionality previously provided as part of *Keil::ARM_Compiler* pack. 12 | > - See [Migrating projects from CMSIS v5 to CMSIS v6](https://learn.arm.com/learning-paths/microcontrollers/project-migration-cmsis-v6) for a guidance on updating existing projects to CMSIS-Compiler. 13 | 14 | ## Repository top level structure 15 | 16 | ```txt 17 | 📦 18 | ┣ 📂 .github GitHub Action workflow and configuration 19 | ┣ 📂 documentation Documentation directory 20 | ┣ 📂 example Usage examples 21 | ┣ 📂 include Include header files of software components 22 | ┣ 📂 source Source code of software components 23 | ┗ 📂 template User code templates 24 | ``` 25 | 26 | ## Generating Software Pack 27 | 28 | Some helper scripts are provided to generate the release artifacts from this repository. 29 | 30 | ### Doxygen Documentation 31 | 32 | Generating the HTML-formatted documentation from its Doxygen-based source is done via 33 | 34 | ```sh 35 | CMSIS-Compiler $ ./documentation/doxygen/gen_doc.sh 36 | ``` 37 | 38 | Prerequisites for this script to succeed are: 39 | 40 | - Doxygen 1.9.6 41 | 42 | Also see [Documentation README](./documentation/README.md). 43 | 44 | ### CMSIS-Pack Bundle 45 | 46 | The CMSIS-Pack bundle can be generated with 47 | 48 | ```sh 49 | CMSIS-Compiler $ ./gen_pack.sh 50 | ``` 51 | 52 | Prerequisites for this script to succeed are: 53 | 54 | - Generated documentation (see above) 55 | - 7z (or GNU zip) 56 | - packchk 57 | - xmllint (optional) 58 | 59 | ### Version and Changelog Inference 60 | 61 | The version and changelog embedded into the documentation and pack are inferred from the 62 | local Git history. In order to get the full changelog one needs to have a full clone (not 63 | a shallow one) including all release tags. 64 | 65 | The version numbers and change logs are taken from the available annotated tags. 66 | 67 | ### Release Pack 68 | 69 | A release is simply done via the GitHub Web UI. The newly created tag needs to have 70 | the pattern `v` where `` shall be the SemVer `..` 71 | version string for the release. The release description is used as the change log 72 | message for the release. 73 | 74 | When using an auto-generated tag (via Web UI) the release description is used as the 75 | annotation message for the generated tag. Alternatively, one can prepare the release 76 | tag in the local clone and add the annotation message independently from creating the 77 | release. 78 | 79 | Once the release is published via the GitHub Web UI the release workflow generates the 80 | documentation and the pack (see above) and attaches the resulting pack archive as an 81 | additional asset to the release. 82 | 83 | ## License Terms 84 | 85 | CMSIS-Compiler is licensed under [Apache License 2.0](LICENSE). 86 | 87 | ### Note 88 | 89 | Individual files contain the following tag instead of the full license text. 90 | 91 | SPDX-License-Identifier: Apache-2.0 92 | 93 | This enables machine processing of license information based on the SPDX License Identifiers that are here available: http://spdx.org/licenses/ 94 | 95 | ## Contributions and Pull Requests 96 | 97 | Contributions are accepted under Apache 2.0. Only submit contributions where you have authored all of the code. 98 | 99 | ### Issues, Labels 100 | 101 | Please feel free to raise an issue on GitHub 102 | to report misbehavior (i.e. bugs) 103 | 104 | Issues are your best way to interact directly with the maintenance team and the community. 105 | We encourage you to append implementation suggestions as this helps to decrease the 106 | workload of the very limited maintenance team. 107 | 108 | We shall be monitoring and responding to issues as best we can. 109 | Please attempt to avoid filing duplicates of open or closed items when possible. 110 | In the spirit of openness we shall be tagging issues with the following: 111 | 112 | - **bug** – We consider this issue to be a bug that shall be investigated. 113 | 114 | - **wontfix** - We appreciate this issue but decided not to change the current behavior. 115 | 116 | - **out-of-scope** - We consider this issue loosely related to CMSIS. It might be implemented outside of CMSIS. Let us know about your work. 117 | 118 | - **question** – We have further questions about this issue. Please review and provide feedback. 119 | 120 | - **documentation** - This issue is a documentation flaw that shall be improved in the future. 121 | 122 | - **DONE** - We consider this issue as resolved - please review and close it. In case of no further activity, these issues shall be closed after a week. 123 | 124 | - **duplicate** - This issue is already addressed elsewhere, see a comment with provided references. 125 | -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | # CMSIS-Compiler Documentation 2 | 3 | CMSIS-Compiler documentation in HTML format is published online at [https://arm-software.github.io/CMSIS-Compiler](https://arm-software.github.io/CMSIS-Compiler). 4 | 5 | The version drop-down menu allows to switch between the documentation provided with official releases and the latest draft documentation for the main branch. 6 | 7 | The documentation source is maintained in `/documentation/doxygen/` folder as a mixture of markdown and doxygen formats. Software source and header files, templates and examples may also contribute information that gets integrated into the final documentation. 8 | 9 | Generating the HTML-formatted documentation from the source is done with `gen_doc.sh` script: 10 | 11 | ```sh 12 | CMSIS-Compiler $ ./documentation/doxygen/gen_doc.sh 13 | ``` 14 | 15 | The script expects specific version of [doxygen](https://www.doxygen.nl/) to be installed locally. After successful execution the resulting documentation package is then available in `./documentation/html/`. 16 | -------------------------------------------------------------------------------- /documentation/doxygen/gen_doc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Version: 3.0 3 | # Date: 2023-11-06 4 | # This bash script generates CMSIS-Compiler documentation 5 | # 6 | # Pre-requisites: 7 | # - bash shell (for Windows: install git for Windows) 8 | # - doxygen 1.9.6 9 | # - linkchecker (can be skipped with -s) 10 | 11 | set -o pipefail 12 | 13 | # Set version of gen pack library 14 | # For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags. 15 | # Use the tag name without the prefix "v", e.g., 0.7.0 16 | REQUIRED_GEN_PACK_LIB="0.11.1" 17 | 18 | DIRNAME=$(dirname "$(readlink -f "$0")") 19 | GENDIR=../html 20 | REQ_DXY_VERSION="1.9.6" 21 | 22 | RUN_LINKCHECKER=1 23 | COMPONENTS=() 24 | 25 | function usage() { 26 | echo "Usage: $(basename "$0") [-h] [-s] [-c ]" 27 | echo " -h,--help Show usage" 28 | echo " -s,--no-linkcheck Skip linkcheck" 29 | echo " -c,--component Select component to generate documentation for. " 30 | echo " Can be given multiple times. Defaults to all components." 31 | } 32 | 33 | while [[ $# -gt 0 ]]; do 34 | case $1 in 35 | '-h'|'help') 36 | usage 37 | exit 1 38 | ;; 39 | '-s'|'--no-linkcheck') 40 | RUN_LINKCHECKER=0 41 | ;; 42 | '-c'|'--component') 43 | shift 44 | COMPONENTS+=("$1") 45 | ;; 46 | *) 47 | echo "Invalid command line argument: $1" >&2 48 | usage 49 | exit 1 50 | ;; 51 | esac 52 | shift # past argument 53 | done 54 | 55 | ############ DO NOT EDIT BELOW ########### 56 | 57 | # Set GEN_PACK_LIB_PATH to use a specific gen-pack library root 58 | # ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB 59 | if [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then 60 | . "${GEN_PACK_LIB_PATH}/gen-pack" 61 | else 62 | . <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap") 63 | fi 64 | 65 | find_git 66 | find_doxygen "${REQ_DXY_VERSION}" 67 | [[ ${RUN_LINKCHECKER} != 0 ]] && find_linkchecker 68 | 69 | if [ -z "${VERSION_FULL}" ]; then 70 | VERSION_FULL=$(git_describe "v") 71 | fi 72 | 73 | pushd "${DIRNAME}" > /dev/null 74 | 75 | echo "Generating documentation ..." 76 | 77 | projectName=$(grep -E "PROJECT_NAME\s+=" compiler.dxy.in | sed -r -e 's/[^"]*"([^"]+)".*/\1/') 78 | projectNumberFull="${VERSION_FULL}" 79 | projectNumber="${projectNumberFull%+*}" 80 | datetime=$(date -u +'%a %b %e %Y %H:%M:%S') 81 | year=$(date -u +'%Y') 82 | 83 | sed -e "s/{projectNumber}/${projectNumber}/" compiler.dxy.in > compiler.dxy 84 | 85 | git_changelog -f html -p "v" > src/history.txt 86 | 87 | echo "\"${UTILITY_DOXYGEN}\" compiler.dxy" 88 | "${UTILITY_DOXYGEN}" compiler.dxy 89 | 90 | mkdir -p "${DIRNAME}/${GENDIR}/search/" 91 | cp -f "${DIRNAME}/style_template/search.css" "${DIRNAME}/${GENDIR}/search/" 92 | cp -f "${DIRNAME}/style_template/navtree.js" "${DIRNAME}/${GENDIR}/" 93 | cp -f "${DIRNAME}/style_template/resize.js" "${DIRNAME}/${GENDIR}/" 94 | 95 | sed -e "s/{datetime}/${datetime}/" "${DIRNAME}/style_template/footer.js.in" \ 96 | | sed -e "s/{year}/${year}/" \ 97 | | sed -e "s/{projectName}/${projectName}/" \ 98 | | sed -e "s/{projectNumber}/${projectNumber}/" \ 99 | | sed -e "s/{projectNumberFull}/${projectNumberFull}/" \ 100 | > "${DIRNAME}/${GENDIR}/footer.js" 101 | 102 | popd > /dev/null 103 | 104 | [[ ${RUN_LINKCHECKER} != 0 ]] && check_links "${DIRNAME}/../html/index.html" "${DIRNAME}" 105 | 106 | 107 | exit 0 108 | -------------------------------------------------------------------------------- /documentation/doxygen/linkchecker.rc: -------------------------------------------------------------------------------- 1 | [output] 2 | ignoreerrors= 3 | mag.svg 4 | mag_sel.svg 5 | mag_d.svg 6 | mag_seld.svg 7 | ../tab_a.png 8 | ../tab_ad.png 9 | 10 | [filtering] 11 | ignorewarnings= 12 | http-redirected -------------------------------------------------------------------------------- /documentation/doxygen/src/history.md: -------------------------------------------------------------------------------- 1 | # Revision History {#rev_hist} 2 | 3 | CMSIS-Compiler version is offically updated upon releases of the [CMSIS-Compiler pack](https://www.keil.arm.com/packs/cmsis-compiler-arm/versions/). 4 | 5 | The table below provides information about the changes delivered with specific versions of CMSIS-Compiler. 6 | -------------------------------------------------------------------------------- /documentation/doxygen/src/images/blocks.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/src/images/blocks.pptx -------------------------------------------------------------------------------- /documentation/doxygen/src/images/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/src/images/overview.png -------------------------------------------------------------------------------- /documentation/doxygen/src/images/retarget_io_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/src/images/retarget_io_file.png -------------------------------------------------------------------------------- /documentation/doxygen/src/images/retarget_io_std.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/src/images/retarget_io_std.png -------------------------------------------------------------------------------- /documentation/doxygen/src/images/retarget_low_level_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/src/images/retarget_low_level_io.png -------------------------------------------------------------------------------- /documentation/doxygen/src/mainpage.md: -------------------------------------------------------------------------------- 1 | # Overview {#mainpage} 2 | 3 | **CMSIS-Compiler** provides software components that simplify retargeting of standard C run-time library functions. 4 | 5 | Application code frequently uses standard C library functions, such as `fopen`, `fwrite`, `printf()`, `scanf()` and others to perform input/output operations. These functions may as well be used in a multithreaded environment. 6 | 7 | The structure of these functions in the standard C run-time library together with the retarget interfaces is: 8 | 9 | ![Software Structure Overview](./images/overview.png) 10 | 11 | Standard C library functions are platform independent and can be easily ported, while the low-level interfaces needs to be tailored to the chosen platform. Generally low-level I/O functions serve to interact with the file system and a serial interface, i.e. terminal. Multithreading support is available for applications that run on top of an RTOS kernel. 12 | 13 | CMSIS-Compiler enables platform specific retargeting by providing software components that break down into the following interfaces: 14 | 15 | - File interface that enables reading and writing files 16 | - STDIN interface that enables standard input stream redirection 17 | - STDOUT interface that enables standard output stream redirection 18 | - STDERR interface that enables standard error stream redirection 19 | - OS interface that enables multithread safety using an arbitrary RTOS 20 | 21 | The pages \ref rt_io and \ref rt_os explain the details about how retargeting is done using the provided components. 22 | 23 | Using CMSIS-Compiler developers can retarget standard I/O streams and file operations to specific platform and enable thread safe operations using RTOS interface. 24 | 25 | > **Note** 26 | > - CMSIS-Compiler replaces and extends retargeting functionality previously provided as part of *Keil::ARM_Compiler* pack. 27 | > - See [Migrating projects from CMSIS v5 to CMSIS v6](https://learn.arm.com/learning-paths/microcontrollers/project-migration-cmsis-v6) for a guidance on updating existing projects to CMSIS-Compiler. 28 | 29 | ## Supported Toolchains {#toolchains} 30 | 31 | The CMSIS-Compiler component is available for the following toolchains: 32 | 33 | - [Arm Compiler for Embedded](https://developer.arm.com/Tools%20and%20Software/Arm%20Compiler%20for%20Embedded) 34 | - [Arm GNU Toolchain (GCC)](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) 35 | 36 | Support for IAR Compiler support will be added in a future revision of the CMSIS-Compiler. 37 | 38 | ## Access to CMSIS-Compiler {#compiler_access} 39 | 40 | CMSIS-View is actively maintained in [**CMSIS-Compiler GitHub repository**](https://github.com/ARM-software/CMSIS-Compiler) and is released as a standalone [**CMSIS-Compiler pack**](https://www.keil.arm.com/packs/cmsis-compiler-arm/versions/) in the [CMSIS-Pack format](https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/index.html). 41 | 42 | The table below explains the content of **ARM::CMSIS-Compiler** pack. 43 | 44 | Directory | Description 45 | :--------------------------------------|:------------------------------------------------------ 46 | 📂 documentation | Folder with this CMSIS-Compiler documenation 47 | 📂 example | [I/O Retarget example project](../../example/README.md) 48 | 📂 include | Header files with [**Retargeting functions**](modules.html) 49 | 📂 source | Compiler-specific implementations of regargeting functions 50 | 📂 template | \ref rt_templates "User Template files" 51 | 📄 ARM.CMSIS-Compiler.pdsc | CMSIS-Pack description file 52 | 📄 LICENSE | License Agreement (Apache 2.0) 53 | 54 | See [CMSIS Documentation](https://arm-software.github.io/CMSIS_6/) for an overview of CMSIS software components, tools and specifications. 55 | 56 | ## Documentation Structure {#doc_content} 57 | 58 | This documentation contains the following sections: 59 | 60 | - \ref rev_hist : lists CMSIS-Compiler releases. 61 | - \ref rt_io : explains low-level I/O retargeting, list available components and describes available user code templates. 62 | - \ref rt_os : explains multithreading support retargeting, list available components and describes available user code templates. 63 | - The [I/O Retarget example project](../../example/README.md) shows how to retarget the output to a UART on an Arm Virtual Hardware model. 64 | - \ref rt_templates : contains the user code template files for the different use cases. 65 | - [**API Reference**](modules.html) describes the API and the functions of the CMSIS-Compiler components in details. 66 | 67 | 68 | 69 | ## License {#doc_license} 70 | 71 | CMSIS-Compiler is provided free of charge by Arm under the [Apache 2.0 License](https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/main/LICENSE) 72 | -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_fs.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup fs_interface_api File Interface 3 | \brief An API that enables integration of standard C library with an arbitrary file system 4 | @{ 5 | */ 6 | 7 | /** 8 | \defgroup fs_interface_definitions Definitions 9 | @{ 10 | */ 11 | 12 | /** 13 | \defgroup fs_interface_open_modes Open Modes 14 | @{ 15 | \def RT_OPEN_RDONLY 16 | \def RT_OPEN_WRONLY 17 | \def RT_OPEN_RDWR 18 | \def RT_OPEN_APPEND 19 | \def RT_OPEN_CREATE 20 | \def RT_OPEN_TRUNCATE 21 | @} 22 | */ 23 | 24 | /** 25 | \defgroup fs_interface_attributes Attributes 26 | @{ 27 | \def RT_ATTR_FILE 28 | \def RT_ATTR_DIR 29 | \def RT_ATTR_LINK 30 | \def RT_ATTR_RD 31 | \def RT_ATTR_WR 32 | @} 33 | */ 34 | 35 | /** 36 | \defgroup fs_interface_seek_operations Seek Operations 37 | @{ 38 | \def RT_SEEK_SET 39 | \def RT_SEEK_CUR 40 | \def RT_SEEK_END 41 | @} 42 | */ 43 | 44 | /** 45 | \defgroup fs_interface_return_codes Return Codes 46 | @{ 47 | \def RT_ERR 48 | \def RT_ERR_NOTSUP 49 | \def RT_ERR_INVAL 50 | \def RT_ERR_IO 51 | \def RT_ERR_NOTFOUND 52 | \def RT_ERR_EXIST 53 | \def RT_ERR_ISDIR 54 | \def RT_ERR_NOSPACE 55 | \def RT_ERR_READONLY 56 | \def RT_ERR_FILEDES 57 | \def RT_ERR_MAXPATH 58 | \def RT_ERR_BUSY 59 | \def RT_ERR_NOTEMPTY 60 | \def RT_ERR_MAXFILES 61 | \def RT_ERR_OVERFLOW 62 | @} 63 | */ 64 | 65 | /** 66 | @} 67 | */ 68 | 69 | /** 70 | \struct rt_fs_time_t 71 | 72 | \details 73 | This struct contains time and date information, including seconds, minutes, 74 | hours, day of the month, month of the year and year. 75 | Values outside of the specified range are treated as invalid. Reserved bits 76 | should be ignored. 77 | */ 78 | 79 | /** 80 | \struct rt_fs_stat_t 81 | 82 | \details 83 | This struct contains various attributes and metadata about a file or directory in 84 | a filesystem, including its attribute bitmap, access time, modification time, 85 | change time and filesystem specific block size and block count allocated to store 86 | the file. 87 | */ 88 | 89 | /** 90 | \fn int32_t rt_fs_open (const char *path, int32_t mode) 91 | 92 | \details 93 | This function opens a file specified by the pathname. 94 | 95 | The mode parameter is a bitmap that specifies the file open mode. 96 | The following bits are exclusive: 97 | - FS_OPEN_RDONLY: open file for reading only 98 | - FS_OPEN_WRONLY: open file for writing only 99 | - FS_OPEN_RDWR: open file for reading and writing 100 | 101 | In addition, any combination of the values below can be set: 102 | - FS_OPEN_APPEND: if set, the file offset is set to the end of file prior to each write 103 | - FS_OPEN_CREATE: if set, the file is created if it does not exist 104 | - FS_OPEN_TRUNCATE: if set, the size of an existing file opened for writing is truncated to zero 105 | 106 | The file position offset shall be set to the beginning of the file unless append mode is specified. 107 | */ 108 | 109 | /** 110 | \fn int32_t rt_fs_close (int32_t fd) 111 | 112 | \details 113 | This function closes the file associated with the file descriptor fd. 114 | */ 115 | 116 | /** 117 | \fn int32_t rt_fs_write (int32_t fd, const void *buf, uint32_t cnt) 118 | 119 | \details 120 | This function shall write cnt bytes from the buffer pointed to by buf to the 121 | file associated with the open file descriptor, fd. 122 | */ 123 | 124 | /** 125 | \fn int32_t rt_fs_read (int32_t fd, void *buf, uint32_t cnt) 126 | 127 | \details 128 | This function reads cnt bytes from the file associated with the file 129 | descriptor fd, into the buffer pointed to by buf. 130 | The actual number of bytes read can be less than cnt. 131 | */ 132 | 133 | /** 134 | \fn int64_t rt_fs_seek (int32_t fd, int64_t offset, int32_t whence) 135 | 136 | \details 137 | This functions moves the file position pointer as specified with parameters 138 | offset and whence. 139 | Parameter whence can have the following possible values: 140 | - RT_SEEK_SET: set the file position pointer to offset bytes from the start of the file 141 | - RT_SEEK_CUR: set the file position pointer to offset bytes from the current location 142 | - RT_SEEK_END: set the file position pointer to offset bytes from the end of the file 143 | */ 144 | 145 | /** 146 | \fn int64_t rt_fs_size (int32_t fd) 147 | 148 | \details 149 | This function retrieves the size of an opened file. 150 | */ 151 | 152 | /** 153 | \fn int32_t rt_fs_stat (int32_t fd, rt_fs_stat_t *stat) 154 | 155 | \details 156 | This function retrieves status information about the file associated with the 157 | given file descriptor. The status information is stored in the rt_fs_stat_t 158 | struct pointed to by stat. 159 | The function shall return with error if fd is not a valid file descriptor or 160 | if parameter stat is NULL. 161 | */ 162 | 163 | /** 164 | \fn int32_t rt_fs_remove (const char *path) 165 | 166 | \details 167 | If removing a directory, the directory must be empty. 168 | */ 169 | 170 | 171 | /** 172 | \fn int32_t rt_fs_rename (const char *oldpath, const char *newpath) 173 | 174 | \details 175 | This function changes the name of a file or directory. 176 | 177 | If the destination exists, it must match the source in type. 178 | If the destination is a directory, the directory must be empty. 179 | */ 180 | 181 | /** 182 | @} 183 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_os.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup os_interface_api OS Interface 3 | \brief Collection of standard C library provided APIs for integration with an arbitrary RTOS. 4 | \details 5 | OS Interface enables an abstraction layer for operating system related functionalities within an 6 | embedded system that targets a specific toolchain. The most notable is the functionality for 7 | handling locking mechanisms for synchronization in a multi-threaded environment. 8 | @{ 9 | */ 10 | 11 | /** 12 | @} 13 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_os_armclib.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup retarget_os_armclib Arm C Library 3 | \ingroup os_interface_api 4 | \brief Declarations of types and functions for integrating an RTOS with the Arm Standard C Library 5 | @{ 6 | */ 7 | 8 | /** 9 | \fn void *__user_perthread_libspace (void) 10 | 11 | \details 12 | This function returns a pointer to memory for storing data that is local to a 13 | particular thread. This means that __user_perthread_libspace() returns a 14 | different address depending on the thread it is called from. 15 | */ 16 | 17 | /** 18 | \struct rt_mutex_t 19 | \brief Mutex type definition 20 | 21 | \details The rt_mutex_t is an incomplete type, an implementation must define it 22 | */ 23 | 24 | /** 25 | \fn int _mutex_initialize(rt_mutex_t *mutex) 26 | 27 | \details 28 | This function accepts a pointer to a pointer-sized word and initializes it as 29 | a valid mutex. By default, _mutex_initialize() returns zero for a nonthreaded 30 | application. Therefore, in a multithreaded application, _mutex_initialize() 31 | must return a nonzero value on success so that at runtime, the library knows 32 | that it is being used in a multithreaded environment. 33 | Ensure that _mutex_initialize() initializes the mutex to an unlocked state. 34 | */ 35 | 36 | /** 37 | \fn void _mutex_acquire(rt_mutex_t *mutex) 38 | 39 | \details 40 | This function causes the calling thread to obtain a lock on the supplied mutex. 41 | _mutex_acquire() returns immediately if the mutex has no owner. If the mutex 42 | is owned by another thread, _mutex_acquire() must block until it becomes available. 43 | _mutex_acquire() is not called by the thread that already owns the mutex. 44 | */ 45 | 46 | /** 47 | \fn void _mutex_release(rt_mutex_t *mutex) 48 | 49 | \details 50 | This function causes the calling thread to release the lock on a mutex acquired 51 | by _mutex_acquire(). The mutex remains in existence, and can be re-locked by a 52 | subsequent call to mutex_acquire(). _mutex_release() assumes that the mutex is 53 | owned by the calling thread. 54 | */ 55 | 56 | /** 57 | \fn void _mutex_free(rt_mutex_t *mutex) 58 | 59 | \details 60 | This function causes the calling thread to free the supplied mutex. Any operating 61 | system resources associated with the mutex are freed. The mutex is destroyed and 62 | cannot be reused. _mutex_free() assumes that the mutex is owned by the calling thread. 63 | */ 64 | 65 | /** 66 | @} 67 | */ 68 | -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_os_newlib.txt: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | \defgroup retarget_os_newlib GCC Newlib 4 | \ingroup os_interface_api 5 | \brief Declarations of types and functions for integrating an RTOS with the GCC Newlib 6 | @{ 7 | */ 8 | 9 | void __retarget_lock_init(_LOCK_T *lock); 10 | 11 | void __retarget_lock_init_recursive(_LOCK_T *lock); 12 | 13 | void __retarget_lock_close(_LOCK_T lock); 14 | 15 | void __retarget_lock_close_recursive(_LOCK_T lock); 16 | 17 | void __retarget_lock_acquire(_LOCK_T lock); 18 | 19 | void __retarget_lock_acquire_recursive(_LOCK_T lock); 20 | 21 | int __retarget_lock_try_acquire(_LOCK_T lock); 22 | 23 | int __retarget_lock_try_acquire_recursive(_LOCK_T lock); 24 | 25 | void __retarget_lock_release(_LOCK_T lock); 26 | 27 | void __retarget_lock_release_recursive(_LOCK_T lock); 28 | 29 | /** 30 | @} 31 | */ 32 | -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_stderr.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup stderr_api STDERR Interface 3 | \brief Minimalistic interface for redirecting stderr stream 4 | @{ 5 | */ 6 | 7 | /** 8 | \fn int stderr_putchar (int ch) 9 | */ 10 | 11 | /** 12 | @} 13 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_stdin.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup stdin_api STDIN Interface 3 | \brief Minimalistic interface for redirecting stdin stream 4 | @{ 5 | */ 6 | 7 | /** 8 | \fn int stdin_getchar (void) 9 | */ 10 | 11 | /** 12 | @} 13 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_stdout.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup stdout_api STDOUT Interface 3 | \brief Minimalistic interface for redirecting stdout stream 4 | @{ 5 | */ 6 | 7 | /** 8 | \fn int stdout_putchar (int ch) 9 | */ 10 | 11 | /** 12 | @} 13 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/ref_retarget_tty.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup tty_api TTY Interface 3 | \brief Minimalistic interface for redirecting tty stream 4 | @{ 5 | */ 6 | 7 | /** 8 | \fn void ttywrch (int ch) 9 | */ 10 | 11 | /** 12 | @} 13 | */ -------------------------------------------------------------------------------- /documentation/doxygen/src/rt_io.md: -------------------------------------------------------------------------------- 1 | # Low-Level I/O Retarget {#rt_io} 2 | 3 | CMSIS-Compiler splits low-level I/O retargeting into **standard I/O stream** related components and **file stream** related components. 4 | 5 | The low-level I/O retarget decision tree is shown below: 6 | 7 | ![Low-Level I/O Retarget Decision Tree](./images/retarget_low_level_io.png) 8 | 9 | Low-Level I/O retargeting implementation checks whether the incoming stream is a standard stream (i.e. stderr, stdin, stdout) or a file system related stream and redirects incoming request to the appropriate software component. Chapters \ref rt_io_components and \ref rt_file_interface explain these software components in detail. 10 | 11 | ## Standard Stream Components {#rt_io_components} 12 | 13 | Software components that retarget the standard C library input/output streams are as follows: 14 | 15 | Component | Description 16 | :-----------|:-------------------- 17 | **STDERR** | Standard error stream of the application to output diagnostic messages. 18 | **STDIN** | Standard input stream going into the application (`scanf` etc.). 19 | **STDOUT** | Standard output stream of the application (`printf` etc.). 20 | **TTY** | Teletypewriter, which is the last resort for error output. 21 | 22 | > **Note** 23 | > - **TTY** is only available for Arm Compiler toolchain. 24 | 25 | Each component can have various \ref rt_io_subcomponents. 26 | 27 | ### Standard Stream Subcomponents {#rt_io_subcomponents} 28 | 29 | The subcomponent selection allows you to change the target hardware interface of the I/O stream. 30 | 31 | #### STDERR/STDIN/STDOUT Subcomponents {#rt_io_std_subcomponents} 32 | 33 | ![STDERR/STDIN/STDOUT subcomponents](./images/retarget_io_std.png) 34 | 35 | The following subcomponents are available: 36 | 37 | Variant | Description 38 | :---------------------|:------------------- 39 | **Breakpoint** | When the I/O stream is used, the application stops with [BKPT](https://developer.arm.com/documentation/100073/latest/The-Arm-C-and-C---Libraries/Support-for-building-an-application-with-the-C-library/Using-the-C-and-C---libraries-with-an-application-in-a-semihosting-environment?lang=en) instruction. No additional code is required. 40 | **Event Recorder** | STDOUT and STDERR can be redirected using the [Event Recorder](https://arm-software.github.io/CMSIS-View/main/evr.html) (especially interesting for targets without ITM (such as Cortex-M0/M0+/M23)). 41 | **ITM** | Use [Instrumentation Trace Macrocell (ITM)](https://developer.arm.com/documentation/ddi0314/h/Instrumentation-Trace-Macrocell?lang=en) for I/O communication via the debugger (only available for Cortex-M3/M4/M7/M33/M55/M85 processors).
Usually, data is shown in a dedicated window.
No additional code is required to output or input data through the ITM channel. However, you have to configure the ITM channel for tracing. 42 | **Custom** | Retarget I/O stream to a user defined interface (such as UART or other application specific interface).
See \subpage custom_subcomponent for further details. 43 | 44 | 45 | > **Note** 46 | > - Depending on the selected subcomponent, certain `#define` are set in the header file **RTE_Components.h** that enable the appropriate code sections in the retarget core implementation. 47 | > - Retargeting **STDOUT** and **STDERR** using the *Event Recorder* variant is available for all Cortex-M based devices. 48 | > - The [microlib](https://developer.arm.com/documentation/100073/latest/The-Arm-C-Micro-library?lang=en) of Arm Compiler C run-time library interfaces to the hardware via low-level functions. It implements a reduced set of high-level functions and therefore does not implement system I/O functions. Thus, in case of using the microlib, you cannot redefine the system I/O functions. Using any of the features of the Arm Compiler component provides the [assert](https://developer.arm.com/documentation/101754/latest/armasm-Legacy-Assembler-Reference/armasm-Directives-Reference/ASSERT-directive?lang=en) facility for microlib. 49 | 50 | ### "Custom" Subcomponent {#custom_subcomponent} 51 | 52 | The **Custom** component provides code template that helps you to implement the retarget interface functionality for custom interfaces that are not mentioned above. 53 | 54 | The following user code templates are available: 55 | 56 | Component | Name | File Name 57 | :--------------|:---------------------|:----------------------------------- 58 | STDOUT:Custom | STDOUT User template | \ref stdout_user_c "stdout_user.c" 59 | STDIN:Custom | STDIN User template | \ref stdin_user_c "stdin_user.c" 60 | STDERR:Custom | STDERR User template | \ref stderr_user_c "stderr_user.c" 61 | TTY:Custom | TTY User template | \ref tty_user_c "tty_user.c" 62 | 63 | ## File Interface Components {#rt_file_interface} 64 | 65 | **CMSIS-Compiler:File Interface** software component provides generic shim layer interface between the C library and an arbitrary file system implementation. 66 | 67 | Standard C library functions interact with files in a same manner as with standard I/O streams and offer the same retargeting interface. The existing interface is split to enable component interchangeability and \ref fs_interface_api API is used to enable quick file system retargeting. 68 | 69 | Default components are as follows: 70 | 71 | Component | Description 72 | :---------------|:------------ 73 | **Breakpoint** | When the file stream is used, the application stops with [BKPT](https://developer.arm.com/documentation/100073/latest/The-Arm-C-and-C---Libraries/Support-for-building-an-application-with-the-C-library/Using-the-C-and-C---libraries-with-an-application-in-a-semihosting-environment?lang=en) instruction. No additional code is required. 74 | **Custom** | Placeholder for custom \ref fs_interface_api implementation 75 | 76 | **Custom** component is available to enable access to \ref fs_interface_api API header file when application provides an custom implementation. Custom implementation is typically needed when file system components do not provide its own implementation. To help you implement the functionality the File Interface:Custom component also provides the \ref retarget_fs_c "code template". 77 | -------------------------------------------------------------------------------- /documentation/doxygen/src/rt_os.md: -------------------------------------------------------------------------------- 1 | # Multithreading Support Retarget {#rt_os} 2 | 3 | **CMSIS-Compiler** enables the standard C library multithreading interface retargeting via **OS Interface** component. 4 | 5 | ## OS Interface {#rt_os_components} 6 | 7 | The software component **CMSIS-Compiler:OS Interface** exposes \ref os_interface_api API that depends on the used toolchain i.e. on the standard C library embedded with the toolchain. Available components are implementations of this API and default components are as follows: 8 | 9 | Component | Description 10 | :----------------|:------------ 11 | **CMSIS-RTOS2** | \ref os_interface_api implementation using CMSIS-RTOS2 API 12 | **Custom** | Placeholder for custom \ref os_interface_api implementation 13 | 14 | Default implementation uses **CMSIS-RTOS2** to implement multithreading support and enables easy retargeting to any RTOS that implements RTOS2 API. 15 | 16 | **Custom** component is available to enable access to \ref os_interface_api API header file when application provides an custom implementation. Custom implementation is typically used when application uses RTOS native API. 17 | 18 | To help you implement the functionality the OS Interface:Custom component also provides the \ref rt_template_os_interface "code templates". 19 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates.md: -------------------------------------------------------------------------------- 1 | # Templates {#rt_templates} 2 | 3 | This section contains the listings for all template files available in the CMSIS-Compiler component: 4 | 5 | - \subpage rt_template_file_interface 6 | - \subpage rt_template_os_interface 7 | - \subpage rt_template_stderr 8 | - \subpage rt_template_stdin 9 | - \subpage rt_template_stdout 10 | - \subpage rt_template_tty 11 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_file.md: -------------------------------------------------------------------------------- 1 | # File Interface {#rt_template_file_interface} 2 | 3 | \ref fs_interface_api provides **Custom** component that can be used to implement its functionality using the code template below 4 | 5 | ## File Interface Custom {#retarget_fs_c} 6 | 7 | \include /file_interface/retarget_fs.c -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_os.md: -------------------------------------------------------------------------------- 1 | # OS Interface {#rt_template_os_interface} 2 | 3 | \ref os_interface_api provides **Custom** component that can be used to implement its functionality using code templates below. 4 | 5 | Exposed OS Interface API is toolchain specific therefore make sure to select correct code template: 6 | 7 | - \ref retarget_os_c_armcc 8 | - \ref retarget_os_gcc 9 | 10 | ## Arm Compiler {#retarget_os_c_armcc} 11 | 12 | \include /os_interface/armcc/retarget_os.c 13 | 14 | 15 | ## GCC Newlib {#retarget_os_gcc} 16 | 17 | **Code template used to retarget locking routines** 18 | 19 | \include /os_interface/gcc/retarget_lock.c 20 | 21 | **Code template used to retarget system calls** 22 | 23 | > **Note** 24 | > - All system call functions are provided in this template although there may not be necessary to reimplement them all. Functions that are not necessary may be removed or kept depending on the linker settings. 25 | > - Reimplementing functions like `_open`, `_close`,` _write`, etc. breaks compatibility with the CMSIS-Compiler:IO component. Make sure to remove them from custom implementation when application does not require to reimplement them. 26 | 27 | \include /os_interface/gcc/retarget_syscalls.c 28 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_stderr.md: -------------------------------------------------------------------------------- 1 | # STDERR {#rt_template_stderr} 2 | 3 | **STDERR** component provides **Custom** subcomponent that can be used to implement its functionality using the code template below 4 | 5 | ## STDERR User Template {#stderr_user_c} 6 | 7 | \include /stdio/stderr_user.c 8 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_stdin.md: -------------------------------------------------------------------------------- 1 | # STDIN {#rt_template_stdin} 2 | 3 | **STDIN** component provides **Custom** subcomponent that can be used to implement its functionality using the code template below 4 | 5 | ## STDIN User Template {#stdin_user_c} 6 | 7 | \include /stdio/stdin_user.c 8 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_stdout.md: -------------------------------------------------------------------------------- 1 | # STDOUT {#rt_template_stdout} 2 | 3 | **STDOUT** component provides **Custom** subcomponent that can be used to implement its functionality using the code template below 4 | 5 | ## STDOUT User Template {#stdout_user_c} 6 | 7 | \include /stdio/stdout_user.c 8 | -------------------------------------------------------------------------------- /documentation/doxygen/src/templates_tty.md: -------------------------------------------------------------------------------- 1 | # TTY {#rt_template_tty} 2 | 3 | **TTY** component provides **Custom** subcomponent that can be used to implement its functionality using the code template below 4 | 5 | ## TTY User Template {#tty_user_c} 6 | 7 | \include /stdio/tty_user.c 8 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/cmsis_logo_white_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/style_template/cmsis_logo_white_small.png -------------------------------------------------------------------------------- /documentation/doxygen/style_template/darkmode_toggle.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | The code below is based on the Doxygen Awesome project with some minor modifications 4 | https://github.com/jothepro/doxygen-awesome-css 5 | 6 | MIT License 7 | 8 | Copyright (c) 2021 - 2022 jothepro 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | */ 29 | 30 | class DarkModeToggle extends HTMLElement { 31 | static icon = '' 32 | static icond = '' 33 | static title = "Toggle Light/Dark Mode" 34 | 35 | static prefersLightModeInDarkModeKey = "prefers-light-mode-in-dark-mode" 36 | static prefersDarkModeInLightModeKey = "prefers-dark-mode-in-light-mode" 37 | 38 | static _staticConstructor = function() { 39 | DarkModeToggle.enableDarkMode(DarkModeToggle.userPreference) 40 | // Update the color scheme when the browsers preference changes 41 | // without user interaction on the website. 42 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { 43 | DarkModeToggle.onSystemPreferenceChanged() 44 | }) 45 | // Update the color scheme when the tab is made visible again. 46 | // It is possible that the appearance was changed in another tab 47 | // while this tab was in the background. 48 | document.addEventListener("visibilitychange", visibilityState => { 49 | if (document.visibilityState === 'visible') { 50 | DarkModeToggle.onSystemPreferenceChanged() 51 | } 52 | }); 53 | }() 54 | 55 | static addButton() { 56 | 57 | var tbuttons = document.getElementsByTagName("dark-mode-toggle"); 58 | var toggleButton; 59 | var titleArea = document.getElementById("titlearea"); 60 | var searchBox = document.getElementById("MSearchBox"); 61 | var mainMenu = document.getElementById("main-menu"); 62 | var navRow1 = document.getElementById("navrow1"); 63 | var mainMenuVisible = false; 64 | if (!tbuttons.length){ 65 | toggleButton = document.createElement('dark-mode-toggle') 66 | toggleButton.title = DarkModeToggle.title 67 | } else {toggleButton=tbuttons[0]} 68 | 69 | 70 | if (DarkModeToggle.darkModeEnabled){ 71 | toggleButton.innerHTML=DarkModeToggle.icond 72 | } else { 73 | toggleButton.innerHTML=DarkModeToggle.icon 74 | } 75 | 76 | if (mainMenu) { 77 | var menuStyle = window.getComputedStyle(mainMenu); 78 | mainMenuVisible = menuStyle.display!=='none' 79 | } 80 | var searchBoxPos1 = document.getElementById("searchBoxPos1"); 81 | if (searchBox) { // (1) search box visible 82 | searchBox.parentNode.appendChild(toggleButton) 83 | } else if (navRow1) { // (2) no search box, static menu bar 84 | var li = document.createElement('li'); 85 | li.style = 'float: right;' 86 | li.appendChild(toggleButton); 87 | toggleButton.style = 'width: 24px; height: 25px; padding-top: 11px; float: right;'; 88 | var row = document.querySelector('#navrow1 > ul:first-of-type'); 89 | row.appendChild(li) 90 | } else if (mainMenu && mainMenuVisible) { // (3) no search box + dynamic menu bar expanded 91 | var li = document.createElement('li'); 92 | li.style = 'float: right;' 93 | li.appendChild(toggleButton); 94 | toggleButton.style = 'width: 14px; height: 36px; padding-top: 10px; float: right;'; 95 | mainMenu.appendChild(li) 96 | } else if (searchBoxPos1) { // (4) no search box + dynamic menu bar collapsed 97 | toggleButton.style = 'width: 24px; height: 36px; padding-top: 10px; float: right;'; 98 | searchBoxPos1.style = 'top: 0px;' 99 | searchBoxPos1.appendChild(toggleButton); 100 | } else if (titleArea) { // (5) no search box and no navigation tabs 101 | toggleButton.style = 'width: 24px; height: 24px; position: absolute; right: 0px; top: 34px;'; 102 | titleArea.append(toggleButton); 103 | } 104 | } 105 | 106 | static init() { 107 | $(function() { 108 | $(document).ready(function() { 109 | 110 | $(document).ready(function(){ 111 | DarkModeToggle.addButton(); 112 | }) 113 | $(window).resize(function(){ 114 | DarkModeToggle.addButton(); 115 | }) 116 | DarkModeToggle.setDarkModeVisibility(DarkModeToggle.darkModeEnabled) 117 | }) 118 | }) 119 | } 120 | 121 | constructor() { 122 | super(); 123 | this.onclick=this.toggleDarkMode 124 | } 125 | 126 | 127 | static createCookie(name, value, days) { 128 | if (days) { 129 | var date = new Date(); 130 | date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 131 | var expires = "; expires=" + date.toGMTString(); 132 | } 133 | else var expires = ""; 134 | 135 | document.cookie = name + "=" + value + expires + "; path=/"; 136 | } 137 | 138 | static readCookie(name) { 139 | var nameEQ = name + "="; 140 | var ca = document.cookie.split(';'); 141 | for (var i = 0; i < ca.length; i++) { 142 | var c = ca[i]; 143 | while (c.charAt(0) == ' ') c = c.substring(1, c.length); 144 | if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 145 | } 146 | return null; 147 | } 148 | 149 | static eraseCookie(name) { 150 | DarkModeToggle.createCookie(name, "", -1); 151 | } 152 | 153 | /** 154 | * @returns `true` for dark-mode, `false` for light-mode system preference 155 | */ 156 | static get systemPreference() { 157 | return window.matchMedia('(prefers-color-scheme: dark)').matches 158 | } 159 | 160 | static get prefersDarkModeInLightMode() { 161 | if (window.chrome) { // Chrome supports localStorage in combination with file:// but not cookies 162 | return localStorage.getItem(DarkModeToggle.prefersDarkModeInLightModeKey) 163 | } else { // Other browsers support cookies in combination with file:// but not localStorage 164 | return DarkModeToggle.readCookie('doxygen_prefers_dark')=='1' 165 | } 166 | } 167 | 168 | static set prefersDarkModeInLightMode(preference) { 169 | if (window.chrome) { 170 | if (preference) { 171 | localStorage.setItem(DarkModeToggle.prefersDarkModeInLightModeKey, true) 172 | } else { 173 | localStorage.removeItem(DarkModeToggle.prefersDarkModeInLightModeKey) 174 | } 175 | } else { 176 | if (preference) { 177 | DarkModeToggle.createCookie('doxygen_prefers_dark','1',365) 178 | } else { 179 | DarkModeToggle.eraseCookie('doxygen_prefers_dark') 180 | } 181 | } 182 | } 183 | 184 | static get prefersLightModeInDarkMode() { 185 | if (window.chrome) { // Chrome supports localStorage in combination with file:// but not cookies 186 | return localStorage.getItem(DarkModeToggle.prefersLightModeInDarkModeKey) 187 | } else { // Other browsers support cookies in combination with file:// but not localStorage 188 | return DarkModeToggle.readCookie('doxygen_prefers_light')=='1' 189 | } 190 | } 191 | 192 | static set prefersLightModeInDarkMode(preference) { 193 | if (window.chrome) { 194 | if (preference) { 195 | localStorage.setItem(DarkModeToggle.prefersLightModeInDarkModeKey, true) 196 | } else { 197 | localStorage.removeItem(DarkModeToggle.prefersLightModeInDarkModeKey) 198 | } 199 | } else { 200 | if (preference) { 201 | DarkModeToggle.createCookie('doxygen_prefers_light','1',365) 202 | } else { 203 | DarkModeToggle.eraseCookie('doxygen_prefers_light') 204 | } 205 | } 206 | } 207 | 208 | 209 | /** 210 | * @returns `true` for dark-mode, `false` for light-mode user preference 211 | */ 212 | static get userPreference() { 213 | return (!DarkModeToggle.systemPreference && DarkModeToggle.prefersDarkModeInLightMode) || 214 | (DarkModeToggle.systemPreference && !DarkModeToggle.prefersLightModeInDarkMode) 215 | } 216 | 217 | static set userPreference(userPreference) { 218 | DarkModeToggle.darkModeEnabled = userPreference 219 | if (!userPreference) { 220 | if (DarkModeToggle.systemPreference) { 221 | DarkModeToggle.prefersLightModeInDarkMode = true 222 | } else { 223 | DarkModeToggle.prefersDarkModeInLightMode = false 224 | } 225 | } else { 226 | if (!DarkModeToggle.systemPreference) { 227 | DarkModeToggle.prefersDarkModeInLightMode = true 228 | } else { 229 | DarkModeToggle.prefersLightModeInDarkMode = false 230 | } 231 | } 232 | DarkModeToggle.onUserPreferenceChanged() 233 | } 234 | 235 | static setDarkModeVisibility(enable) { 236 | var darkModeStyle, lightModeStyle; 237 | if(enable) { 238 | darkModeStyle = 'inline-block'; 239 | lightModeStyle = 'none' 240 | } else { 241 | darkModeStyle = 'none'; 242 | lightModeStyle = 'inline-block' 243 | } 244 | document.querySelectorAll('.dark-mode-visible').forEach(function(el) { 245 | el.style.display = darkModeStyle; 246 | }); 247 | document.querySelectorAll('.light-mode-visible').forEach(function(el) { 248 | el.style.display = lightModeStyle; 249 | }); 250 | } 251 | static enableDarkMode(enable) { 252 | if(enable) { 253 | DarkModeToggle.darkModeEnabled = true 254 | document.documentElement.classList.add("dark-mode") 255 | document.documentElement.classList.remove("light-mode") 256 | } else { 257 | DarkModeToggle.darkModeEnabled = false 258 | document.documentElement.classList.remove("dark-mode") 259 | document.documentElement.classList.add("light-mode") 260 | } 261 | DarkModeToggle.setDarkModeVisibility(enable) 262 | } 263 | 264 | static onSystemPreferenceChanged() { 265 | DarkModeToggle.darkModeEnabled = DarkModeToggle.userPreference 266 | DarkModeToggle.enableDarkMode(DarkModeToggle.darkModeEnabled) 267 | } 268 | 269 | static onUserPreferenceChanged() { 270 | DarkModeToggle.enableDarkMode(DarkModeToggle.darkModeEnabled) 271 | } 272 | 273 | toggleDarkMode() { 274 | DarkModeToggle.userPreference = !DarkModeToggle.userPreference 275 | DarkModeToggle.addButton(); 276 | } 277 | } 278 | 279 | customElements.define("dark-mode-toggle", DarkModeToggle); 280 | 281 | DarkModeToggle.init(); 282 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/style_template/dropdown.png -------------------------------------------------------------------------------- /documentation/doxygen/style_template/extra_navtree.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --arm_light_blue: #00C1DE; 3 | --arm_blue: #11809F; 4 | --arm_blue1: #0091BD; 5 | --arm_dark_blue: #002B49; 6 | --arm_light_gray: #E5ECEB; 7 | --arm_light_gray1: #EFF5F4; 8 | --arm_light_gray2: #EBEBEB; 9 | --arm_light_gray3: #F7F7F7; 10 | --arm_dark_gray: #7D868C; 11 | --arm_black: #333E48; 12 | --arm_orange: #FF6B00; 13 | } 14 | 15 | #nav-tree ul { 16 | list-style:none outside none; 17 | margin:0px; 18 | padding:0px; 19 | } 20 | 21 | #nav-tree li { 22 | white-space:nowrap; 23 | margin:0px; 24 | padding:0px; 25 | } 26 | 27 | #nav-tree .plus { 28 | margin:0px; 29 | } 30 | 31 | #nav-tree .selected { 32 | background-image: none; 33 | background-repeat:no-repeat; 34 | text-shadow: none; 35 | border: 1.5px solid var(--arm_blue); 36 | border-left-width: 5px; 37 | margin-left:-10px; /*correction to place selection border on the edge screen edge */ 38 | } 39 | 40 | #nav-tree img { 41 | margin:0px; 42 | padding:0px; 43 | border:0px; 44 | vertical-align: middle; 45 | } 46 | 47 | #nav-tree a { 48 | color: var(--nav-text-normal-color); 49 | text-decoration:none; 50 | padding:0px; 51 | padding-left:0px; 52 | margin:0px; 53 | outline:none; 54 | } 55 | 56 | #nav-tree .label { 57 | margin:0px; 58 | padding:0px; 59 | font: 15px Lato, Calibri, sans-serif; 60 | } 61 | 62 | #nav-tree .label:hover { 63 | color: var(--arm_orange); 64 | } 65 | 66 | #nav-tree .label a { 67 | padding-left:6px; 68 | line-height: 30px; 69 | } 70 | 71 | #nav-tree .selected a { 72 | font-weight: bold; 73 | } 74 | 75 | /*correction for the larger box border on the left (10px-5px) */ 76 | #nav-tree .selected .arrow { 77 | margin-left:5px; 78 | } 79 | 80 | #nav-tree .children_ul { 81 | margin:0px; 82 | padding:0px; 83 | } 84 | 85 | #nav-tree { 86 | padding: 0px 0px; 87 | padding-left: 10px; /*correction to add space before the first arrow in nav-tree */ 88 | overflow:auto; 89 | } 90 | 91 | #doc-content { 92 | overflow:auto; 93 | display:block; 94 | padding:0px; 95 | margin:0px; 96 | -webkit-overflow-scrolling : touch; /* iOS 5+ */ 97 | } 98 | 99 | #side-nav { 100 | padding:0 2px 0 0; 101 | margin: 0px; 102 | display:block; 103 | position: absolute; 104 | left: 0px; 105 | width: 330px; 106 | } 107 | 108 | .ui-resizable .ui-resizable-handle { 109 | display:block; 110 | } 111 | 112 | .ui-resizable-e { 113 | background-color: var(--nav-splitbar-color); 114 | background-repeat:repeat-y; 115 | background-attachment: scroll; 116 | cursor:ew-resize; 117 | height:100%; 118 | right:0; 119 | top:0; 120 | width:1px; 121 | } 122 | 123 | .ui-resizable-handle { 124 | display:none; 125 | font-size:0.1px; 126 | position:absolute; 127 | z-index:1; 128 | } 129 | 130 | #nav-tree-contents { 131 | margin: 6px 0px 0px 0px; 132 | } 133 | 134 | #nav-tree { 135 | 136 | -webkit-overflow-scrolling : touch; /* iOS 5+ */ 137 | } 138 | 139 | #nav-sync { 140 | position:absolute; 141 | top:5px; 142 | right:24px; 143 | z-index:0; 144 | opacity:0; 145 | } 146 | 147 | #nav-sync img { 148 | opacity:0; 149 | } 150 | 151 | #nav-sync img:hover { 152 | opacity:0; 153 | } 154 | 155 | #nav-tree a:hover { 156 | color: var(--arm_orange); 157 | } 158 | 159 | @media print 160 | { 161 | #nav-tree { display: none; } 162 | div.ui-resizable-handle { display: none; position: relative; } 163 | } 164 | 165 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/extra_search.css: -------------------------------------------------------------------------------- 1 | 2 | dark-mode-toggle { 3 | position: absolute; 4 | right: 205px; 5 | padding-top: 3px; 6 | color: var(--arm_light_gray); 7 | } 8 | 9 | .tablist .MSearchBox { 10 | pointer-events: none; 11 | display: inline-block; 12 | white-space : nowrap; 13 | background: none; 14 | border-radius: 0.0em; 15 | height: 0em; 16 | width: 0em; 17 | line-height: 0px; 18 | } 19 | 20 | .tablist .MSearchField { 21 | pointer-events: none; 22 | display: inline-block; 23 | vertical-align: middle; 24 | width: 0em; 25 | height: 0px; 26 | margin: 0 0; 27 | padding: 0; 28 | line-height: 0em; 29 | border:none; 30 | outline: none; 31 | -webkit-border-radius: 0px; 32 | border-radius: 0px; 33 | background: none; 34 | } 35 | 36 | .tablist .MSearchBoxInactive { 37 | pointer-events: none; 38 | opacity:0.0; 39 | } 40 | 41 | .tablist .MSearchBoxActive { 42 | pointer-events: none; 43 | opacity:0.0; 44 | } 45 | 46 | .tablist .MSearchBoxInactive:hover { 47 | pointer-events: none; 48 | opacity:0.0; 49 | } -------------------------------------------------------------------------------- /documentation/doxygen/style_template/extra_tabs.css: -------------------------------------------------------------------------------- 1 | 2 | /* in Doxygen 1.9.2 'tabs' is assigned to second navigation row (navrow1) with 3 | 'Main Page', 'Namespaces', etc */ 4 | 5 | .tabs, .tabs1, .tabs2, .tabs3, .main-nav { 6 | background-color: var(--arm_light_gray); 7 | color: var(--arm_black); 8 | width: 100%; 9 | z-index: 101; 10 | font-family: 'Futura PT W01 Medium', 'Lato Light', Lato, Calibri, sans-serif; 11 | font-size: 14px; 12 | font-weight: 800; 13 | } 14 | 15 | .tabs1 { 16 | background-color: var(--arm_black); 17 | font-size: 16px; 18 | } 19 | 20 | .tabs1 a { 21 | color:while; 22 | } 23 | 24 | .tabs { 25 | background-color: var(--nav_tabs-background-color); 26 | border-top-style:solid; 27 | border-top-width:1px; 28 | border-top-color:var(--nav_tabs-border-color); 29 | } 30 | 31 | .tablist, .main-menu { 32 | margin: 0; 33 | padding: 0; 34 | display: table; 35 | line-height: 28px; 36 | } 37 | 38 | .tablist li { 39 | float: left; 40 | display: table-cell; 41 | background-color: var(--nav_tabs-background-color); 42 | border-right-style:solid; 43 | border-right-width:1px; 44 | border-right-color:var(--nav_tabs-border-color); 45 | list-style: none; 46 | margin:0px; 47 | } 48 | 49 | .tabs1 .tablist li { 50 | background-color: var(--arm_black); 51 | font-weight: 1000; 52 | } 53 | 54 | .tablist a { 55 | display: block; 56 | padding: 0 10px; 57 | color: var(--arm_dark_gray); 58 | font-weight: 600; 59 | outline: none; 60 | } 61 | 62 | .tabs1 .tablist a { 63 | padding: 3px 20px; 64 | color: white; 65 | background-color:var(--arm_black); 66 | } 67 | 68 | .tablist li.current a { 69 | background-color: var(--arm_dark_gray); 70 | color: white; 71 | } 72 | 73 | .tabs1 .tablist li.current a { 74 | background-color: var(--arm_blue); 75 | } 76 | 77 | .tabs .tablist a { 78 | background-color: var(--nav_tabs-background-color); 79 | color: var(--nav_tabs-text-color); 80 | } 81 | .tabs .tablist li.current a { 82 | background-color: var(--nav_tabs-background-active-color); 83 | color: var(--nav_tabs-text-active-color); 84 | } 85 | 86 | .tabs a:hover { 87 | color: var(--arm_orange); 88 | } 89 | 90 | .tabs li.current a:hover { 91 | color: white; 92 | } 93 | 94 | .tabs1 a:hover { 95 | color: var(--arm_yellow); 96 | } 97 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/footer.js.in: -------------------------------------------------------------------------------- 1 | function writeHeader() { 2 | document.write('Version {projectNumber}'); 3 | }; 4 | 5 | function writeFooter() { 6 | document.write('Generated on {datetime} for {projectName} {projectNumberFull}. Copyright © {year} Arm Limited (or its affiliates). All rights reserved.'); 7 | }; 8 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | $projectname: $title 9 | $title 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | $treeview 22 | $search 23 | $mathjax 24 | $darkmode 25 | $extrastylesheet 26 | 27 | 28 | 29 | 30 | 31 |
32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
44 | 45 |
$projectname 46 | 47 |   53 | 54 |
55 |
$projectbrief
56 |
$searchbox
$searchbox
74 |
75 | 76 | 77 |
78 |
    79 | 82 |
83 |
84 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/resize.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | var once=1; 26 | function initResizable() 27 | { 28 | var cookie_namespace = 'doxygen'; 29 | var sidenav,navtree,content,header,barWidth=6,desktop_vp=768,titleHeight; 30 | 31 | function readSetting(cookie) 32 | { 33 | if (window.chrome) { 34 | var val = localStorage.getItem(cookie_namespace+'_width'); 35 | if (val) return val; 36 | } else { 37 | var myCookie = cookie_namespace+"_"+cookie+"="; 38 | if (document.cookie) { 39 | var index = document.cookie.indexOf(myCookie); 40 | if (index != -1) { 41 | var valStart = index + myCookie.length; 42 | var valEnd = document.cookie.indexOf(";", valStart); 43 | if (valEnd == -1) { 44 | valEnd = document.cookie.length; 45 | } 46 | var val = document.cookie.substring(valStart, valEnd); 47 | return val; 48 | } 49 | } 50 | } 51 | return 0; 52 | } 53 | 54 | function writeSetting(cookie, val) 55 | { 56 | if (window.chrome) { 57 | localStorage.setItem(cookie_namespace+"_width",val); 58 | } else { 59 | var date = new Date(); 60 | date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week 61 | expiration = date.toGMTString(); 62 | document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; SameSite=Lax; expires=" + expiration+"; path=/"; 63 | } 64 | } 65 | 66 | function resizeWidth() 67 | { 68 | var windowWidth = $(window).width() + "px"; 69 | var sidenavWidth = $(sidenav).outerWidth(); 70 | content.css({marginLeft:parseInt(sidenavWidth)+"px"}); 71 | if (typeof page_layout!=='undefined' && page_layout==1) { 72 | footer.css({marginLeft:parseInt(sidenavWidth)+"px"}); 73 | } 74 | writeSetting('width',sidenavWidth-barWidth); 75 | } 76 | 77 | function restoreWidth(navWidth) 78 | { 79 | var windowWidth = $(window).width() + "px"; 80 | content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); 81 | if (typeof page_layout!=='undefined' && page_layout==1) { 82 | footer.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); 83 | } 84 | sidenav.css({width:navWidth + "px"}); 85 | } 86 | 87 | function resizeHeight() 88 | { 89 | var headerHeight = header.outerHeight(); 90 | var footerHeight = footer.outerHeight(); 91 | var windowHeight = $(window).height(); 92 | var contentHeight,navtreeHeight,sideNavHeight; 93 | if (typeof page_layout==='undefined' || page_layout==0) { /* DISABLE_INDEX=NO */ 94 | contentHeight = windowHeight - headerHeight - footerHeight; 95 | navtreeHeight = contentHeight; 96 | sideNavHeight = contentHeight; 97 | } else if (page_layout==1) { /* DISABLE_INDEX=YES */ 98 | contentHeight = windowHeight - footerHeight; 99 | navtreeHeight = windowHeight - headerHeight; 100 | sideNavHeight = windowHeight; 101 | } 102 | content.css({height:contentHeight + "px"}); 103 | navtree.css({height:navtreeHeight + "px"}); 104 | sidenav.css({height:sideNavHeight + "px"}); 105 | if (location.hash.slice(1)) { 106 | (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView(); 107 | } 108 | } 109 | 110 | function collapseExpand() 111 | { 112 | var newWidth; 113 | if (sidenav.width()>0) { 114 | newWidth=0; 115 | } 116 | else { 117 | var width = readSetting('width'); 118 | newWidth = (width>250 && width<$(window).width()) ? width : 250; 119 | } 120 | restoreWidth(newWidth); 121 | var sidenavWidth = $(sidenav).outerWidth(); 122 | writeSetting('width',sidenavWidth-barWidth); 123 | } 124 | 125 | header = $("#top"); 126 | sidenav = $("#side-nav"); 127 | content = $("#doc-content"); 128 | navtree = $("#nav-tree"); 129 | footer = $("#nav-path"); 130 | $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); 131 | $(sidenav).resizable({ minWidth: 0 }); 132 | $(window).resize(function() { resizeHeight(); }); 133 | var device = navigator.userAgent.toLowerCase(); 134 | var touch_device = device.match(/(iphone|ipod|ipad|android)/); 135 | if (touch_device) { /* wider split bar for touch only devices */ 136 | $(sidenav).css({ paddingRight:'20px' }); 137 | $('.ui-resizable-e').css({ width:'20px' }); 138 | $('#nav-sync').css({ right:'34px' }); 139 | barWidth=20; 140 | } 141 | var width = readSetting('width'); 142 | if (width) { restoreWidth(width); } else { resizeWidth(); } 143 | resizeHeight(); 144 | var url = location.href; 145 | var i=url.indexOf("#"); 146 | if (i>=0) window.location.hash=url.substr(i); 147 | var _preventDefault = function(evt) { evt.preventDefault(); }; 148 | $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); 149 | if (once) { 150 | $(".ui-resizable-handle").dblclick(collapseExpand); 151 | once=0 152 | } 153 | $(window).on('load',resizeHeight); 154 | } 155 | /* @license-end */ 156 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | .titlearea table { 4 | width: 100%; 5 | } 6 | 7 | dark-mode-toggle { 8 | position: absolute; 9 | right: 5px; 10 | padding-top: 3px; 11 | } 12 | 13 | #MSearchBox { 14 | position: absolute; 15 | right: 34px; 16 | } 17 | 18 | /*---------------- Search box styling */ 19 | 20 | .SRPage * { 21 | font-weight: normal; 22 | line-height: normal; 23 | } 24 | 25 | dark-mode-toggle { 26 | margin-left: 5px; 27 | display: flex; 28 | float: right; 29 | } 30 | 31 | #MSearchBox { 32 | display: inline-block; 33 | white-space : nowrap; 34 | background: var(--search-background-color); 35 | border-radius: 0.65em; 36 | box-shadow: var(--search-box-shadow); 37 | z-index: 102; 38 | } 39 | 40 | #MSearchBox .left { 41 | display: inline-block; 42 | vertical-align: middle; 43 | height: 1.4em; 44 | } 45 | 46 | #MSearchSelect { 47 | display: inline-block; 48 | vertical-align: middle; 49 | width: 20px; 50 | height: 19px; 51 | background-image: var(--search-magnification-select-image); 52 | margin: 0 0 0 0.3em; 53 | padding: 0; 54 | } 55 | 56 | #MSearchSelectExt { 57 | display: inline-block; 58 | vertical-align: middle; 59 | width: 10px; 60 | height: 19px; 61 | background-image: var(--search-magnification-image); 62 | margin: 0 0 0 0.5em; 63 | padding: 0; 64 | } 65 | 66 | 67 | #MSearchField { 68 | display: inline-block; 69 | vertical-align: middle; 70 | width: 7.5em; 71 | height: 19px; 72 | margin: 0 0.15em; 73 | padding: 0; 74 | line-height: 1em; 75 | border:none; 76 | color: var(--search-foreground-color); 77 | outline: none; 78 | font-family: var(--font-family-search); 79 | -webkit-border-radius: 0px; 80 | border-radius: 0px; 81 | background: none; 82 | } 83 | 84 | @media(hover: none) { 85 | /* to avoid zooming on iOS */ 86 | #MSearchField { 87 | font-size: 16px; 88 | } 89 | } 90 | 91 | #MSearchBox .right { 92 | display: inline-block; 93 | vertical-align: middle; 94 | width: 1.4em; 95 | height: 1.4em; 96 | } 97 | 98 | #MSearchClose { 99 | display: none; 100 | font-size: inherit; 101 | background : none; 102 | border: none; 103 | margin: 0; 104 | padding: 0; 105 | outline: none; 106 | 107 | } 108 | 109 | #MSearchCloseImg { 110 | padding: 0.3em; 111 | margin: 0; 112 | } 113 | 114 | .MSearchBoxActive #MSearchField { 115 | color: var(--search-active-color); 116 | } 117 | 118 | 119 | 120 | /*---------------- Search filter selection */ 121 | 122 | #MSearchSelectWindow { 123 | display: none; 124 | position: absolute; 125 | left: 0; top: 0; 126 | border: 1px solid var(--search-filter-border-color); 127 | background-color: var(--search-filter-background-color); 128 | z-index: 10001; 129 | padding-top: 4px; 130 | padding-bottom: 4px; 131 | -moz-border-radius: 4px; 132 | -webkit-border-top-left-radius: 4px; 133 | -webkit-border-top-right-radius: 4px; 134 | -webkit-border-bottom-left-radius: 4px; 135 | -webkit-border-bottom-right-radius: 4px; 136 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 137 | } 138 | 139 | .SelectItem { 140 | font: 8pt var(--font-family-search); 141 | padding-left: 2px; 142 | padding-right: 12px; 143 | border: 0px; 144 | } 145 | 146 | span.SelectionMark { 147 | margin-right: 4px; 148 | font-family: var(--font-family-monospace); 149 | outline-style: none; 150 | text-decoration: none; 151 | } 152 | 153 | a.SelectItem { 154 | display: block; 155 | outline-style: none; 156 | color: var(--search-filter-foreground-color); 157 | text-decoration: none; 158 | padding-left: 6px; 159 | padding-right: 12px; 160 | } 161 | 162 | a.SelectItem:focus, 163 | a.SelectItem:active { 164 | color: var(--search-filter-foreground-color); 165 | outline-style: none; 166 | text-decoration: none; 167 | } 168 | 169 | a.SelectItem:hover { 170 | color: var(--search-filter-highlight-text-color); 171 | background-color: var(--search-filter-highlight-bg-color); 172 | outline-style: none; 173 | text-decoration: none; 174 | cursor: pointer; 175 | display: block; 176 | } 177 | 178 | /*---------------- Search results window */ 179 | 180 | iframe#MSearchResults { 181 | /*width: 60ex;*/ 182 | height: 15em; 183 | } 184 | 185 | #MSearchResultsWindow { 186 | display: none; 187 | position: absolute; 188 | left: 0; top: 0; 189 | border: 1px solid var(--search-results-border-color); 190 | background-color: var(--search-results-background-color); 191 | z-index:10000; 192 | width: 300px; 193 | height: 400px; 194 | overflow: auto; 195 | } 196 | 197 | /* ----------------------------------- */ 198 | 199 | 200 | #SRIndex { 201 | clear:both; 202 | } 203 | 204 | .SREntry { 205 | font-size: 10pt; 206 | padding-left: 1ex; 207 | } 208 | 209 | .SRPage .SREntry { 210 | font-size: 8pt; 211 | padding: 1px 5px; 212 | } 213 | 214 | div.SRPage { 215 | margin: 5px 2px; 216 | background-color: var(--search-results-background-color); 217 | } 218 | 219 | .SRChildren { 220 | padding-left: 3ex; padding-bottom: .5em 221 | } 222 | 223 | .SRPage .SRChildren { 224 | display: none; 225 | } 226 | 227 | .SRSymbol { 228 | font-weight: bold; 229 | color: var(--search-results-foreground-color); 230 | font-family: var(--font-family-search); 231 | text-decoration: none; 232 | outline: none; 233 | } 234 | 235 | a.SRScope { 236 | display: block; 237 | color: var(--search-results-foreground-color); 238 | font-family: var(--font-family-search); 239 | font-size: 8pt; 240 | text-decoration: none; 241 | outline: none; 242 | } 243 | 244 | a.SRSymbol:focus, a.SRSymbol:active, 245 | a.SRScope:focus, a.SRScope:active { 246 | text-decoration: underline; 247 | } 248 | 249 | span.SRScope { 250 | padding-left: 4px; 251 | font-family: var(--font-family-search); 252 | } 253 | 254 | .SRPage .SRStatus { 255 | padding: 2px 5px; 256 | font-size: 8pt; 257 | font-style: italic; 258 | font-family: var(--font-family-search); 259 | } 260 | 261 | .SRResult { 262 | display: none; 263 | } 264 | 265 | div.searchresults { 266 | margin-left: 10px; 267 | margin-right: 10px; 268 | } 269 | 270 | /*---------------- External search page results */ 271 | 272 | .pages b { 273 | color: white; 274 | padding: 5px 5px 3px 5px; 275 | background-image: var(--nav-gradient-active-image-parent); 276 | background-repeat: repeat-x; 277 | text-shadow: 0 1px 1px #000000; 278 | } 279 | 280 | .pages { 281 | line-height: 17px; 282 | margin-left: 4px; 283 | text-decoration: none; 284 | } 285 | 286 | .hl { 287 | font-weight: bold; 288 | } 289 | 290 | #searchresults { 291 | margin-bottom: 20px; 292 | } 293 | 294 | .searchpages { 295 | margin-top: 10px; 296 | } 297 | 298 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/style_template/tab_b.png -------------------------------------------------------------------------------- /documentation/doxygen/style_template/tab_topnav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/documentation/doxygen/style_template/tab_topnav.png -------------------------------------------------------------------------------- /documentation/doxygen/style_template/tabs.js: -------------------------------------------------------------------------------- 1 | var strgURL = location.pathname; // path of current component 2 | 3 | // constructor for the array of objects 4 | function tabElement(id, folderName, tabTxt ) { 5 | this.id = id; // elementID as needed in html; 6 | this.folderName = folderName; // folder name of the component 7 | this.tabTxt = tabTxt; // Text displayed as menu on the web 8 | this.currentListItem = '
  • ' + this.tabTxt + '
  • '; 9 | this.listItem = '
  • ' + this.tabTxt + '
  • '; 10 | }; 11 | 12 | // array of objects 13 | var arr = []; 14 | 15 | // fill array 16 | // arr.push( new tabElement( "Zone", ".", "Zone")); 17 | 18 | // write tabs 19 | // called from the header file. 20 | function writeComponentTabs() { 21 | for ( var i=0; i < arr.length; i++ ) { 22 | str = "/" + arr[i].folderName + "/" 23 | if (strgURL.search(str) > 0) { // if this is the current folder 24 | document.write(arr[i].currentListItem); // then print and highlight the tab 25 | } else { 26 | document.write(arr[i].listItem); // else, print the tab 27 | } 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /documentation/doxygen/style_template/version.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --arm_light_blue: #00C1DE; 3 | --arm_blue: #11809F; 4 | --arm_blue1: #0091BD; 5 | --arm_dark_blue: #002B49; 6 | --arm_light_gray: #E5ECEB; 7 | --arm_light_gray1: #EFF5F4; 8 | --arm_light_gray2: #EBEBEB; 9 | --arm_light_gray3: #F7F7F7; 10 | --arm_dark_gray: #7D868C; 11 | --arm_black: #333E48; 12 | --arm_orange: #FF6B00; 13 | --arm_yellow: #FFC700; 14 | } 15 | 16 | /* Dropdown Button */ 17 | .dropbtn { 18 | margin: 0px; 19 | padding: 0px 20px 0px 0em; 20 | background-image: url("dropdown.png"); 21 | background-repeat: no-repeat; 22 | background-size: 0.5em; 23 | background-position: right center; 24 | cursor: pointer; 25 | } 26 | 27 | /* The container
    - needed to position the dropdown content */ 28 | .dropdown { 29 | position: relative; 30 | display: inline-block; 31 | } 32 | 33 | /* Dropdown Content (Hidden by Default) */ 34 | .dropdown-content { 35 | display: none; 36 | position: absolute; 37 | background-color: var(--arm_light_gray3); 38 | min-width: 160px; 39 | box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4); 40 | white-space: nowrap; 41 | cursor: pointer; 42 | z-index: 1; 43 | } 44 | 45 | /* Links inside the dropdown */ 46 | .dropdown-content a { 47 | # color: black; 48 | color: var(--arm_dark_gray); 49 | padding: 4px 6px; 50 | text-decoration: none; 51 | display: block; 52 | } 53 | 54 | /* Change color of dropdown links on hover */ 55 | .dropdown-content a:hover {background-color: #ddd} 56 | 57 | /* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */ 58 | .show {display:block;} 59 | -------------------------------------------------------------------------------- /documentation/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /documentation/version.js: -------------------------------------------------------------------------------- 1 | function writeVersionDropdown() { 2 | }; 3 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # I/O Retarget example project 2 | 3 | This project prints "Hello World" and a counter value via the UART output. It is configured for Arm Virtual Hardware, but other target hardware that provides a CMSIS Driver:USART can be easily added. 4 | 5 | ## Prerequisites 6 | 7 | ### Tools 8 | 9 | - [CMSIS-Toolbox 2.1.0](https://github.com/Open-CMSIS-Pack/devtools/releases) or higher 10 | - [Arm Compiler for Embedded](https://developer.arm.com/downloads/view/ACOMPE), or 11 | - [GCC Compiler for Arm bare-metal](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) or 12 | - [Clang Compiler](https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm) or 13 | - [IAR Build Tools for Arm](https://www.iar.com/products/architectures/arm/iar-build-tools-for-arm/) 14 | - [Arm Virtual Hardware](https://developer.arm.com/Tools%20and%20Software/Arm%20Virtual%20Hardware) for local execution 15 | 16 | ### Packs 17 | 18 | - Required packs are listed in the file `retarget.csolution.yml` 19 | 20 | ## Project Structure 21 | 22 | The project is generated using the [CMSIS-Toolbox](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-overview.md) and is defined in [`csolution`](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-Input-Format.md) format: 23 | 24 | - `retarget.csolution.yml` lists the required packs and defines the hardware target and build-types (along with the compiler). 25 | - `retarget.cproject.yml` defines the source files and the software components. 26 | 27 | ## Build Project 28 | 29 | Use the `cbuild` command to build the Debug configuration for VHT_CM3 target defined in `retarget.csolution.yml` solution file. 30 | 31 | ```bash 32 | cbuild retarget.csolution.yml -p -r --update-rte -c retarget.Debug+VHT_CM3 33 | ``` 34 | 35 | > **Note** 36 | > - During the build process required packs may be downloaded (`-p` flag). 37 | 38 | By default the project is compiled using GCC as set in `cdefault.yml` file. 39 | One can build the project by specifying the toolchain - AC6, GCC, CLANG and IAR are supported. 40 | 41 | ### To build with Arm Compiler 6: 42 | 43 | ```bash 44 | cbuild retarget.csolution.yml -p -r --update-rte --toolchain AC6 -c retarget.Debug+VHT_CM3 45 | ``` 46 | 47 | ## Execute Project 48 | 49 | The project is configured for execution on Arm Virtual Hardware which removes the requirement for a physical hardware board. 50 | 51 | To execute application image on Arm Virtual Hardware use below command: 52 | ```bash 53 | FVP_MPS2_Cortex-M3 -f fvp-config.txt out/retarget/VHT_CM3/Debug/retarget.elf 54 | ``` 55 | > **Note** 56 | > - For Arm Compiler 6, the application image file has extension `.axf` 57 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/RTE_Device.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Copyright (c) 2016 ARM Ltd. 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. 5 | * In no event will the authors be held liable for any damages arising from 6 | * the use of this software. Permission is granted to anyone to use this 7 | * software for any purpose, including commercial applications, and to alter 8 | * it and redistribute it freely, subject to the following restrictions: 9 | * 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software in 12 | * a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 15 | * 2. Altered source versions must be plainly marked as such, and must not be 16 | * misrepresented as being the original software. 17 | * 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | * 20 | * $Date: 25. April 2016 21 | * $Revision: V1.0.0 22 | * 23 | * Project: RTE Device Configuration for ARM CMSDK_CM device 24 | * -------------------------------------------------------------------------- */ 25 | 26 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 27 | 28 | #ifndef __RTE_DEVICE_H 29 | #define __RTE_DEVICE_H 30 | 31 | // USART0 (Universal synchronous asynchronous receiver transmitter) [Driver_USART0] 32 | // Configuration settings for Driver_USART0 in component ::CMSIS Driver:USART 33 | #define RTE_USART0 1 34 | 35 | 36 | // USART1 (Universal synchronous asynchronous receiver transmitter) [Driver_USART1] 37 | // Configuration settings for Driver_USART1 in component ::CMSIS Driver:USART 38 | #define RTE_USART1 0 39 | 40 | 41 | // USART2 (Universal synchronous asynchronous receiver transmitter) [Driver_USART2] 42 | // Configuration settings for Driver_USART2 in component ::CMSIS Driver:USART 43 | #define RTE_UART2 0 44 | 45 | 46 | // USART3 (Universal synchronous asynchronous receiver transmitter) [Driver_USART3] 47 | // Configuration settings for Driver_USART3 in component ::CMSIS Driver:USART 48 | #define RTE_UART3 0 49 | 50 | #endif /* __RTE_DEVICE_H */ 51 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/RTE_Device.h.base@1.0.0: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------------- 2 | * Copyright (c) 2016 ARM Ltd. 3 | * 4 | * This software is provided 'as-is', without any express or implied warranty. 5 | * In no event will the authors be held liable for any damages arising from 6 | * the use of this software. Permission is granted to anyone to use this 7 | * software for any purpose, including commercial applications, and to alter 8 | * it and redistribute it freely, subject to the following restrictions: 9 | * 10 | * 1. The origin of this software must not be misrepresented; you must not 11 | * claim that you wrote the original software. If you use this software in 12 | * a product, an acknowledgment in the product documentation would be 13 | * appreciated but is not required. 14 | * 15 | * 2. Altered source versions must be plainly marked as such, and must not be 16 | * misrepresented as being the original software. 17 | * 18 | * 3. This notice may not be removed or altered from any source distribution. 19 | * 20 | * $Date: 25. April 2016 21 | * $Revision: V1.0.0 22 | * 23 | * Project: RTE Device Configuration for ARM CMSDK_CM device 24 | * -------------------------------------------------------------------------- */ 25 | 26 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 27 | 28 | #ifndef __RTE_DEVICE_H 29 | #define __RTE_DEVICE_H 30 | 31 | // USART0 (Universal synchronous asynchronous receiver transmitter) [Driver_USART0] 32 | // Configuration settings for Driver_USART0 in component ::CMSIS Driver:USART 33 | #define RTE_USART0 0 34 | 35 | 36 | // USART1 (Universal synchronous asynchronous receiver transmitter) [Driver_USART1] 37 | // Configuration settings for Driver_USART1 in component ::CMSIS Driver:USART 38 | #define RTE_USART1 0 39 | 40 | 41 | // USART2 (Universal synchronous asynchronous receiver transmitter) [Driver_USART2] 42 | // Configuration settings for Driver_USART2 in component ::CMSIS Driver:USART 43 | #define RTE_UART2 0 44 | 45 | 46 | // USART3 (Universal synchronous asynchronous receiver transmitter) [Driver_USART3] 47 | // Configuration settings for Driver_USART3 in component ::CMSIS Driver:USART 48 | #define RTE_UART3 0 49 | 50 | #endif /* __RTE_DEVICE_H */ 51 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/ac6_arm.sct: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m3 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | 4 | /* 5 | ;-------- <<< Use Configuration Wizard in Context Menu >>> ------------------- 6 | */ 7 | 8 | /*--------------------- Flash Configuration ---------------------------------- 9 | ; Flash Configuration 10 | ; Flash Base Address <0x0-0xFFFFFFFF:8> 11 | ; Flash Size (in Bytes) <0x0-0xFFFFFFFF:8> 12 | ; 13 | *----------------------------------------------------------------------------*/ 14 | #define __ROM_BASE 0x00000000 15 | #define __ROM_SIZE 0x00080000 16 | 17 | /*--------------------- Embedded RAM Configuration --------------------------- 18 | ; RAM Configuration 19 | ; RAM Base Address <0x0-0xFFFFFFFF:8> 20 | ; RAM Size (in Bytes) <0x0-0xFFFFFFFF:8> 21 | ; 22 | *----------------------------------------------------------------------------*/ 23 | #define __RAM_BASE 0x20000000 24 | #define __RAM_SIZE 0x00040000 25 | 26 | /*--------------------- Stack / Heap Configuration --------------------------- 27 | ; Stack / Heap Configuration 28 | ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 29 | ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 30 | ; 31 | *----------------------------------------------------------------------------*/ 32 | #define __STACK_SIZE 0x00000200 33 | #define __HEAP_SIZE 0x00000C00 34 | 35 | /* 36 | ;------------- <<< end of configuration section >>> --------------------------- 37 | */ 38 | 39 | 40 | /*---------------------------------------------------------------------------- 41 | User Stack & Heap boundary definition 42 | *----------------------------------------------------------------------------*/ 43 | #define __STACK_TOP (__RAM_BASE + __RAM_SIZE) /* starts at end of RAM */ 44 | #define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */ 45 | 46 | 47 | /*---------------------------------------------------------------------------- 48 | Scatter File Definitions definition 49 | *----------------------------------------------------------------------------*/ 50 | #define __RO_BASE __ROM_BASE 51 | #define __RO_SIZE __ROM_SIZE 52 | 53 | #define __RW_BASE __RAM_BASE 54 | #define __RW_SIZE (__RAM_SIZE - __STACK_SIZE - __HEAP_SIZE) 55 | 56 | 57 | LR_ROM __RO_BASE __RO_SIZE { ; load region size_region 58 | ER_ROM __RO_BASE __RO_SIZE { ; load address = execution address 59 | *.o (RESET, +First) 60 | *(InRoot$$Sections) 61 | .ANY (+RO) 62 | .ANY (+XO) 63 | } 64 | 65 | RW_RAM __RW_BASE __RW_SIZE { ; RW data 66 | .ANY (+RW +ZI) 67 | } 68 | 69 | #if __HEAP_SIZE > 0 70 | ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap 71 | } 72 | #endif 73 | 74 | ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/ac6_arm.sct.base@1.0.0: -------------------------------------------------------------------------------- 1 | #! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m3 -xc 2 | ; command above MUST be in first line (no comment above!) 3 | 4 | /* 5 | ;-------- <<< Use Configuration Wizard in Context Menu >>> ------------------- 6 | */ 7 | 8 | /*--------------------- Flash Configuration ---------------------------------- 9 | ; Flash Configuration 10 | ; Flash Base Address <0x0-0xFFFFFFFF:8> 11 | ; Flash Size (in Bytes) <0x0-0xFFFFFFFF:8> 12 | ; 13 | *----------------------------------------------------------------------------*/ 14 | #define __ROM_BASE 0x00000000 15 | #define __ROM_SIZE 0x00080000 16 | 17 | /*--------------------- Embedded RAM Configuration --------------------------- 18 | ; RAM Configuration 19 | ; RAM Base Address <0x0-0xFFFFFFFF:8> 20 | ; RAM Size (in Bytes) <0x0-0xFFFFFFFF:8> 21 | ; 22 | *----------------------------------------------------------------------------*/ 23 | #define __RAM_BASE 0x20000000 24 | #define __RAM_SIZE 0x00040000 25 | 26 | /*--------------------- Stack / Heap Configuration --------------------------- 27 | ; Stack / Heap Configuration 28 | ; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 29 | ; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 30 | ; 31 | *----------------------------------------------------------------------------*/ 32 | #define __STACK_SIZE 0x00000200 33 | #define __HEAP_SIZE 0x00000C00 34 | 35 | /* 36 | ;------------- <<< end of configuration section >>> --------------------------- 37 | */ 38 | 39 | 40 | /*---------------------------------------------------------------------------- 41 | User Stack & Heap boundary definition 42 | *----------------------------------------------------------------------------*/ 43 | #define __STACK_TOP (__RAM_BASE + __RAM_SIZE) /* starts at end of RAM */ 44 | #define __HEAP_BASE (AlignExpr(+0, 8)) /* starts after RW_RAM section, 8 byte aligned */ 45 | 46 | 47 | /*---------------------------------------------------------------------------- 48 | Scatter File Definitions definition 49 | *----------------------------------------------------------------------------*/ 50 | #define __RO_BASE __ROM_BASE 51 | #define __RO_SIZE __ROM_SIZE 52 | 53 | #define __RW_BASE __RAM_BASE 54 | #define __RW_SIZE (__RAM_SIZE - __STACK_SIZE - __HEAP_SIZE) 55 | 56 | 57 | LR_ROM __RO_BASE __RO_SIZE { ; load region size_region 58 | ER_ROM __RO_BASE __RO_SIZE { ; load address = execution address 59 | *.o (RESET, +First) 60 | *(InRoot$$Sections) 61 | .ANY (+RO) 62 | .ANY (+XO) 63 | } 64 | 65 | RW_RAM __RW_BASE __RW_SIZE { ; RW data 66 | .ANY (+RW +ZI) 67 | } 68 | 69 | #if __HEAP_SIZE > 0 70 | ARM_LIB_HEAP __HEAP_BASE EMPTY __HEAP_SIZE { ; Reserve empty region for heap 71 | } 72 | #endif 73 | 74 | ARM_LIB_STACK __STACK_TOP EMPTY -__STACK_SIZE { ; Reserve empty region for stack 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/gcc_arm.ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/example/RTE/Device/CMSDK_CM3_VHT/gcc_arm.ld -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/gcc_arm.ld.base@1.1.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ARM-software/CMSIS-Compiler/086337f6a2070930d7b089e73c2d3ff1d893a522/example/RTE/Device/CMSDK_CM3_VHT/gcc_arm.ld.base@1.1.0 -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/regions_CMSDK_CM3_VHT.h: -------------------------------------------------------------------------------- 1 | #ifndef REGIONS_CMSDK_CM3_VHT_H 2 | #define REGIONS_CMSDK_CM3_VHT_H 3 | 4 | 5 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 6 | 7 | // Device pack: Keil.V2M-MPS2_CMx_BSP.1.8.0 8 | // Device pack used to generate this file 9 | 10 | // ROM Configuration 11 | // ======================= 12 | // IROM1=<__ROM0> 13 | // Base address <0x0-0xFFFFFFFF:8> 14 | // Defines base address of memory region. 15 | // Default: 0x00000000 16 | #define __ROM0_BASE 0x00000000 17 | // Region size [bytes] <0x0-0xFFFFFFFF:8> 18 | // Defines size of memory region. 19 | // Default: 0x00400000 20 | #define __ROM0_SIZE 0x00400000 21 | // Default region 22 | // Enables memory region globally for the application. 23 | #define __ROM0_DEFAULT 1 24 | // Startup 25 | // Selects region to be used for startup code. 26 | #define __ROM0_STARTUP 1 27 | // 28 | 29 | // 30 | 31 | // RAM Configuration 32 | // ======================= 33 | // IRAM1=<__RAM0> 34 | // Base address <0x0-0xFFFFFFFF:8> 35 | // Defines base address of memory region. 36 | // Default: 0x20000000 37 | #define __RAM0_BASE 0x20000000 38 | // Region size [bytes] <0x0-0xFFFFFFFF:8> 39 | // Defines size of memory region. 40 | // Default: 0x00400000 41 | #define __RAM0_SIZE 0x00400000 42 | // Default region 43 | // Enables memory region globally for the application. 44 | #define __RAM0_DEFAULT 1 45 | // No zero initialize 46 | // Excludes region from zero initialization. 47 | #define __RAM0_NOINIT 0 48 | // 49 | 50 | // 51 | 52 | // Stack / Heap Configuration 53 | // Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 54 | // Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 55 | #define __STACK_SIZE 0x00000400 56 | #define __HEAP_SIZE 0x00000C00 57 | // 58 | 59 | 60 | #endif /* REGIONS_CMSDK_CM3_VHT_H */ 61 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/system_CMSDK_CM3.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file system_CMSDK_CM3.c 3 | * @brief CMSIS System Source File for CMSDK_M3 Device 4 | ******************************************************************************/ 5 | /* Copyright (c) 2011 - 2022 ARM LIMITED 6 | 7 | All rights reserved. 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | - Neither the name of ARM nor the names of its contributors may be used 16 | to endorse or promote products derived from this software without 17 | specific prior written permission. 18 | * 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | ---------------------------------------------------------------------------*/ 31 | 32 | #if defined (CMSDK_CM3) || defined (CMSDK_CM3_VHT) 33 | #include "CMSDK_CM3.h" 34 | #else 35 | #error device not specified! 36 | #endif 37 | 38 | 39 | /*---------------------------------------------------------------------------- 40 | Define clocks 41 | *----------------------------------------------------------------------------*/ 42 | #define XTAL (50000000UL) /* Oscillator frequency */ 43 | 44 | #define SYSTEM_CLOCK (XTAL / 2U) 45 | 46 | /*---------------------------------------------------------------------------- 47 | Exception / Interrupt Vector table 48 | *----------------------------------------------------------------------------*/ 49 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[256]; 50 | 51 | /*---------------------------------------------------------------------------- 52 | System Core Clock Variable 53 | *----------------------------------------------------------------------------*/ 54 | uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */ 55 | 56 | /*---------------------------------------------------------------------------- 57 | System Core Clock update function 58 | *----------------------------------------------------------------------------*/ 59 | void SystemCoreClockUpdate (void) 60 | { 61 | SystemCoreClock = SYSTEM_CLOCK; 62 | } 63 | 64 | /*---------------------------------------------------------------------------- 65 | System initialization function 66 | *----------------------------------------------------------------------------*/ 67 | void SystemInit (void) 68 | { 69 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) 70 | SCB->VTOR = (uint32_t) &(__VECTOR_TABLE[0]); 71 | #endif 72 | 73 | #ifdef UNALIGNED_SUPPORT_DISABLE 74 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; 75 | #endif 76 | 77 | SystemCoreClock = SYSTEM_CLOCK; 78 | } 79 | -------------------------------------------------------------------------------- /example/RTE/Device/CMSDK_CM3_VHT/system_CMSDK_CM3.c.base@1.1.0: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file system_CMSDK_CM3.c 3 | * @brief CMSIS System Source File for CMSDK_M3 Device 4 | ******************************************************************************/ 5 | /* Copyright (c) 2011 - 2022 ARM LIMITED 6 | 7 | All rights reserved. 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | - Neither the name of ARM nor the names of its contributors may be used 16 | to endorse or promote products derived from this software without 17 | specific prior written permission. 18 | * 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | ---------------------------------------------------------------------------*/ 31 | 32 | #if defined (CMSDK_CM3) || defined (CMSDK_CM3_VHT) 33 | #include "CMSDK_CM3.h" 34 | #else 35 | #error device not specified! 36 | #endif 37 | 38 | 39 | /*---------------------------------------------------------------------------- 40 | Define clocks 41 | *----------------------------------------------------------------------------*/ 42 | #define XTAL (50000000UL) /* Oscillator frequency */ 43 | 44 | #define SYSTEM_CLOCK (XTAL / 2U) 45 | 46 | /*---------------------------------------------------------------------------- 47 | Exception / Interrupt Vector table 48 | *----------------------------------------------------------------------------*/ 49 | extern const VECTOR_TABLE_Type __VECTOR_TABLE[256]; 50 | 51 | /*---------------------------------------------------------------------------- 52 | System Core Clock Variable 53 | *----------------------------------------------------------------------------*/ 54 | uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */ 55 | 56 | /*---------------------------------------------------------------------------- 57 | System Core Clock update function 58 | *----------------------------------------------------------------------------*/ 59 | void SystemCoreClockUpdate (void) 60 | { 61 | SystemCoreClock = SYSTEM_CLOCK; 62 | } 63 | 64 | /*---------------------------------------------------------------------------- 65 | System initialization function 66 | *----------------------------------------------------------------------------*/ 67 | void SystemInit (void) 68 | { 69 | #if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U) 70 | SCB->VTOR = (uint32_t) &(__VECTOR_TABLE[0]); 71 | #endif 72 | 73 | #ifdef UNALIGNED_SUPPORT_DISABLE 74 | SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; 75 | #endif 76 | 77 | SystemCoreClock = SYSTEM_CLOCK; 78 | } 79 | -------------------------------------------------------------------------------- /example/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import logging 5 | 6 | from datetime import datetime 7 | from enum import Enum 8 | from glob import glob, iglob 9 | from pathlib import Path 10 | 11 | from zipfile import ZipFile 12 | 13 | from matrix_runner import main, matrix_axis, matrix_action, matrix_command, matrix_filter 14 | 15 | 16 | @matrix_axis("compiler", "c", "Compiler(s) to be considered.") 17 | class CompilerAxis(Enum): 18 | AC6 = ('AC6') 19 | GCC = ('GCC') 20 | IAR = ('IAR') 21 | CLANG = ('Clang') 22 | 23 | @property 24 | def image_ext(self): 25 | ext = { 26 | CompilerAxis.AC6: 'axf', 27 | CompilerAxis.GCC: 'elf', 28 | CompilerAxis.IAR: 'out', 29 | CompilerAxis.CLANG: 'elf', 30 | } 31 | return ext[self] 32 | 33 | @property 34 | def toolchain(self): 35 | ext = { 36 | CompilerAxis.AC6: 'AC6', 37 | CompilerAxis.GCC: 'GCC', 38 | CompilerAxis.IAR: 'IAR', 39 | CompilerAxis.CLANG: 'CLANG' 40 | } 41 | return ext[self] 42 | 43 | 44 | @matrix_axis("build", "b", "Build-type(s) to consider.") 45 | class BuildTypeAxis(Enum): 46 | Debug = ('Debug') 47 | Release = ('Release') 48 | 49 | def solution_file(): 50 | return "retarget.csolution.yml" 51 | 52 | def context(config): 53 | return f"{config.build}+VHT_CM3" 54 | 55 | def config_suffix(config, timestamp=True): 56 | suffix = f"{config.compiler[0]}-{config.build}" 57 | if timestamp: 58 | suffix += f"-{datetime.now().strftime('%Y%m%d%H%M%S')}" 59 | return suffix 60 | 61 | def output_basedir(): 62 | return "out" 63 | 64 | def output_dir(config): 65 | return f"{output_basedir()}/retarget/VHT_CM3/{config.build}" 66 | 67 | @matrix_action 68 | def clean(config): 69 | """Build the selected configurations using CMSIS-Build.""" 70 | yield cbuild_clean(solution_file()) 71 | 72 | 73 | @matrix_action 74 | def build(config, results): 75 | """Build the selected configurations using CMSIS-Build.""" 76 | 77 | logging.info("Compiling Tests...") 78 | 79 | yield cbuild(solution_file(), config) 80 | 81 | if not all(r.success for r in results): 82 | return 83 | 84 | file = f"{output_basedir()}/example-{config_suffix(config)}.zip" 85 | logging.info("Archiving build output to %s...", file) 86 | with ZipFile(file, "w") as archive: 87 | for content in iglob(f"{output_dir(config)}/**/*", recursive=True): 88 | if Path(content).is_file(): 89 | archive.write(content) 90 | 91 | 92 | @matrix_action 93 | def extract(config): 94 | """Extract the latest build archive.""" 95 | archives = sorted(glob(f"{output_basedir()}/example-{config_suffix(config, timestamp=False)}-*.zip"), reverse=True) 96 | yield unzip(archives[0]) 97 | 98 | def expect_in(expectation, text): 99 | if expectation not in text: 100 | raise AssertionError(f"'{expectation}' not found in '{text}'!") 101 | 102 | @matrix_action 103 | def run(config, results): 104 | """Run the selected configurations.""" 105 | logging.info("Running Example on Arm model ...") 106 | yield model_exec(config) 107 | 108 | if not all(r.success for r in results): 109 | return 110 | 111 | try: 112 | output = results[0].output.getvalue() 113 | for i in range(1, 10): 114 | expect_in(f"Hello World {i}", output) 115 | expect_in(f"Finished", output) 116 | except AssertionError as e: 117 | logging.error(e) 118 | results[0].success = False 119 | 120 | @matrix_command() 121 | def cbuild_clean(project): 122 | return ["cbuild", "-p", "-C", project] 123 | 124 | 125 | @matrix_command() 126 | def unzip(archive): 127 | return ["bash", "-c", f"unzip -o {archive}"] 128 | 129 | 130 | @matrix_command() 131 | def cbuild(solution, config): 132 | return ["cbuild", "--toolchain", config.compiler.toolchain, "-p", "--update-rte", \ 133 | "--context", f".{context(config)}", solution ] 134 | 135 | 136 | @matrix_command() 137 | def model_exec(config): 138 | cmdline = ["FVP_MPS2_Cortex-M3", "-q", "--simlimit", 1, "-f", "fvp-config.txt"] 139 | cmdline += ["-a", f"{output_dir(config)}/retarget.{config.compiler.image_ext}"] 140 | return cmdline 141 | 142 | 143 | @matrix_filter 144 | def filter_iar(config): 145 | return config.compiler == CompilerAxis.IAR 146 | 147 | if __name__ == "__main__": 148 | main() 149 | -------------------------------------------------------------------------------- /example/cdefault.yml: -------------------------------------------------------------------------------- 1 | default: 2 | 3 | compiler: GCC 4 | 5 | misc: 6 | - for-compiler: AC6 7 | C-CPP: 8 | - -ffunction-sections 9 | - -Wno-macro-redefined 10 | - -Wno-pragma-pack 11 | - -Wno-parentheses-equality 12 | - -Wno-license-management 13 | C: 14 | - -std=gnu11 15 | ASM: 16 | - -masm=auto 17 | Link: 18 | - --entry=Reset_Handler 19 | - --map 20 | - --info summarysizes 21 | - --summary_stderr 22 | - --diag_suppress=L6314W 23 | 24 | - for-compiler: GCC 25 | C-CPP: 26 | - -masm-syntax-unified 27 | - -fomit-frame-pointer 28 | C: 29 | - -std=gnu11 30 | Link: 31 | - --specs=nano.specs 32 | - -Wl,-Map=$elf()$.map 33 | 34 | - for-compiler: CLANG 35 | C-CPP: 36 | - -fomit-frame-pointer 37 | C: 38 | - -std=gnu11 39 | Link: 40 | - -lcrt0 41 | - -Wl,-Map=$elf()$.map 42 | 43 | - for-compiler: IAR 44 | C-CPP: 45 | - --dlib_config DLib_Config_Full.h 46 | Link: 47 | - --map=$elf()$.map 48 | -------------------------------------------------------------------------------- /example/fvp-config.txt: -------------------------------------------------------------------------------- 1 | # Parameters: 2 | # instance.parameter=value #(type, mode) default = 'def value' : description : [min..max] 3 | #---------------------------------------------------------------------------------------------- 4 | fvp_mps2.mps2_visualisation.disable-visualisation=1 # (bool , init-time) default = '0' : Enable/disable visualisation 5 | armcortexm3ct.semihosting-enable=0 # (bool , init-time) default = '1' : Enable semihosting SVC traps. Applications that do not use semihosting must set this parameter to false. 6 | fvp_mps2.UART0.shutdown_on_eot=1 # (bool , init-time) default = '0' : Shutdown simulation when a EOT (ASCII 4) char is transmitted (useful for regression tests when semihosting is not available) 7 | fvp_mps2.UART0.out_file=- # (string, init-time) default = '' : Output file to hold data written by the UART (use '-' to send all output to stdout) 8 | fvp_mps2.telnetterminal0.start_telnet=0 # (bool , init-time) default = '1' : Start telnet if nothing connected 9 | #---------------------------------------------------------------------------------------------- 10 | -------------------------------------------------------------------------------- /example/main.c: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------- 2 | * Copyright (c) 2023 Arm Limited (or its affiliates). All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | *---------------------------------------------------------------------------*/ 18 | 19 | #include 20 | #include 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | #include "retarget_stdout.h" 26 | 27 | extern int stdout_init (void); 28 | 29 | int main (void) { 30 | uint32_t count; 31 | 32 | stdout_init(); 33 | 34 | printf("Starting ...\r\n"); 35 | 36 | while (1) { 37 | /* Use printf via USART to output "Hello World" lines */ 38 | for (count = 1U; count <= 10U; count++) { 39 | printf ("Hello World %u\r\n", (unsigned int)count); 40 | } 41 | 42 | printf("\r\nFinished\r\n\x04"); 43 | } 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /example/requirements.txt: -------------------------------------------------------------------------------- 1 | python-matrix-runner~=1.0 2 | -------------------------------------------------------------------------------- /example/retarget.cproject.yml: -------------------------------------------------------------------------------- 1 | project: 2 | 3 | packs: 4 | - pack: ARM::CMSIS 5 | - pack: ARM::CMSIS-Compiler 6 | 7 | groups: 8 | - group: Documentation 9 | files: 10 | - file: ./README.md 11 | - group: Main 12 | files: 13 | - file: ./main.c 14 | - file: ./stdout_USART.c 15 | 16 | components: 17 | - component: CMSIS:CORE 18 | - component: CMSIS Driver:USART 19 | - component: CMSIS-Compiler:CORE 20 | - component: CMSIS-Compiler:STDOUT:Custom 21 | - component: Device:Startup&C Startup 22 | - component: Board Support&V2M-MPS2:Common 23 | -------------------------------------------------------------------------------- /example/retarget.csolution.yml: -------------------------------------------------------------------------------- 1 | solution: 2 | created-for: CMSIS-Toolbox@2.0.0 3 | cdefault: 4 | 5 | packs: 6 | - pack: Keil::V2M-MPS2_CMx_BSP@1.8.0 7 | 8 | target-types: 9 | - type: VHT_CM3 10 | device: CMSDK_CM3_VHT 11 | 12 | build-types: 13 | - type: Debug 14 | debug: on 15 | optimize: none 16 | 17 | - type: Release 18 | debug: off 19 | optimize: size 20 | 21 | projects: 22 | - project: ./retarget.cproject.yml 23 | -------------------------------------------------------------------------------- /example/stdout_USART.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: stdout_USART.c 3 | * Purpose: STDOUT USART Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_stdout.h" 26 | #include "Driver_USART.h" 27 | 28 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 29 | 30 | // STDOUT USART Interface 31 | 32 | // Connect to hardware via Driver_USART# <0-255> 33 | // Select driver control block for USART interface 34 | #define USART_DRV_NUM 0 35 | 36 | // Baudrate 37 | #define USART_BAUDRATE 115200 38 | 39 | // 40 | 41 | 42 | #define _USART_Driver_(n) Driver_USART##n 43 | #define USART_Driver_(n) _USART_Driver_(n) 44 | 45 | extern ARM_DRIVER_USART USART_Driver_(USART_DRV_NUM); 46 | #define ptrUSART (&USART_Driver_(USART_DRV_NUM)) 47 | 48 | 49 | /** 50 | Initialize stdout 51 | 52 | \return 0 on success, or -1 on error. 53 | */ 54 | int stdout_init (void) { 55 | int32_t status; 56 | 57 | status = ptrUSART->Initialize(NULL); 58 | if (status != ARM_DRIVER_OK) return (-1); 59 | 60 | status = ptrUSART->PowerControl(ARM_POWER_FULL); 61 | if (status != ARM_DRIVER_OK) return (-1); 62 | 63 | status = ptrUSART->Control(ARM_USART_MODE_ASYNCHRONOUS | 64 | ARM_USART_DATA_BITS_8 | 65 | ARM_USART_PARITY_NONE | 66 | ARM_USART_STOP_BITS_1 | 67 | ARM_USART_FLOW_CONTROL_NONE, 68 | USART_BAUDRATE); 69 | if (status != ARM_DRIVER_OK) return (-1); 70 | 71 | status = ptrUSART->Control(ARM_USART_CONTROL_TX, 1); 72 | if (status != ARM_DRIVER_OK) return (-1); 73 | 74 | return (0); 75 | } 76 | 77 | 78 | /** 79 | Put a character to the stdout 80 | 81 | \param[in] ch Character to output 82 | \return The character written, or -1 on write error. 83 | */ 84 | int stdout_putchar (int ch) { 85 | uint8_t buf[1]; 86 | 87 | buf[0] = ch; 88 | if (ptrUSART->Send(buf, 1) != ARM_DRIVER_OK) { 89 | return (-1); 90 | } 91 | while (ptrUSART->GetTxCount() != 1); 92 | return (ch); 93 | } 94 | -------------------------------------------------------------------------------- /example/vcpkg-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "default-registry": { 3 | "kind": "git", 4 | "baseline": "032d9d0820db290ce9ff644dabfdf564343013ae", 5 | "repository": "https://github.com/microsoft/vcpkg" 6 | }, 7 | "registries": [ 8 | { 9 | "kind": "artifact", 10 | "location": "https://aka.ms/vcpkg-ce-default", 11 | "name": "microsoft" 12 | }, 13 | { 14 | "kind": "artifact", 15 | "location": "https://aka.ms/vcpkg-artifacts-arm", 16 | "name": "arm" 17 | } 18 | ], 19 | "requires": { 20 | "microsoft:cmake": "^3.25.2", 21 | "microsoft:ninja": "^1.10.2", 22 | "arm:compilers/arm/armclang": "^6.20.0", 23 | "arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1", 24 | "arm:compilers/arm/llvm-embedded": "^17.0.1", 25 | "arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.1.0", 26 | "arm:models/arm/avh-fvp": "^11.22.39" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /gen_pack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Version: 3.0 3 | # Date: 2023-11-06 4 | # This bash script generates a CMSIS Software Pack: CMSIS-Compiler 5 | # 6 | 7 | set -o pipefail 8 | 9 | # Set version of gen pack library 10 | # For available versions see https://github.com/Open-CMSIS-Pack/gen-pack/tags. 11 | # Use the tag name without the prefix "v", e.g., 0.7.0 12 | REQUIRED_GEN_PACK_LIB="0.11.1" 13 | 14 | # Set default command line arguments 15 | DEFAULT_ARGS=(-c "v") 16 | 17 | # Pack warehouse directory - destination 18 | # Default: ./output 19 | # 20 | # PACK_OUTPUT=./output 21 | 22 | # Temporary pack build directory, 23 | # Default: ./build 24 | # 25 | # PACK_BUILD=./build 26 | 27 | # Specify directory names to be added to pack base directory 28 | # An empty list defaults to all folders next to this script. 29 | # Default: empty (all folders) 30 | # 31 | PACK_DIRS=" 32 | documentation 33 | example 34 | include 35 | source 36 | template 37 | " 38 | 39 | # Specify file names to be added to pack base directory 40 | # Default: empty 41 | # 42 | PACK_BASE_FILES=" 43 | LICENSE 44 | " 45 | 46 | # Specify file names to be deleted from pack build directory 47 | # Default: empty 48 | # 49 | PACK_DELETE_FILES=" 50 | documentation/doxygen 51 | documentation/README.md 52 | example/build.py 53 | example/requirements.txt 54 | " 55 | 56 | # Specify patches to be applied 57 | # Default: empty 58 | # 59 | # PACK_PATCH_FILES="" 60 | 61 | # Specify addition argument to packchk 62 | # Default: empty 63 | # 64 | PACKCHK_ARGS=() 65 | 66 | # Specify additional dependencies for packchk 67 | # Default: empty 68 | # 69 | PACKCHK_DEPS=" 70 | ARM.CMSIS.pdsc 71 | ARM.CMSIS-View.pdsc 72 | Keil.V2M-MPS2_CMx_BSP.pdsc 73 | " 74 | 75 | # Optional: restrict fallback modes for changelog generation 76 | # Default: full 77 | # Values: 78 | # - full Tag annotations, release descriptions, or commit messages (in order) 79 | # - release Tag annotations, or release descriptions (in order) 80 | # - tag Tag annotations only 81 | # 82 | PACK_CHANGELOG_MODE="tag" 83 | 84 | # 85 | # custom pre-processing steps 86 | # 87 | # usage: preprocess 88 | # The build folder 89 | # 90 | function preprocess() { 91 | # add custom steps here to be executed 92 | # before populating the pack build folder 93 | ./documentation/doxygen/gen_doc.sh 94 | return 0 95 | } 96 | 97 | # 98 | # custom post-processing steps 99 | # 100 | # usage: postprocess 101 | # The build folder 102 | # 103 | function postprocess() { 104 | # add custom steps here to be executed 105 | # after populating the pack build folder 106 | # but before archiving the pack into output folder 107 | return 0 108 | } 109 | 110 | ############ DO NOT EDIT BELOW ########### 111 | 112 | # Set GEN_PACK_LIB_PATH to use a specific gen-pack library root 113 | # ... instead of bootstrap based on REQUIRED_GEN_PACK_LIB 114 | if [[ -f "${GEN_PACK_LIB_PATH}/gen-pack" ]]; then 115 | . "${GEN_PACK_LIB_PATH}/gen-pack" 116 | else 117 | . <(curl -sL "https://raw.githubusercontent.com/Open-CMSIS-Pack/gen-pack/main/bootstrap") 118 | fi 119 | 120 | gen_pack "${DEFAULT_ARGS[@]}" "$@" 121 | 122 | exit 0 123 | -------------------------------------------------------------------------------- /include/armcc/retarget_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_OS_H__ 20 | #define RETARGET_OS_H__ 21 | 22 | /* 23 | The rt_heap.h header file defines the interface for retargeting the heap implementation. 24 | 25 | It provides a way for users to customize the way that the heap is managed, by 26 | defining their own functions for allocating and deallocating memory. 27 | */ 28 | #include 29 | 30 | /* 31 | The rt_locale.h header file enables the retargetting of the locale mechanism. 32 | 33 | It is used to override the default behavior of the locale-related functions 34 | and to provide custom locale functionality. 35 | */ 36 | #include 37 | 38 | /* 39 | The rt_misc.h header file contains definitions for various retargetable functions. 40 | 41 | It includes functions like _getenv_init(), _clock_init(), __user_libspace(), 42 | __rt_lib_init(), __ARM_get_argv(), __rt_lib_shutdown(), __rt_exit(), 43 | __user_initial_stackheap(), __user_heap_extent() and __user_stack_slop() which are 44 | responsible for the initialization, shutdown, and memory allocation of various 45 | parts of the library. 46 | 47 | The header file also includes various structures like __initial_stackheap, 48 | __heap_extent, and __stack_slop, which can be defined by users to give bounds 49 | on the heap and stack address space. 50 | */ 51 | #include 52 | 53 | /* 54 | The time.h header file provides declarations for types, macros, and functions 55 | for manipulating time. 56 | 57 | It defines macros, types, and functions that deal with calendar time, handle 58 | local time expressed for a specific time zone and Daylight Savings Time. 59 | */ 60 | #include 61 | 62 | #ifdef __cplusplus 63 | extern "C" 64 | { 65 | #endif 66 | 67 | /// Retrieve thread local storage 68 | void *__user_perthread_libspace (void); 69 | 70 | /// Mutex type definition 71 | struct rt_mutex_s; 72 | typedef struct rt_mutex_s rt_mutex_t; 73 | 74 | /// Initialize mutex 75 | /// \param[in] mutex Pointer to mutex object 76 | /// \return nonzero value on success, otherwise the function returns 0 77 | int _mutex_initialize(rt_mutex_t *mutex); 78 | 79 | /// Acquire mutex 80 | /// \param[in] mutex Pointer to mutex object 81 | void _mutex_acquire(rt_mutex_t *mutex); 82 | 83 | /// Release mutex 84 | /// \param[in] mutex Pointer to mutex object 85 | void _mutex_release(rt_mutex_t *mutex); 86 | 87 | /// Free mutex 88 | /// \param[in] mutex Pointer to mutex object 89 | void _mutex_free(rt_mutex_t *mutex); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* RETARGET_OS_H__ */ 96 | -------------------------------------------------------------------------------- /include/gcc/retarget_os.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_OS_H__ 20 | #define RETARGET_OS_H__ 21 | 22 | /* 23 | The unistd.h header file contains declarations for types, constants and functions 24 | that provide access to system services. 25 | 26 | It defines functions that perform operations like file I/O, process management and 27 | inter-process communication. 28 | */ 29 | #include 30 | 31 | /* 32 | The fcntl.h header file contains declarations for functions, constants, and types 33 | that provide access to operations on file descriptors. 34 | */ 35 | #include 36 | 37 | /* 38 | The time.h header file provides declarations for types, macros, and functions 39 | for manipulating time. 40 | 41 | It defines macros, types, and functions that deal with calendar time, handle 42 | local time expressed for a specific time zone and Daylight Savings Time. 43 | */ 44 | #include 45 | 46 | /* 47 | The stdio.h header file provides declarations for input and output operations. 48 | */ 49 | #include 50 | 51 | 52 | // ==== Locking Routines ==== 53 | 54 | /// \fn void __retarget_lock_init(_LOCK_T *lock) 55 | /// \brief Allocate lock related resources. 56 | /// \param[in] lock pointer to user defined lock object 57 | 58 | /// \fn void __retarget_lock_init_recursive(_LOCK_T *lock) 59 | /// \brief Allocate recursive lock related resources. 60 | /// \param[in] lock pointer to user defined lock object 61 | 62 | /// \fn void __retarget_lock_close(_LOCK_T lock) 63 | /// \brief Free lock related resources. 64 | /// \param[in] lock user defined lock object 65 | 66 | /// \fn void __retarget_lock_close_recursive(_LOCK_T lock) 67 | /// \brief Free recursive lock related resources. 68 | /// \param[in] lock user defined lock object 69 | 70 | /// \fn void __retarget_lock_acquire(_LOCK_T lock) 71 | /// \brief Acquire lock immediately after the lock object is available. 72 | /// \param[in] lock user defined lock object 73 | 74 | /// \fn void __retarget_lock_acquire_recursive(_LOCK_T lock) 75 | /// \brief Acquire recursive lock immediately after the lock object is available. 76 | /// \param[in] lock user defined lock object 77 | 78 | /// \fn int __retarget_lock_try_acquire(_LOCK_T lock) 79 | /// \brief Acquire lock if the lock object is available. 80 | /// \param[in] lock user defined lock object 81 | /// \return zero for success and non-zero to indicate that the lock cannot be acquired 82 | 83 | /// \fn int __retarget_lock_try_acquire_recursive(_LOCK_T lock) 84 | /// \brief Acquire recursive lock if the lock object is available. 85 | /// \param[in] lock user defined lock object 86 | /// \return zero for success and non-zero to indicate that the lock cannot be acquired 87 | 88 | /// \fn void __retarget_lock_release(_LOCK_T lock) 89 | /// \brief Relinquish the lock ownership. 90 | /// \param[in] lock user defined lock object 91 | 92 | /// \fn void __retarget_lock_release_recursive(_LOCK_T lock) 93 | /// \brief Relinquish the recursive lock ownership. 94 | /// \param[in] lock user defined lock object 95 | 96 | #endif /* RETARGET_OS_H__ */ 97 | -------------------------------------------------------------------------------- /include/retarget_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_FS_H__ 20 | #define RETARGET_FS_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | 27 | #include 28 | 29 | /// File Open Mode definitions 30 | #define RT_OPEN_RDONLY 0x0000 ///< Open file for reading only 31 | #define RT_OPEN_WRONLY 0x0001 ///< Open file for writing only 32 | #define RT_OPEN_RDWR 0x0002 ///< Open file for reading and writing 33 | #define RT_OPEN_APPEND 0x0008 ///< Open file in append mode 34 | #define RT_OPEN_CREATE 0x0100 ///< Create file if it does not exist 35 | #define RT_OPEN_TRUNCATE 0x0200 ///< Truncate existing file 36 | 37 | /// File Attribute definitions 38 | #define RT_ATTR_FILE 0x0001 ///< File is a regular file 39 | #define RT_ATTR_DIR 0x0002 ///< File is a directory 40 | #define RT_ATTR_LINK 0x0004 ///< File is a symbolic link 41 | #define RT_ATTR_RD 0x0100 ///< File read is permitted 42 | #define RT_ATTR_WR 0x0200 ///< File write is permitted 43 | 44 | /// File Seek Operation definitions 45 | #define RT_SEEK_SET 0 ///< Set position offset from the start of the file 46 | #define RT_SEEK_CUR 1 ///< Set position offset from the current location 47 | #define RT_SEEK_END 2 ///< Set position offset from the end of the file 48 | 49 | /// File Operation Return Codes 50 | #define RT_ERR (-1) ///< Unspecified error 51 | #define RT_ERR_NOTSUP (-2) ///< Not supported 52 | #define RT_ERR_INVAL (-3) ///< Invalid argument 53 | #define RT_ERR_IO (-4) ///< Low level I/O error 54 | #define RT_ERR_NOTFOUND (-5) ///< File not found 55 | #define RT_ERR_EXIST (-6) ///< File already exists 56 | #define RT_ERR_ISDIR (-7) ///< File is a directory 57 | #define RT_ERR_NOSPACE (-8) ///< Not enough space or out of memory 58 | #define RT_ERR_READONLY (-9) ///< File is read only 59 | #define RT_ERR_FILEDES (-10) ///< File descriptor error (out of range, file not open, w/r to file opened in r/w mode) 60 | #define RT_ERR_MAXPATH (-11) ///< File or path name is too long 61 | #define RT_ERR_BUSY (-12) ///< File is busy, access is denied 62 | #define RT_ERR_NOTEMPTY (-13) ///< Directory is not empty 63 | #define RT_ERR_MAXFILES (-14) ///< Too many files open 64 | #define RT_ERR_OVERFLOW (-15) ///< Value overflows the specified range 65 | 66 | 67 | /// Time and Date Information 68 | typedef struct rt_fs_time_s { 69 | uint16_t year; ///< Year 70 | uint8_t mon; ///< Month of year [0, 11] 71 | uint8_t day; ///< Day of month [1, 31] 72 | uint8_t hour; ///< Hours [0, 23] 73 | uint8_t min; ///< Minutes [0, 59] 74 | uint8_t sec; ///< Seconds [0, 60] 75 | uint8_t rsvd; ///< Reserved 76 | } rt_fs_time_t; 77 | 78 | ///File Status Information 79 | typedef struct rt_fs_stat_s { 80 | uint32_t attr; ///< File attribute bitmap 81 | rt_fs_time_t access; ///< Last file data access timestamp 82 | rt_fs_time_t modify; ///< Last file data modification timestamp 83 | rt_fs_time_t change; ///< Last file object change timestamp 84 | uint32_t blksize; ///< The size of filesystem block 85 | uint32_t blkcount; ///< Number of allocated filesystem blocks 86 | } rt_fs_stat_t; 87 | 88 | 89 | /// Open a file 90 | /// \param[in] path string specifying the pathname of the file to be opened 91 | /// \param[in] mode integer bitmap specifying the file open mode 92 | /// \return a non-negative integer representing the file descriptor on success, or error code on failure 93 | int32_t rt_fs_open (const char *path, int32_t mode); 94 | 95 | /// Close a file 96 | /// \param[in] fd file descriptor of an opened file 97 | /// \return zero if the file was successfully closed, or error code on failure 98 | int32_t rt_fs_close (int32_t fd); 99 | 100 | /// Write to a file 101 | /// \param[in] fd file descriptor of an opened file 102 | /// \param[in] buf pointer to the buffer containing data to write 103 | /// \param[in] cnt number of bytes to write 104 | /// \return number of bytes actually written, or error code on failure 105 | int32_t rt_fs_write (int32_t fd, const void *buf, uint32_t cnt); 106 | 107 | /// Read from a file 108 | /// \param[in] fd file descriptor of an opened file 109 | /// \param[out] buf pointer to the buffer to store read data 110 | /// \param[in] cnt number of bytes to read 111 | /// \return number of bytes actually read, 0 at the EOF, or error code on failure 112 | int32_t rt_fs_read (int32_t fd, void *buf, uint32_t cnt); 113 | 114 | /// Move the file position pointer 115 | /// \param[in] fd file descriptor of an opened file 116 | /// \param[in] offset the number of bytes to move 117 | /// \param[in] whence file position location (RT_SEEK_SET, RT_SEEK_CUR, RT_SEEK_END) 118 | /// \return current file position from the beginning of the file, or error code on failure 119 | int64_t rt_fs_seek (int32_t fd, int64_t offset, int32_t whence); 120 | 121 | /// Get file size 122 | /// \param[in] fd file descriptor of an opened file 123 | /// \return file size in bytes, or error code on failure 124 | int64_t rt_fs_size (int32_t fd); 125 | 126 | /// Get file status information 127 | /// \param[in] fd file descriptor of an opened file 128 | /// \param[out] stat pointer to a rt_fs_stat_t object to store the status information in 129 | /// \return zero if the file status was successfully retrieved, or error code on failure 130 | int32_t rt_fs_stat (int32_t fd, rt_fs_stat_t *stat); 131 | 132 | /// Remove a file or directory 133 | /// \param[in] path string specifying the pathname 134 | /// \return zero if the file or directory was successfully removed, or error code on failure 135 | int32_t rt_fs_remove (const char *path); 136 | 137 | /// Rename or move a file or directory 138 | /// \param[in] oldpath string specifying file or directory to be renamed 139 | /// \param[in] newpath string specifying the new pathname 140 | /// \return zero if the file or directory was successfully renamed or moved, or error code on failure 141 | int32_t rt_fs_rename (const char *oldpath, const char *newpath); 142 | 143 | #ifdef __cplusplus 144 | } 145 | #endif 146 | 147 | #endif /* RETARGET_FS_H__ */ 148 | -------------------------------------------------------------------------------- /include/retarget_stderr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_STDERR_H__ 20 | #define RETARGET_STDERR_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | 27 | /// Put a character to the stderr 28 | /// \param[in] ch Character to output 29 | /// \return the character written, or -1 on write error 30 | int stderr_putchar (int ch); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* RETARGET_STDERR_H__ */ 37 | -------------------------------------------------------------------------------- /include/retarget_stdin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_STDIN_H__ 20 | #define RETARGET_STDIN_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | 27 | /// Get a character from the stdin 28 | /// \return the next character from the input, or -1 on read error 29 | int stdin_getchar (void); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* RETARGET_STDIN_H__ */ 36 | -------------------------------------------------------------------------------- /include/retarget_stdout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_STDOUT_H__ 20 | #define RETARGET_STDOUT_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | 27 | /// Put a character to the stdout 28 | /// \param[in] ch Character to output 29 | /// \return the character written, or -1 on write error 30 | int stdout_putchar (int ch); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* RETARGET_STDOUT_H__ */ 37 | -------------------------------------------------------------------------------- /include/retarget_tty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef RETARGET_TTY_H__ 20 | #define RETARGET_TTY_H__ 21 | 22 | #ifdef __cplusplus 23 | extern "C" 24 | { 25 | #endif 26 | 27 | /// Put a character to the teletypewritter 28 | /// \param[in] ch Character to output 29 | void ttywrch (int ch); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* RETARGET_TTY_H__ */ 36 | -------------------------------------------------------------------------------- /source/armcc/retarget_os_rtos2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_os.h" 21 | 22 | #include "cmsis_os2.h" 23 | #include "cmsis_compiler.h" 24 | 25 | /* Microlib does not support operating system functions */ 26 | #if !defined(__MICROLIB) 27 | 28 | /* Check if the kernel has been initialized */ 29 | static uint32_t os_kernel_is_initialized (void) { 30 | if (osKernelGetState() > osKernelInactive) { 31 | return 1U; 32 | } else { 33 | return 0U; 34 | } 35 | } 36 | 37 | /* Check if the kernel is running */ 38 | static uint32_t os_kernel_is_running (void) { 39 | if (osKernelGetState() == osKernelRunning) { 40 | return 1U; 41 | } else { 42 | return 0U; 43 | } 44 | } 45 | 46 | /* Check if processor is in Thread or Handler mode */ 47 | static uint32_t is_thread_mode (void) { 48 | if (__get_IPSR() == 0U) { 49 | return 1U; /* Thread mode */ 50 | } else { 51 | return 0U; /* Handler mode */ 52 | } 53 | } 54 | 55 | /* Define retarget mutex structure to hold mutex identifier */ 56 | struct rt_mutex_s { 57 | osMutexId_t id; 58 | }; 59 | 60 | /* Initialize mutex */ 61 | __USED int _mutex_initialize(rt_mutex_t *mutex) { 62 | int result = 0; 63 | 64 | if (os_kernel_is_initialized()) { 65 | mutex->id = osMutexNew(NULL); 66 | 67 | if (mutex->id != NULL) { 68 | result = 1; 69 | } 70 | } 71 | return result; 72 | } 73 | 74 | /* Acquire mutex */ 75 | __USED void _mutex_acquire(rt_mutex_t *mutex) { 76 | if (os_kernel_is_running() && is_thread_mode()) { 77 | (void)osMutexAcquire(mutex->id, osWaitForever); 78 | } 79 | } 80 | 81 | /* Release mutex */ 82 | __USED void _mutex_release(rt_mutex_t *mutex) { 83 | if (os_kernel_is_running() && is_thread_mode()) { 84 | (void)osMutexRelease(mutex->id); 85 | } 86 | } 87 | 88 | /* Free mutex */ 89 | __USED void _mutex_free(rt_mutex_t *mutex) { 90 | (void)osMutexDelete(mutex->id); 91 | } 92 | #endif /* !defined(__MICROLIB) */ 93 | -------------------------------------------------------------------------------- /source/clang/retarget_syscalls.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | #include "RTE_Components.h" 22 | 23 | #ifdef RTE_CMSIS_Compiler_STDERR 24 | #include "retarget_stderr.h" 25 | #endif 26 | 27 | #ifdef RTE_CMSIS_Compiler_STDIN 28 | #include "retarget_stdin.h" 29 | #endif 30 | 31 | #ifdef RTE_CMSIS_Compiler_STDOUT 32 | #include "retarget_stdout.h" 33 | #endif 34 | 35 | #if defined(RTE_CMSIS_Compiler_STDIN) 36 | /** 37 | Get a character from the stdio 38 | 39 | \return The next character from the input, or -1 on read error. 40 | */ 41 | static int stdin_getc(FILE *file) { 42 | (void)file; 43 | return stdin_getchar(); 44 | } 45 | 46 | static FILE __stdin = FDEV_SETUP_STREAM(NULL, 47 | stdin_getc, 48 | NULL, 49 | _FDEV_SETUP_READ); 50 | FILE *const stdin = &__stdin; 51 | 52 | #endif 53 | 54 | #if defined(RTE_CMSIS_Compiler_STDOUT) 55 | /** 56 | Put a character to the stdout 57 | 58 | \param[in] ch Character to output 59 | \return The character written, or -1 on write error. 60 | */ 61 | static int stdout_putc(char c, FILE *file) { 62 | (void)file; 63 | return stdout_putchar(c); 64 | } 65 | 66 | static FILE __stdout = FDEV_SETUP_STREAM(stdout_putc, 67 | NULL, 68 | NULL, 69 | _FDEV_SETUP_WRITE); 70 | FILE *const stdout = &__stdout; 71 | #endif 72 | 73 | 74 | #if defined(RTE_CMSIS_Compiler_STDERR) 75 | /** 76 | Put a character to the stderr 77 | 78 | \param[in] ch Character to output 79 | \return The character written, or -1 on write error. 80 | */ 81 | static int stderr_putc(char c, FILE *file) { 82 | (void)file; 83 | return stderr_putchar(c); 84 | } 85 | 86 | static FILE __stderr = FDEV_SETUP_STREAM(stderr_putc, 87 | NULL, 88 | NULL, 89 | _FDEV_SETUP_WRITE); 90 | FILE *const stderr = &__stderr; 91 | #endif 92 | 93 | /* Terminate a process */ 94 | __attribute__((weak, __noreturn__)) 95 | void _exit (int status) { 96 | for(;;){ ; } 97 | } 98 | -------------------------------------------------------------------------------- /source/gcc/retarget_lock_rtos2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "retarget_os.h" 20 | 21 | #if defined(_RETARGETABLE_LOCKING) && (_RETARGETABLE_LOCKING == 1) 22 | /* 23 | Retargeting routines implementation using CMSIS-RTOS2. 24 | 25 | Multi-threaded applications are required to provide an implementation for 26 | all __retarget routines and static locks defined in sys/lock.h. 27 | If some routines or static locks are missing, the link fails with doubly 28 | defined symbols. 29 | */ 30 | #include 31 | #include "cmsis_compiler.h" 32 | #include "cmsis_os2.h" 33 | 34 | /* Lock structure holds mutex object pointer */ 35 | struct __lock { 36 | int irqmask; 37 | void *mutex; 38 | }; 39 | 40 | /* Newlib mutexes */ 41 | struct __lock __lock___sinit_recursive_mutex = {0}; 42 | struct __lock __lock___sfp_recursive_mutex = {0}; 43 | struct __lock __lock___atexit_recursive_mutex = {0}; 44 | struct __lock __lock___at_quick_exit_mutex = {0}; 45 | struct __lock __lock___malloc_recursive_mutex = {0}; 46 | struct __lock __lock___env_recursive_mutex = {0}; 47 | struct __lock __lock___tz_mutex = {0}; 48 | struct __lock __lock___dd_hash_mutex = {0}; 49 | struct __lock __lock___arc4random_mutex = {0}; 50 | 51 | 52 | /* Check if function is called from thread of from irq. */ 53 | __STATIC_INLINE int is_irq_mode (void) { 54 | if (__get_IPSR() == 0U) { 55 | return 0; /* Thread mode */ 56 | } else { 57 | return 1; /* Handler mode */ 58 | } 59 | } 60 | 61 | /* Check if interrupts are masked (i.e. disabled) */ 62 | __STATIC_INLINE int is_irq_masked (void) { 63 | #if ((defined(__ARM_ARCH_7M__) && (__ARM_ARCH_7M__ != 0)) || \ 64 | (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ != 0)) || \ 65 | (defined(__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ != 0)) || \ 66 | (defined(__ARM_ARCH_8_1M_MAIN__) && (__ARM_ARCH_8_1M_MAIN__ != 0))) 67 | return ((__get_PRIMASK() != 0U) || (__get_BASEPRI() != 0U)); 68 | #else 69 | return (__get_PRIMASK() != 0U); 70 | #endif 71 | } 72 | 73 | /* Initialize a mutex */ 74 | static osMutexId_t mutex_init (uint32_t attr_bits) { 75 | osMutexId_t id; 76 | osMutexAttr_t attr; 77 | 78 | attr.name = NULL; 79 | attr.attr_bits = osMutexPrioInherit | attr_bits; 80 | attr.cb_mem = NULL; 81 | attr.cb_size = 0U; 82 | 83 | id = osMutexNew (&attr); 84 | 85 | return (id); 86 | } 87 | 88 | /* Acquire mutex */ 89 | static int mutex_acquire (osMutexId_t *p_mutex, uint32_t attr_bits, uint32_t timeout) { 90 | osMutexId_t id; 91 | int rval = -1; 92 | 93 | id = *p_mutex; 94 | 95 | if (id == NULL) { 96 | /* Create mutex */ 97 | id = mutex_init (attr_bits); 98 | 99 | /* Set mutex id */ 100 | *p_mutex = id; 101 | } 102 | 103 | if (id != NULL) { 104 | if (osKernelGetState() == osKernelRunning) { 105 | /* Kernel is running, acquire mutex */ 106 | if (osMutexAcquire (id, timeout) == osOK) { 107 | rval = 0; 108 | } 109 | } 110 | } 111 | 112 | return (rval); 113 | } 114 | 115 | /* Release mutex */ 116 | static int mutex_release (osMutexId_t id) { 117 | int rval = -1; 118 | 119 | if (osMutexRelease (id) == osOK) { 120 | rval = 0; 121 | } 122 | return (rval); 123 | } 124 | 125 | /* Free mutex object */ 126 | static int mutex_deinit (osMutexId_t *id) { 127 | int rval = -1; 128 | 129 | if (osMutexDelete (id) == osOK) { 130 | rval = 0; 131 | } 132 | return (rval); 133 | } 134 | 135 | 136 | /* Allocate lock related resources */ 137 | void __retarget_lock_init (_LOCK_T *lock) { 138 | /* Allocate lock structure */ 139 | *lock = malloc(sizeof(struct __lock)); 140 | 141 | if (*lock != NULL) { 142 | /* Initialize lock object */ 143 | (*lock)->mutex = mutex_init (0U); 144 | } else { 145 | /* Out of memory */ 146 | abort(); 147 | } 148 | } 149 | 150 | 151 | /* Allocate recursive lock related resources */ 152 | void __retarget_lock_init_recursive (_LOCK_T *lock) { 153 | /* Allocate lock structure */ 154 | *lock = malloc(sizeof(struct __lock)); 155 | 156 | if (*lock != NULL) { 157 | /* Initialize lock object */ 158 | (*lock)->mutex = mutex_init (osMutexRecursive); 159 | } else { 160 | /* Out of memory */ 161 | abort(); 162 | } 163 | } 164 | 165 | 166 | /* Free lock related resources */ 167 | void __retarget_lock_close (_LOCK_T lock) { 168 | __retarget_lock_close_recursive (lock); 169 | } 170 | 171 | 172 | /* Free recursive lock related resources */ 173 | void __retarget_lock_close_recursive (_LOCK_T lock) { 174 | /* Delete lock object */ 175 | (void)mutex_deinit(lock->mutex); 176 | 177 | /* Free lock structure */ 178 | free(lock); 179 | } 180 | 181 | 182 | /* Acquire lock immediately after the lock object is available */ 183 | void __retarget_lock_acquire (_LOCK_T lock) { 184 | 185 | if (is_irq_mode() == 1) { 186 | /* Called from irq context */ 187 | if (is_irq_masked() == 0) { 188 | /* Interrupts are not disabled */ 189 | __disable_irq(); 190 | 191 | /* Set lock variable */ 192 | lock->irqmask = 1; 193 | } 194 | } 195 | else { 196 | (void)mutex_acquire (&lock->mutex, 0U, osWaitForever); 197 | } 198 | } 199 | 200 | 201 | /* Acquire recursive lock immediately after the lock object is available */ 202 | void __retarget_lock_acquire_recursive (_LOCK_T lock) { 203 | 204 | if (is_irq_mode() == 1) { 205 | /* Called from irq context */ 206 | if (is_irq_masked() == 0) { 207 | /* Interrupts are not disabled */ 208 | __disable_irq(); 209 | 210 | /* Set lock variable */ 211 | lock->irqmask = 1; 212 | } 213 | } 214 | else { 215 | (void)mutex_acquire (&lock->mutex, osMutexRecursive, osWaitForever); 216 | } 217 | } 218 | 219 | 220 | /* Acquire lock if the lock object is available */ 221 | int __retarget_lock_try_acquire (_LOCK_T lock) { 222 | int rval; 223 | 224 | if (is_irq_mode() == 1) { 225 | /* Called from irq context */ 226 | rval = -1; 227 | } else { 228 | rval = mutex_acquire (&lock->mutex, 0U, 0U); 229 | } 230 | 231 | /* Return zero for success and non-zero to indicate that the lock cannot be acquired */ 232 | return (rval); 233 | } 234 | 235 | 236 | /* Acquire recursive lock if the lock object is available */ 237 | int __retarget_lock_try_acquire_recursive (_LOCK_T lock) { 238 | int rval; 239 | 240 | if (is_irq_mode() == 1) { 241 | /* Called from irq context */ 242 | rval = -1; 243 | } else { 244 | rval = mutex_acquire (&lock->mutex, osMutexRecursive, 0U); 245 | } 246 | 247 | /* Return zero for success and non-zero to indicate that the lock cannot be acquired */ 248 | return (rval); 249 | } 250 | 251 | 252 | /* Relinquish the lock ownership */ 253 | void __retarget_lock_release (_LOCK_T lock) { 254 | __retarget_lock_release_recursive (lock); 255 | } 256 | 257 | 258 | /* Relinquish the recursive lock ownership */ 259 | void __retarget_lock_release_recursive (_LOCK_T lock) { 260 | 261 | if (lock->irqmask == 1) { 262 | /* Lock acquire disabled interrupts, clear lock variable */ 263 | lock->irqmask = 0; 264 | 265 | /* Re-enable interrupts */ 266 | __enable_irq(); 267 | } 268 | else { 269 | (void)mutex_release (lock->mutex); 270 | } 271 | } 272 | #endif /* _RETARGETABLE_LOCKING */ 273 | -------------------------------------------------------------------------------- /source/iar/retarget_io.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | 21 | #include "RTE_Components.h" 22 | 23 | #ifdef RTE_CMSIS_Compiler_STDERR 24 | #include "retarget_stderr.h" 25 | #endif 26 | 27 | #ifdef RTE_CMSIS_Compiler_STDIN 28 | #include "retarget_stdin.h" 29 | #endif 30 | 31 | #ifdef RTE_CMSIS_Compiler_STDOUT 32 | #include "retarget_stdout.h" 33 | #endif 34 | 35 | #if defined(RTE_CMSIS_Compiler_STDIN) 36 | 37 | size_t __read(int handle, unsigned char *buf, size_t bufSize) 38 | { 39 | #if defined(RTE_CMSIS_Compiler_STDIN) 40 | if (handle == 0) 41 | { 42 | size_t nChars = 0; 43 | for (size_t i = bufSize; i > 0; --i) 44 | { 45 | const int c = stdin_getchar(); 46 | if (c < 0) { 47 | break; 48 | } 49 | *buf++ = (unsigned char)c; 50 | nChars++; 51 | } 52 | return nChars; 53 | } 54 | #endif 55 | 56 | return -1; 57 | } 58 | 59 | #endif 60 | 61 | #if defined(RTE_CMSIS_Compiler_STDOUT) || defined(RTE_CMSIS_Compiler_STDERR) 62 | 63 | size_t __write(int handle, const unsigned char *buf, size_t bufSize) 64 | { 65 | /* Check for the command to flush all handles */ 66 | if (handle == -1) 67 | { 68 | return 0; 69 | } 70 | 71 | #if defined(RTE_CMSIS_Compiler_STDOUT) 72 | if (handle == 1 /* stdout */) { 73 | for (size_t i = bufSize; i > 0; --i) 74 | { 75 | stdout_putchar(*buf++); 76 | } 77 | return bufSize; 78 | } 79 | #endif 80 | 81 | #if defined(RTE_CMSIS_Compiler_STDERR) 82 | if (handle == 2 /* stderr */) { 83 | for (size_t i = bufSize; i > 0; --i) 84 | { 85 | stderr_putchar(*buf); 86 | ++buf; 87 | } 88 | return bufSize; 89 | } 90 | #endif 91 | return -1; 92 | } 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /source/iar/retarget_os_rtos2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "cmsis_os2.h" 20 | #include "cmsis_compiler.h" 21 | 22 | /* Check if the kernel has been initialized */ 23 | static uint32_t os_kernel_is_initialized (void) { 24 | if (osKernelGetState() > osKernelInactive) { 25 | return 1U; 26 | } else { 27 | return 0U; 28 | } 29 | } 30 | 31 | /* Check if the kernel is running */ 32 | static uint32_t os_kernel_is_running (void) { 33 | if (osKernelGetState() == osKernelRunning) { 34 | return 1U; 35 | } else { 36 | return 0U; 37 | } 38 | } 39 | 40 | /* Check if processor is in Thread or Handler mode */ 41 | static uint32_t is_thread_mode (void) { 42 | if (__get_IPSR() == 0U) { 43 | return 1U; /* Thread mode */ 44 | } else { 45 | return 0U; /* Handler mode */ 46 | } 47 | } 48 | 49 | /* Define retarget mutex structure to hold mutex identifier */ 50 | struct rt_mutex_s { 51 | osMutexId_t id; 52 | }; 53 | 54 | #pragma language=save 55 | #pragma language=extended 56 | /* Initialize mutex */ 57 | __USED void __iar_system_Mtxinit(struct rt_mutex_s *mutex) 58 | { 59 | if (os_kernel_is_initialized()) { 60 | mutex->id = osMutexNew(NULL); 61 | } 62 | } 63 | 64 | /* Acquire mutex */ 65 | __USED void __iar_system_Mtxlock(struct rt_mutex_s *mutex) 66 | { 67 | if (os_kernel_is_running() && is_thread_mode()) { 68 | (void)osMutexAcquire(mutex->id, osWaitForever); 69 | } 70 | } 71 | 72 | /* Release mutex */ 73 | __USED void __iar_system_Mtxunlock(struct rt_mutex_s *mutex) // Unlock a system lock 74 | { 75 | if (os_kernel_is_running() && is_thread_mode()) { 76 | (void)osMutexRelease(mutex->id); 77 | } 78 | } 79 | 80 | /* Free mutex */ 81 | __USED void __iar_system_Mtxdst(struct rt_mutex_s *mutex) // Destroy a system lock 82 | { 83 | (void)osMutexDelete(mutex->id); 84 | } 85 | 86 | //#endif //defined(_DLIB_THREAD_SUPPORT) && _DLIB_THREAD_SUPPORT > 0 87 | 88 | /* Initialize mutex */ 89 | __USED void __iar_file_Mtxinit(struct rt_mutex_s *mutex) 90 | { 91 | if (os_kernel_is_initialized()) { 92 | mutex->id = osMutexNew(NULL); 93 | } 94 | } 95 | 96 | /* Acquire mutex */ 97 | __USED void __iar_file_Mtxlock(struct rt_mutex_s *mutex) 98 | { 99 | if (os_kernel_is_running() && is_thread_mode()) { 100 | (void)osMutexAcquire(mutex->id, osWaitForever); 101 | } 102 | } 103 | 104 | /* Release mutex */ 105 | __USED void __iar_file_Mtxunlock(struct rt_mutex_s *mutex) // Unlock a system lock 106 | { 107 | if (os_kernel_is_running() && is_thread_mode()) { 108 | (void)osMutexRelease(mutex->id); 109 | } 110 | } 111 | 112 | /* Free mutex */ 113 | __USED void __iar_file_Mtxdst(struct rt_mutex_s *mutex) // Destroy a system lock 114 | { 115 | (void)osMutexDelete(mutex->id); 116 | } 117 | 118 | #pragma language=restore 119 | -------------------------------------------------------------------------------- /source/retarget_fs_bkpt.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: retarget_fs_bkpt.c 3 | * Purpose: File Interface Retarget to Breakpoint 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include 26 | #include "retarget_fs.h" 27 | 28 | #include "RTE_Components.h" 29 | #include CMSIS_device_header 30 | 31 | /* Open a file */ 32 | int32_t rt_fs_open (const char *path, int32_t mode) { 33 | (void)path; 34 | (void)mode; 35 | 36 | __ASM("BKPT 0"); 37 | return (RT_ERR); 38 | } 39 | 40 | /* Close a file */ 41 | int32_t rt_fs_close (int32_t fd) { 42 | (void)fd; 43 | 44 | __ASM("BKPT 0"); 45 | return (RT_ERR); 46 | } 47 | 48 | /* Write to a file */ 49 | int32_t rt_fs_write (int32_t fd, const void *buf, uint32_t cnt) { 50 | (void)fd; 51 | (void)buf; 52 | (void)cnt; 53 | 54 | __ASM("BKPT 0"); 55 | return (RT_ERR); 56 | } 57 | 58 | /* Read from a file */ 59 | int32_t rt_fs_read (int32_t fd, void *buf, uint32_t cnt) { 60 | (void)fd; 61 | (void)buf; 62 | (void)cnt; 63 | 64 | __ASM("BKPT 0"); 65 | return (RT_ERR); 66 | } 67 | 68 | /* Move the file position pointer */ 69 | int64_t rt_fs_seek (int32_t fd, int64_t offset, int32_t whence) { 70 | (void)fd; 71 | (void)offset; 72 | (void)whence; 73 | 74 | __ASM("BKPT 0"); 75 | return (RT_ERR); 76 | } 77 | 78 | /* Get file size */ 79 | int64_t rt_fs_size (int32_t fd) { 80 | (void)fd; 81 | 82 | __ASM("BKPT 0"); 83 | return (RT_ERR); 84 | } 85 | 86 | /* Get file status information */ 87 | int32_t rt_fs_stat (int32_t fd, rt_fs_stat_t *stat) { 88 | (void)fd; 89 | (void)stat; 90 | 91 | __ASM("BKPT 0"); 92 | return (RT_ERR); 93 | } 94 | 95 | /* Remove a file or directory */ 96 | int32_t rt_fs_remove (const char *path) { 97 | (void)path; 98 | 99 | __ASM("BKPT 0"); 100 | return (RT_ERR); 101 | } 102 | 103 | /* Rename or move a file or directory */ 104 | int32_t rt_fs_rename (const char *oldpath, const char *newpath) { 105 | (void)oldpath; 106 | (void)newpath; 107 | 108 | __ASM("BKPT 0"); 109 | return (RT_ERR); 110 | } 111 | -------------------------------------------------------------------------------- /source/stderr_bkpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "retarget_stderr.h" 20 | 21 | #include "RTE_Components.h" 22 | #include CMSIS_device_header 23 | 24 | /** 25 | Put a character to the stderr 26 | 27 | \param[in] ch Character to output 28 | \return The character written, or -1 on write error. 29 | */ 30 | int stderr_putchar (int ch) { 31 | __ASM("BKPT 0"); 32 | return (ch); 33 | } 34 | -------------------------------------------------------------------------------- /source/stderr_evr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stderr.h" 21 | 22 | #include "EventRecorder.h" 23 | 24 | /** 25 | Put a character to the stderr 26 | 27 | \param[in] ch Character to output 28 | \return The character written, or -1 on write error. 29 | */ 30 | int stderr_putchar (int ch) { 31 | static uint32_t index = 0U; 32 | static uint8_t buffer[8]; 33 | 34 | if (index >= 8U) { 35 | return (-1); 36 | } 37 | buffer[index++] = (uint8_t)ch; 38 | if ((index == 8U) || (ch == '\n')) { 39 | EventRecordData(EventID(EventLevelError, 0xFE, 0x00), buffer, index); 40 | index = 0U; 41 | } 42 | return (ch); 43 | } 44 | -------------------------------------------------------------------------------- /source/stderr_itm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stderr.h" 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | /** 26 | Put a character to the stderr 27 | 28 | \param[in] ch Character to output 29 | \return The character written, or -1 on write error. 30 | */ 31 | int stderr_putchar (int ch) { 32 | return ((int)ITM_SendChar((uint32_t)ch)); 33 | } 34 | -------------------------------------------------------------------------------- /source/stdin_bkpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stdin.h" 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | /** 26 | Get a character from the stdio 27 | 28 | \return The next character from the input, or -1 on read error. 29 | */ 30 | int stdin_getchar (void) { 31 | int32_t ch = -1; 32 | 33 | __ASM("BKPT 0"); 34 | return (ch); 35 | } 36 | -------------------------------------------------------------------------------- /source/stdin_itm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stdin.h" 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | #ifndef CMSIS_Compiler_CORE_ITM_RXBUFFER_DISABLE 26 | /* Value identifying ITM_RxBuffer is ready for next character */ 27 | #define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) 28 | 29 | /* Variable to receive ITM characters */ 30 | extern 31 | volatile int32_t ITM_RxBuffer; 32 | volatile int32_t ITM_RxBuffer = ITM_RXBUFFER_EMPTY; 33 | #endif /* CMSIS_Compiler_CORE_ITM_RXBUFFER_DISABLE */ 34 | 35 | /** 36 | Get a character from the stdio 37 | 38 | \return The next character from the input, or -1 on read error. 39 | */ 40 | int stdin_getchar (void) { 41 | int32_t ch; 42 | 43 | do { 44 | ch = ITM_ReceiveChar(); 45 | } while (ch == -1); 46 | return (ch); 47 | } 48 | -------------------------------------------------------------------------------- /source/stdout_bkpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "retarget_stdout.h" 20 | 21 | #include "RTE_Components.h" 22 | #include CMSIS_device_header 23 | 24 | /** 25 | Put a character to the stdout 26 | 27 | \param[in] ch Character to output 28 | \return The character written, or -1 on write error. 29 | */ 30 | int stdout_putchar (int ch) { 31 | __ASM("BKPT 0"); 32 | return (ch); 33 | } 34 | -------------------------------------------------------------------------------- /source/stdout_evr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stdout.h" 21 | 22 | #include "EventRecorder.h" 23 | 24 | /** 25 | Put a character to the stdout 26 | 27 | \param[in] ch Character to output 28 | \return The character written, or -1 on write error. 29 | */ 30 | int stdout_putchar (int ch) { 31 | static uint32_t index = 0U; 32 | static uint8_t buffer[8]; 33 | 34 | if (index >= 8U) { 35 | return (-1); 36 | } 37 | buffer[index++] = (uint8_t)ch; 38 | if ((index == 8U) || (ch == '\n')) { 39 | EventRecordData(EventID(EventLevelOp, 0xFE, 0x00), buffer, index); 40 | index = 0U; 41 | } 42 | return (ch); 43 | } 44 | -------------------------------------------------------------------------------- /source/stdout_itm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_stdout.h" 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | /** 26 | Put a character to the stdout 27 | 28 | \param[in] ch Character to output 29 | \return The character written, or -1 on write error. 30 | */ 31 | int stdout_putchar (int ch) { 32 | return ((int)ITM_SendChar((uint32_t)ch)); 33 | } 34 | -------------------------------------------------------------------------------- /source/tty_bkpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "retarget_tty.h" 20 | 21 | #include "RTE_Components.h" 22 | #include CMSIS_device_header 23 | 24 | /** 25 | Put a character to the teletypewritter 26 | 27 | \param[in] ch Character to output 28 | */ 29 | void ttywrch (int ch) { 30 | (void)ch; 31 | __ASM("BKPT 0"); 32 | } 33 | -------------------------------------------------------------------------------- /source/tty_itm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include 20 | #include "retarget_tty.h" 21 | 22 | #include "RTE_Components.h" 23 | #include CMSIS_device_header 24 | 25 | /** 26 | Put a character to the teletypewritter 27 | 28 | \param[in] ch Character to output 29 | */ 30 | void ttywrch (int ch) { 31 | ITM_SendChar((uint32_t)ch); 32 | } 33 | -------------------------------------------------------------------------------- /template/file_interface/retarget_fs.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: retarget_fs.c 3 | * Purpose: File Interface Retarget Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_fs.h" 26 | 27 | /* Open a file */ 28 | int32_t rt_fs_open (const char *path, int32_t mode) { 29 | // ... 30 | return (RT_ERR); 31 | } 32 | 33 | /* Close a file */ 34 | int32_t rt_fs_close (int32_t fd) { 35 | // ... 36 | return (RT_ERR); 37 | } 38 | 39 | /* Write to a file */ 40 | int32_t rt_fs_write (int32_t fd, const void *buf, uint32_t cnt) { 41 | // ... 42 | return (RT_ERR); 43 | } 44 | 45 | /* Read from a file */ 46 | int32_t rt_fs_read (int32_t fd, void *buf, uint32_t cnt) { 47 | // ... 48 | return (RT_ERR); 49 | } 50 | 51 | /* Move the file position pointer */ 52 | int64_t rt_fs_seek (int32_t fd, int64_t offset, int32_t whence) { 53 | // ... 54 | return (RT_ERR); 55 | } 56 | 57 | /* Get file size */ 58 | int64_t rt_fs_size (int32_t fd) { 59 | // ... 60 | return (RT_ERR); 61 | } 62 | 63 | /* Get file status information */ 64 | int32_t rt_fs_stat (int32_t fd, rt_fs_stat_t *stat) { 65 | // ... 66 | return (RT_ERR); 67 | } 68 | 69 | /* Remove a file or directory */ 70 | int32_t rt_fs_remove (const char *path) { 71 | // ... 72 | return (RT_ERR); 73 | } 74 | 75 | /* Rename or move a file or directory */ 76 | int32_t rt_fs_rename (const char *oldpath, const char *newpath) { 77 | // ... 78 | return (RT_ERR); 79 | } 80 | -------------------------------------------------------------------------------- /template/os_interface/armcc/retarget_os.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: retarget_os.c 3 | * Purpose: OS Interface Retarget Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | /* Mutex identifier */ 26 | typedef void *mutex; 27 | 28 | /* Mutex function prototypes */ 29 | int _mutex_initialize(mutex *m); 30 | void _mutex_acquire (mutex *m); 31 | void _mutex_release (mutex *m); 32 | void _mutex_free (mutex *m); 33 | 34 | /* Initialize mutex */ 35 | int _mutex_initialize(mutex *m) { 36 | /* .. */ 37 | return 0; 38 | } 39 | 40 | /* Acquire mutex */ 41 | void _mutex_acquire(mutex *m) { 42 | /* .. */ 43 | } 44 | 45 | /* Release mutex */ 46 | void _mutex_release(mutex *m) { 47 | /* .. */ 48 | } 49 | 50 | /* Free mutex */ 51 | void _mutex_free(mutex *m) { 52 | /* .. */ 53 | } 54 | -------------------------------------------------------------------------------- /template/os_interface/gcc/retarget_lock.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: retarget_lock.c 3 | * Purpose: Locking Routines Retarget Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include 26 | 27 | /* Lock structure definition */ 28 | struct __lock { 29 | /* ... */ 30 | }; 31 | 32 | /* Newlib mutexes */ 33 | struct __lock __lock___sinit_recursive_mutex = {0}; 34 | struct __lock __lock___sfp_recursive_mutex = {0}; 35 | struct __lock __lock___atexit_recursive_mutex = {0}; 36 | struct __lock __lock___at_quick_exit_mutex = {0}; 37 | struct __lock __lock___malloc_recursive_mutex = {0}; 38 | struct __lock __lock___env_recursive_mutex = {0}; 39 | struct __lock __lock___tz_mutex = {0}; 40 | struct __lock __lock___dd_hash_mutex = {0}; 41 | struct __lock __lock___arc4random_mutex = {0}; 42 | 43 | 44 | /* Allocate lock related resources */ 45 | void __retarget_lock_init (_LOCK_T *lock) { 46 | /* .. */ 47 | } 48 | 49 | 50 | /* Allocate recursive lock related resources */ 51 | void __retarget_lock_init_recursive (_LOCK_T *lock) { 52 | /* .. */ 53 | } 54 | 55 | 56 | /* Free lock related resources */ 57 | void __retarget_lock_close (_LOCK_T lock) { 58 | /* .. */ 59 | } 60 | 61 | 62 | /* Free recursive lock related resources */ 63 | void __retarget_lock_close_recursive (_LOCK_T lock) { 64 | /* .. */ 65 | } 66 | 67 | 68 | /* Acquire lock immediately after the lock object is available */ 69 | void __retarget_lock_acquire (_LOCK_T lock) { 70 | /* .. */ 71 | } 72 | 73 | 74 | /* Acquire recursive lock immediately after the lock object is available */ 75 | void __retarget_lock_acquire_recursive (_LOCK_T lock) { 76 | /* .. */ 77 | } 78 | 79 | 80 | /* Acquire lock if the lock object is available */ 81 | int __retarget_lock_try_acquire (_LOCK_T lock) { 82 | /* .. */ 83 | return -1; 84 | } 85 | 86 | 87 | /* Acquire recursive lock if the lock object is available */ 88 | int __retarget_lock_try_acquire_recursive (_LOCK_T lock) { 89 | /* .. */ 90 | return -1; 91 | } 92 | 93 | 94 | /* Relinquish the lock ownership */ 95 | void __retarget_lock_release (_LOCK_T lock) { 96 | /* .. */ 97 | } 98 | 99 | 100 | /* Relinquish the recursive lock ownership */ 101 | void __retarget_lock_release_recursive (_LOCK_T lock) { 102 | /* .. */ 103 | } 104 | -------------------------------------------------------------------------------- /template/os_interface/gcc/retarget_syscalls.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: retarget_syscalls.c 3 | * Purpose: System Call Routines Retarget Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /* Open file */ 30 | int _open (const char *path, int oflag, ...) { 31 | // ... 32 | return (-1); 33 | } 34 | 35 | 36 | /* Close a file descriptor */ 37 | int _close (int fildes) { 38 | // ... 39 | return (-1); 40 | } 41 | 42 | 43 | /* Write on a file */ 44 | ssize_t _write (int fildes, const void *buf, size_t nbyte) { 45 | // ... 46 | return (-1); 47 | } 48 | 49 | 50 | /* Read from a file */ 51 | ssize_t _read (int fildes, void *buf, size_t nbyte) { 52 | // ... 53 | return (-1); 54 | } 55 | 56 | 57 | /* Move the read/write file offset */ 58 | off_t _lseek (int fildes, off_t offset, int whence) { 59 | // ... 60 | return (-1); 61 | } 62 | 63 | 64 | /* Test for a terminal device */ 65 | int _isatty (int fildes) { 66 | // ... 67 | return (0); 68 | } 69 | 70 | 71 | /* Get file status */ 72 | int _fstat (int fildes, struct stat *buf) { 73 | // ... 74 | return (-1); 75 | } 76 | 77 | 78 | /* Link one file to another file */ 79 | int _link(const char *path1, const char *path2) { 80 | // ... 81 | return (-1); 82 | } 83 | 84 | 85 | /* Remove a directory entry */ 86 | int _unlink (const char *path) { 87 | // ... 88 | return (-1); 89 | } 90 | 91 | 92 | /* Execute a file */ 93 | int _execve(const char *path, char *const argv[], char *const envp[]) { 94 | // ... 95 | return -1; 96 | } 97 | 98 | 99 | /* Create a new process */ 100 | pid_t fork (void) { 101 | // ... 102 | return -1; 103 | } 104 | 105 | 106 | /* Terminate a process */ 107 | void _exit (int status) { 108 | // ... 109 | } 110 | 111 | 112 | /* Send a signal to a process or a group of processes */ 113 | int _kill (pid_t pid, int sig) { 114 | // ... 115 | return -1; 116 | } 117 | 118 | 119 | /* Get the current process id */ 120 | pid_t _getpid (void) { 121 | // ... 122 | return 0; 123 | } 124 | 125 | /* Wait for a child process to stop or terminate */ 126 | pid_t _wait (int *stat_loc) { 127 | // ... 128 | return -1; 129 | } 130 | 131 | 132 | /* Extend heap space by incr bytes */ 133 | void *_sbrk (ptrdiff_t incr) { 134 | // ... 135 | return -1; 136 | } 137 | -------------------------------------------------------------------------------- /template/stdio/stderr_user.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: stderr_user.c 3 | * Purpose: STDERR User Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_stderr.h" 26 | 27 | /** 28 | Put a character to the stderr 29 | 30 | \param[in] ch Character to output 31 | \return The character written, or -1 on write error. 32 | */ 33 | int stderr_putchar (int ch) { 34 | // ... 35 | return (-1); 36 | } 37 | -------------------------------------------------------------------------------- /template/stdio/stdin_user.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: stdin_user.c 3 | * Purpose: STDIN User Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_stdin.h" 26 | 27 | /** 28 | Get a character from stdin 29 | 30 | \return The next character from the input, or -1 on read error. 31 | */ 32 | int stdin_getchar (void) { 33 | // ... 34 | return (-1); 35 | } 36 | -------------------------------------------------------------------------------- /template/stdio/stdout_user.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: stdout_user.c 3 | * Purpose: STDOUT User Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_stdout.h" 26 | 27 | /** 28 | Put a character to the stdout 29 | 30 | \param[in] ch Character to output 31 | \return The character written, or -1 on write error. 32 | */ 33 | int stdout_putchar (int ch) { 34 | // ... 35 | return (-1); 36 | } 37 | -------------------------------------------------------------------------------- /template/stdio/tty_user.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * Name: tty_user.c 3 | * Purpose: TTY User Template 4 | * Rev.: 1.0.0 5 | *-----------------------------------------------------------------------------*/ 6 | 7 | /* 8 | * Copyright (C) 2023 ARM Limited or its affiliates. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include "retarget_tty.h" 26 | 27 | /** 28 | Put a character to the teletypewritter 29 | 30 | \param[in] ch Character to output 31 | */ 32 | void ttywrch (int ch) { 33 | // ... 34 | } 35 | --------------------------------------------------------------------------------