├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md └── workflows │ ├── stale.yml │ └── sync_issues.yml ├── .gitlab-ci.yml ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FreeRTOS ├── History.txt ├── License │ └── license.txt ├── README.md ├── Source │ ├── croutine.c │ ├── event_groups.c │ ├── include │ │ ├── FreeRTOS.h │ │ ├── StackMacros.h │ │ ├── atomic.h │ │ ├── croutine.h │ │ ├── deprecated_definitions.h │ │ ├── event_groups.h │ │ ├── list.h │ │ ├── message_buffer.h │ │ ├── mpu_prototypes.h │ │ ├── mpu_wrappers.h │ │ ├── portable.h │ │ ├── projdefs.h │ │ ├── queue.h │ │ ├── semphr.h │ │ ├── stack_macros.h │ │ ├── stdint.readme │ │ ├── stream_buffer.h │ │ ├── task.h │ │ └── timers.h │ ├── list.c │ ├── portable │ │ ├── Common │ │ │ └── mpu_wrappers.c │ │ ├── GCC │ │ │ ├── ARM7_AT91FR40008 │ │ │ │ ├── port.c │ │ │ │ ├── portISR.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM7_AT91SAM7S │ │ │ │ ├── AT91SAM7X256.h │ │ │ │ ├── ioat91sam7x256.h │ │ │ │ ├── lib_AT91SAM7X256.c │ │ │ │ ├── lib_AT91SAM7X256.h │ │ │ │ ├── port.c │ │ │ │ ├── portISR.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM7_LPC2000 │ │ │ │ ├── port.c │ │ │ │ ├── portISR.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM7_LPC23xx │ │ │ │ ├── port.c │ │ │ │ ├── portISR.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CA53_64_BIT │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CA9 │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM0 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM23 │ │ │ │ ├── non_secure │ │ │ │ │ ├── port.c │ │ │ │ │ ├── portasm.c │ │ │ │ │ ├── portasm.h │ │ │ │ │ └── portmacro.h │ │ │ │ └── secure │ │ │ │ │ ├── secure_context.c │ │ │ │ │ ├── secure_context.h │ │ │ │ │ ├── secure_context_port.c │ │ │ │ │ ├── secure_heap.c │ │ │ │ │ ├── secure_heap.h │ │ │ │ │ ├── secure_init.c │ │ │ │ │ ├── secure_init.h │ │ │ │ │ └── secure_port_macros.h │ │ │ ├── ARM_CM23_NTZ │ │ │ │ └── non_secure │ │ │ │ │ ├── port.c │ │ │ │ │ ├── portasm.c │ │ │ │ │ ├── portasm.h │ │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM3 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM33 │ │ │ │ ├── non_secure │ │ │ │ │ ├── port.c │ │ │ │ │ ├── portasm.c │ │ │ │ │ ├── portasm.h │ │ │ │ │ └── portmacro.h │ │ │ │ └── secure │ │ │ │ │ ├── secure_context.c │ │ │ │ │ ├── secure_context.h │ │ │ │ │ ├── secure_context_port.c │ │ │ │ │ ├── secure_heap.c │ │ │ │ │ ├── secure_heap.h │ │ │ │ │ ├── secure_init.c │ │ │ │ │ ├── secure_init.h │ │ │ │ │ └── secure_port_macros.h │ │ │ ├── ARM_CM33_NTZ │ │ │ │ └── non_secure │ │ │ │ │ ├── port.c │ │ │ │ │ ├── portasm.c │ │ │ │ │ ├── portasm.h │ │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM3_MPU │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM4F │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM4_MPU │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CM7 │ │ │ │ ├── ReadMe.txt │ │ │ │ └── r0p1 │ │ │ │ │ ├── port.c │ │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CR5 │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ └── portmacro.h │ │ │ ├── ARM_CRx_No_GIC │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ └── portmacro.h │ │ │ ├── ATMega323 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── AVR32_UC3 │ │ │ │ ├── exception.S │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── AVR_AVRDx │ │ │ │ ├── port.c │ │ │ │ ├── porthardware.h │ │ │ │ └── portmacro.h │ │ │ ├── AVR_Mega0 │ │ │ │ ├── port.c │ │ │ │ ├── porthardware.h │ │ │ │ └── portmacro.h │ │ │ ├── CORTUS_APS3 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── ColdFire_V2 │ │ │ │ ├── port.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── H8S2329 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── HCS12 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── IA32_flat │ │ │ │ ├── ISR_Support.h │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ └── portmacro.h │ │ │ ├── MCF5235 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── MSP430F449 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── MicroBlaze │ │ │ │ ├── port.c │ │ │ │ ├── portasm.s │ │ │ │ └── portmacro.h │ │ │ ├── MicroBlazeV8 │ │ │ │ ├── port.c │ │ │ │ ├── port_exceptions.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── MicroBlazeV9 │ │ │ │ ├── port.c │ │ │ │ ├── port_exceptions.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── NiosII │ │ │ │ ├── port.c │ │ │ │ ├── port_asm.S │ │ │ │ └── portmacro.h │ │ │ ├── PPC405_Xilinx │ │ │ │ ├── FPU_Macros.h │ │ │ │ ├── port.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── PPC440_Xilinx │ │ │ │ ├── FPU_Macros.h │ │ │ │ ├── port.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── RISC-V │ │ │ │ ├── Documentation.url │ │ │ │ ├── chip_specific_extensions │ │ │ │ │ ├── Pulpino_Vega_RV32M1RM │ │ │ │ │ │ └── freertos_risc_v_chip_specific_extensions.h │ │ │ │ │ ├── RV32I_CLINT_no_extensions │ │ │ │ │ │ └── freertos_risc_v_chip_specific_extensions.h │ │ │ │ │ └── readme.txt │ │ │ │ ├── port.c │ │ │ │ ├── portASM.S │ │ │ │ ├── portmacro.h │ │ │ │ └── readme.txt │ │ │ ├── RL78 │ │ │ │ ├── isr_support.h │ │ │ │ ├── port.c │ │ │ │ ├── portasm.S │ │ │ │ └── portmacro.h │ │ │ ├── RX100 │ │ │ │ ├── port.c │ │ │ │ ├── portmacro.h │ │ │ │ └── readme.txt │ │ │ ├── RX200 │ │ │ │ ├── port.c │ │ │ │ └── portmacro.h │ │ │ ├── RX600 │ │ │ │ ├── port.c │ │ │ │ ├── portmacro.h │ │ │ │ └── readme.txt │ │ │ ├── RX600v2 │ │ │ │ ├── port.c │ │ │ │ ├── portmacro.h │ │ │ │ └── readme.txt │ │ │ ├── RX700v3_DPFPU │ │ │ │ ├── port.c │ │ │ │ ├── portmacro.h │ │ │ │ └── readme.txt │ │ │ ├── STR75x │ │ │ │ ├── port.c │ │ │ │ ├── portISR.c │ │ │ │ └── portmacro.h │ │ │ └── TriCore_1782 │ │ │ │ ├── port.c │ │ │ │ ├── portmacro.h │ │ │ │ └── porttrap.c │ │ ├── MemMang │ │ │ ├── ReadMe.url │ │ │ ├── heap_1.c │ │ │ ├── heap_2.c │ │ │ ├── heap_3.c │ │ │ ├── heap_4.c │ │ │ └── heap_5.c │ │ └── readme.txt │ ├── queue.c │ ├── stream_buffer.c │ ├── tasks.c │ └── timers.c └── links_to_doc_pages_for_the_demo_projects.url ├── LICENSE ├── README.md ├── examples ├── Basic_RTOS_Example │ └── Basic_RTOS_Example.ino └── FreeRTOS_POSIX_thread │ └── FreeRTOS_POSIX_thread.ino ├── library.properties └── src ├── FreeRTOS.h ├── FreeRTOSConfig.h ├── FreeRTOSVariant.c ├── FreeRTOS_POSIX.h ├── FreeRTOS_POSIX ├── FreeRTOS_POSIX_clock.c ├── FreeRTOS_POSIX_mqueue.c ├── FreeRTOS_POSIX_pthread.c ├── FreeRTOS_POSIX_pthread_barrier.c ├── FreeRTOS_POSIX_pthread_cond.c ├── FreeRTOS_POSIX_pthread_mutex.c ├── FreeRTOS_POSIX_sched.c ├── FreeRTOS_POSIX_semaphore.c ├── FreeRTOS_POSIX_timer.c ├── FreeRTOS_POSIX_unistd.c ├── FreeRTOS_POSIX_utils.c ├── errno.h ├── fcntl.h ├── mqueue.h ├── pthread.h ├── sched.h ├── semaphore.h ├── signal.h ├── sys │ └── types.h ├── time.h ├── unistd.h └── utils.h ├── FreeRTOS_POSIX_internal.h ├── FreeRTOS_POSIX_portable.h ├── FreeRTOS_POSIX_portable_default.h ├── FreeRTOS_POSIX_types.h ├── Seeed_Arduino_FreeRTOS.h ├── arch ├── samd21 │ ├── FreeRTOSConfig.h │ └── FreeRTOSVariant.h ├── samd51 │ ├── FreeRTOSConfig.h │ └── FreeRTOSVariant.h └── stm32h7xx │ ├── FreeRTOSConfig.h │ └── FreeRTOSVariant.h ├── atomic.h ├── croutine.c ├── croutine.h ├── error_hooks.cpp ├── error_hooks.h ├── event_groups.c ├── event_groups.h ├── heap.c ├── iot_doubly_linked_list.h ├── list.c ├── list.h ├── logger.cpp ├── message_buffer.h ├── mpu_prototypes.h ├── mpu_wrappers.c ├── port.c ├── portmacro.h ├── queue.c ├── queue.h ├── semphr.h ├── stack_macros.h ├── stream_buffer.c ├── stream_buffer.h ├── task.h ├── tasks.c ├── timers.c └── timers.h /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PRs' 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 4 * * *' 7 | 8 | jobs: 9 | stale: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | 16 | - name: Checkout script repository 17 | uses: actions/checkout@v4 18 | with: 19 | repository: Seeed-Studio/sync-github-all-issues 20 | path: ci 21 | 22 | - name: Run script 23 | run: ./ci/tools/stale.sh 24 | env: 25 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /.github/workflows/sync_issues.yml: -------------------------------------------------------------------------------- 1 | name: Automate Issue Management 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | - edited 8 | - assigned 9 | - unassigned 10 | - labeled 11 | - unlabeled 12 | - reopened 13 | 14 | jobs: 15 | add_issue_to_project: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Add issue to GitHub Project 19 | uses: actions/add-to-project@v1.0.2 20 | with: 21 | project-url: https://github.com/orgs/Seeed-Studio/projects/17 22 | github-token: ${{ secrets.ISSUE_ASSEMBLE }} 23 | labeled: bug 24 | label-operator: NOT -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | build: 2 | tags: 3 | - nas 4 | script: 5 | - wget -c https://files.seeedstudio.com/arduino/seeed-arduino-ci.sh 6 | - chmod +x seeed-arduino-ci.sh 7 | - bash $PWD/seeed-arduino-ci.sh Basic_RTOS_Example:uno 8 | 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: generic 3 | dist: bionic 4 | sudo: false 5 | cache: 6 | directories: 7 | - ~/arduino_ide 8 | - ~/.arduino15/packages/ 9 | 10 | before_install: 11 | - wget -c https://files.seeedstudio.com/arduino/seeed-arduino-ci.sh 12 | 13 | script: 14 | - chmod +x seeed-arduino-ci.sh 15 | - cat $PWD/seeed-arduino-ci.sh 16 | - bash $PWD/seeed-arduino-ci.sh Basic_RTOS_Example:uno 17 | 18 | notifications: 19 | email: 20 | on_success: change 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at zuobaozhu@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing guidelines 2 | 3 | All guidelines for contributing to the Seeed_Arduino_FreeRTOS repository can be found at [`How to contribute guideline`](https://github.com/Seeed-Studio/Seeed_Arduino_FreeRTOS/wiki/How_to_contribute). 4 | -------------------------------------------------------------------------------- /FreeRTOS/License/license.txt: -------------------------------------------------------------------------------- 1 | The FreeRTOS kernel is released under the MIT open source license, the text of 2 | which is provided below. 3 | 4 | This license covers the FreeRTOS kernel source files, which are located in the 5 | /FreeRTOS/Source directory of the official FreeRTOS kernel download. It also 6 | covers most of the source files in the demo application projects, which are 7 | located in the /FreeRTOS/Demo directory of the official FreeRTOS download. The 8 | demo projects may also include third party software that is not part of FreeRTOS 9 | and is licensed separately to FreeRTOS. Examples of third party software 10 | includes header files provided by chip or tools vendors, linker scripts, 11 | peripheral drivers, etc. All the software in subdirectories of the /FreeRTOS 12 | directory is either open source or distributed with permission, and is free for 13 | use. For the avoidance of doubt, refer to the comments at the top of each 14 | source file. 15 | 16 | 17 | License text: 18 | ------------- 19 | 20 | Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 21 | Permission is hereby granted, free of charge, to any person obtaining a copy of 22 | this software and associated documentation files (the "Software"), to deal in 23 | the Software without restriction, including without limitation the rights to 24 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 25 | the Software, and to permit persons to whom the Software is furnished to do so, 26 | subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 33 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 34 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 35 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 36 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 37 | 38 | -------------------------------------------------------------------------------- /FreeRTOS/README.md: -------------------------------------------------------------------------------- 1 | ## Directories: 2 | 3 | + The **FreeRTOS/Source** directory contains the FreeRTOS source code, and contains 4 | its own readme file. 5 | 6 | + The **FreeRTOS/Demo** directory contains a demo application for every official 7 | FreeRTOS port, and contains its own readme file. 8 | 9 | + The **FreeRTOS/Test** directory contains the tests performed on common code and the portable layer code, and contains its own readme file. 10 | 11 | See [FreeRTOS/SourceOrganization](http://www.freertos.org/a00017.html) for full details of the directory structure and information on locating the files you require. 12 | 13 | The easiest way to use FreeRTOS is to start with one of the pre-configured demo 14 | application projects (found in the FreeRTOS/Demo directory). That way you will 15 | have the correct FreeRTOS source files included, and the correct include paths 16 | configured. 17 | Once a demo application is building and executing you can remove 18 | the demo application file, and start to add in your own application source 19 | files. 20 | 21 | ### See also - 22 | + [Quick Start Guide](http://www.freertos.org/FreeRTOS-quick-start-guide.html) 23 | 24 | + [FAQ](http://www.freertos.org/FAQHelp.html) 25 | -------------------------------------------------------------------------------- /FreeRTOS/Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | 28 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 29 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released. 30 | #endif 31 | 32 | #include "stack_macros.h" 33 | -------------------------------------------------------------------------------- /FreeRTOS/Source/include/stdint.readme: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef FREERTOS_STDINT 28 | #define FREERTOS_STDINT 29 | 30 | /******************************************************************************* 31 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions 32 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be 33 | * built using compilers that do not provide their own stdint.h definition. 34 | * 35 | * To use this file: 36 | * 37 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h 38 | * header file, as that directory will already be in the compiler's include 39 | * path. 40 | * 41 | * 2) Rename the copied file stdint.h. 42 | * 43 | */ 44 | 45 | typedef signed char int8_t; 46 | typedef unsigned char uint8_t; 47 | typedef short int16_t; 48 | typedef unsigned short uint16_t; 49 | typedef long int32_t; 50 | typedef unsigned long uint32_t; 51 | 52 | #endif /* FREERTOS_STDINT */ 53 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.c: -------------------------------------------------------------------------------- 1 | //* ---------------------------------------------------------------------------- 2 | //* ATMEL Microcontroller Software Support - ROUSSET - 3 | //* ---------------------------------------------------------------------------- 4 | //* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 5 | //* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 6 | //* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 7 | //* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 8 | //* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 9 | //* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 10 | //* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 11 | //* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 12 | //* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 13 | //* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | //* ---------------------------------------------------------------------------- 15 | //* File Name : lib_AT91SAM7X256.h 16 | //* Object : AT91SAM7X256 inlined functions 17 | //* Generated : AT91 SW Application Group 05/20/2005 (16:22:29) 18 | //* 19 | //* CVS Reference : /lib_dbgu.h/1.1/Fri Jan 31 12:18:40 2003// 20 | //* CVS Reference : /lib_pmc_SAM7X.h/1.1/Tue Feb 1 08:32:10 2005// 21 | //* CVS Reference : /lib_VREG_6085B.h/1.1/Tue Feb 1 16:20:47 2005// 22 | //* CVS Reference : /lib_rstc_6098A.h/1.1/Wed Oct 6 10:39:20 2004// 23 | //* CVS Reference : /lib_ssc.h/1.4/Fri Jan 31 12:19:20 2003// 24 | //* CVS Reference : /lib_wdtc_6080A.h/1.1/Wed Oct 6 10:38:30 2004// 25 | //* CVS Reference : /lib_usart.h/1.5/Thu Nov 21 16:01:54 2002// 26 | //* CVS Reference : /lib_spi2.h/1.1/Mon Aug 25 14:23:52 2003// 27 | //* CVS Reference : /lib_pitc_6079A.h/1.2/Tue Nov 9 14:43:56 2004// 28 | //* CVS Reference : /lib_aic_6075b.h/1.1/Fri May 20 14:01:19 2005// 29 | //* CVS Reference : /lib_aes_6149a.h/1.1/Mon Jan 17 07:43:09 2005// 30 | //* CVS Reference : /lib_twi.h/1.3/Mon Jul 19 14:27:58 2004// 31 | //* CVS Reference : /lib_adc.h/1.6/Fri Oct 17 09:12:38 2003// 32 | //* CVS Reference : /lib_rttc_6081A.h/1.1/Wed Oct 6 10:39:38 2004// 33 | //* CVS Reference : /lib_udp.h/1.4/Wed Feb 16 08:39:34 2005// 34 | //* CVS Reference : /lib_des3_6150a.h/1.1/Mon Jan 17 09:19:19 2005// 35 | //* CVS Reference : /lib_tc_1753b.h/1.1/Fri Jan 31 12:20:02 2003// 36 | //* CVS Reference : /lib_MC_SAM7X.h/1.1/Thu Mar 25 15:19:14 2004// 37 | //* CVS Reference : /lib_pio.h/1.3/Fri Jan 31 12:18:56 2003// 38 | //* CVS Reference : /lib_can_AT91.h/1.4/Fri Oct 17 09:12:50 2003// 39 | //* CVS Reference : /lib_PWM_SAM.h/1.3/Thu Jan 22 10:10:50 2004// 40 | //* CVS Reference : /lib_pdc.h/1.2/Tue Jul 2 13:29:40 2002// 41 | //* ---------------------------------------------------------------------------- 42 | 43 | 44 | #include "AT91SAM7X256.h" 45 | 46 | 47 | //*---------------------------------------------------------------------------- 48 | //* \fn AT91F_AIC_ConfigureIt 49 | //* \brief Interrupt Handler Initialization 50 | //*---------------------------------------------------------------------------- 51 | 52 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/Seeed_Arduino_FreeRTOS/c9e0ae0779bc8b010036313e3a4d00ddebddc3a2/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23/non_secure/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_ASM_H__ 29 | #define __PORT_ASM_H__ 30 | 31 | /* Scheduler includes. */ 32 | #include "FreeRTOS.h" 33 | 34 | /* MPU wrappers includes. */ 35 | #include "mpu_wrappers.h" 36 | 37 | /** 38 | * @brief Restore the context of the first task so that the first task starts 39 | * executing. 40 | */ 41 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 42 | 43 | /** 44 | * @brief Checks whether or not the processor is privileged. 45 | * 46 | * @return 1 if the processor is already privileged, 0 otherwise. 47 | */ 48 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 49 | 50 | /** 51 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 52 | * register. 53 | * 54 | * @note This is a privileged function and should only be called from the kenrel 55 | * code. 56 | * 57 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 58 | * Bit[0] = 0 --> The processor is running privileged 59 | * Bit[0] = 1 --> The processor is running unprivileged. 60 | */ 61 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 62 | 63 | /** 64 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 65 | * register. 66 | * 67 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 68 | * Bit[0] = 0 --> The processor is running privileged 69 | * Bit[0] = 1 --> The processor is running unprivileged. 70 | */ 71 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 72 | 73 | /** 74 | * @brief Starts the first task. 75 | */ 76 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 77 | 78 | /** 79 | * @brief Disables interrupts. 80 | */ 81 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 82 | 83 | /** 84 | * @brief Enables interrupts. 85 | */ 86 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 87 | 88 | /** 89 | * @brief PendSV Exception handler. 90 | */ 91 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 92 | 93 | /** 94 | * @brief SVC Handler. 95 | */ 96 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 97 | 98 | /** 99 | * @brief Allocate a Secure context for the calling task. 100 | * 101 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 102 | * secure side for the calling task. 103 | */ 104 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 105 | 106 | /** 107 | * @brief Free the task's secure context. 108 | * 109 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 110 | */ 111 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 112 | 113 | #endif /* __PORT_ASM_H__ */ 114 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23/secure/secure_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_CONTEXT_H__ 29 | #define __SECURE_CONTEXT_H__ 30 | 31 | /* Standard includes. */ 32 | #include 33 | 34 | /* FreeRTOS includes. */ 35 | #include "FreeRTOSConfig.h" 36 | 37 | /** 38 | * @brief PSP value when no task's context is loaded. 39 | */ 40 | #define securecontextNO_STACK 0x0 41 | 42 | /** 43 | * @brief Opaque handle. 44 | */ 45 | struct SecureContext; 46 | typedef struct SecureContext * SecureContextHandle_t; 47 | /*-----------------------------------------------------------*/ 48 | 49 | /** 50 | * @brief Initializes the secure context management system. 51 | * 52 | * PSP is set to NULL and therefore a task must allocate and load a context 53 | * before calling any secure side function in the thread mode. 54 | * 55 | * @note This function must be called in the handler mode. It is no-op if called 56 | * in the thread mode. 57 | */ 58 | void SecureContext_Init( void ); 59 | 60 | /** 61 | * @brief Allocates a context on the secure side. 62 | * 63 | * @note This function must be called in the handler mode. It is no-op if called 64 | * in the thread mode. 65 | * 66 | * @param[in] ulSecureStackSize Size of the stack to allocate on secure side. 67 | * @param[in] ulIsTaskPrivileged 1 if the calling task is privileged, 0 otherwise. 68 | * 69 | * @return Opaque context handle if context is successfully allocated, NULL 70 | * otherwise. 71 | */ 72 | #if ( configENABLE_MPU == 1 ) 73 | SecureContextHandle_t SecureContext_AllocateContext( uint32_t ulSecureStackSize, 74 | uint32_t ulIsTaskPrivileged ); 75 | #else /* configENABLE_MPU */ 76 | SecureContextHandle_t SecureContext_AllocateContext( uint32_t ulSecureStackSize ); 77 | #endif /* configENABLE_MPU */ 78 | 79 | /** 80 | * @brief Frees the given context. 81 | * 82 | * @note This function must be called in the handler mode. It is no-op if called 83 | * in the thread mode. 84 | * 85 | * @param[in] xSecureContextHandle Context handle corresponding to the 86 | * context to be freed. 87 | */ 88 | void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle ); 89 | 90 | /** 91 | * @brief Loads the given context. 92 | * 93 | * @note This function must be called in the handler mode. It is no-op if called 94 | * in the thread mode. 95 | * 96 | * @param[in] xSecureContextHandle Context handle corresponding to the context 97 | * to be loaded. 98 | */ 99 | void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle ); 100 | 101 | /** 102 | * @brief Saves the given context. 103 | * 104 | * @note This function must be called in the handler mode. It is no-op if called 105 | * in the thread mode. 106 | * 107 | * @param[in] xSecureContextHandle Context handle corresponding to the context 108 | * to be saved. 109 | */ 110 | void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle ); 111 | 112 | #endif /* __SECURE_CONTEXT_H__ */ 113 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23/secure/secure_context_port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Secure context includes. */ 29 | #include "secure_context.h" 30 | 31 | /* Secure port macros. */ 32 | #include "secure_port_macros.h" 33 | 34 | #if ( configENABLE_FPU == 1 ) 35 | #error Cortex-M23 does not have a Floating Point Unit (FPU) and therefore configENABLE_FPU must be set to 0. 36 | #endif 37 | 38 | secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle ) 39 | { 40 | /* xSecureContextHandle value is in r0. */ 41 | __asm volatile 42 | ( 43 | " .syntax unified \n" 44 | " \n" 45 | " mrs r1, ipsr \n"/* r1 = IPSR. */ 46 | " cbz r1, load_ctx_therad_mode \n"/* Do nothing if the processor is running in the Thread Mode. */ 47 | " ldmia r0!, {r1, r2} \n"/* r1 = xSecureContextHandle->pucCurrentStackPointer, r2 = xSecureContextHandle->pucStackLimit. */ 48 | #if ( configENABLE_MPU == 1 ) 49 | " ldmia r1!, {r3} \n"/* Read CONTROL register value from task's stack. r3 = CONTROL. */ 50 | " msr control, r3 \n"/* CONTROL = r3. */ 51 | #endif /* configENABLE_MPU */ 52 | " msr psplim, r2 \n"/* PSPLIM = r2. */ 53 | " msr psp, r1 \n"/* PSP = r1. */ 54 | " \n" 55 | " load_ctx_therad_mode: \n" 56 | " nop \n" 57 | " \n" 58 | ::: "r0", "r1", "r2" 59 | ); 60 | } 61 | /*-----------------------------------------------------------*/ 62 | 63 | secureportNON_SECURE_CALLABLE void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle ) 64 | { 65 | /* xSecureContextHandle value is in r0. */ 66 | __asm volatile 67 | ( 68 | " .syntax unified \n" 69 | " \n" 70 | " mrs r1, ipsr \n"/* r1 = IPSR. */ 71 | " cbz r1, save_ctx_therad_mode \n"/* Do nothing if the processor is running in the Thread Mode. */ 72 | " mrs r1, psp \n"/* r1 = PSP. */ 73 | #if ( configENABLE_MPU == 1 ) 74 | " mrs r2, control \n"/* r2 = CONTROL. */ 75 | " subs r1, r1, #4 \n"/* Make space for the CONTROL value on the stack. */ 76 | " str r1, [r0] \n"/* Save the top of stack in context. xSecureContextHandle->pucCurrentStackPointer = r1. */ 77 | " stmia r1!, {r2} \n"/* Store CONTROL value on the stack. */ 78 | #else /* configENABLE_MPU */ 79 | " str r1, [r0] \n"/* Save the top of stack in context. xSecureContextHandle->pucCurrentStackPointer = r1. */ 80 | #endif /* configENABLE_MPU */ 81 | " movs r1, %0 \n"/* r1 = securecontextNO_STACK. */ 82 | " msr psplim, r1 \n"/* PSPLIM = securecontextNO_STACK. */ 83 | " msr psp, r1 \n"/* PSP = securecontextNO_STACK i.e. No stack for thread mode until next task's context is loaded. */ 84 | " \n" 85 | " save_ctx_therad_mode: \n" 86 | " nop \n" 87 | " \n" 88 | ::"i" ( securecontextNO_STACK ) : "r1", "memory" 89 | ); 90 | } 91 | /*-----------------------------------------------------------*/ 92 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23/secure/secure_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_HEAP_H__ 29 | #define __SECURE_HEAP_H__ 30 | 31 | /* Standard includes. */ 32 | #include 33 | 34 | /** 35 | * @brief Allocates memory from heap. 36 | * 37 | * @param[in] xWantedSize The size of the memory to be allocated. 38 | * 39 | * @return Pointer to the memory region if the allocation is successful, NULL 40 | * otherwise. 41 | */ 42 | void * pvPortMalloc( size_t xWantedSize ); 43 | 44 | /** 45 | * @brief Frees the previously allocated memory. 46 | * 47 | * @param[in] pv Pointer to the memory to be freed. 48 | */ 49 | void vPortFree( void * pv ); 50 | 51 | #endif /* __SECURE_HEAP_H__ */ 52 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23/secure/secure_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_INIT_H__ 29 | #define __SECURE_INIT_H__ 30 | 31 | /** 32 | * @brief De-prioritizes the non-secure exceptions. 33 | * 34 | * This is needed to ensure that the non-secure PendSV runs at the lowest 35 | * priority. Context switch is done in the non-secure PendSV handler. 36 | * 37 | * @note This function must be called in the handler mode. It is no-op if called 38 | * in the thread mode. 39 | */ 40 | void SecureInit_DePrioritizeNSExceptions( void ); 41 | 42 | /** 43 | * @brief Sets up the Floating Point Unit (FPU) for Non-Secure access. 44 | * 45 | * Also sets FPCCR.TS=1 to ensure that the content of the Floating Point 46 | * Registers are not leaked to the non-secure side. 47 | * 48 | * @note This function must be called in the handler mode. It is no-op if called 49 | * in the thread mode. 50 | */ 51 | void SecureInit_EnableNSFPUAccess( void ); 52 | 53 | #endif /* __SECURE_INIT_H__ */ 54 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM23_NTZ/non_secure/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_ASM_H__ 29 | #define __PORT_ASM_H__ 30 | 31 | /* Scheduler includes. */ 32 | #include "FreeRTOS.h" 33 | 34 | /* MPU wrappers includes. */ 35 | #include "mpu_wrappers.h" 36 | 37 | /** 38 | * @brief Restore the context of the first task so that the first task starts 39 | * executing. 40 | */ 41 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 42 | 43 | /** 44 | * @brief Checks whether or not the processor is privileged. 45 | * 46 | * @return 1 if the processor is already privileged, 0 otherwise. 47 | */ 48 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 49 | 50 | /** 51 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 52 | * register. 53 | * 54 | * @note This is a privileged function and should only be called from the kenrel 55 | * code. 56 | * 57 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 58 | * Bit[0] = 0 --> The processor is running privileged 59 | * Bit[0] = 1 --> The processor is running unprivileged. 60 | */ 61 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 62 | 63 | /** 64 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 65 | * register. 66 | * 67 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 68 | * Bit[0] = 0 --> The processor is running privileged 69 | * Bit[0] = 1 --> The processor is running unprivileged. 70 | */ 71 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 72 | 73 | /** 74 | * @brief Starts the first task. 75 | */ 76 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 77 | 78 | /** 79 | * @brief Disables interrupts. 80 | */ 81 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 82 | 83 | /** 84 | * @brief Enables interrupts. 85 | */ 86 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 87 | 88 | /** 89 | * @brief PendSV Exception handler. 90 | */ 91 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 92 | 93 | /** 94 | * @brief SVC Handler. 95 | */ 96 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 97 | 98 | /** 99 | * @brief Allocate a Secure context for the calling task. 100 | * 101 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 102 | * secure side for the calling task. 103 | */ 104 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 105 | 106 | /** 107 | * @brief Free the task's secure context. 108 | * 109 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 110 | */ 111 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 112 | 113 | #endif /* __PORT_ASM_H__ */ 114 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33/non_secure/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_ASM_H__ 29 | #define __PORT_ASM_H__ 30 | 31 | /* Scheduler includes. */ 32 | #include "FreeRTOS.h" 33 | 34 | /* MPU wrappers includes. */ 35 | #include "mpu_wrappers.h" 36 | 37 | /** 38 | * @brief Restore the context of the first task so that the first task starts 39 | * executing. 40 | */ 41 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 42 | 43 | /** 44 | * @brief Checks whether or not the processor is privileged. 45 | * 46 | * @return 1 if the processor is already privileged, 0 otherwise. 47 | */ 48 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 49 | 50 | /** 51 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 52 | * register. 53 | * 54 | * @note This is a privileged function and should only be called from the kenrel 55 | * code. 56 | * 57 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 58 | * Bit[0] = 0 --> The processor is running privileged 59 | * Bit[0] = 1 --> The processor is running unprivileged. 60 | */ 61 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 62 | 63 | /** 64 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 65 | * register. 66 | * 67 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 68 | * Bit[0] = 0 --> The processor is running privileged 69 | * Bit[0] = 1 --> The processor is running unprivileged. 70 | */ 71 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 72 | 73 | /** 74 | * @brief Starts the first task. 75 | */ 76 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 77 | 78 | /** 79 | * @brief Disables interrupts. 80 | */ 81 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 82 | 83 | /** 84 | * @brief Enables interrupts. 85 | */ 86 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 87 | 88 | /** 89 | * @brief PendSV Exception handler. 90 | */ 91 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 92 | 93 | /** 94 | * @brief SVC Handler. 95 | */ 96 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 97 | 98 | /** 99 | * @brief Allocate a Secure context for the calling task. 100 | * 101 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 102 | * secure side for the calling task. 103 | */ 104 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 105 | 106 | /** 107 | * @brief Free the task's secure context. 108 | * 109 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 110 | */ 111 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 112 | 113 | #endif /* __PORT_ASM_H__ */ 114 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33/secure/secure_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_CONTEXT_H__ 29 | #define __SECURE_CONTEXT_H__ 30 | 31 | /* Standard includes. */ 32 | #include 33 | 34 | /* FreeRTOS includes. */ 35 | #include "FreeRTOSConfig.h" 36 | 37 | /** 38 | * @brief PSP value when no task's context is loaded. 39 | */ 40 | #define securecontextNO_STACK 0x0 41 | 42 | /** 43 | * @brief Opaque handle. 44 | */ 45 | struct SecureContext; 46 | typedef struct SecureContext * SecureContextHandle_t; 47 | /*-----------------------------------------------------------*/ 48 | 49 | /** 50 | * @brief Initializes the secure context management system. 51 | * 52 | * PSP is set to NULL and therefore a task must allocate and load a context 53 | * before calling any secure side function in the thread mode. 54 | * 55 | * @note This function must be called in the handler mode. It is no-op if called 56 | * in the thread mode. 57 | */ 58 | void SecureContext_Init( void ); 59 | 60 | /** 61 | * @brief Allocates a context on the secure side. 62 | * 63 | * @note This function must be called in the handler mode. It is no-op if called 64 | * in the thread mode. 65 | * 66 | * @param[in] ulSecureStackSize Size of the stack to allocate on secure side. 67 | * @param[in] ulIsTaskPrivileged 1 if the calling task is privileged, 0 otherwise. 68 | * 69 | * @return Opaque context handle if context is successfully allocated, NULL 70 | * otherwise. 71 | */ 72 | #if ( configENABLE_MPU == 1 ) 73 | SecureContextHandle_t SecureContext_AllocateContext( uint32_t ulSecureStackSize, 74 | uint32_t ulIsTaskPrivileged ); 75 | #else /* configENABLE_MPU */ 76 | SecureContextHandle_t SecureContext_AllocateContext( uint32_t ulSecureStackSize ); 77 | #endif /* configENABLE_MPU */ 78 | 79 | /** 80 | * @brief Frees the given context. 81 | * 82 | * @note This function must be called in the handler mode. It is no-op if called 83 | * in the thread mode. 84 | * 85 | * @param[in] xSecureContextHandle Context handle corresponding to the 86 | * context to be freed. 87 | */ 88 | void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle ); 89 | 90 | /** 91 | * @brief Loads the given context. 92 | * 93 | * @note This function must be called in the handler mode. It is no-op if called 94 | * in the thread mode. 95 | * 96 | * @param[in] xSecureContextHandle Context handle corresponding to the context 97 | * to be loaded. 98 | */ 99 | void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle ); 100 | 101 | /** 102 | * @brief Saves the given context. 103 | * 104 | * @note This function must be called in the handler mode. It is no-op if called 105 | * in the thread mode. 106 | * 107 | * @param[in] xSecureContextHandle Context handle corresponding to the context 108 | * to be saved. 109 | */ 110 | void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle ); 111 | 112 | #endif /* __SECURE_CONTEXT_H__ */ 113 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33/secure/secure_context_port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Secure context includes. */ 29 | #include "secure_context.h" 30 | 31 | /* Secure port macros. */ 32 | #include "secure_port_macros.h" 33 | 34 | secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle ) 35 | { 36 | /* xSecureContextHandle value is in r0. */ 37 | __asm volatile 38 | ( 39 | " .syntax unified \n" 40 | " \n" 41 | " mrs r1, ipsr \n"/* r1 = IPSR. */ 42 | " cbz r1, load_ctx_therad_mode \n"/* Do nothing if the processor is running in the Thread Mode. */ 43 | " ldmia r0!, {r1, r2} \n"/* r1 = xSecureContextHandle->pucCurrentStackPointer, r2 = xSecureContextHandle->pucStackLimit. */ 44 | #if ( configENABLE_MPU == 1 ) 45 | " ldmia r1!, {r3} \n"/* Read CONTROL register value from task's stack. r3 = CONTROL. */ 46 | " msr control, r3 \n"/* CONTROL = r3. */ 47 | #endif /* configENABLE_MPU */ 48 | " msr psplim, r2 \n"/* PSPLIM = r2. */ 49 | " msr psp, r1 \n"/* PSP = r1. */ 50 | " \n" 51 | " load_ctx_therad_mode: \n" 52 | " nop \n" 53 | " \n" 54 | ::: "r0", "r1", "r2" 55 | ); 56 | } 57 | /*-----------------------------------------------------------*/ 58 | 59 | secureportNON_SECURE_CALLABLE void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle ) 60 | { 61 | /* xSecureContextHandle value is in r0. */ 62 | __asm volatile 63 | ( 64 | " .syntax unified \n" 65 | " \n" 66 | " mrs r1, ipsr \n"/* r1 = IPSR. */ 67 | " cbz r1, save_ctx_therad_mode \n"/* Do nothing if the processor is running in the Thread Mode. */ 68 | " mrs r1, psp \n"/* r1 = PSP. */ 69 | #if ( configENABLE_FPU == 1 ) 70 | " vstmdb r1!, {s0} \n"/* Trigger the defferred stacking of FPU registers. */ 71 | " vldmia r1!, {s0} \n"/* Nullify the effect of the pervious statement. */ 72 | #endif /* configENABLE_FPU */ 73 | #if ( configENABLE_MPU == 1 ) 74 | " mrs r2, control \n"/* r2 = CONTROL. */ 75 | " stmdb r1!, {r2} \n"/* Store CONTROL value on the stack. */ 76 | #endif /* configENABLE_MPU */ 77 | " str r1, [r0] \n"/* Save the top of stack in context. xSecureContextHandle->pucCurrentStackPointer = r1. */ 78 | " movs r1, %0 \n"/* r1 = securecontextNO_STACK. */ 79 | " msr psplim, r1 \n"/* PSPLIM = securecontextNO_STACK. */ 80 | " msr psp, r1 \n"/* PSP = securecontextNO_STACK i.e. No stack for thread mode until next task's context is loaded. */ 81 | " \n" 82 | " save_ctx_therad_mode: \n" 83 | " nop \n" 84 | " \n" 85 | ::"i" ( securecontextNO_STACK ) : "r1", "memory" 86 | ); 87 | } 88 | /*-----------------------------------------------------------*/ 89 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33/secure/secure_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_HEAP_H__ 29 | #define __SECURE_HEAP_H__ 30 | 31 | /* Standard includes. */ 32 | #include 33 | 34 | /** 35 | * @brief Allocates memory from heap. 36 | * 37 | * @param[in] xWantedSize The size of the memory to be allocated. 38 | * 39 | * @return Pointer to the memory region if the allocation is successful, NULL 40 | * otherwise. 41 | */ 42 | void * pvPortMalloc( size_t xWantedSize ); 43 | 44 | /** 45 | * @brief Frees the previously allocated memory. 46 | * 47 | * @param[in] pv Pointer to the memory to be freed. 48 | */ 49 | void vPortFree( void * pv ); 50 | 51 | #endif /* __SECURE_HEAP_H__ */ 52 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33/secure/secure_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __SECURE_INIT_H__ 29 | #define __SECURE_INIT_H__ 30 | 31 | /** 32 | * @brief De-prioritizes the non-secure exceptions. 33 | * 34 | * This is needed to ensure that the non-secure PendSV runs at the lowest 35 | * priority. Context switch is done in the non-secure PendSV handler. 36 | * 37 | * @note This function must be called in the handler mode. It is no-op if called 38 | * in the thread mode. 39 | */ 40 | void SecureInit_DePrioritizeNSExceptions( void ); 41 | 42 | /** 43 | * @brief Sets up the Floating Point Unit (FPU) for Non-Secure access. 44 | * 45 | * Also sets FPCCR.TS=1 to ensure that the content of the Floating Point 46 | * Registers are not leaked to the non-secure side. 47 | * 48 | * @note This function must be called in the handler mode. It is no-op if called 49 | * in the thread mode. 50 | */ 51 | void SecureInit_EnableNSFPUAccess( void ); 52 | 53 | #endif /* __SECURE_INIT_H__ */ 54 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef __PORT_ASM_H__ 29 | #define __PORT_ASM_H__ 30 | 31 | /* Scheduler includes. */ 32 | #include "FreeRTOS.h" 33 | 34 | /* MPU wrappers includes. */ 35 | #include "mpu_wrappers.h" 36 | 37 | /** 38 | * @brief Restore the context of the first task so that the first task starts 39 | * executing. 40 | */ 41 | void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 42 | 43 | /** 44 | * @brief Checks whether or not the processor is privileged. 45 | * 46 | * @return 1 if the processor is already privileged, 0 otherwise. 47 | */ 48 | BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) ); 49 | 50 | /** 51 | * @brief Raises the privilege level by clearing the bit 0 of the CONTROL 52 | * register. 53 | * 54 | * @note This is a privileged function and should only be called from the kenrel 55 | * code. 56 | * 57 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 58 | * Bit[0] = 0 --> The processor is running privileged 59 | * Bit[0] = 1 --> The processor is running unprivileged. 60 | */ 61 | void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 62 | 63 | /** 64 | * @brief Lowers the privilege level by setting the bit 0 of the CONTROL 65 | * register. 66 | * 67 | * Bit 0 of the CONTROL register defines the privilege level of Thread Mode. 68 | * Bit[0] = 0 --> The processor is running privileged 69 | * Bit[0] = 1 --> The processor is running unprivileged. 70 | */ 71 | void vResetPrivilege( void ) __attribute__( ( naked ) ); 72 | 73 | /** 74 | * @brief Starts the first task. 75 | */ 76 | void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 77 | 78 | /** 79 | * @brief Disables interrupts. 80 | */ 81 | uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 82 | 83 | /** 84 | * @brief Enables interrupts. 85 | */ 86 | void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 87 | 88 | /** 89 | * @brief PendSV Exception handler. 90 | */ 91 | void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 92 | 93 | /** 94 | * @brief SVC Handler. 95 | */ 96 | void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 97 | 98 | /** 99 | * @brief Allocate a Secure context for the calling task. 100 | * 101 | * @param[in] ulSecureStackSize The size of the stack to be allocated on the 102 | * secure side for the calling task. 103 | */ 104 | void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) ); 105 | 106 | /** 107 | * @brief Free the task's secure context. 108 | * 109 | * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task. 110 | */ 111 | void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION; 112 | 113 | #endif /* __PORT_ASM_H__ */ 114 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ARM_CM7/ReadMe.txt: -------------------------------------------------------------------------------- 1 | There are two options for running FreeRTOS on ARM Cortex-M7 microcontrollers. 2 | The best option depends on the revision of the ARM Cortex-M7 core in use. The 3 | revision is specified by an 'r' number, and a 'p' number, so will look something 4 | like 'r0p1'. Check the documentation for the microcontroller in use to find the 5 | revision of the Cortex-M7 core used in that microcontroller. If in doubt, use 6 | the FreeRTOS port provided specifically for r0p1 revisions, as that can be used 7 | with all core revisions. 8 | 9 | The first option is to use the ARM Cortex-M4F port, and the second option is to 10 | use the Cortex-M7 r0p1 port - the latter containing a minor errata workaround. 11 | 12 | If the revision of the ARM Cortex-M7 core is not r0p1 then either option can be 13 | used, but it is recommended to use the FreeRTOS ARM Cortex-M4F port located in 14 | the /FreeRTOS/Source/portable/GCC/ARM_CM4F directory. 15 | 16 | If the revision of the ARM Cortex-M7 core is r0p1 then use the FreeRTOS ARM 17 | Cortex-M7 r0p1 port located in the /FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 18 | directory. -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* 29 | Changes from V1.2.3 30 | 31 | + portCPU_CLOSK_HZ definition changed to 8MHz base 10, previously it 32 | base 16. 33 | */ 34 | 35 | #ifndef PORTMACRO_H 36 | #define PORTMACRO_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /*----------------------------------------------------------- 43 | * Port specific definitions. 44 | * 45 | * The settings in this file configure FreeRTOS correctly for the 46 | * given hardware and compiler. 47 | * 48 | * These settings should not be altered. 49 | *----------------------------------------------------------- 50 | */ 51 | 52 | /* Type definitions. */ 53 | #define portCHAR char 54 | #define portFLOAT float 55 | #define portDOUBLE double 56 | #define portLONG long 57 | #define portSHORT int 58 | #define portSTACK_TYPE uint8_t 59 | #define portBASE_TYPE char 60 | 61 | typedef portSTACK_TYPE StackType_t; 62 | typedef signed char BaseType_t; 63 | typedef unsigned char UBaseType_t; 64 | 65 | #if( configUSE_16_BIT_TICKS == 1 ) 66 | typedef uint16_t TickType_t; 67 | #define portMAX_DELAY ( TickType_t ) 0xffff 68 | #else 69 | typedef uint32_t TickType_t; 70 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 71 | #endif 72 | /*-----------------------------------------------------------*/ 73 | 74 | /* Critical section management. */ 75 | #define portENTER_CRITICAL() asm volatile ( "in __tmp_reg__, __SREG__" :: ); \ 76 | asm volatile ( "cli" :: ); \ 77 | asm volatile ( "push __tmp_reg__" :: ) 78 | 79 | #define portEXIT_CRITICAL() asm volatile ( "pop __tmp_reg__" :: ); \ 80 | asm volatile ( "out __SREG__, __tmp_reg__" :: ) 81 | 82 | #define portDISABLE_INTERRUPTS() asm volatile ( "cli" :: ); 83 | #define portENABLE_INTERRUPTS() asm volatile ( "sei" :: ); 84 | /*-----------------------------------------------------------*/ 85 | 86 | /* Architecture specifics. */ 87 | #define portSTACK_GROWTH ( -1 ) 88 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 89 | #define portBYTE_ALIGNMENT 1 90 | #define portNOP() asm volatile ( "nop" ); 91 | /*-----------------------------------------------------------*/ 92 | 93 | /* Kernel utilities. */ 94 | extern void vPortYield( void ) __attribute__ ( ( naked ) ); 95 | #define portYIELD() vPortYield() 96 | /*-----------------------------------------------------------*/ 97 | 98 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 99 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 100 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* PORTMACRO_H */ 107 | 108 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/AVR_AVRDx/porthardware.h: -------------------------------------------------------------------------------- 1 | #ifndef PORTHARDWARE_H 2 | #define PORTHARDWARE_H 3 | 4 | #include "FreeRTOSConfig.h" 5 | 6 | /*-----------------------------------------------------------*/ 7 | 8 | #define CLR_INT( FLAG_REG, FLAG_MASK ) \ 9 | asm volatile ( \ 10 | "push r16\n\t" \ 11 | "ldi r16, %1\n\t" \ 12 | "sts %0, r16\n\t" \ 13 | "pop r16\n\t" \ 14 | : \ 15 | : "i" ( _SFR_MEM_ADDR( FLAG_REG ) ), "i" ( ( uint8_t ) ( FLAG_MASK ) ) \ 16 | ); 17 | 18 | #if ( configUSE_TIMER_INSTANCE == 0 ) 19 | 20 | #define TICK_INT_vect TCB0_INT_vect 21 | #define INT_FLAGS TCB0_INTFLAGS 22 | #define INT_MASK TCB_CAPT_bm 23 | 24 | #define TICK_init() \ 25 | { \ 26 | TCB0.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 27 | TCB0.INTCTRL = TCB_CAPT_bm; \ 28 | TCB0.CTRLA = TCB_ENABLE_bm; \ 29 | } 30 | 31 | #elif ( configUSE_TIMER_INSTANCE == 1 ) 32 | 33 | #define TICK_INT_vect TCB1_INT_vect 34 | #define INT_FLAGS TCB1_INTFLAGS 35 | #define INT_MASK TCB_CAPT_bm 36 | 37 | #define TICK_init() \ 38 | { \ 39 | TCB1.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 40 | TCB1.INTCTRL = TCB_CAPT_bm; \ 41 | TCB1.CTRLA = TCB_ENABLE_bm; \ 42 | } 43 | 44 | #elif ( configUSE_TIMER_INSTANCE == 2 ) 45 | 46 | #define TICK_INT_vect TCB2_INT_vect 47 | #define INT_FLAGS TCB2_INTFLAGS 48 | #define INT_MASK TCB_CAPT_bm 49 | 50 | #define TICK_init() \ 51 | { \ 52 | TCB2.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 53 | TCB2.INTCTRL = TCB_CAPT_bm; \ 54 | TCB2.CTRLA = TCB_ENABLE_bm; \ 55 | } 56 | 57 | #elif ( configUSE_TIMER_INSTANCE == 3 ) 58 | 59 | #define TICK_INT_vect TCB3_INT_vect 60 | #define INT_FLAGS TCB3_INTFLAGS 61 | #define INT_MASK TCB_CAPT_bm 62 | 63 | #define TICK_init() \ 64 | { \ 65 | TCB3.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 66 | TCB3.INTCTRL = TCB_CAPT_bm; \ 67 | TCB3.CTRLA = TCB_ENABLE_bm; \ 68 | } 69 | 70 | #elif ( configUSE_TIMER_INSTANCE == 4 ) 71 | 72 | #define TICK_INT_vect TCB4_INT_vect 73 | #define INT_FLAGS TCB4_INTFLAGS 74 | #define INT_MASK TCB_CAPT_bm 75 | 76 | #define TICK_init() \ 77 | { \ 78 | TCB4.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 79 | TCB4.INTCTRL = TCB_CAPT_bm; \ 80 | TCB4.CTRLA = TCB_ENABLE_bm; \ 81 | } 82 | 83 | #elif ( configUSE_TIMER_INSTANCE == 5 ) 84 | 85 | #define TICK_INT_vect RTC_CNT_vect 86 | #define INT_FLAGS RTC_INTFLAGS 87 | #define INT_MASK RTC_OVF_bm 88 | 89 | /* Hertz to period for RTC setup */ 90 | #define RTC_PERIOD_HZ( x ) ( 32768 * ( ( 1.0 / x ) ) ) 91 | #define TICK_init() \ 92 | { \ 93 | while( RTC.STATUS > 0 ) {; } \ 94 | RTC.CTRLA = RTC_PRESCALER_DIV1_gc | 1 << RTC_RTCEN_bp; \ 95 | RTC.PER = RTC_PERIOD_HZ( configTICK_RATE_HZ ); \ 96 | RTC.INTCTRL |= 1 << RTC_OVF_bp; \ 97 | } 98 | 99 | #else /* if ( configUSE_TIMER_INSTANCE == 0 ) */ 100 | #undef TICK_INT_vect 101 | #undef INT_FLAGS 102 | #undef INT_MASK 103 | #undef TICK_init() 104 | #error Invalid timer setting. 105 | #endif /* if ( configUSE_TIMER_INSTANCE == 0 ) */ 106 | 107 | /*-----------------------------------------------------------*/ 108 | 109 | #endif /* PORTHARDWARE_H */ 110 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/AVR_AVRDx/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef PORTMACRO_H 28 | #define PORTMACRO_H 29 | 30 | /* *INDENT-OFF* */ 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | /* *INDENT-ON* */ 35 | 36 | /*----------------------------------------------------------- 37 | * Port specific definitions. 38 | * 39 | * The settings in this file configure FreeRTOS correctly for the 40 | * given hardware and compiler. 41 | * 42 | * These settings should not be altered. 43 | *----------------------------------------------------------- 44 | */ 45 | 46 | /* Type definitions. */ 47 | #define portCHAR char 48 | #define portFLOAT float 49 | #define portDOUBLE double 50 | #define portLONG long 51 | #define portSHORT int 52 | #define portSTACK_TYPE uint8_t 53 | #define portBASE_TYPE char 54 | 55 | #define portPOINTER_SIZE_TYPE uint16_t 56 | 57 | typedef portSTACK_TYPE StackType_t; 58 | typedef signed char BaseType_t; 59 | typedef unsigned char UBaseType_t; 60 | 61 | #if ( configUSE_16_BIT_TICKS == 1 ) 62 | typedef uint16_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffff 64 | #else 65 | typedef uint32_t TickType_t; 66 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 67 | #endif 68 | /*-----------------------------------------------------------*/ 69 | 70 | /* Critical section management. */ 71 | #define portENTER_CRITICAL() \ 72 | asm volatile ( "in __tmp_reg__, __SREG__" ); \ 73 | asm volatile ( "cli" ); \ 74 | asm volatile ( "push __tmp_reg__" ) 75 | 76 | #define portEXIT_CRITICAL() \ 77 | asm volatile ( "pop __tmp_reg__" ); \ 78 | asm volatile ( "out __SREG__, __tmp_reg__" ) 79 | 80 | #define portDISABLE_INTERRUPTS() asm volatile ( "cli" ::); 81 | #define portENABLE_INTERRUPTS() asm volatile ( "sei" ::); 82 | /*-----------------------------------------------------------*/ 83 | 84 | /* Architecture specifics. */ 85 | #define portSTACK_GROWTH ( -1 ) 86 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 87 | #define portBYTE_ALIGNMENT 1 88 | #define portNOP() asm volatile ( "nop" ); 89 | /*-----------------------------------------------------------*/ 90 | 91 | /* Kernel utilities. */ 92 | extern void vPortYield( void ) __attribute__( ( naked ) ); 93 | #define portYIELD() vPortYield() 94 | 95 | extern void vPortYieldFromISR( void ) __attribute__( ( naked ) ); 96 | #define portYIELD_FROM_ISR() vPortYieldFromISR() 97 | /*-----------------------------------------------------------*/ 98 | 99 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 100 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 101 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 102 | 103 | /* *INDENT-OFF* */ 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | /* *INDENT-ON* */ 108 | 109 | #endif /* PORTMACRO_H */ 110 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/AVR_Mega0/porthardware.h: -------------------------------------------------------------------------------- 1 | #ifndef PORTHARDWARE_H 2 | #define PORTHARDWARE_H 3 | 4 | #include "FreeRTOSConfig.h" 5 | 6 | /*-----------------------------------------------------------*/ 7 | 8 | #define CLR_INT( FLAG_REG, FLAG_MASK ) \ 9 | asm volatile ( \ 10 | "push r16\n\t" \ 11 | "ldi r16, %1\n\t" \ 12 | "sts %0, r16\n\t" \ 13 | "pop r16\n\t" \ 14 | : \ 15 | : "i" ( _SFR_MEM_ADDR( FLAG_REG ) ), "i" ( ( uint8_t ) ( FLAG_MASK ) ) \ 16 | ); 17 | 18 | #if ( configUSE_TIMER_INSTANCE == 0 ) 19 | 20 | #define TICK_INT_vect TCB0_INT_vect 21 | #define INT_FLAGS TCB0_INTFLAGS 22 | #define INT_MASK TCB_CAPT_bm 23 | 24 | #define TICK_init() \ 25 | { \ 26 | TCB0.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 27 | TCB0.INTCTRL = TCB_CAPT_bm; \ 28 | TCB0.CTRLA = TCB_ENABLE_bm; \ 29 | } 30 | 31 | #elif ( configUSE_TIMER_INSTANCE == 1 ) 32 | 33 | #define TICK_INT_vect TCB1_INT_vect 34 | #define INT_FLAGS TCB1_INTFLAGS 35 | #define INT_MASK TCB_CAPT_bm 36 | 37 | #define TICK_init() \ 38 | { \ 39 | TCB1.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 40 | TCB1.INTCTRL = TCB_CAPT_bm; \ 41 | TCB1.CTRLA = TCB_ENABLE_bm; \ 42 | } 43 | 44 | #elif ( configUSE_TIMER_INSTANCE == 2 ) 45 | 46 | #define TICK_INT_vect TCB2_INT_vect 47 | #define INT_FLAGS TCB2_INTFLAGS 48 | #define INT_MASK TCB_CAPT_bm 49 | 50 | #define TICK_init() \ 51 | { \ 52 | TCB2.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 53 | TCB2.INTCTRL = TCB_CAPT_bm; \ 54 | TCB2.CTRLA = TCB_ENABLE_bm; \ 55 | } 56 | 57 | #elif ( configUSE_TIMER_INSTANCE == 3 ) 58 | 59 | #define TICK_INT_vect TCB3_INT_vect 60 | #define INT_FLAGS TCB3_INTFLAGS 61 | #define INT_MASK TCB_CAPT_bm 62 | 63 | #define TICK_init() \ 64 | { \ 65 | TCB3.CCMP = configCPU_CLOCK_HZ / configTICK_RATE_HZ; \ 66 | TCB3.INTCTRL = TCB_CAPT_bm; \ 67 | TCB3.CTRLA = TCB_ENABLE_bm; \ 68 | } 69 | 70 | #elif ( configUSE_TIMER_INSTANCE == 4 ) 71 | 72 | #define TICK_INT_vect RTC_CNT_vect 73 | #define INT_FLAGS RTC_INTFLAGS 74 | #define INT_MASK RTC_OVF_bm 75 | 76 | /* Hertz to period for RTC setup */ 77 | #define RTC_PERIOD_HZ( x ) ( 32768 * ( ( 1.0 / x ) ) ) 78 | #define TICK_init() \ 79 | { \ 80 | while( RTC.STATUS > 0 ) {; } \ 81 | RTC.CTRLA = RTC_PRESCALER_DIV1_gc | 1 << RTC_RTCEN_bp; \ 82 | RTC.PER = RTC_PERIOD_HZ( configTICK_RATE_HZ ); \ 83 | RTC.INTCTRL |= 1 << RTC_OVF_bp; \ 84 | } 85 | 86 | #else /* if ( configUSE_TIMER_INSTANCE == 0 ) */ 87 | #undef TICK_INT_vect 88 | #undef INT_FLAGS 89 | #undef INT_MASK 90 | #undef TICK_init() 91 | #error Invalid timer setting. 92 | #endif /* if ( configUSE_TIMER_INSTANCE == 0 ) */ 93 | 94 | /*-----------------------------------------------------------*/ 95 | 96 | #endif /* PORTHARDWARE_H */ 97 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/AVR_Mega0/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef PORTMACRO_H 28 | #define PORTMACRO_H 29 | 30 | /* *INDENT-OFF* */ 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | /* *INDENT-ON* */ 35 | 36 | /*----------------------------------------------------------- 37 | * Port specific definitions. 38 | * 39 | * The settings in this file configure FreeRTOS correctly for the 40 | * given hardware and compiler. 41 | * 42 | * These settings should not be altered. 43 | *----------------------------------------------------------- 44 | */ 45 | 46 | /* Type definitions. */ 47 | #define portCHAR char 48 | #define portFLOAT float 49 | #define portDOUBLE double 50 | #define portLONG long 51 | #define portSHORT int 52 | #define portSTACK_TYPE uint8_t 53 | #define portBASE_TYPE char 54 | 55 | #define portPOINTER_SIZE_TYPE uint16_t 56 | 57 | typedef portSTACK_TYPE StackType_t; 58 | typedef signed char BaseType_t; 59 | typedef unsigned char UBaseType_t; 60 | 61 | #if ( configUSE_16_BIT_TICKS == 1 ) 62 | typedef uint16_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffff 64 | #else 65 | typedef uint32_t TickType_t; 66 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 67 | #endif 68 | /*-----------------------------------------------------------*/ 69 | 70 | /* Critical section management. */ 71 | #define portENTER_CRITICAL() \ 72 | asm volatile ( "in __tmp_reg__, __SREG__" ); \ 73 | asm volatile ( "cli" ); \ 74 | asm volatile ( "push __tmp_reg__" ) 75 | 76 | #define portEXIT_CRITICAL() \ 77 | asm volatile ( "pop __tmp_reg__" ); \ 78 | asm volatile ( "out __SREG__, __tmp_reg__" ) 79 | 80 | #define portDISABLE_INTERRUPTS() asm volatile ( "cli" ::); 81 | #define portENABLE_INTERRUPTS() asm volatile ( "sei" ::); 82 | /*-----------------------------------------------------------*/ 83 | 84 | /* Architecture specifics. */ 85 | #define portSTACK_GROWTH ( -1 ) 86 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 87 | #define portBYTE_ALIGNMENT 1 88 | #define portNOP() asm volatile ( "nop" ); 89 | /*-----------------------------------------------------------*/ 90 | 91 | /* Kernel utilities. */ 92 | extern void vPortYield( void ) __attribute__( ( naked ) ); 93 | #define portYIELD() vPortYield() 94 | 95 | extern void vPortYieldFromISR( void ) __attribute__( ( naked ) ); 96 | #define portYIELD_FROM_ISR() vPortYieldFromISR() 97 | /*-----------------------------------------------------------*/ 98 | 99 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 100 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) 101 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) 102 | 103 | /* *INDENT-OFF* */ 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | /* *INDENT-ON* */ 108 | 109 | #endif /* PORTMACRO_H */ 110 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ColdFire_V2/port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Kernel includes. */ 29 | #include "FreeRTOS.h" 30 | #include "task.h" 31 | 32 | #define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 ) 33 | 34 | /* Supervisor mode set. */ 35 | #define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000) 36 | 37 | /* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This 38 | will be set to 0 prior to the first task being started. */ 39 | static uint32_t ulCriticalNesting = 0x9999UL; 40 | 41 | /*-----------------------------------------------------------*/ 42 | 43 | StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) 44 | { 45 | *pxTopOfStack = ( StackType_t ) pvParameters; 46 | pxTopOfStack--; 47 | 48 | *pxTopOfStack = (StackType_t) 0xDEADBEEF; 49 | pxTopOfStack--; 50 | 51 | /* Exception stack frame starts with the return address. */ 52 | *pxTopOfStack = ( StackType_t ) pxCode; 53 | pxTopOfStack--; 54 | 55 | *pxTopOfStack = ( portINITIAL_FORMAT_VECTOR << 16UL ) | ( portINITIAL_STATUS_REGISTER ); 56 | pxTopOfStack--; 57 | 58 | *pxTopOfStack = ( StackType_t ) 0x0; /*FP*/ 59 | pxTopOfStack -= 14; /* A5 to D0. */ 60 | 61 | return pxTopOfStack; 62 | } 63 | /*-----------------------------------------------------------*/ 64 | 65 | BaseType_t xPortStartScheduler( void ) 66 | { 67 | extern void vPortStartFirstTask( void ); 68 | 69 | ulCriticalNesting = 0UL; 70 | 71 | /* Configure the interrupts used by this port. */ 72 | vApplicationSetupInterrupts(); 73 | 74 | /* Start the first task executing. */ 75 | vPortStartFirstTask(); 76 | 77 | return pdFALSE; 78 | } 79 | /*-----------------------------------------------------------*/ 80 | 81 | void vPortEndScheduler( void ) 82 | { 83 | /* Not implemented as there is nothing to return to. */ 84 | } 85 | /*-----------------------------------------------------------*/ 86 | 87 | void vPortEnterCritical( void ) 88 | { 89 | if( ulCriticalNesting == 0UL ) 90 | { 91 | /* Guard against context switches being pended simultaneously with a 92 | critical section being entered. */ 93 | do 94 | { 95 | portDISABLE_INTERRUPTS(); 96 | if( MCF_INTC0_INTFRCL == 0UL ) 97 | { 98 | break; 99 | } 100 | 101 | portENABLE_INTERRUPTS(); 102 | 103 | } while( 1 ); 104 | } 105 | ulCriticalNesting++; 106 | } 107 | /*-----------------------------------------------------------*/ 108 | 109 | void vPortExitCritical( void ) 110 | { 111 | ulCriticalNesting--; 112 | if( ulCriticalNesting == 0 ) 113 | { 114 | portENABLE_INTERRUPTS(); 115 | } 116 | } 117 | /*-----------------------------------------------------------*/ 118 | 119 | void vPortYieldHandler( void ) 120 | { 121 | uint32_t ulSavedInterruptMask; 122 | 123 | ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); 124 | /* Note this will clear all forced interrupts - this is done for speed. */ 125 | MCF_INTC0_INTFRCL = 0; 126 | vTaskSwitchContext(); 127 | portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask ); 128 | } 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ColdFire_V2/portasm.S: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* 29 | * Purpose: Lowest level routines for all ColdFire processors. 30 | * 31 | * Notes: 32 | * 33 | * ulPortSetIPL() and mcf5xxx_wr_cacr() copied with permission from FreeScale 34 | * supplied source files. 35 | */ 36 | 37 | .global ulPortSetIPL 38 | .global mcf5xxx_wr_cacr 39 | .global __cs3_isr_interrupt_80 40 | .global vPortStartFirstTask 41 | 42 | .text 43 | 44 | .macro portSAVE_CONTEXT 45 | 46 | lea.l (-60, %sp), %sp 47 | movem.l %d0-%fp, (%sp) 48 | move.l pxCurrentTCB, %a0 49 | move.l %sp, (%a0) 50 | 51 | .endm 52 | 53 | .macro portRESTORE_CONTEXT 54 | 55 | move.l pxCurrentTCB, %a0 56 | move.l (%a0), %sp 57 | movem.l (%sp), %d0-%fp 58 | lea.l %sp@(60), %sp 59 | rte 60 | 61 | .endm 62 | 63 | /********************************************************************/ 64 | /* 65 | * This routines changes the IPL to the value passed into the routine. 66 | * It also returns the old IPL value back. 67 | * Calling convention from C: 68 | * old_ipl = asm_set_ipl(new_ipl); 69 | * For the Diab Data C compiler, it passes return value thru D0. 70 | * Note that only the least significant three bits of the passed 71 | * value are used. 72 | */ 73 | 74 | ulPortSetIPL: 75 | link A6,#-8 76 | movem.l D6-D7,(SP) 77 | 78 | move.w SR,D7 /* current sr */ 79 | 80 | move.l D7,D0 /* prepare return value */ 81 | andi.l #0x0700,D0 /* mask out IPL */ 82 | lsr.l #8,D0 /* IPL */ 83 | 84 | move.l 8(A6),D6 /* get argument */ 85 | andi.l #0x07,D6 /* least significant three bits */ 86 | lsl.l #8,D6 /* move over to make mask */ 87 | 88 | andi.l #0x0000F8FF,D7 /* zero out current IPL */ 89 | or.l D6,D7 /* place new IPL in sr */ 90 | move.w D7,SR 91 | 92 | movem.l (SP),D6-D7 93 | lea 8(SP),SP 94 | unlk A6 95 | rts 96 | /********************************************************************/ 97 | 98 | mcf5xxx_wr_cacr: 99 | move.l 4(sp),d0 100 | .long 0x4e7b0002 /* movec d0,cacr */ 101 | nop 102 | rts 103 | 104 | /********************************************************************/ 105 | 106 | /* Yield interrupt. */ 107 | __cs3_isr_interrupt_80: 108 | portSAVE_CONTEXT 109 | jsr vPortYieldHandler 110 | portRESTORE_CONTEXT 111 | 112 | /********************************************************************/ 113 | 114 | 115 | vPortStartFirstTask: 116 | portRESTORE_CONTEXT 117 | 118 | .end 119 | 120 | 121 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORTMACRO_H 29 | #define PORTMACRO_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /*----------------------------------------------------------- 36 | * Port specific definitions. 37 | * 38 | * The settings in this file configure FreeRTOS correctly for the 39 | * given hardware and compiler. 40 | * 41 | * These settings should not be altered. 42 | *----------------------------------------------------------- 43 | */ 44 | 45 | /* Type definitions. */ 46 | #define portCHAR char 47 | #define portFLOAT float 48 | #define portDOUBLE double 49 | #define portLONG long 50 | #define portSHORT short 51 | #define portSTACK_TYPE uint32_t 52 | #define portBASE_TYPE long 53 | 54 | typedef portSTACK_TYPE StackType_t; 55 | typedef long BaseType_t; 56 | typedef unsigned long UBaseType_t; 57 | 58 | #if( configUSE_16_BIT_TICKS == 1 ) 59 | typedef uint16_t TickType_t; 60 | #define portMAX_DELAY ( TickType_t ) 0xffff 61 | #else 62 | typedef uint32_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 64 | #endif 65 | /*-----------------------------------------------------------*/ 66 | 67 | /* Hardware specifics. */ 68 | #define portBYTE_ALIGNMENT 4 69 | #define portSTACK_GROWTH -1 70 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 71 | /*-----------------------------------------------------------*/ 72 | uint32_t ulPortSetIPL( uint32_t ); 73 | #define portDISABLE_INTERRUPTS() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) 74 | #define portENABLE_INTERRUPTS() ulPortSetIPL( 0 ) 75 | 76 | 77 | extern void vPortEnterCritical( void ); 78 | extern void vPortExitCritical( void ); 79 | #define portENTER_CRITICAL() vPortEnterCritical() 80 | #define portEXIT_CRITICAL() vPortExitCritical() 81 | 82 | extern UBaseType_t uxPortSetInterruptMaskFromISR( void ); 83 | extern void vPortClearInterruptMaskFromISR( UBaseType_t ); 84 | #define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY ) 85 | #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister ) 86 | 87 | /*-----------------------------------------------------------*/ 88 | 89 | /* Task utilities. */ 90 | 91 | #define portNOP() asm volatile ( "nop" ) 92 | 93 | /* Note this will overwrite all other bits in the force register, it is done this way for speed. */ 94 | #define portYIELD() MCF_INTC0_INTFRCL = ( 1UL << configYIELD_INTERRUPT_VECTOR ); portNOP(); portNOP() 95 | 96 | /*-----------------------------------------------------------*/ 97 | 98 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 99 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__((noreturn)) 100 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 101 | /*-----------------------------------------------------------*/ 102 | 103 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) \ 104 | { \ 105 | portYIELD(); \ 106 | } 107 | 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif /* PORTMACRO_H */ 114 | 115 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/IA32_flat/ISR_Support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | .extern ulTopOfSystemStack 29 | .extern ulInterruptNesting 30 | 31 | /*-----------------------------------------------------------*/ 32 | 33 | .macro portFREERTOS_INTERRUPT_ENTRY 34 | 35 | /* Save general purpose registers. */ 36 | pusha 37 | 38 | /* If ulInterruptNesting is zero the rest of the task context will need 39 | saving and a stack switch might be required. */ 40 | movl ulInterruptNesting, %eax 41 | test %eax, %eax 42 | jne 2f 43 | 44 | /* Interrupts are not nested, so save the rest of the task context. */ 45 | .if configSUPPORT_FPU == 1 46 | 47 | /* If the task has a buffer allocated to save the FPU context then 48 | save the FPU context now. */ 49 | movl pucPortTaskFPUContextBuffer, %eax 50 | test %eax, %eax 51 | je 1f 52 | fnsave ( %eax ) /* Save FLOP context into ucTempFPUBuffer array. */ 53 | fwait 54 | 55 | 1: 56 | /* Save the address of the FPU context, if any. */ 57 | push pucPortTaskFPUContextBuffer 58 | 59 | .endif /* configSUPPORT_FPU */ 60 | 61 | /* Find the TCB. */ 62 | movl pxCurrentTCB, %eax 63 | 64 | /* Stack location is first item in the TCB. */ 65 | movl %esp, (%eax) 66 | 67 | /* Switch stacks. */ 68 | movl ulTopOfSystemStack, %esp 69 | movl %esp, %ebp 70 | 71 | 2: 72 | /* Increment nesting count. */ 73 | add $1, ulInterruptNesting 74 | 75 | .endm 76 | /*-----------------------------------------------------------*/ 77 | 78 | .macro portINTERRUPT_EPILOGUE 79 | 80 | cli 81 | sub $1, ulInterruptNesting 82 | 83 | /* If the nesting has unwound to zero. */ 84 | movl ulInterruptNesting, %eax 85 | test %eax, %eax 86 | jne 2f 87 | 88 | /* If a yield was requested then select a new TCB now. */ 89 | movl ulPortYieldPending, %eax 90 | test %eax, %eax 91 | je 1f 92 | movl $0, ulPortYieldPending 93 | call vTaskSwitchContext 94 | 95 | 1: 96 | /* Stack location is first item in the TCB. */ 97 | movl pxCurrentTCB, %eax 98 | movl (%eax), %esp 99 | 100 | .if configSUPPORT_FPU == 1 101 | 102 | /* Restore address of task's FPU context buffer. */ 103 | pop pucPortTaskFPUContextBuffer 104 | 105 | /* If the task has a buffer allocated in which its FPU context is saved, 106 | then restore it now. */ 107 | movl pucPortTaskFPUContextBuffer, %eax 108 | test %eax, %eax 109 | je 1f 110 | frstor ( %eax ) 111 | 1: 112 | .endif 113 | 114 | 2: 115 | popa 116 | 117 | .endm 118 | /*-----------------------------------------------------------*/ 119 | 120 | .macro portFREERTOS_INTERRUPT_EXIT 121 | 122 | portINTERRUPT_EPILOGUE 123 | /* EOI. */ 124 | movl $0x00, (0xFEE000B0) 125 | iret 126 | 127 | .endm 128 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORTMACRO_H 29 | #define PORTMACRO_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | /*----------------------------------------------------------- 36 | * Port specific definitions. 37 | * 38 | * The settings in this file configure FreeRTOS correctly for the 39 | * given hardware and compiler. 40 | * 41 | * These settings should not be altered. 42 | *----------------------------------------------------------- 43 | */ 44 | 45 | /* Type definitions. */ 46 | #define portCHAR char 47 | #define portFLOAT float 48 | #define portDOUBLE double 49 | #define portLONG long 50 | #define portSHORT short 51 | #define portSTACK_TYPE uint32_t 52 | #define portBASE_TYPE long 53 | 54 | typedef portSTACK_TYPE StackType_t; 55 | typedef long BaseType_t; 56 | typedef unsigned long UBaseType_t; 57 | 58 | #if( configUSE_16_BIT_TICKS == 1 ) 59 | typedef uint16_t TickType_t; 60 | #define portMAX_DELAY ( TickType_t ) 0xffff 61 | #else 62 | typedef uint32_t TickType_t; 63 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 64 | 65 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 66 | not need to be guarded with a critical section. */ 67 | #define portTICK_TYPE_IS_ATOMIC 1 68 | #endif 69 | /*-----------------------------------------------------------*/ 70 | 71 | /* Interrupt control macros. */ 72 | void microblaze_disable_interrupts( void ); 73 | void microblaze_enable_interrupts( void ); 74 | #define portDISABLE_INTERRUPTS() microblaze_disable_interrupts() 75 | #define portENABLE_INTERRUPTS() microblaze_enable_interrupts() 76 | /*-----------------------------------------------------------*/ 77 | 78 | /* Critical section macros. */ 79 | void vPortEnterCritical( void ); 80 | void vPortExitCritical( void ); 81 | #define portENTER_CRITICAL() { \ 82 | extern UBaseType_t uxCriticalNesting; \ 83 | microblaze_disable_interrupts(); \ 84 | uxCriticalNesting++; \ 85 | } 86 | 87 | #define portEXIT_CRITICAL() { \ 88 | extern UBaseType_t uxCriticalNesting; \ 89 | /* Interrupts are disabled, so we can */ \ 90 | /* access the variable directly. */ \ 91 | uxCriticalNesting--; \ 92 | if( uxCriticalNesting == 0 ) \ 93 | { \ 94 | /* The nesting has unwound and we \ 95 | can enable interrupts again. */ \ 96 | portENABLE_INTERRUPTS(); \ 97 | } \ 98 | } 99 | 100 | /*-----------------------------------------------------------*/ 101 | 102 | /* Task utilities. */ 103 | void vPortYield( void ); 104 | #define portYIELD() vPortYield() 105 | 106 | void vTaskSwitchContext(); 107 | #define portYIELD_FROM_ISR() vTaskSwitchContext() 108 | /*-----------------------------------------------------------*/ 109 | 110 | /* Hardware specifics. */ 111 | #define portBYTE_ALIGNMENT 4 112 | #define portSTACK_GROWTH ( -1 ) 113 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 114 | #define portNOP() asm volatile ( "NOP" ) 115 | /*-----------------------------------------------------------*/ 116 | 117 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 118 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 119 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* PORTMACRO_H */ 126 | 127 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/NiosII/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORTMACRO_H 29 | #define PORTMACRO_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #include "sys/alt_irq.h" 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | 67 | /* 32-bit tick type on a 32-bit architecture, so reads of the tick count do 68 | not need to be guarded with a critical section. */ 69 | #define portTICK_TYPE_IS_ATOMIC 1 70 | #endif 71 | /*-----------------------------------------------------------*/ 72 | 73 | /* Architecture specifics. */ 74 | #define portSTACK_GROWTH ( -1 ) 75 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 76 | #define portBYTE_ALIGNMENT 4 77 | #define portNOP() asm volatile ( "NOP" ) 78 | #define portCRITICAL_NESTING_IN_TCB 1 79 | /*-----------------------------------------------------------*/ 80 | 81 | extern void vTaskSwitchContext( void ); 82 | #define portYIELD() asm volatile ( "trap" ); 83 | #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) vTaskSwitchContext() 84 | 85 | 86 | /* Include the port_asm.S file where the Context saving/restoring is defined. */ 87 | __asm__( "\n\t.globl save_context" ); 88 | 89 | /*-----------------------------------------------------------*/ 90 | 91 | extern void vTaskEnterCritical( void ); 92 | extern void vTaskExitCritical( void ); 93 | 94 | #define portDISABLE_INTERRUPTS() alt_irq_disable_all() 95 | #define portENABLE_INTERRUPTS() alt_irq_enable_all( 0x01 ); 96 | #define portENTER_CRITICAL() vTaskEnterCritical() 97 | #define portEXIT_CRITICAL() vTaskExitCritical() 98 | /*-----------------------------------------------------------*/ 99 | 100 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 101 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 102 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif /* PORTMACRO_H */ 109 | 110 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/PPC405_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* When switching out a task, if the task tag contains a buffer address then 29 | save the flop context into the buffer. */ 30 | #define traceTASK_SWITCHED_OUT() \ 31 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 32 | { \ 33 | extern void vPortSaveFPURegisters( void * ); \ 34 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 35 | } 36 | 37 | /* When switching in a task, if the task tag contains a buffer address then 38 | load the flop context from the buffer. */ 39 | #define traceTASK_SWITCHED_IN() \ 40 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 41 | { \ 42 | extern void vPortRestoreFPURegisters( void * ); \ 43 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 44 | } 45 | 46 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORTMACRO_H 29 | #define PORTMACRO_H 30 | 31 | #include "xexception_l.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | #endif 67 | /*-----------------------------------------------------------*/ 68 | 69 | /* This port uses the critical nesting count from the TCB rather than 70 | maintaining a separate value and then saving this value in the task stack. */ 71 | #define portCRITICAL_NESTING_IN_TCB 1 72 | 73 | /* Interrupt control macros. */ 74 | #define portDISABLE_INTERRUPTS() XExc_mDisableExceptions( XEXC_NON_CRITICAL ); 75 | #define portENABLE_INTERRUPTS() XExc_mEnableExceptions( XEXC_NON_CRITICAL ); 76 | 77 | /*-----------------------------------------------------------*/ 78 | 79 | /* Critical section macros. */ 80 | void vTaskEnterCritical( void ); 81 | void vTaskExitCritical( void ); 82 | #define portENTER_CRITICAL() vTaskEnterCritical() 83 | #define portEXIT_CRITICAL() vTaskExitCritical() 84 | 85 | /*-----------------------------------------------------------*/ 86 | 87 | /* Task utilities. */ 88 | void vPortYield( void ); 89 | #define portYIELD() asm volatile ( "SC \n\t NOP" ) 90 | #define portYIELD_FROM_ISR() vTaskSwitchContext() 91 | 92 | /*-----------------------------------------------------------*/ 93 | 94 | /* Hardware specifics. */ 95 | #define portBYTE_ALIGNMENT 8 96 | #define portSTACK_GROWTH ( -1 ) 97 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 98 | #define portNOP() asm volatile ( "NOP" ) 99 | 100 | /* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */ 101 | #define portNO_FLOP_REGISTERS_TO_SAVE ( 32 + 1 ) 102 | 103 | /*-----------------------------------------------------------*/ 104 | 105 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 106 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 107 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 108 | 109 | /* Port specific interrupt handling functions. */ 110 | void vPortSetupInterruptController( void ); 111 | BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); 112 | 113 | #ifdef __cplusplus 114 | } 115 | #endif 116 | 117 | #endif /* PORTMACRO_H */ 118 | 119 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/PPC440_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* When switching out a task, if the task tag contains a buffer address then 29 | save the flop context into the buffer. */ 30 | #define traceTASK_SWITCHED_OUT() \ 31 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 32 | { \ 33 | extern void vPortSaveFPURegisters( void * ); \ 34 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 35 | } 36 | 37 | /* When switching in a task, if the task tag contains a buffer address then 38 | load the flop context from the buffer. */ 39 | #define traceTASK_SWITCHED_IN() \ 40 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 41 | { \ 42 | extern void vPortRestoreFPURegisters( void * ); \ 43 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 44 | } 45 | 46 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORTMACRO_H 29 | #define PORTMACRO_H 30 | 31 | #include "xexception_l.h" 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /*----------------------------------------------------------- 38 | * Port specific definitions. 39 | * 40 | * The settings in this file configure FreeRTOS correctly for the 41 | * given hardware and compiler. 42 | * 43 | * These settings should not be altered. 44 | *----------------------------------------------------------- 45 | */ 46 | 47 | /* Type definitions. */ 48 | #define portCHAR char 49 | #define portFLOAT float 50 | #define portDOUBLE double 51 | #define portLONG long 52 | #define portSHORT short 53 | #define portSTACK_TYPE uint32_t 54 | #define portBASE_TYPE long 55 | 56 | typedef portSTACK_TYPE StackType_t; 57 | typedef long BaseType_t; 58 | typedef unsigned long UBaseType_t; 59 | 60 | #if( configUSE_16_BIT_TICKS == 1 ) 61 | typedef uint16_t TickType_t; 62 | #define portMAX_DELAY ( TickType_t ) 0xffff 63 | #else 64 | typedef uint32_t TickType_t; 65 | #define portMAX_DELAY ( TickType_t ) 0xffffffffUL 66 | #endif 67 | /*-----------------------------------------------------------*/ 68 | 69 | /* This port uses the critical nesting count from the TCB rather than 70 | maintaining a separate value and then saving this value in the task stack. */ 71 | #define portCRITICAL_NESTING_IN_TCB 1 72 | 73 | /* Interrupt control macros. */ 74 | #define portDISABLE_INTERRUPTS() XExc_mDisableExceptions( XEXC_NON_CRITICAL ); 75 | #define portENABLE_INTERRUPTS() XExc_mEnableExceptions( XEXC_NON_CRITICAL ); 76 | 77 | /*-----------------------------------------------------------*/ 78 | 79 | /* Critical section macros. */ 80 | void vTaskEnterCritical( void ); 81 | void vTaskExitCritical( void ); 82 | #define portENTER_CRITICAL() vTaskEnterCritical() 83 | #define portEXIT_CRITICAL() vTaskExitCritical() 84 | 85 | /*-----------------------------------------------------------*/ 86 | 87 | /* Task utilities. */ 88 | void vPortYield( void ); 89 | #define portYIELD() asm volatile ( "SC \n\t NOP" ) 90 | #define portYIELD_FROM_ISR() vTaskSwitchContext() 91 | 92 | /*-----------------------------------------------------------*/ 93 | 94 | /* Hardware specifics. */ 95 | #define portBYTE_ALIGNMENT 8 96 | #define portSTACK_GROWTH ( -1 ) 97 | #define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) 98 | #define portNOP() asm volatile ( "NOP" ) 99 | 100 | /* There are 32 * 32bit floating point regieters, plus the FPSCR to save. */ 101 | #define portNO_FLOP_REGISTERS_TO_SAVE ( 32 + 1 ) 102 | 103 | /*-----------------------------------------------------------*/ 104 | 105 | /* Task function macros as described on the FreeRTOS.org WEB site. */ 106 | #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) 107 | #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) 108 | 109 | /* Port specific interrupt handling functions. */ 110 | void vPortSetupInterruptController( void ); 111 | BaseType_t xPortInstallInterruptHandler( uint8_t ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); 112 | 113 | #ifdef __cplusplus 114 | } 115 | #endif 116 | 117 | #endif /* PORTMACRO_H */ 118 | 119 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RISC-V/Documentation.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,11 3 | [InternetShortcut] 4 | IDList= 5 | URL=https://www.FreeRTOS.org/Using-FreeRTOS-on-RISC-V.html 6 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/Pulpino_Vega_RV32M1RM/freertos_risc_v_chip_specific_extensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and t 10 | 11 | o permit persons to whom the Software is furnished to do so, 12 | * subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | * https://www.FreeRTOS.org 25 | * https://github.com/FreeRTOS 26 | * 27 | * 1 tab == 4 spaces! 28 | */ 29 | 30 | /* 31 | * The FreeRTOS kernel's RISC-V port is split between the the code that is 32 | * common across all currently supported RISC-V chips (implementations of the 33 | * RISC-V ISA), and code that tailors the port to a specific RISC-V chip: 34 | * 35 | * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that 36 | * is common to all currently supported RISC-V chips. There is only one 37 | * portASM.S file because the same file is built for all RISC-V target chips. 38 | * 39 | * + Header files called freertos_risc_v_chip_specific_extensions.h contain the 40 | * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V 41 | * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files 42 | * as there are multiple RISC-V chip implementations. 43 | * 44 | * !!!NOTE!!! 45 | * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h 46 | * HEADER FILE FOR THE CHIP IN USE. This is done using the assembler's (not the 47 | * compiler's!) include path. For example, if the chip in use includes a core 48 | * local interrupter (CLINT) and does not include any chip specific register 49 | * extensions then add the path below to the assembler's include path: 50 | * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions 51 | * 52 | */ 53 | 54 | /* 55 | * This freertos_risc_v_chip_specific_extensions.h is for use with Pulpino Ri5cy 56 | * devices, developed and tested using the Vega board RV32M1RM. 57 | */ 58 | 59 | #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__ 60 | #define __FREERTOS_RISC_V_EXTENSIONS_H__ 61 | 62 | #define portasmHAS_MTIME 0 63 | 64 | /* Constants to define the additional registers found on the Pulpino RI5KY. */ 65 | #define lpstart0 0x7b0 66 | #define lpend0 0x7b1 67 | #define lpcount0 0x7b2 68 | #define lpstart1 0x7b4 69 | #define lpend1 0x7b5 70 | #define lpcount1 0x7b6 71 | 72 | /* Six additional registers to save and restore, as per the #defines above. */ 73 | #define portasmADDITIONAL_CONTEXT_SIZE 6 /* Must be even number on 32-bit cores. */ 74 | 75 | /* Save additional registers found on the Pulpino. */ 76 | .macro portasmSAVE_ADDITIONAL_REGISTERS 77 | addi sp, sp, -(portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE) /* Make room for the additional registers. */ 78 | csrr t0, lpstart0 /* Load additional registers into accessible temporary registers. */ 79 | csrr t1, lpend0 80 | csrr t2, lpcount0 81 | csrr t3, lpstart1 82 | csrr t4, lpend1 83 | csrr t5, lpcount1 84 | sw t0, 1 * portWORD_SIZE( sp ) 85 | sw t1, 2 * portWORD_SIZE( sp ) 86 | sw t2, 3 * portWORD_SIZE( sp ) 87 | sw t3, 4 * portWORD_SIZE( sp ) 88 | sw t4, 5 * portWORD_SIZE( sp ) 89 | sw t5, 6 * portWORD_SIZE( sp ) 90 | .endm 91 | 92 | /* Restore the additional registers found on the Pulpino. */ 93 | .macro portasmRESTORE_ADDITIONAL_REGISTERS 94 | lw t0, 1 * portWORD_SIZE( sp ) /* Load additional registers into accessible temporary registers. */ 95 | lw t1, 2 * portWORD_SIZE( sp ) 96 | lw t2, 3 * portWORD_SIZE( sp ) 97 | lw t3, 4 * portWORD_SIZE( sp ) 98 | lw t4, 5 * portWORD_SIZE( sp ) 99 | lw t5, 6 * portWORD_SIZE( sp ) 100 | csrw lpstart0, t0 101 | csrw lpend0, t1 102 | csrw lpcount0, t2 103 | csrw lpstart1, t3 104 | csrw lpend1, t4 105 | csrw lpcount1, t5 106 | addi sp, sp, (portasmADDITIONAL_CONTEXT_SIZE * portWORD_SIZE )/* Remove space added for additional registers. */ 107 | .endm 108 | 109 | #endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */ 110 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/RV32I_CLINT_no_extensions/freertos_risc_v_chip_specific_extensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* 29 | * The FreeRTOS kernel's RISC-V port is split between the the code that is 30 | * common across all currently supported RISC-V chips (implementations of the 31 | * RISC-V ISA), and code that tailors the port to a specific RISC-V chip: 32 | * 33 | * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that 34 | * is common to all currently supported RISC-V chips. There is only one 35 | * portASM.S file because the same file is built for all RISC-V target chips. 36 | * 37 | * + Header files called freertos_risc_v_chip_specific_extensions.h contain the 38 | * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V 39 | * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files 40 | * as there are multiple RISC-V chip implementations. 41 | * 42 | * !!!NOTE!!! 43 | * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h 44 | * HEADER FILE FOR THE CHIP IN USE. This is done using the assembler's (not the 45 | * compiler's!) include path. For example, if the chip in use includes a core 46 | * local interrupter (CLINT) and does not include any chip specific register 47 | * extensions then add the path below to the assembler's include path: 48 | * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions 49 | * 50 | */ 51 | 52 | 53 | #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__ 54 | #define __FREERTOS_RISC_V_EXTENSIONS_H__ 55 | 56 | #define portasmHAS_SIFIVE_CLINT 1 57 | #define portasmHAS_MTIME 1 58 | #define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */ 59 | 60 | .macro portasmSAVE_ADDITIONAL_REGISTERS 61 | /* No additional registers to save, so this macro does nothing. */ 62 | .endm 63 | 64 | .macro portasmRESTORE_ADDITIONAL_REGISTERS 65 | /* No additional registers to restore, so this macro does nothing. */ 66 | .endm 67 | 68 | #endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */ 69 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RISC-V/chip_specific_extensions/readme.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * The FreeRTOS kernel's RISC-V port is split between the the code that is 3 | * common across all currently supported RISC-V chips (implementations of the 4 | * RISC-V ISA), and code that tailors the port to a specific RISC-V chip: 5 | * 6 | * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that 7 | * is common to all currently supported RISC-V chips. There is only one 8 | * portASM.S file because the same file is built for all RISC-V target chips. 9 | * 10 | * + Header files called freertos_risc_v_chip_specific_extensions.h contain the 11 | * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V 12 | * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files 13 | * as there are multiple RISC-V chip implementations. 14 | * 15 | * !!!NOTE!!! 16 | * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h 17 | * HEADER FILE FOR THE CHIP IN USE. This is done using the assembler's (not the 18 | * compiler's!) include path. For example, if the chip in use includes a core 19 | * local interrupter (CLINT) and does not include any chip specific register 20 | * extensions then add the path below to the assembler's include path: 21 | * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RISC-V/readme.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * The FreeRTOS kernel's RISC-V port is split between the the code that is 3 | * common across all currently supported RISC-V chips (implementations of the 4 | * RISC-V ISA), and code that tailors the port to a specific RISC-V chip: 5 | * 6 | * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that 7 | * is common to all currently supported RISC-V chips. There is only one 8 | * portASM.S file because the same file is built for all RISC-V target chips. 9 | * 10 | * + Header files called freertos_risc_v_chip_specific_extensions.h contain the 11 | * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V 12 | * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files 13 | * as there are multiple RISC-V chip implementations. 14 | * 15 | * !!!NOTE!!! 16 | * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h 17 | * HEADER FILE FOR THE CHIP IN USE. This is done using the assembler's (not the 18 | * compiler's!) include path. For example, if the chip in use includes a core 19 | * local interrupter (CLINT) and does not include any chip specific register 20 | * extensions then add the path below to the assembler's include path: 21 | * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RL78/isr_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* Variables used by scheduler */ 29 | .extern _pxCurrentTCB 30 | .extern _usCriticalNesting 31 | 32 | /* 33 | * portSAVE_CONTEXT MACRO 34 | * Saves the context of the general purpose registers, CS and ES (only in far 35 | * memory mode) registers the usCriticalNesting Value and the Stack Pointer 36 | * of the active Task onto the task stack 37 | */ 38 | .macro portSAVE_CONTEXT 39 | 40 | SEL RB0 41 | 42 | /* Save AX Register to stack. */ 43 | PUSH AX 44 | PUSH HL 45 | /* Save CS register. */ 46 | MOV A, CS 47 | XCH A, X 48 | /* Save ES register. */ 49 | MOV A, ES 50 | PUSH AX 51 | /* Save the remaining general purpose registers from bank 0. */ 52 | PUSH DE 53 | PUSH BC 54 | /* Save the other register banks - only necessary in the GCC port. */ 55 | SEL RB1 56 | PUSH AX 57 | PUSH BC 58 | PUSH DE 59 | PUSH HL 60 | SEL RB2 61 | PUSH AX 62 | PUSH BC 63 | PUSH DE 64 | PUSH HL 65 | /* Registers in bank 3 are for ISR use only so don't need saving. */ 66 | SEL RB0 67 | /* Save the usCriticalNesting value. */ 68 | MOVW AX, !_usCriticalNesting 69 | PUSH AX 70 | /* Save the Stack pointer. */ 71 | MOVW AX, !_pxCurrentTCB 72 | MOVW HL, AX 73 | MOVW AX, SP 74 | MOVW [HL], AX 75 | /* Switch stack pointers. */ 76 | movw sp,#_stack /* Set stack pointer */ 77 | 78 | .endm 79 | 80 | 81 | /* 82 | * portRESTORE_CONTEXT MACRO 83 | * Restores the task Stack Pointer then use this to restore usCriticalNesting, 84 | * general purpose registers and the CS and ES (only in far memory mode) 85 | * of the selected task from the task stack 86 | */ 87 | .macro portRESTORE_CONTEXT MACRO 88 | SEL RB0 89 | /* Restore the Stack pointer. */ 90 | MOVW AX, !_pxCurrentTCB 91 | MOVW HL, AX 92 | MOVW AX, [HL] 93 | MOVW SP, AX 94 | /* Restore usCriticalNesting value. */ 95 | POP AX 96 | MOVW !_usCriticalNesting, AX 97 | /* Restore the alternative register banks - only necessary in the GCC 98 | port. Register bank 3 is dedicated for interrupts use so is not saved or 99 | restored. */ 100 | SEL RB2 101 | POP HL 102 | POP DE 103 | POP BC 104 | POP AX 105 | SEL RB1 106 | POP HL 107 | POP DE 108 | POP BC 109 | POP AX 110 | SEL RB0 111 | /* Restore the necessary general purpose registers. */ 112 | POP BC 113 | POP DE 114 | /* Restore the ES register. */ 115 | POP AX 116 | MOV ES, A 117 | /* Restore the CS register. */ 118 | XCH A, X 119 | MOV CS, A 120 | /* Restore general purpose register HL. */ 121 | POP HL 122 | /* Restore AX. */ 123 | POP AX 124 | 125 | .endm 126 | 127 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RL78/portasm.S: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #include "FreeRTOSConfig.h" 29 | #include "ISR_Support.h" 30 | 31 | .global _vPortYield 32 | .global _vPortStartFirstTask 33 | .global _vPortTickISR 34 | 35 | .extern _vTaskSwitchContext 36 | .extern _xTaskIncrementTick 37 | 38 | .text 39 | .align 2 40 | 41 | /* FreeRTOS yield handler. This is installed as the BRK software interrupt 42 | handler. */ 43 | _vPortYield: 44 | /* Save the context of the current task. */ 45 | portSAVE_CONTEXT 46 | /* Call the scheduler to select the next task. */ 47 | call !!_vTaskSwitchContext 48 | /* Restore the context of the next task to run. */ 49 | portRESTORE_CONTEXT 50 | retb 51 | 52 | 53 | /* Starts the scheduler by restoring the context of the task that will execute 54 | first. */ 55 | .align 2 56 | _vPortStartFirstTask: 57 | /* Restore the context of whichever task will execute first. */ 58 | portRESTORE_CONTEXT 59 | /* An interrupt stack frame is used so the task is started using RETI. */ 60 | reti 61 | 62 | /* FreeRTOS tick handler. This is installed as the interval timer interrupt 63 | handler. */ 64 | .align 2 65 | _vPortTickISR: 66 | 67 | /* Save the context of the currently executing task. */ 68 | portSAVE_CONTEXT 69 | /* Call the RTOS tick function. */ 70 | call !!_xTaskIncrementTick 71 | #if configUSE_PREEMPTION == 1 72 | /* Select the next task to run. */ 73 | call !!_vTaskSwitchContext 74 | #endif 75 | /* Retore the context of whichever task will run next. */ 76 | portRESTORE_CONTEXT 77 | reti 78 | 79 | .end 80 | 81 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RX100/readme.txt: -------------------------------------------------------------------------------- 1 | The following table shows which port is recommended to be used. 2 | 3 | 4 | RX MCU Group CPU FPU FPU Port Layer 5 | Core (Single (Double CC-RX GNURX ICCRX (*6) 6 | Type Precision) Precision) 7 | 8 | RX110 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 9 | RX111 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 10 | RX113 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 11 | RX130 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 12 | RX13T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 13 | 14 | RX210 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 15 | RX21A RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 16 | RX220 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 17 | RX230,RX231 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 18 | RX23E-A RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 19 | RX23W RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 20 | RX23T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 21 | RX24T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 22 | RX24U RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 23 | 24 | RX610 RXv1 Yes --- N/A (*4) N/A (*4) N/A (*4) 25 | RX62N,RX621 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 26 | RX630 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 27 | RX634 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 28 | RX63N,RX631 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 29 | RX64M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 30 | RX65N,RX651 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 31 | RX66N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 32 | RX62T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 33 | RX62G RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 34 | RX63T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 35 | RX66T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 36 | 37 | RX71M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 38 | RX72M RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 39 | RX72N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 40 | RX72T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 41 | 42 | Notes: 43 | 44 | *1: If the application writer wants to use their own tick interrupt configuration when tickless idle 45 | functionality is not used, please define configSETUP_TICK_INTERRUPT() (in FreeRTOSConfig.h) and provide 46 | the configuration function. Please be aware that port.c is hard coded to use CMT0 though it seems to be 47 | configured to use any CMTn according to the definition of configTICK_VECTOR (in FreeRTOSConfig.h). 48 | 49 | *2: If the application writer wants to use their own tick interrupt configuration when tickless idle 50 | functionality is used, please modify port.c for the configuration. Please be aware that port.c is 51 | hard coded to use CMT0 though it seems to be configured to use any CMTn according to the definition of 52 | configTICK_VECTOR (in FreeRTOSConfig.h). 53 | 54 | *3: RX100 ports are also available. 55 | 56 | *4: RX600 ports use MVTIPL instruction but RX610 MCUs don't support this instruction. 57 | 58 | *5: RX700v3_DPFPU ports are also available with the following definition in FreeRTOSConfig.h. 59 | 60 | #define configUSE_TASK_DPFPU_SUPPORT 0 61 | 62 | *6: PriorityDefinitions.h has to be provided for port_asm.s in case of other than RX700v3_DPFPU port. 63 | It contains two definitions of interrupt priority like the following. 64 | 65 | #define configKERNEL_INTERRUPT_PRIORITY 1 66 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY 4 67 | 68 | 69 | For more information about Renesas RX MCUs, please visit the following URL: 70 | 71 | https://www.renesas.com/products/microcontrollers-microprocessors/rx.html 72 | 73 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RX600/readme.txt: -------------------------------------------------------------------------------- 1 | The following table shows which port is recommended to be used. 2 | 3 | 4 | RX MCU Group CPU FPU FPU Port Layer 5 | Core (Single (Double CC-RX GNURX ICCRX (*6) 6 | Type Precision) Precision) 7 | 8 | RX110 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 9 | RX111 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 10 | RX113 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 11 | RX130 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 12 | RX13T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 13 | 14 | RX210 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 15 | RX21A RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 16 | RX220 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 17 | RX230,RX231 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 18 | RX23E-A RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 19 | RX23W RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 20 | RX23T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 21 | RX24T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 22 | RX24U RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 23 | 24 | RX610 RXv1 Yes --- N/A (*4) N/A (*4) N/A (*4) 25 | RX62N,RX621 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 26 | RX630 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 27 | RX634 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 28 | RX63N,RX631 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 29 | RX64M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 30 | RX65N,RX651 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 31 | RX66N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 32 | RX62T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 33 | RX62G RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 34 | RX63T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 35 | RX66T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 36 | 37 | RX71M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 38 | RX72M RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 39 | RX72N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 40 | RX72T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 41 | 42 | Notes: 43 | 44 | *1: If the application writer wants to use their own tick interrupt configuration when tickless idle 45 | functionality is not used, please define configSETUP_TICK_INTERRUPT() (in FreeRTOSConfig.h) and provide 46 | the configuration function. Please be aware that port.c is hard coded to use CMT0 though it seems to be 47 | configured to use any CMTn according to the definition of configTICK_VECTOR (in FreeRTOSConfig.h). 48 | 49 | *2: If the application writer wants to use their own tick interrupt configuration when tickless idle 50 | functionality is used, please modify port.c for the configuration. Please be aware that port.c is 51 | hard coded to use CMT0 though it seems to be configured to use any CMTn according to the definition of 52 | configTICK_VECTOR (in FreeRTOSConfig.h). 53 | 54 | *3: RX100 ports are also available. 55 | 56 | *4: RX600 ports use MVTIPL instruction but RX610 MCUs don't support this instruction. 57 | 58 | *5: RX700v3_DPFPU ports are also available with the following definition in FreeRTOSConfig.h. 59 | 60 | #define configUSE_TASK_DPFPU_SUPPORT 0 61 | 62 | *6: PriorityDefinitions.h has to be provided for port_asm.s in case of other than RX700v3_DPFPU port. 63 | It contains two definitions of interrupt priority like the following. 64 | 65 | #define configKERNEL_INTERRUPT_PRIORITY 1 66 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY 4 67 | 68 | 69 | For more information about Renesas RX MCUs, please visit the following URL: 70 | 71 | https://www.renesas.com/products/microcontrollers-microprocessors/rx.html 72 | 73 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RX600v2/readme.txt: -------------------------------------------------------------------------------- 1 | The following table shows which port is recommended to be used. 2 | 3 | 4 | RX MCU Group CPU FPU FPU Port Layer 5 | Core (Single (Double CC-RX GNURX ICCRX (*6) 6 | Type Precision) Precision) 7 | 8 | RX110 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 9 | RX111 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 10 | RX113 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 11 | RX130 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 12 | RX13T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 13 | 14 | RX210 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 15 | RX21A RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 16 | RX220 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 17 | RX230,RX231 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 18 | RX23E-A RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 19 | RX23W RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 20 | RX23T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 21 | RX24T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 22 | RX24U RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 23 | 24 | RX610 RXv1 Yes --- N/A (*4) N/A (*4) N/A (*4) 25 | RX62N,RX621 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 26 | RX630 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 27 | RX634 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 28 | RX63N,RX631 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 29 | RX64M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 30 | RX65N,RX651 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 31 | RX66N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 32 | RX62T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 33 | RX62G RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 34 | RX63T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 35 | RX66T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 36 | 37 | RX71M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 38 | RX72M RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 39 | RX72N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 40 | RX72T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 41 | 42 | Notes: 43 | 44 | *1: If the application writer wants to use their own tick interrupt configuration when tickless idle 45 | functionality is not used, please define configSETUP_TICK_INTERRUPT() (in FreeRTOSConfig.h) and provide 46 | the configuration function. Please be aware that port.c is hard coded to use CMT0 though it seems to be 47 | configured to use any CMTn according to the definition of configTICK_VECTOR (in FreeRTOSConfig.h). 48 | 49 | *2: If the application writer wants to use their own tick interrupt configuration when tickless idle 50 | functionality is used, please modify port.c for the configuration. Please be aware that port.c is 51 | hard coded to use CMT0 though it seems to be configured to use any CMTn according to the definition of 52 | configTICK_VECTOR (in FreeRTOSConfig.h). 53 | 54 | *3: RX100 ports are also available. 55 | 56 | *4: RX600 ports use MVTIPL instruction but RX610 MCUs don't support this instruction. 57 | 58 | *5: RX700v3_DPFPU ports are also available with the following definition in FreeRTOSConfig.h. 59 | 60 | #define configUSE_TASK_DPFPU_SUPPORT 0 61 | 62 | *6: PriorityDefinitions.h has to be provided for port_asm.s in case of other than RX700v3_DPFPU port. 63 | It contains two definitions of interrupt priority like the following. 64 | 65 | #define configKERNEL_INTERRUPT_PRIORITY 1 66 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY 4 67 | 68 | 69 | For more information about Renesas RX MCUs, please visit the following URL: 70 | 71 | https://www.renesas.com/products/microcontrollers-microprocessors/rx.html 72 | 73 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/GCC/RX700v3_DPFPU/readme.txt: -------------------------------------------------------------------------------- 1 | The following table shows which port is recommended to be used. 2 | 3 | 4 | RX MCU Group CPU FPU FPU Port Layer 5 | Core (Single (Double CC-RX GNURX ICCRX (*6) 6 | Type Precision) Precision) 7 | 8 | RX110 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 9 | RX111 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 10 | RX113 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 11 | RX130 RXv1 No --- Renesas/RX100 (*1,*2) GCC/RX100 (*1,*2) IAR/RX100 (*1,*2) 12 | RX13T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 13 | 14 | RX210 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 15 | RX21A RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 16 | RX220 RXv1 No --- Renesas/RX200 (*3) N/A (*3) N/A (*3) 17 | RX230,RX231 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 18 | RX23E-A RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 19 | RX23W RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 20 | RX23T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 21 | RX24T RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 22 | RX24U RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 23 | 24 | RX610 RXv1 Yes --- N/A (*4) N/A (*4) N/A (*4) 25 | RX62N,RX621 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 26 | RX630 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 27 | RX634 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 28 | RX63N,RX631 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 29 | RX64M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 30 | RX65N,RX651 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 31 | RX66N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 32 | RX62T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 33 | RX62G RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 34 | RX63T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600 35 | RX66T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 36 | 37 | RX71M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2 38 | RX72M RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 39 | RX72N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU 40 | RX72T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5) 41 | 42 | Notes: 43 | 44 | *1: If the application writer wants to use their own tick interrupt configuration when tickless idle 45 | functionality is not used, please define configSETUP_TICK_INTERRUPT() (in FreeRTOSConfig.h) and provide 46 | the configuration function. Please be aware that port.c is hard coded to use CMT0 though it seems to be 47 | configured to use any CMTn according to the definition of configTICK_VECTOR (in FreeRTOSConfig.h). 48 | 49 | *2: If the application writer wants to use their own tick interrupt configuration when tickless idle 50 | functionality is used, please modify port.c for the configuration. Please be aware that port.c is 51 | hard coded to use CMT0 though it seems to be configured to use any CMTn according to the definition of 52 | configTICK_VECTOR (in FreeRTOSConfig.h). 53 | 54 | *3: RX100 ports are also available. 55 | 56 | *4: RX600 ports use MVTIPL instruction but RX610 MCUs don't support this instruction. 57 | 58 | *5: RX700v3_DPFPU ports are also available with the following definition in FreeRTOSConfig.h. 59 | 60 | #define configUSE_TASK_DPFPU_SUPPORT 0 61 | 62 | *6: PriorityDefinitions.h has to be provided for port_asm.s in case of other than RX700v3_DPFPU port. 63 | It contains two definitions of interrupt priority like the following. 64 | 65 | #define configKERNEL_INTERRUPT_PRIORITY 1 66 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY 4 67 | 68 | 69 | For more information about Renesas RX MCUs, please visit the following URL: 70 | 71 | https://www.renesas.com/products/microcontrollers-microprocessors/rx.html 72 | 73 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/MemMang/ReadMe.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=https://www.FreeRTOS.org/a00111.html 5 | IDList= 6 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/MemMang/heap_3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.4.3 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | 29 | /* 30 | * Implementation of pvPortMalloc() and vPortFree() that relies on the 31 | * compilers own malloc() and free() implementations. 32 | * 33 | * This file can only be used if the linker is configured to to generate 34 | * a heap memory area. 35 | * 36 | * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the 37 | * memory management pages of https://www.FreeRTOS.org for more information. 38 | */ 39 | 40 | #include 41 | 42 | /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining 43 | * all the API functions to use the MPU wrappers. That should only be done when 44 | * task.h is included from an application file. */ 45 | #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE 46 | 47 | #include "FreeRTOS.h" 48 | #include "task.h" 49 | 50 | #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE 51 | 52 | #if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) 53 | #error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0 54 | #endif 55 | 56 | /*-----------------------------------------------------------*/ 57 | 58 | void * pvPortMalloc( size_t xWantedSize ) 59 | { 60 | void * pvReturn; 61 | 62 | vTaskSuspendAll(); 63 | { 64 | pvReturn = malloc( xWantedSize ); 65 | traceMALLOC( pvReturn, xWantedSize ); 66 | } 67 | ( void ) xTaskResumeAll(); 68 | 69 | #if ( configUSE_MALLOC_FAILED_HOOK == 1 ) 70 | { 71 | if( pvReturn == NULL ) 72 | { 73 | extern void vApplicationMallocFailedHook( void ); 74 | vApplicationMallocFailedHook(); 75 | } 76 | } 77 | #endif 78 | 79 | return pvReturn; 80 | } 81 | /*-----------------------------------------------------------*/ 82 | 83 | void vPortFree( void * pv ) 84 | { 85 | if( pv ) 86 | { 87 | vTaskSuspendAll(); 88 | { 89 | free( pv ); 90 | traceFREE( pv, 0 ); 91 | } 92 | ( void ) xTaskResumeAll(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /FreeRTOS/Source/portable/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and/or compiler. 4 | 5 | 6 | + The FreeRTOS/Source/Portable/MemMang directory contains the five sample 7 | memory allocators as described on the https://www.FreeRTOS.org WEB site. 8 | 9 | + The other directories each contain files specific to a particular 10 | microcontroller or compiler, where the directory name denotes the compiler 11 | specific files the directory contains. 12 | 13 | 14 | 15 | For example, if you are interested in the [compiler] port for the [architecture] 16 | microcontroller, then the port specific files are contained in 17 | FreeRTOS/Source/Portable/[compiler]/[architecture] directory. If this is the 18 | only port you are interested in then all the other directories can be 19 | ignored. 20 | 21 | -------------------------------------------------------------------------------- /FreeRTOS/links_to_doc_pages_for_the_demo_projects.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://www.freertos.org/a00090.html 5 | IDList= 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Seeed Studio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Seeed-Arduino-FreeRTOS [![Build Status](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_FreeRTOS.svg?branch=master)](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_FreeRTOS) 2 | 3 | ### Introduction 4 | 5 | This library ports the latest FreeRTOS(10.4.3) and allow you to create FreeRTOS Projects in the in Arduino IDE. 6 | 7 | ### Boards 8 | - samd21 series 9 | - zero 10 | - seeeduio xiao 11 | 12 | **...** 13 | - samd51 series 14 | - Wio Terminal 15 | 16 | **...** 17 | ### License 18 | This software is written by LynnL4 for seeed studio 19 | Email:hongtai.liu@seeed.cc and is licensed under The MIT License. Check License.txt for more information. 20 | 21 | Contributing to this software is warmly welcomed. You can do this basically by 22 | forking, committing modifications and then pulling requests (follow the links above 23 | for operating guide). Adding change log and your contact into file header is encouraged. 24 | Thanks for your contribution. 25 | 26 | Seeed Studio is an open hardware facilitation company based in Shenzhen, China. 27 | Benefiting from local manufacture power and convenient global logistic system, 28 | we integrate resources to serve new era of innovation. Seeed also works with 29 | global distributors and partners to push open hardware movement. 30 | 31 | -------------------------------------------------------------------------------- /examples/FreeRTOS_POSIX_thread/FreeRTOS_POSIX_thread.ino: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void *print_message_function( void *ptr ); 9 | 10 | void setup() 11 | { 12 | pthread_t thread1, thread2; 13 | char *message1 = "Thread 1"; 14 | char *message2 = "Thread 2"; 15 | int iret1, iret2; 16 | 17 | /* Create independent threads each of which will execute function */ 18 | 19 | iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1); 20 | iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2); 21 | 22 | /* Wait till threads are complete before main continues. Unless we */ 23 | /* wait we run the risk of executing an exit which will terminate */ 24 | /* the process and all threads before the threads have completed. */ 25 | 26 | pthread_join( thread1, NULL); 27 | pthread_join( thread2, NULL); 28 | 29 | printf("Thread 1 returns: %d\n",iret1); 30 | printf("Thread 2 returns: %d\n",iret2); 31 | } 32 | 33 | void *print_message_function( void *ptr ) 34 | { 35 | char *message; 36 | message = (char *) ptr; 37 | //printf("%s \n", message); 38 | } 39 | 40 | void loop() { 41 | // put your main code here, to run repeatedly: 42 | 43 | } 44 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Seeed Arduino FreeRTOS 2 | version=10.4.3 3 | author=hongtai.liu 4 | maintainer=hongtai.liu 5 | sentence=FreeRTOS ported for Arduino 6 | paragraph=FreeRTOS ported for Arduino 7 | category=Device Control 8 | url= 9 | architectures=* 10 | repository= 11 | -------------------------------------------------------------------------------- /src/FreeRTOS.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_FREERTOS_H_ 2 | #define _ARDUINO_FREERTOS_H_ 3 | 4 | #include "../FreeRTOS/Source/include/FreeRTOS.h" 5 | 6 | #endif //_ARDUINO_FREERTOS_H_ 7 | -------------------------------------------------------------------------------- /src/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_FREERTOS_CONFIG_H 2 | #define _ARDUINO_FREERTOS_CONFIG_H 3 | 4 | /*----------------------------------------------------------- 5 | * Application specific definitions. 6 | * 7 | * These definitions should be adjusted for your particular hardware and 8 | * application requirements. 9 | * 10 | * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE 11 | * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. 12 | * 13 | * See http://www.freertos.org/a00110.html. 14 | *----------------------------------------------------------*/ 15 | 16 | //Load default FreeRTOS configuration 17 | #ifdef ARDUINO_ARCH_SAMD 18 | #if defined(__SAMD51__) 19 | #include "arch/samd51/FreeRTOSConfig.h" 20 | #elif defined(__SAMD21G18A__) 21 | #include "arch/samd21/FreeRTOSConfig.h" 22 | #else 23 | #error "Processor architecture not recognized!" 24 | #endif 25 | #elif defined(ARDUINO_ARCH_STM32) 26 | #if defined(STM32H7xx) 27 | #include "arch/stm32h7xx/FreeRTOSConfig.h" 28 | #else 29 | #error "Processor or architecture not recognized!" 30 | #endif 31 | #else 32 | #error "Processor or architecture not support!" 33 | #endif 34 | 35 | // Load extra configurations, which can override the default configuration 36 | #if __has_include("FreeRTOSConfig_extra.h") 37 | #include "FreeRTOSConfig_extra.h" 38 | #endif 39 | #define configUSE_POSIX_ERRNO 1 40 | #endif /* _ARDUINO_FREERTOS_CONFIG_H */ 41 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file FreeRTOS_POSIX.h 28 | * @brief FreeRTOS+POSIX header. 29 | * 30 | * This file must be included before all other FreeRTOS+POSIX includes. 31 | */ 32 | 33 | #ifndef _FREERTOS_POSIX_H_ 34 | #define _FREERTOS_POSIX_H_ 35 | 36 | /* FreeRTOS+POSIX platform-specific configuration headers. */ 37 | #include "FreeRTOS_POSIX_portable.h" 38 | #include "FreeRTOS_POSIX_portable_default.h" 39 | 40 | /* FreeRTOS includes. */ 41 | #include "FreeRTOS.h" 42 | #include "event_groups.h" 43 | #include "semphr.h" 44 | #include "task.h" 45 | 46 | /* FreeRTOS+POSIX data types and internal structs. */ 47 | #include "FreeRTOS_POSIX/sys/types.h" 48 | #include "FreeRTOS_POSIX_internal.h" 49 | 50 | #endif /* _FREERTOS_POSIX_H_ */ 51 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/FreeRTOS_POSIX_sched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file FreeRTOS_POSIX_sched.c 28 | * @brief Implementation of scheduler functions in sched.h 29 | */ 30 | 31 | /* FreeRTOS+POSIX includes. */ 32 | #include "FreeRTOS_POSIX.h" 33 | #include "FreeRTOS_POSIX/sched.h" 34 | 35 | /*-----------------------------------------------------------*/ 36 | 37 | int sched_get_priority_max( int policy ) 38 | { 39 | /* Silence warnings about unused parameters. */ 40 | ( void ) policy; 41 | 42 | return configMAX_PRIORITIES - 1; 43 | } 44 | 45 | /*-----------------------------------------------------------*/ 46 | 47 | int sched_get_priority_min( int policy ) 48 | { 49 | /* Silence warnings about unused parameters. */ 50 | ( void ) policy; 51 | 52 | return tskIDLE_PRIORITY; 53 | } 54 | 55 | /*-----------------------------------------------------------*/ 56 | 57 | int sched_yield( void ) 58 | { 59 | taskYIELD(); 60 | 61 | return 0; 62 | } 63 | 64 | /*-----------------------------------------------------------*/ 65 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/FreeRTOS_POSIX_unistd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file FreeRTOS_POSIX_unistd.c 28 | * @brief Implementation of functions in unistd.h 29 | */ 30 | 31 | /* FreeRTOS+POSIX includes. */ 32 | #include "FreeRTOS_POSIX.h" 33 | #include "FreeRTOS_POSIX/unistd.h" 34 | 35 | /*-----------------------------------------------------------*/ 36 | 37 | unsigned sleep( unsigned seconds ) 38 | { 39 | vTaskDelay( pdMS_TO_TICKS( seconds * 1000 ) ); 40 | 41 | return 0; 42 | } 43 | 44 | /*-----------------------------------------------------------*/ 45 | 46 | int usleep( useconds_t usec ) 47 | { 48 | /* To avoid delaying for less than usec, always round up. */ 49 | vTaskDelay( pdMS_TO_TICKS( usec / 1000 + ( usec % 1000 != 0 ) ) ); 50 | 51 | return 0; 52 | } 53 | 54 | /*-----------------------------------------------------------*/ 55 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file errno.h 28 | * @brief System error numbers. 29 | * 30 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html 31 | * 32 | * The values defined in this file may not be compatible with the strerror 33 | * function provided by this system. 34 | */ 35 | 36 | #ifndef _FREERTOS_POSIX_ERRNO_H_ 37 | #define _FREERTOS_POSIX_ERRNO_H_ 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | /* Undefine all errnos to avoid redefinition errors with system errnos. */ 44 | #undef EPERM 45 | #undef ENOENT 46 | #undef EBADF 47 | #undef EAGAIN 48 | #undef ENOMEM 49 | #undef EEXIST 50 | #undef EBUSY 51 | #undef EINVAL 52 | #undef ENOSPC 53 | #undef ERANGE 54 | #undef ENAMETOOLONG 55 | #undef EDEADLK 56 | #undef EOVERFLOW 57 | #undef ENOSYS 58 | #undef EMSGSIZE 59 | #undef ENOTSUP 60 | #undef ETIMEDOUT 61 | 62 | /** 63 | * @name Definition of POSIX errnos. 64 | */ 65 | /**@{ */ 66 | #define EPERM 1 /**< Operation not permitted. */ 67 | #define ENOENT 2 /**< No such file or directory. */ 68 | #define EBADF 9 /**< Bad file descriptor. */ 69 | #define EAGAIN 11 /**< Resource unavailable, try again. */ 70 | #define ENOMEM 12 /**< Not enough space. */ 71 | #define EEXIST 17 /**< File exists. */ 72 | #define EBUSY 16 /**< Device or resource busy. */ 73 | #define EINVAL 22 /**< Invalid argument. */ 74 | #define ENOSPC 28 /**< No space left on device. */ 75 | #define ERANGE 34 /**< Result too large. */ 76 | #define ENAMETOOLONG 36 /**< File name too long. */ 77 | #define EDEADLK 45 /**< Resource deadlock would occur. */ 78 | #define EOVERFLOW 75 /**< Value too large to be stored in data type. */ 79 | #define ENOSYS 88 /**< Function not supported. */ 80 | #define EMSGSIZE 90 /**< Message too long. */ 81 | #define ENOTSUP 95 /**< Operation not supported. */ 82 | #define ETIMEDOUT 116 /**< Connection timed out. */ 83 | /**@} */ 84 | 85 | /** 86 | * @name System Variable 87 | * 88 | * @brief Define FreeRTOS+POSIX errno, if enabled. 89 | * Set configUSE_POSIX_ERRNO to enable, and clear to disable. See FreeRTOS.h. 90 | * 91 | * @{ 92 | */ 93 | #if ( configUSE_POSIX_ERRNO == 1 ) 94 | extern int FreeRTOS_errno; 95 | #define errno FreeRTOS_errno 96 | #endif 97 | /**@} */ 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif /* ifndef _FREERTOS_POSIX_ERRNO_H_ */ 104 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/fcntl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file fcntl.h 28 | * @brief File control options. 29 | * 30 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html 31 | */ 32 | 33 | #ifndef _FREERTOS_POSIX_FCNTL_H_ 34 | #define _FREERTOS_POSIX_FCNTL_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * @name File creation flags for use in the oflag value to open() and openat(). 42 | */ 43 | /**@{ */ 44 | #define O_CLOEXEC 0x0001 /**< Close the file descriptor upon exec(). */ 45 | #define O_CREAT 0x0002 /**< Create file if it does not exist. */ 46 | #define O_DIRECTORY 0x0004 /**< Fail if file is a non-directory file. */ 47 | #define O_EXCL 0x0008 /**< Exclusive use flag. */ 48 | #define O_NOCTTY 0x0010 /**< Do not assign controlling terminal. */ 49 | #define O_NOFOLLOW 0x0020 /**< Do not follow symbolic links. */ 50 | #define O_TRUNC 0x0040 /**< Truncate flag. */ 51 | #define O_TTY_INIT 0x0080 /**< termios structure provides conforming behavior. */ 52 | /**@} */ 53 | 54 | /** 55 | * @name File status flags for open(), openat(), and fcntl(). 56 | */ 57 | /**@{ */ 58 | #define O_APPEND 0x0100 /**< Set append mode. */ 59 | #define O_DSYNC 0x0200 /**< Write according to synchronized I/O data integrity completion. */ 60 | #define O_NONBLOCK 0x0400 /**< Non-blocking mode. */ 61 | #define O_RSYNC 0x0800 /**< Synchronized read I/O operations. */ 62 | #define O_SYNC 0x0200 /**< Write according to synchronized I/O file integrity completion. */ 63 | /**@} */ 64 | 65 | /** 66 | * @name Mask for file access modes. 67 | */ 68 | /**@{ */ 69 | #define O_ACCMODE 0xF000 70 | /**@} */ 71 | 72 | /** 73 | * @name File access modes for open(), openat(), and fcntl(). 74 | */ 75 | /**@{ */ 76 | #define O_EXEC 0x1000 /**< Open for execute only (non-directory files). */ 77 | #define O_RDONLY 0x2000 /**< Open for reading only. */ 78 | #define O_RDWR 0xA000 /**< Open for reading and writing. */ 79 | #define O_SEARCH 0x4000 /**< Open directory for search only. */ 80 | #define O_WRONLY 0x8000 /**< Open for writing only. */ 81 | /**@} */ 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* ifndef _FREERTOS_POSIX_FCNTL_H_ */ 88 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/sched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file sched.h 28 | * @brief Execution scheduling. 29 | * 30 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html 31 | */ 32 | 33 | #ifndef _FREERTOS_POSIX_SCHED_H_ 34 | #define _FREERTOS_POSIX_SCHED_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** 41 | * @name Scheduling Policies 42 | */ 43 | /**@{ */ 44 | #define SCHED_OTHER 0 /**< Another scheduling policy. */ 45 | /**@} */ 46 | 47 | /** 48 | * @brief Scheduling parameters required for implementation of each supported 49 | * scheduling policy. 50 | */ 51 | struct sched_param 52 | { 53 | int sched_priority; /**< Process or thread execution scheduling priority. */ 54 | }; 55 | 56 | /** 57 | * @brief Get priority limit (max). 58 | * 59 | * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_get_priority_max.html 60 | * 61 | * @note policy is ignored. 62 | * 63 | * @return the maximum priority value (0-based) system configuration allows. 64 | *
65 | * e.g. if configMAX_PRIORITIES == 7, this function returns (configMAX_PRIORITIES - 1). 66 | * configMAX_PRIORITIES is configured in application FreeRTOSConfig.h file. 67 | */ 68 | int sched_get_priority_max( int policy ); 69 | 70 | /** 71 | * @brief Get priority limit (min). 72 | * 73 | * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_get_priority_min.html 74 | * 75 | * @note policy is ignored. 76 | */ 77 | int sched_get_priority_min( int policy ); 78 | 79 | /** 80 | * @brief Yield the processor. 81 | * 82 | * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html 83 | * 84 | * @retval 0 - Upon successful completion 85 | */ 86 | int sched_yield( void ); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | 92 | #endif /* ifndef _FREERTOS_POSIX_SCHED_H_ */ 93 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file signal.h 28 | * @brief Signals. 29 | * 30 | * Signals are currently not implemented in FreeRTOS+POSIX. This header only 31 | * defines the signal data structures used elsewhere. 32 | * 33 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html 34 | */ 35 | 36 | 37 | #ifndef _FREERTOS_POSIX_SIGNAL_H_ 38 | #define _FREERTOS_POSIX_SIGNAL_H_ 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** 45 | * @name Values of sigev_notify. 46 | */ 47 | /**@{ */ 48 | #define SIGEV_NONE 0 /**< No asynchronous notification is delivered when the event of interest occurs. */ 49 | #define SIGEV_SIGNAL 1 /**< A queued signal, with an application-defined value, is generated when the event of interest occurs. Not supported. */ 50 | #define SIGEV_THREAD 2 /**< A notification function is called to perform notification. */ 51 | /**@} */ 52 | 53 | /** 54 | * @brief Signal value. 55 | */ 56 | union sigval 57 | { 58 | int sival_int; /**< Integer signal value. */ 59 | void * sival_ptr; /**< Pointer signal value. */ 60 | }; 61 | 62 | /** 63 | * @brief Signal event structure. 64 | */ 65 | struct sigevent 66 | { 67 | int sigev_notify; /**< Notification type. A value of SIGEV_SIGNAL is not supported. */ 68 | int sigev_signo; /**< Signal number. This member is ignored. */ 69 | union sigval sigev_value; /**< Signal value. Only the sival_ptr member is used. */ 70 | void ( * sigev_notify_function )( union sigval ); /**< Notification function. */ 71 | pthread_attr_t * sigev_notify_attributes; /**< Notification attributes. */ 72 | }; 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* ifndef _FREERTOS_POSIX_SIGNAL_H_ */ 79 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX/unistd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file unistd.h 28 | * @brief Standard symbolic constants and types 29 | * 30 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html 31 | */ 32 | 33 | #ifndef _FREERTOS_POSIX_UNISTD_H_ 34 | #define _FREERTOS_POSIX_UNISTD_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #include "FreeRTOS_POSIX/sys/types.h" 41 | 42 | /** 43 | * @brief Suspend execution for an interval of time. 44 | * 45 | * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html 46 | * 47 | * @param[in] seconds The number of seconds to suspend execution. 48 | * 49 | * @retval 0 - Upon successful completion. 50 | * 51 | * @note Return value of a positive number is not yet supported. 52 | */ 53 | unsigned sleep( unsigned seconds ); 54 | 55 | /** 56 | * @brief Suspend execution for microsecond intervals. 57 | * 58 | * This is a useful, non-POSIX function. 59 | * @param[in] usec The number of microseconds to suspend execution. 60 | * 61 | * @retval 0 - Upon successful completion. 62 | */ 63 | int usleep( useconds_t usec ); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* ifndef _FREERTOS_POSIX_UNISTD_H_ */ 70 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX_portable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS+POSIX V1.0.4 3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | /** 27 | * @file FreeRTOS_POSIX_portable.h 28 | * @brief Port-specific configuration of FreeRTOS+POSIX. 29 | */ 30 | 31 | #ifndef _FREERTOS_POSIX_PORTABLE_H_ 32 | #define _FREERTOS_POSIX_PORTABLE_H_ 33 | 34 | /* This port uses the defaults in FreeRTOS_POSIX_portable_default.h, so this 35 | * file is empty. */ 36 | 37 | #endif /* _FREERTOS_POSIX_PORTABLE_H_ */ 38 | -------------------------------------------------------------------------------- /src/FreeRTOS_POSIX_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Amazon FreeRTOS POSIX V1.1.0 3 | * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://aws.amazon.com/freertos 23 | * http://www.FreeRTOS.org 24 | */ 25 | 26 | #ifndef _FREERTOS_POSIX_INTERNAL_TYPES_H_ 27 | #define _FREERTOS_POSIX_INTERNAL_TYPES_H_ 28 | 29 | #include "FreeRTOS_POSIX_internal.h" 30 | 31 | /* 32 | * sys/types.h defines a POSIX type when posixconfigENABLE_PTHREAD__T 33 | * is not defined AND when posixconfigENABLE_PTHREAD__T is set to 1. 34 | * FreeRTOS_POSIX_internal.h defines internal type ONLY when 35 | * posixconfigENABLE_PTHREAD__T is set to 1. 36 | * #else part below is to have a type defined, so the code compiles, when 37 | * posixconfigENABLE_PTHREAD__T is not defined. 38 | */ 39 | #if posixconfigENABLE_PTHREAD_MUTEX_T == 1 40 | typedef pthread_mutex_internal_t PthreadMutexType_t; 41 | #else 42 | typedef void * PthreadMutexType_t; 43 | #endif 44 | 45 | #if posixconfigENABLE_PTHREAD_COND_T == 1 46 | typedef pthread_cond_internal_t PthreadCondType_t; 47 | #else 48 | typedef void * PthreadCondType_t; 49 | #endif 50 | 51 | #if posixconfigENABLE_SEM_T == 1 52 | typedef sem_internal_t PosixSemType_t; 53 | #else 54 | typedef void * PosixSemType_t; 55 | #endif 56 | 57 | #if posixconfigENABLE_PTHREAD_MUTEXATTR_T == 1 58 | typedef struct pthread_mutexattr 59 | { 60 | uint32_t ulpthreadMutexAttrStorage; 61 | } PthreadMutexAttrType_t; 62 | #else 63 | typedef void * PthreadMutexAttrType_t; 64 | #endif 65 | 66 | #if posixconfigENABLE_PTHREAD_ATTR_T == 1 67 | typedef struct pthread_attr 68 | { 69 | uint32_t ulpthreadAttrStorage; 70 | } PthreadAttrType_t; 71 | #else 72 | typedef void * PthreadAttrType_t; 73 | #endif 74 | 75 | #if posixconfigENABLE_PTHREAD_BARRIER_T == 1 76 | typedef pthread_barrier_internal_t PthreadBarrierType_t; 77 | #else 78 | typedef void * PthreadBarrierType_t; 79 | #endif 80 | 81 | #endif /* _FREERTOS_POSIX_INTERNAL_TYPES_H_ */ 82 | -------------------------------------------------------------------------------- /src/Seeed_Arduino_FreeRTOS.h: -------------------------------------------------------------------------------- 1 | #ifndef _SEEED_ARDUINO_FREERTOS_H_ 2 | #define _SEEED_ARDUINO_FREERTOS_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #endif //_SEEED_ARDUINO_FREERTOS_H_ 20 | -------------------------------------------------------------------------------- /src/arch/samd21/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #define configMEMMANG_HEAP 4 2 | 3 | #define configUSE_PREEMPTION 1 4 | #define configUSE_IDLE_HOOK 0 5 | #define configUSE_TICK_HOOK 0 6 | #define configCPU_CLOCK_HZ ((unsigned long)F_CPU) 7 | #define configTICK_RATE_HZ ((TickType_t)1000) 8 | #define configMAX_PRIORITIES (9) 9 | #define configMINIMAL_STACK_SIZE ((unsigned short)150) 10 | #define configTOTAL_HEAP_SIZE ((size_t)(12 * 1024)) 11 | #define configMAX_TASK_NAME_LEN (8) 12 | #define configUSE_TRACE_FACILITY 1 13 | #define configUSE_16_BIT_TICKS 0 14 | #define configIDLE_SHOULD_YIELD 1 15 | #define configUSE_MUTEXES 1 16 | #define configQUEUE_REGISTRY_SIZE 8 17 | #define configUSE_RECURSIVE_MUTEXES 1 18 | #define configUSE_MALLOC_FAILED_HOOK 1 19 | #define configUSE_APPLICATION_TASK_TAG 0 20 | #define configUSE_COUNTING_SEMAPHORES 1 21 | #define configUSE_QUEUE_SETS 1 22 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 23 | // #define configSUPPORT_STATIC_ALLOCATION 1 24 | 25 | /* Cortex-M specific definitions. */ 26 | #ifdef __NVIC_PRIO_BITS 27 | /* patch */ 28 | #if __NVIC_PRIO_BITS != 3 29 | #undef __NVIC_PRIO_BITS 30 | #define __NVIC_PRIO_BITS 3 31 | #endif 32 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 33 | #define configPRIO_BITS __NVIC_PRIO_BITS 34 | #else 35 | #define configPRIO_BITS 3 /* 8 priority levels */ 36 | #endif 37 | 38 | /* Run time stats related definitions. */ 39 | //void vMainConfigureTimerForRunTimeStats( void ); 40 | unsigned long ulMainGetRunTimeCounterValue(void); 41 | #define configGENERATE_RUN_TIME_STATS 0 42 | #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //vMainConfigureTimerForRunTimeStats() 43 | #define portGET_RUN_TIME_COUNTER_VALUE() ulMainGetRunTimeCounterValue() 44 | 45 | /* Co-routine definitions. */ 46 | #define configUSE_CO_ROUTINES 0 47 | #define configMAX_CO_ROUTINE_PRIORITIES (2) 48 | 49 | /* Software timer definitions. */ 50 | #define configUSE_TIMERS 1 51 | #define configTIMER_TASK_PRIORITY (2) 52 | #define configTIMER_QUEUE_LENGTH 5 53 | #define configTIMER_TASK_STACK_DEPTH (80) 54 | 55 | /* Set the following definitions to 1 to include the API function, or zero 56 | to exclude the API function. */ 57 | #define INCLUDE_xTaskGetCurrentTaskHandle 1 58 | #define INCLUDE_vTaskPrioritySet 1 59 | #define INCLUDE_uxTaskPriorityGet 1 60 | #define INCLUDE_vTaskDelete 1 61 | #define INCLUDE_vTaskCleanUpResources 1 62 | #define INCLUDE_vTaskSuspend 1 63 | #define INCLUDE_vTaskDelayUntil 1 64 | #define INCLUDE_vTaskDelay 1 65 | #define INCLUDE_eTaskGetState 1 66 | 67 | /* Arduino framework integration */ 68 | // calibration factor for vNopDelayMS in error_hooks.c 69 | // used to set accuracy of nopDelayMS function 70 | // this was experimentally chosen from a samd21 processor at 32khz 71 | #define configCAL_FACTOR (F_CPU/6000) 72 | 73 | /* This demo makes use of one or more example stats formatting functions. These 74 | format the raw data provided by the uxTaskGetSystemState() function in to human 75 | readable ASCII form. See the notes in the implementation of vTaskList() within 76 | FreeRTOS/Source/tasks.c for limitations. */ 77 | #define configUSE_STATS_FORMATTING_FUNCTIONS 1 78 | 79 | #define configUSE_MUTEXES 1 80 | #define INCLUDE_uxTaskGetStackHighWaterMark 1 81 | #define INCLUDE_xTaskGetIdleTaskHandle 1 82 | #define configUSE_MALLOC_FAILED_HOOK 1 83 | #define configCHECK_FOR_STACK_OVERFLOW 2 84 | /* Normal assert() semantics without relying on the provision of an assert.h 85 | header file. */ 86 | extern void assertBlink(void); 87 | extern void freertos_printf(const char *format, ...); 88 | #define configASSERT(x) \ 89 | if ((x) == 0) \ 90 | { \ 91 | freertos_printf("\n\rASSERT: %s :#%d\n\r", __func__, __LINE__); \ 92 | assertBlink(); \ 93 | } 94 | 95 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 96 | standard names - or at least those used in the unmodified vector table. */ 97 | #define xPortPendSVHandler PendSV_Handler 98 | //#define xPortSysTickHandler SysTick_Handler 99 | 100 | /* The size of the global output buffer that is available for use when there 101 | are multiple command interpreters running at once (for example, one on a UART 102 | and one on TCP/IP). This is done to prevent an output buffer being defined by 103 | each implementation - which would waste RAM. In this case, there is only one 104 | command interpreter running. */ 105 | #define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048 106 | -------------------------------------------------------------------------------- /src/arch/samd21/FreeRTOSVariant.h: -------------------------------------------------------------------------------- 1 | #if defined(USE_TINYUSB) 2 | void tinyusb_task_backgroud(void *arg) 3 | { 4 | (void *)arg; 5 | while (1) 6 | { 7 | TinyUSB_Device_Task(); 8 | TinyUSB_Device_FlushCDC(); 9 | delay(10); 10 | } 11 | vTaskDelete(NULL); 12 | } 13 | void tinyusb_task() 14 | { 15 | xTaskCreate(tinyusb_task_backgroud, "tub back", 256, NULL, configMAX_PRIORITIES, NULL); 16 | } 17 | #endif 18 | 19 | extern void xPortSysTickHandler(void); 20 | int sysTickHook(void) 21 | { 22 | if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) 23 | { 24 | xPortSysTickHandler(); 25 | } 26 | return 0; // return zero to keep running the arduino default handler! 27 | } -------------------------------------------------------------------------------- /src/arch/samd51/FreeRTOSVariant.h: -------------------------------------------------------------------------------- 1 | #if defined(USE_TINYUSB) 2 | void tinyusb_task_backgroud(void *arg) 3 | { 4 | (void *)arg; 5 | while (1) 6 | { 7 | TinyUSB_Device_Task(); 8 | TinyUSB_Device_FlushCDC(); 9 | delay(10); 10 | } 11 | vTaskDelete(NULL); 12 | } 13 | void tinyusb_task() 14 | { 15 | xTaskCreate(tinyusb_task_backgroud, "tub back", 256, NULL, configMAX_PRIORITIES, NULL); 16 | } 17 | #endif 18 | 19 | extern void xPortSysTickHandler(void); 20 | int sysTickHook(void) 21 | { 22 | if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) 23 | { 24 | xPortSysTickHandler(); 25 | } 26 | return 0; // return zero to keep running the arduino default handler! 27 | } -------------------------------------------------------------------------------- /src/arch/stm32h7xx/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | #define configENABLE_FPU 0 2 | #define configENABLE_MPU 0 3 | 4 | #define configUSE_PREEMPTION 1 5 | #define configSUPPORT_STATIC_ALLOCATION 0 6 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 7 | #define configUSE_IDLE_HOOK 0 8 | #define configUSE_TICK_HOOK 0 9 | #define configCPU_CLOCK_HZ (F_CPU) 10 | #define configTICK_RATE_HZ ((TickType_t)1000) 11 | #define configMAX_PRIORITIES (56) 12 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 13 | #define configTOTAL_HEAP_SIZE ((size_t)65535) 14 | #define configMAX_TASK_NAME_LEN (16) 15 | #define configUSE_TRACE_FACILITY 1 16 | #define configUSE_16_BIT_TICKS 0 17 | #define configUSE_MUTEXES 1 18 | #define configQUEUE_REGISTRY_SIZE 8 19 | #define configUSE_RECURSIVE_MUTEXES 1 20 | #define configUSE_COUNTING_SEMAPHORES 1 21 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 22 | /* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */ 23 | /* Defaults to size_t for backward compatibility, but can be changed 24 | if lengths will always be less than the number of bytes in a size_t. */ 25 | #define configMESSAGE_BUFFER_LENGTH_TYPE size_t 26 | /* USER CODE END MESSAGE_BUFFER_LENGTH_TYPE */ 27 | 28 | /* Co-routine definitions. */ 29 | #define configUSE_CO_ROUTINES 0 30 | #define configMAX_CO_ROUTINE_PRIORITIES (2) 31 | 32 | /* Software timer definitions. */ 33 | #define configUSE_TIMERS 1 34 | #define configTIMER_TASK_PRIORITY (2) 35 | #define configTIMER_QUEUE_LENGTH 10 36 | #define configTIMER_TASK_STACK_DEPTH 256 37 | 38 | /* Set the following definitions to 1 to include the API function, or zero 39 | to exclude the API function. */ 40 | #define INCLUDE_vTaskPrioritySet 1 41 | #define INCLUDE_uxTaskPriorityGet 1 42 | #define INCLUDE_vTaskDelete 1 43 | #define INCLUDE_vTaskCleanUpResources 1 44 | #define INCLUDE_vTaskSuspend 1 45 | #define INCLUDE_vTaskDelayUntil 1 46 | #define INCLUDE_vTaskDelay 1 47 | #define INCLUDE_xTaskGetSchedulerState 1 48 | #define INCLUDE_xTimerPendFunctionCall 1 49 | #define INCLUDE_xQueueGetMutexHolder 1 50 | #define INCLUDE_uxTaskGetStackHighWaterMark 1 51 | #define INCLUDE_eTaskGetState 1 52 | 53 | /* Arduino framework integration */ 54 | // calibration factor for vNopDelayMS in error_hooks.c 55 | // used to set accuracy of nopDelayMS function 56 | // this was experimentally chosen from a stm32h7xx processor 57 | #define configCAL_FACTOR (F_CPU/7000) 58 | 59 | /* Cortex-M specific definitions. */ 60 | #ifdef __NVIC_PRIO_BITS 61 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 62 | #define configPRIO_BITS __NVIC_PRIO_BITS 63 | #else 64 | #define configPRIO_BITS 4 65 | #endif 66 | 67 | /* The lowest interrupt priority that can be used in a call to a "set priority" 68 | function. */ 69 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 70 | 71 | /* The highest interrupt priority that can be used by any interrupt service 72 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 73 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 74 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 75 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 76 | 77 | /* Interrupt priorities used by the kernel port layer itself. These are generic 78 | to all Cortex-M ports, and do not rely on any particular library functions. */ 79 | #define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) 80 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 81 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 82 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) 83 | 84 | /* Normal assert() semantics without relying on the provision of an assert.h 85 | header file. */ 86 | /* USER CODE BEGIN 1 */ 87 | extern void assertBlink(void); 88 | extern void freertos_printf(const char *format, ...); 89 | #define configASSERT(x) \ 90 | if ((x) == 0) \ 91 | { \ 92 | freertos_printf("\n\rASSERT: %s :#%d\n\r", __func__, __LINE__); \ 93 | assertBlink(); \ 94 | } 95 | 96 | /* USER CODE END 1 */ 97 | 98 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 99 | standard names. */ 100 | #define vPortSVCHandler SVC_Handler 101 | #define xPortPendSVHandler PendSV_Handler -------------------------------------------------------------------------------- /src/arch/stm32h7xx/FreeRTOSVariant.h: -------------------------------------------------------------------------------- 1 | extern void xPortSysTickHandler(void); 2 | int osSystickHandler(void) 3 | { 4 | if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) 5 | { 6 | xPortSysTickHandler(); 7 | } 8 | return 0; // return zero to keep running the arduino default handler! 9 | } -------------------------------------------------------------------------------- /src/croutine.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_CROUTINE_H_ 2 | #define _ARDUINO_CROUTINE_H_ 3 | 4 | #include "../FreeRTOS/Source/include/croutine.h" 5 | 6 | #endif //_ARDUINO_CROUTINE_H_ 7 | -------------------------------------------------------------------------------- /src/error_hooks.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "FreeRTOS.h" 4 | #include "task.h" 5 | 6 | #ifndef ERROR_HOOKS_H 7 | #define ERROR_HOOKS_H 8 | 9 | #ifdef __cplusplus 10 | 11 | //************************************************** 12 | // Cpp function prototypes 13 | //************************************************** 14 | 15 | // set the error serial port for debugging asserts and crashes 16 | void vSetErrorSerial(Stream *serial); 17 | 18 | extern "C" 19 | { 20 | #endif 21 | 22 | //************************************************** 23 | // defines 24 | //************************************************** 25 | 26 | 27 | //************************************************** 28 | // C function prototypes 29 | //************************************************** 30 | 31 | // set the error led to use by the rtos 32 | void vSetErrorLed(uint8_t pin, uint8_t activeState); 33 | 34 | // remove a linux or windows path from a file path 35 | // will leave file name remaining 36 | const char* removePath(const char* path); 37 | 38 | // called on fatal error (interrupts disabled already) 39 | void rtosFatalError(void); 40 | 41 | // fatal error print out what file assert failed 42 | void rtosFatalErrorSerialPrint(unsigned long ulLine, const char *pcFileName, uint8_t valueA, const char* evaluation, uint8_t valueB); 43 | 44 | // called on full heap or malloc failure 45 | void vApplicationMallocFailedHook(void); 46 | 47 | // called on full stack 48 | void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ); 49 | 50 | 51 | 52 | // blink an error code out the default led when the rtos has crashed 53 | void errorBlink(int errorNumber); 54 | 55 | // will delay the processors using nops 56 | // this is used when the rtos has crashed and we cannot use more advanced timing 57 | void vNopDelayMS(unsigned long millis); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/event_groups.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_EVENT_GROUPS_H_ 2 | #define _ARDUINO_EVENT_GROUPS_H_ 3 | 4 | #include "../FreeRTOS/Source/include/event_groups.h" 5 | 6 | #endif //_ARDUINO_EVENT_GROUPS_H_ 7 | -------------------------------------------------------------------------------- /src/heap.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOS.h" 2 | 3 | #ifndef configMEMMANG_HEAP 4 | #define configMEMMANG_HEAP 4 5 | #endif 6 | 7 | #if (configMEMMANG_HEAP == 1) 8 | #include "../FreeRTOS/Source/portable/MemMang/heap_1.c" 9 | #elif (configMEMMANG_HEAP == 2) 10 | #include "../FreeRTOS/Source/portable/MemMang/heap_2.c" 11 | #elif (configMEMMANG_HEAP == 3) 12 | #include "../FreeRTOS/Source/portable/MemMang/heap_3.c" 13 | #elif (configMEMMANG_HEAP == 4) 14 | #include "../FreeRTOS/Source/portable/MemMang/heap_4.c" 15 | #elif (configMEMMANG_HEAP == 5) 16 | #include "../FreeRTOS/Source/portable/MemMang/heap_5.c" 17 | #else 18 | #error "Wrong Memory allocation implementations defined" 19 | #endif 20 | -------------------------------------------------------------------------------- /src/list.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_LIST_H_ 2 | #define _ARDUINO_LIST_H_ 3 | 4 | #include "../FreeRTOS/Source/include/list.h" 5 | 6 | #endif //_ARDUINO_LIST_H_ 7 | -------------------------------------------------------------------------------- /src/logger.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Arduino.h" 3 | extern "C"{ 4 | void freertos_printf(const char *format, ...) { 5 | char print_buf[512] = { 0 }; 6 | 7 | va_list args; 8 | va_start(args, format); 9 | int r = vsnprintf(print_buf, sizeof(print_buf), format, args); 10 | va_end(args); 11 | 12 | if (r > 0) { 13 | SERIAL_PORT_MONITOR.write(print_buf); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/message_buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_MESSAGE_BUFFER_H_ 2 | #define _ARDUINO_MESSAGE_BUFFER_H_ 3 | 4 | #include "../FreeRTOS/Source/include/message_buffer.h" 5 | 6 | #endif //_ARDUINO_MESSAGE_BUFFER_H_ 7 | -------------------------------------------------------------------------------- /src/mpu_prototypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_MPU_PROTOTYPES_H_ 2 | #define _ARDUINO_MPU_PROTOTYPES_H_ 3 | 4 | /* MPU not supported */ 5 | /*#include "FreeRTOS/Source/include/mpu_prototypes.h"*/ 6 | 7 | #endif //_ARDUINO_MPU_PROTOTYPES_H_ 8 | -------------------------------------------------------------------------------- /src/mpu_wrappers.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @file mpu_wrappers.c 3 | * @author Frederic Pillon for STMicroelectronics. 4 | * @brief Include source file to match Arduino library format 5 | */ 6 | 7 | /* MPU not supported */ 8 | /*#include "../portable/Common/mpu_wrappers.c"*/ 9 | -------------------------------------------------------------------------------- /src/port.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __CORTEX_M 4 | #pragma GCC error "no \"__CORTEX_M\" definition" 5 | #endif 6 | 7 | #if (__CORTEX_M == 0x00U) 8 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM0/port.c" 9 | #elif (__CORTEX_M == 0x03U) 10 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM3/port.c" 11 | #elif (__CORTEX_M == 0x04U) 12 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" 13 | #elif (__CORTEX_M == 0x07U) 14 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/port.c" 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /src/portmacro.h: -------------------------------------------------------------------------------- 1 | #ifndef _PORTMACRO_H_ 2 | #define _PORTMACRO_H_ 3 | #ifdef ARDUINO_ARCH_SAMD 4 | #include "sam.h" 5 | #endif 6 | 7 | #ifdef ARDUINO_ARCH_STM32 8 | #include "stm32_def.h" 9 | #endif 10 | 11 | #ifndef __CORTEX_M 12 | #pragma GCC error "no \"__CORTEX_M\" definition" 13 | #endif 14 | 15 | #if (__CORTEX_M == 0x00U) 16 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h" 17 | #elif (__CORTEX_M == 0x03U) 18 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h" 19 | #elif (__CORTEX_M == 0x04U) 20 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h" 21 | #elif (__CORTEX_M == 0x07U) 22 | #include "../FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1/portmacro.h" 23 | #endif 24 | #endif //_PORTMACRO_H_ 25 | -------------------------------------------------------------------------------- /src/queue.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_QUEUE_H_ 2 | #define _ARDUINO_QUEUE_H_ 3 | 4 | #include "../FreeRTOS/Source/include/queue.h" 5 | 6 | #endif //_ARDUINO_QUEUE_H_ 7 | -------------------------------------------------------------------------------- /src/semphr.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_SEMPHR_H_ 2 | #define _ARDUINO_SEMPHR_H_ 3 | 4 | #include "../FreeRTOS/Source/include/semphr.h" 5 | 6 | #endif //_ARDUINO_SEMPHR_H_ 7 | -------------------------------------------------------------------------------- /src/stack_macros.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_STACK_MACROS_H_ 2 | #define _ARDUINO_STACK_MACROS_H_ 3 | 4 | #include "../FreeRTOS/Source/include/stack_macros.h" 5 | 6 | #endif //_ARDUINO_STACK_MACROS_H_ 7 | -------------------------------------------------------------------------------- /src/stream_buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_STREAM_BUFFER_H_ 2 | #define _ARDUINO_STREAM_BUFFER_H_ 3 | 4 | #include "../FreeRTOS/Source/include/stream_buffer.h" 5 | 6 | #endif //_ARDUINO_STREAM_BUFFER_H_ 7 | -------------------------------------------------------------------------------- /src/task.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_TASK_H_ 2 | #define _ARDUINO_TASK_H_ 3 | 4 | #include "../FreeRTOS/Source/include/task.h" 5 | 6 | #endif //_ARDUINO_TASK_H_ 7 | -------------------------------------------------------------------------------- /src/timers.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARDUINO_TIMERS_H_ 2 | #define _ARDUINO_TIMERS_H_ 3 | 4 | #include "../FreeRTOS/Source/include/timers.h" 5 | 6 | #endif //_ARDUINO_TIMERS_H_ 7 | --------------------------------------------------------------------------------