33 Commits
Author SHA1 Message Date
Stefan Wick f8899e5d6d Merge pull request #38 from eclipse-threadx/bo-ms/add_revision_history
Add revision history file.
2024-02-27 17:24:08 -08:00
Stefan Wick acc5190739 Merge branch 'master' into bo-ms/add_revision_history 2024-02-27 17:14:01 -08:00
Stefan Wick 79cbf4019f Merge branch 'master' into bo-ms/add_revision_history 2024-02-27 17:11:51 -08:00
Stefan Wick 2a963969bc Merge pull request #37 from eclipse-threadx/tizho/update_version
Update version number to 6.4.1
2024-02-27 17:07:24 -08:00
Bo Chen (from Dev Box) 1317123fdc Add revision history file. 2024-02-27 16:58:07 +08:00
TiejunZhou 814a8a346c Update version number to 6.4.1 2024-02-27 06:37:17 +00:00
Stefan Wick 34616e26e7 Merge pull request #35 from eclipse-threadx/wickste-patch-4
Update README.md
2024-02-21 07:09:23 -08:00
Stefan Wick f840cf4ce6 Update README.md 2024-02-20 22:51:45 -08:00
Stefan Wick ec683ddf14 Merge pull request #33 from eclipse-threadx/wickste-patch-3
Update LICENSE.txt and Delete LICENSED-HARDWARE.txt
2024-02-13 12:23:50 -08:00
Stefan Wick 1d6706dfa9 Merge branch 'master' into wickste-patch-3 2024-02-12 09:04:40 -08:00
Stefan Wick 6809f87fdd Merge pull request #32 from eclipse-threadx/wickste-patch-2
Update CONTRIBUTING.md
2024-02-12 08:20:24 -08:00
Stefan Wick 9b766d144f Merge branch 'master' into wickste-patch-2 2024-02-12 08:20:12 -08:00
Stefan Wick fb4b913dc2 Merge pull request #31 from eclipse-threadx/wickste-patch-1
Create SECURITY.md
2024-02-09 10:48:15 -08:00
Stefan Wick 01517ad256 Delete LICENSED-HARDWARE.txt 2024-02-06 21:41:48 -08:00
Stefan Wick 9f85e68bd1 Update LICENSE.txt 2024-02-06 21:41:28 -08:00
Stefan Wick bc8f7f3623 Update CONTRIBUTING.md 2024-02-06 21:15:04 -08:00
Stefan Wick 3ca016c042 Create SECURITY.md 2024-02-06 18:34:50 -08:00
Stefan Wick 4e747beb15 Merge pull request #30 from eclipse-threadx/bo-ms/copyright
Update copyright.
2024-01-28 22:20:07 -08:00
Bo Chen (from Dev Box) 151863ad7c Update copyright. 2024-01-29 14:15:48 +08:00
Stefan Wick d7b2a72452 Merge pull request #29 from ericwol-msft/SECURITY.md-update
Delete SECURITY.md
2024-01-18 17:53:20 -08:00
Eric Wolz e432e2cfa2 Delete SECURITY.md 2024-01-18 11:38:21 -08:00
Stefan Wick 0ea87a458d Merge pull request #28 from eclipse-threadx/tizho/update_script
Update links in run.sh script
2024-01-12 14:03:10 -08:00
TiejunZhou f8ab75e3ee Update links in run.sh script 2024-01-12 05:58:52 +00:00
Xiuwen Cai e74a289b41 Update release date and version
Update release date and version
2023-12-28 17:43:14 +08:00
Xiuwen Cai 9551a4cda1 Update release date and version. 2023-12-28 09:01:01 +00:00
TiejunZhou 268e4edf97 Merge pull request #25 Add regression test
Add regression test
2023-12-04 13:37:29 +08:00
TiejunZhou fcce06af34 Add scripts 2023-12-01 02:16:43 +00:00
TiejunZhou 521fe0bacb Add GitHub action to run regression test 2023-12-01 01:45:45 +00:00
TiejunZhou 772f99b415 Add test files 2023-11-30 09:26:50 +00:00
Xiuwen Cai df4ecd8404 Update on 30 Nov 2023. Expand to see details.
dd0abfd Fix sequential checking logic
6d0382a Add configuration checks
2023-11-30 05:23:36 +00:00
Xiuwen Cai cef8e4ffeb Update on 23 Oct 2023. Expand to see details.
f203c27 Update headers and readme for 6.3.0 release.
40d3d10 Avoid clearing user extension in flash control block on opening flash
689dcc1 Added obsolete count and mapping bitmap cache for NOR flash. optimized block seraching logic.
b183526 Enable weekly pipeline build to avoid CodeQL expiration
2eec506 Enable codeql in onebranch pipeline
2023-10-23 05:31:43 +00:00
Xiuwen Cai e1a2752d6c Update on 12 May 2023. Expand to see details.
14f4439 Update CFS usage
9b8b2f0 Update CFS usage
0a78a87 Onboard to Central Feed Services
2bd4393 create LevelX cmsis-pack
2023-05-12 07:01:11 +00:00
Tiejun Zhou 39de3e54bd Update hardware license 2023-03-22 10:38:19 +08:00
83 changed files with 7493 additions and 1108 deletions
+13
View File
@@ -0,0 +1,13 @@
{
"image": "ghcr.io/tiejunms/azure_rtos_docker",
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
],
"remoteUser": "vscode",
"runArgs": [ "--cap-add=NET_ADMIN"]
}
+25
View File
@@ -0,0 +1,25 @@
# This is a basic workflow that is manually triggered
name: regression_test
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "linux_job"
run_tests:
permissions:
contents: read
issues: read
checks: write
pull-requests: write
pages: write
id-token: write
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
+69 -11
View File
@@ -1,14 +1,72 @@
# Contributing
# Contributing to Eclipse ThreadX
This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.
Thanks for your interest in this project.
When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
## Project description
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
Eclipse ThreadX provides a vendor-neutral, open source, safety certified OS for
real-time applications published on under a permissive license. The Eclipse
ThreadX suite encompasses:
* ThreadX - advanced real-time operating system (RTOS) designed specifically for deeply embedded applications
* NetX Duo - advanced, industrial-grade TCP/IP network stack designed specifically for deeply embedded real-time and IoT applications
* FileX - high-performance, FAT-compatible file system thats fully integrated with ThreadX kernel
* GUIX - provides a complete, embedded graphical user interface (GUI) library
* USBX - high-performance USB host, device, and on-the-go (OTG) embedded stack, that is fully integrated with ThreadX kernel
* LevelX - Flash Wear Leveling for FileX and stand-alone purposes
* GuiX Studio - design environment, facilitating the creation and maintenance of all graphical elements for GUIX
* TraceX - analysis tool that provides a graphical view of real-time system events to better understand the behavior of real-time systems
Project site: https://projects.eclipse.org/projects/iot.threadx
## Terms of Use
This repository is subject to the Terms of Use of the Eclipse Foundation
https://www.eclipse.org/legal/termsofuse.php
## Developer resources
Information regarding source code management, builds, coding standards, and more.
https://projects.eclipse.org/projects/iot.threadx/developer
The project maintains the following source code repositories
* https://github.com/eclipse-threadx/.github
* https://github.com/eclipse-threadx/cmsis-packs
* https://github.com/eclipse-threadx/filex
* https://github.com/eclipse-threadx/getting-started
* https://github.com/eclipse-threadx/guix
* https://github.com/eclipse-threadx/levelx
* https://github.com/eclipse-threadx/netxduo
* https://github.com/eclipse-threadx/rtos-docs
* https://github.com/eclipse-threadx/samples
* https://github.com/eclipse-threadx/threadx
* https://github.com/eclipse-threadx/threadx-learn-samples
* https://github.com/eclipse-threadx/tracex
* https://github.com/eclipse-threadx/usbx
## Eclipse Development Process
This Eclipse Foundation open project is governed by the Eclipse Foundation
Development Process and operates under the terms of the Eclipse IP Policy.
* https://eclipse.org/projects/dev_process
* https://www.eclipse.org/org/documents/Eclipse_IP_Policy.pdf
## Eclipse Contributor Agreement
In order to be able to contribute to Eclipse Foundation projects you must electronically sign the Eclipse Contributor Agreement (ECA).
https://www.eclipse.org/legal/ECA.php
The ECA provides the Eclipse Foundation with a permanent record that you agree
that each of your contributions will comply with the commitments documented in
the Developer Certificate of Origin (DCO). Having an ECA on file associated with
the email address matching the "Author" field of your contribution's Git commits
fulfills the DCO's requirement that you sign-off on your contributions.
For more information, please see the Eclipse Committer Handbook:
https://www.eclipse.org/projects/handbook/#resources-commit
## Contact
Contact the project developers via the project's "dev" list.
https://accounts.eclipse.org/mailing-list/threadx-dev
+17 -242
View File
@@ -1,246 +1,21 @@
MICROSOFT SOFTWARE LICENSE TERMS
MIT License
MICROSOFT AZURE RTOS
Copyright (c) 2024 - present Microsoft Corporation
Shape
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
These license terms are an agreement between you and Microsoft Corporation (or
one of its affiliates). They apply to the software named above and any Microsoft
services or software updates (except to the extent such services or updates are
accompanied by new or additional terms, in which case those different terms
apply prospectively and do not alter your or Microsofts rights relating to
pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU
HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. INSTALLATION AND USE RIGHTS.
a) General. You may install and use the software and the included Microsoft
applications solely for internal development, testing and evaluation purposes.
Any distribution or production use requires a separate license as set forth in
Section 2.
b) Contributions. Microsoft welcomes contributions to this software. In the event
that you make a contribution to this software you will be required to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and
actually do, grant Microsoft the rights to use your contribution. For details,
visit https://cla.microsoft.com.
c) Included Microsoft Applications. The software includes other Microsoft
applications which are governed by the licenses embedded in or made available
with those applications.
d) Third Party Components. The software may include third party components with
separate legal notices or governed by other agreements, as may be described
within the software or in the ThirdPartyNotices file(s) accompanying the
software.
e) Competitive Benchmarking. If you are a direct competitor, and you access or use
the software for purposes of competitive benchmarking, analysis, or intelligence
gathering, you waive as against Microsoft, its subsidiaries, and its affiliated
companies (including prospectively) any competitive use, access, and
benchmarking test restrictions in the terms governing your software to the
extent your terms of use are, or purport to be, more restrictive than
Microsofts terms. If you do not waive any such purported restrictions in the
terms governing your software, you are not allowed to access or use this
software, and will not do so.
2. DISTRIBUTION AND PRODUCTION USE. If you have obtained and/or are developing on
microprocessor(s) and/or microcontroller(s) (“hardware”) listed in the file
named “LICENSED-HARDWARE.txt” included in the repository and/or distributed with
the software you have the following rights in and to the software solely when
used in combination with the hardware. In the event hardware is not listed in
the LICENSED-HARDWARE.txt file, you do not have the rights in this Section 2.
a) Distribution and Production Use Rights.
i. You may use the software in production (e.g. program the modified or unmodified
software to devices you own or control) and distribute (i.e. make available to
third parties) the modified or unmodified binary image produced from this code.
ii. You may permit your device distributors or developers to copy and distribute the
binary image as programmed or to be programmed to your devices.
iii. You may redistribute the unmodified or modified source to your device
distributors or developers. Modifications must be clearly marked. Any
redistribution in source code form must contain this license and any other
licenses that accompany the software.
b) Requirements. For any code you distribute, you must:
i. when distributed in binary form, except as embedded in a device, include with
such distribution the terms of this agreement;
ii. when distributed in source code form to distributors or developers of your
devices, include with such distribution the terms of this agreement; and
iii. indemnify, defend and hold harmless Microsoft from any claims, including
attorneys fees, related to the distribution or use of your devices, except to
the extent that any claim is based solely on the unmodified software.
c) Restrictions. You may not:
i. use or modify the software to create a competing real time operating system
software;
ii. remove any copyright notices or licenses contained in the software;
iii. use Microsofts trademarks or trade dress in your application in any way that
suggests your device or application comes from or is endorsed by Microsoft;
iv. transfer individual components, specific libraries, classes, functions or code
fragments of the software separately for purposes unrelated to the software; or
v. use or distribute the software in any way that would subject the software or
Microsofts intellectual property or technology to any other license terms.
3. SCOPE OF LICENSE. The software is licensed, not sold. Microsoft reserves all
other rights. Unless applicable law gives you more rights despite this
limitation, you will not (and have no right to):
a) remove, minimize, block, or modify any notices of Microsoft or its suppliers in
the software;
b) use the software in any way that is against the law or to create or propagate
malware; or
c) share, publish, distribute, or lease the software (except as permitted in
Section 2 above), or provide the software as a stand-alone offering for others
to use.
4. DATA. This software may interact with other Microsoft products that collect data
that is transmitted to Microsoft. To learn more about how Microsoft processes
personal data we collect, please see the Microsoft Privacy Statement at
https://go.microsoft.com/fwlink/?LinkId=248681.
5. EXPORT RESTRICTIONS. You must comply with all domestic and international export
laws and regulations that apply to the software, which include restrictions on
destinations, end users, and end use. For further information on export
restrictions, visit https://aka.ms/exporting.
6. SUPPORT SERVICES. Microsoft is not obligated under this agreement to provide any
support services for the software. Any support provided is “as is”, “with all
faults”, and without warranty of any kind.
7. UPDATES. Microsoft may periodically update the software. You may obtain updates
only from Microsoft or Microsoft-authorized sources. Updates may not include or
support all existing software features, services, or peripheral devices.
8. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this
agreement if you fail to comply with any of its terms or conditions. In such
event, you must destroy all copies of the software and all of its component
parts.
9. ENTIRE AGREEMENT. This agreement, and any other terms Microsoft may provide for
supplements, updates, or third-party applications, is the entire agreement for
the software. To the extent you have entered into a separate agreement with
Microsoft relating specifically to the software, the terms in such agreement
shall control.
10. APPLICABLE LAW AND PLACE TO RESOLVE DISPUTES. If you acquired the software in
the United States or Canada, the laws of the state or province where you live
(or, if a business, where your principal place of business is located) govern
the interpretation of this agreement, claims for its breach, and all other
claims (including consumer protection, unfair competition, and tort claims),
regardless of conflict of laws principles. If you acquired the software in any
other country, its laws apply. If U.S. federal jurisdiction exists, you and
Microsoft consent to exclusive jurisdiction and venue in the federal court in
King County, Washington for all disputes heard in court. If not, you and
Microsoft consent to exclusive jurisdiction and venue in the Superior Court of
King County, Washington for all disputes heard in court.
11. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal
rights. You may have other rights, including consumer rights, under the laws of
your state or country. Separate and apart from your relationship with Microsoft,
you may also have rights with respect to the party from which you acquired the
software. This agreement does not change those other rights if the laws of your
state or country do not permit it to do so. For example, if you acquired the
software in one of the below regions, or mandatory country law applies, then the
following provisions apply to you:
a) Australia. You have statutory guarantees under the Australian Consumer Law and
nothing in this agreement is intended to affect those rights.
b) Germany and Austria.
i. Warranty. The properly licensed software will perform substantially as
described in any Microsoft materials that accompany the software. However,
Microsoft gives no contractual guarantee in relation to the licensed software.
ii. Limitation of Liability. In case of intentional conduct, gross negligence,
claims based on the Product Liability Act, as well as, in case of death or
personal or physical injury, Microsoft is liable according to the statutory law.
Subject to the foregoing clause ii., Microsoft will only be liable for slight
negligence if Microsoft is in breach of such material contractual obligations,
the fulfillment of which facilitate the due performance of this agreement, the
breach of which would endanger the purpose of this agreement and the compliance
with which a party may constantly trust in (so-called "cardinal obligations").
In other cases of slight negligence, Microsoft will not be liable for slight
negligence.
12. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO
THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED
WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT.
13. LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING
DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM
MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT
RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL,
INDIRECT, OR INCIDENTAL DAMAGES.
This limitation applies to (a) anything related to the software, services,
content (including code) on third party Internet sites, or third party
applications; and (b) claims for breach of contract, warranty, guarantee, or
condition; strict liability, negligence, or other tort; or any other claim; in
each case to the extent permitted by applicable law.
It also applies even if Microsoft knew or should have known about the
possibility of the damages. The above limitation or exclusion may not apply to
you because your state, province, or country may not allow the exclusion or
limitation of incidental, consequential, or other damages.
Please note: As this software is distributed in Canada, some of the clauses in
this agreement are provided below in French.
Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce
contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel
». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft
naccorde aucune autre garantie expresse. Vous pouvez bénéficier de droits
additionnels en vertu du droit local sur la protection des consommateurs, que ce
contrat ne peut modifier. La ou elles sont permises par le droit locale, les
garanties implicites de qualité marchande, dadéquation à un usage particulier
et dabsence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES
DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une
indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous
ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris
les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne:
•tout ce qui est relié au logiciel, aux services ou au contenu (y compris le
code) figurant sur des sites Internet tiers ou dans des programmes tiers; et
•les réclamations au titre de violation de contrat ou de garantie, ou au titre
de responsabilité stricte, de négligence ou dune autre faute dans la limite
autorisée par la loi en vigueur.
Elle sapplique également, même si Microsoft connaissait ou devrait connaître
l’éventualité dun tel dommage. Si votre pays nautorise pas lexclusion ou la
limitation de responsabilité pour les dommages indirects, accessoires ou de
quelque nature que ce soit, il se peut que la limitation ou lexclusion
ci-dessus ne sappliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous
pourriez avoir dautres droits prévus par les lois de votre pays. Le présent
contrat ne modifie pas les droits que vous confèrent les lois de votre pays si
celles-ci ne le permettent pas.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-45
View File
@@ -1,45 +0,0 @@
LICENSED HARDWARE LIST
Last Updated: 2023-02-10
Microsoft has entered into OEM Agreements with manufacturers of the following
microprocessors and microcontrollers (the “hardware”) to enable those
manufacturers to include and distribute Azure RTOS in certain hardware. If you
have obtained and/or are developing on microprocessor(s) and/or
microcontroller(s) (“hardware”) listed below you inherit the “Distribution and
Production Use” rights in Section 2 of the Microsoft Software License Terms for
Microsoft Azure RTOS. If hardware is not listed below, you do not have those
rights.
STMicroelectronics:
STM32 MCUs
STM32 MPUs
MediaTek:
MT3620 MCU (Azure Sphere)
Microchip:
PIC 32-bit MCUs
SAM 32-bit MCUs
SAM 32-bit MPUs
NXP:
i.MX RT10xx and RT116x/7x series crossover MCUs
LPC5500 series
MCX N series
Renesas:
Synergy Platform
RX Family of MCUs
RA Family of MCUs
RZ/A, RZ/N and RZ/T Family of MPUs
--------------------------------------------------------------------------------
More coming soon. Please check back frequently for updates.
+15 -23
View File
@@ -1,12 +1,12 @@
# Azure RTOS LevelX
# Eclipse ThreadX LevelX
LevelX provides NAND and NOR flash wear leveling facilities to embedded applications. Since both NAND and NOR flash memory can only be erased a finite number of times, its critical to distribute the flash memory use evenly. This is typically called **wear leveling** and is the purpose behind LevelX. LevelX presents to the user an array of logical sectors that are mapped to physical flash memory inside of LevelX. Applications may use LevelX in conjunction with FileX or may read/write logical sectors directly. LevelX is designed for fault tolerance. Flash updates are performed in a multiple-step process that can be interrupted in each step. LevelX automatically recovers to the optimal state during the next operation.
## Getting Started
Azure RTOS LevelX as part of Azure RTOS has been integrated to the semiconductor's SDKs and development environment. You can develop using the tools of choice from [STMicroelectronics](https://www.st.com/content/st_com/en/campaigns/x-cube-azrtos-azure-rtos-stm32.html), [NXP](https://www.nxp.com/design/software/embedded-software/azure-rtos-for-nxp-microcontrollers:AZURE-RTOS), [Renesas](https://github.com/renesas/azure-rtos) and [Microchip](https://mu.microchip.com/get-started-simplifying-your-iot-design-with-azure-rtos).
LevelX as part of Eclipse ThreadX has been integrated to the semiconductor's SDKs and development environment. You can develop using the tools of choice from [STMicroelectronics](https://www.st.com/content/st_com/en/campaigns/x-cube-azrtos-azure-rtos-stm32.html), [NXP](https://www.nxp.com/design/software/embedded-software/azure-rtos-for-nxp-microcontrollers:AZURE-RTOS), [Renesas](https://github.com/renesas/azure-rtos) and [Microchip](https://mu.microchip.com/get-started-simplifying-your-iot-design-with-azure-rtos).
See [Overview of Azure RTOS LevelX](https://learn.microsoft.com/azure/rtos/levelx/overview-levelx) for the high-level overview, and all documentation and APIs can be found in: [Azure RTOS LevelX documentation](https://learn.microsoft.com/azure/rtos/levelx/).
See [Overview of Eclipse ThreadX LevelX](https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/levelx/index.md) for the high-level overview.
## Repository Structure and Usage
@@ -19,7 +19,7 @@ See [Overview of Azure RTOS LevelX](https://learn.microsoft.com/azure/rtos/level
├── LICENSE.txt # License terms
├── LICENSE-HARDWARE.txt # Licensed hardware from semiconductors
├── CONTRIBUTING.md # Contribution guidance
└── SECURITY.md # Microsoft repo security guidance
└── SECURITY.md # Repo security guidance
### Branches & Releases
@@ -74,7 +74,7 @@ The master branch has the most recent code with all new features and bug fixes.
## Component dependencies
The main components of Azure RTOS are each provided in their own repository, but there are dependencies between them, as shown in the following graph. This is important to understand when setting up your builds.
The main components of Eclipse ThreadX are each provided in their own repository, but there are dependencies between them, as shown in the following graph. This is important to understand when setting up your builds.
![dependency graph](docs/deps.png)
@@ -82,7 +82,7 @@ The main components of Azure RTOS are each provided in their own repository, but
### Building and using the library
Instruction for building the LevelX as static library using Arm GNU Toolchain and CMake. If you are using toolchain and IDE from semiconductor, you might follow its own instructions to use Azure RTOS components as explained in the [Getting Started](#getting-started) section.
Instruction for building the LevelX as static library using Arm GNU Toolchain and CMake. If you are using toolchain and IDE from semiconductor, you might follow its own instructions to use Eclipse ThreadX components as explained in the [Getting Started](#getting-started) section.
1. Install the following tools:
@@ -95,14 +95,14 @@ Instruction for building the LevelX as static library using Arm GNU Toolchain an
1. Cloning the repo.
```bash
$ git clone --recursive https://github.com/azure-rtos/levelx.git
$ git clone --recursive https://github.com/eclipse-threadx/levelx.git
```
1. Define the features and addons you need in `lx_user.h` and build together with the component source code. You can refer to [`lx_user_sample.h`](https://github.com/azure-rtos/levelx/blob/master/common/inc/lx_user_sample.h) as an example.
1. Building as a static library
Each component of Azure RTOS comes with a composable CMake-based build system that supports many different MCUs and host systems. Integrating any of these components into your device app code is as simple as adding a git submodule and then including it in your build using the CMake `add_subdirectory()`.
Each component of Eclipse ThreadX comes with a composable CMake-based build system that supports many different MCUs and host systems. Integrating any of these components into your device app code is as simple as adding a git submodule and then including it in your build using the CMake `add_subdirectory()`.
While the typical usage pattern is to include LevelX into your device code source tree to be built & linked with your code, you can compile this project as a standalone static library to confirm your build is set up correctly.
@@ -114,31 +114,23 @@ Instruction for building the LevelX as static library using Arm GNU Toolchain an
$ cmake --build ./build
```
## Professional support
[Professional support plans](https://azure.microsoft.com/support/options/) are available from Microsoft. For community support and others, see the [Resources](#resources) section below.
## Licensing
License terms for using Azure RTOS are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information. No additional license fees are required for deploying Azure RTOS on hardware defined in the [LICENSED-HARDWARE.txt](./LICENSED-HARDWARE.txt) file. If you are using hardware not listed in the file or having licensing questions in general, please contact Microsoft directly at https://aka.ms/azrtos-license.
License terms for using Eclipse ThreadX are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information.
## Resources
The following are references to additional Azure RTOS resources:
The following are references to additional Eclipse ThreadX resources:
- **Product introduction and white papers**: https://azure.com/rtos
- **General technical questions**: https://aka.ms/QnA/azure-rtos
- **Product issues and bugs, or feature requests**: https://github.com/azure-rtos/levelx/issues
- **Licensing and sales questions**: https://aka.ms/azrtos-license
- **Product roadmap and support policy**: https://aka.ms/azrtos/lts
- **Blogs and videos**: http://msiotblog.com and https://aka.ms/iotshow
- **Azure RTOS TraceX Installer**: https://aka.ms/azrtos-tracex-installer
- **Product introduction**: https://github.com/eclipse-threadx/rtos-docs
- **Product issues and bugs, or feature requests**: https://github.com/eclipse-threadx/levelx/issues
- **TraceX Installer**: https://aka.ms/azrtos-tracex-installer
You can also check [previous questions](https://stackoverflow.com/questions/tagged/azure-rtos+levelx) or ask new ones on StackOverflow using the `azure-rtos` and `levelx` tags.
You can also check [previous questions](https://stackoverflow.com/questions/tagged/azure-rtos+levelx) or ask new ones on StackOverflow using the `threadx` and `levelx` tags.
## Security
Azure RTOS provides OEMs with components to secure communication and to create code and data isolation using underlying MCU/MPU hardware protection mechanisms. It is ultimately the responsibility of the device builder to ensure the device fully meets the evolving security requirements associated with its specific use case.
Eclipse ThreadX provides OEMs with components to secure communication and to create code and data isolation using underlying MCU/MPU hardware protection mechanisms. It is ultimately the responsibility of the device builder to ensure the device fully meets the evolving security requirements associated with its specific use case.
## Contribution
+12 -27
View File
@@ -1,35 +1,20 @@
## Security
# Security Policy
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
## Supported Versions
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
| Version | Supported |
| ------- | ------------------ |
| 6.4.x | :white_check_mark: |
## Reporting Security Issues
## Reporting a Vulnerability
**Please do not report security vulnerabilities through public GitHub issues.**
If you think you have found a vulnerability in <project> you can report it using one of the following ways:
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
* Contact the [Eclipse Foundation Security Team](mailto:security@eclipse-foundation.org)
* [Report a Vulnerability](https://github.com/eclipse-threadx/levelx/security/advisories/new)
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
You can find more information about reporting and disclosure at the [Eclipse Foundation Security page](https://www.eclipse.org/security/).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
## Security Policy
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
This project follows [Eclipse Foundation Vulnerability Reporting Policy](https://www.eclipse.org/security/policy/).
+54 -13
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -26,7 +25,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* lx_api.h PORTABLE C */
/* 6.2.1 */
/* 6.4.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -79,7 +78,19 @@
/* modified NAND logic, */
/* added new driver interface */
/* and user extension, */
/* resulting in version 6.2.1 */
/* resulting in version 6.2.1 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* made LX_NOR_SECTOR_SIZE */
/* configurable, added mapping */
/* bitmap and obsolete count */
/* cache for NOR flash, */
/* resulting in version 6.3.0 */
/* 12-31-2023 Xiuwen Cai Modified comment(s), */
/* added configuration checks, */
/* resulting in version 6.4.0 */
/* 03-01-2024 Tiejun Zhou Modified comment(s), */
/* update version number, */
/* resulting in version 6.4.1 */
/* */
/**************************************************************************/
@@ -191,7 +202,7 @@ typedef unsigned long long ULONG64;
/* Define basic constants for the LevelX Stack. */
#define AZURE_RTOS_LEVELX
#define LEVELX_MAJOR_VERSION 6
#define LEVELX_MINOR_VERSION 2
#define LEVELX_MINOR_VERSION 4
#define LEVELX_PATCH_VERSION 1
@@ -233,7 +244,9 @@ typedef unsigned long long ULONG64;
#define LX_NOR_FLASH_OPENED ((ULONG) 0x4E4F524F)
#define LX_NOR_FLASH_CLOSED ((ULONG) 0x4E4F5244)
#ifndef LX_NOR_SECTOR_SIZE
#define LX_NOR_SECTOR_SIZE (512/sizeof(ULONG))
#endif
#define LX_NOR_FLASH_MIN_LOGICAL_SECTOR_OFFSET 1
#define LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET 2
#ifndef LX_NOR_FLASH_MAX_ERASE_COUNT_DELTA
@@ -246,6 +259,11 @@ typedef unsigned long long ULONG64;
#ifndef LX_NOR_EXTENDED_CACHE_SIZE
#define LX_NOR_EXTENDED_CACHE_SIZE 8 /* Maximum number of extended cache sectors. */
#endif
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
#ifndef LX_NOR_OBSOLETE_COUNT_CACHE_TYPE
#define LX_NOR_OBSOLETE_COUNT_CACHE_TYPE UCHAR
#endif
#endif
/* Define the mask for the hash index into the sector mapping cache table. The sector mapping cache is divided
@@ -266,6 +284,19 @@ typedef unsigned long long ULONG64;
#define LX_NOR_PHYSICAL_SECTOR_FREE 0xFFFFFFFF
/* Check extended cache configurations. */
#ifdef LX_NOR_DISABLE_EXTENDED_CACHE
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
#error "To enable mapping bitmap, you need to undefine LX_NOR_DISABLE_EXTENDED_CACHE."
#endif
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
#error "To enable obsolete count cache, you need to undefine LX_NOR_DISABLE_EXTENDED_CACHE."
#endif
#endif
/* Define NAND flash constants. */
#define LX_NAND_GOOD_BLOCK 0xFF
@@ -566,6 +597,7 @@ typedef struct LX_NOR_FLASH_STRUCT
ULONG lx_nor_flash_mapped_physical_sectors;
ULONG lx_nor_flash_obsolete_physical_sectors;
ULONG lx_nor_flash_minimum_erase_count;
ULONG lx_nor_flash_minimum_erased_blocks;
ULONG lx_nor_flash_maximum_erase_count;
ULONG lx_nor_flash_free_block_search;
@@ -616,6 +648,15 @@ typedef struct LX_NOR_FLASH_STRUCT
lx_nor_flash_extended_cache[LX_NOR_EXTENDED_CACHE_SIZE];
ULONG lx_nor_flash_extended_cache_hits;
ULONG lx_nor_flash_extended_cache_misses;
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
ULONG *lx_nor_flash_extended_cache_mapping_bitmap;
ULONG lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector;
#endif
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
LX_NOR_OBSOLETE_COUNT_CACHE_TYPE
*lx_nor_flash_extended_cache_obsolete_count;
ULONG lx_nor_flash_extended_cache_obsolete_count_max_block;
#endif
#endif
#ifdef LX_THREAD_SAFE_ENABLE
+42 -14
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -26,7 +25,7 @@
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* lx_user.h PORTABLE C */
/* 6.2.1 */
/* 6.3.0 */
/* */
/* AUTHOR */
/* */
@@ -50,7 +49,12 @@
/* resulting in version 6.1.7 */
/* 03-08-2023 Xiuwen Cai Modified comment(s), and */
/* added new NAND options, */
/* resulting in version 6.2.1 */
/* resulting in version 6.2.1 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added options for mapping , */
/* bitmap cache and obsolete */
/* count cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -113,15 +117,39 @@
/* #define LX_STANDALONE_ENABLE */
/* Define user extension for NOR flash control block. */
/* Define user extension for NOR flash control block. User extension is placed at the end of flash control block and it is not cleared on opening flash. */
/*
#define LX_NOR_FLASH_USER_EXTENSION ????
*/
/* Define user extension for NAND flash control block. */
/* Define user extension for NAND flash control block. User extension is placed at the end of flash control block and it is not cleared on opening flash. */
/*
#define LX_NAND_FLASH_USER_EXTENSION ????
*/
/* Determine if logical sector mapping bitmap should be enabled in extended cache.
Cache memory will be allocated to sector mapping bitmap first. One bit can be allocated for each physical sector. */
/*
#define LX_NOR_ENABLE_MAPPING_BITMAP
*/
/* Determine if obsolete count cache should be enabled in extended cache.
Cache memory will be allocated to obsolete count cache after the mapping bitmap if enabled,
and the rest of the cache memory is allocated to sector cache. */
/*
#define LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
*/
/* Defines obsolete count cache element size. If number of sectors per block is greater than 256, use USHORT instead of UCHAR. */
/*
#define LX_NOR_OBSOLETE_COUNT_CACHE_TYPE UCHAR
*/
/* Define the logical sector size for NOR flash. The sector size is in units of 32-bit words.
This sector size should match the sector size used in file system. */
/*
#define LX_NOR_SECTOR_SIZE (512/sizeof(ULONG))
*/
#endif
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+33 -25
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -36,19 +35,19 @@ LX_NOR_FLASH nor_flash;
the fx_media_open call.
fx_media_format(&ram_disk,
_fx_nor_sim_driver, // Driver entry
FX_NULL, // Unused
media_memory, // Media buffer pointer
sizeof(media_memory), // Media buffer size
"MY_NOR_DISK", // Volume Name
1, // Number of FATs
32, // Directory Entries
0, // Hidden sectors
120, // Total sectors
512, // Sector size
1, // Sectors per cluster
1, // Heads
1); // Sectors per track
_fx_nor_sim_driver, // Driver entry
FX_NULL, // Unused
media_memory, // Media buffer pointer
sizeof(media_memory), // Media buffer size
"MY_NOR_DISK", // Volume Name
1, // Number of FATs
32, // Directory Entries
0, // Hidden sectors
120, // Total sectors
LX_NOR_SECTOR_SIZE * sizeof(ULONG), // Sector size
1, // Sectors per cluster
1, // Heads
1); // Sectors per track
*/
@@ -231,7 +230,7 @@ UINT status;
/* Move to the next entries. */
logical_sector++;
destination_buffer = destination_buffer + 512;
destination_buffer = destination_buffer + media_ptr -> fx_media_bytes_per_sector;
}
/* Successful driver request. */
@@ -265,7 +264,7 @@ UINT status;
/* Move to the next entries. */
logical_sector++;
source_buffer = source_buffer + 512;
source_buffer = source_buffer + media_ptr -> fx_media_bytes_per_sector;
}
/* Successful driver request. */
@@ -428,6 +427,15 @@ UINT status;
case FX_DRIVER_BOOT_WRITE:
{
/* Make sure the media bytes per sector equals to the LevelX logical sector size. */
if (media_ptr -> fx_media_bytes_per_sector != (LX_NOR_SECTOR_SIZE) * sizeof(ULONG))
{
/* Sector size mismatch, return error. */
media_ptr -> fx_media_driver_status = FX_IO_ERROR;
break;
}
/* Write the boot record and return to the caller. */
/* Setup the source buffer. */
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+16 -13
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nand_flash_data_page_copy PORTABLE C */
/* 6.2.1 */
/* 6.4.0 */
/* AUTHOR */
/* */
/* Xiuwen Cai, Microsoft Corporation */
@@ -78,7 +77,11 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 12-31-2023 Xiuwen Cai Modified comment(s), */
/* fixed sequential checking */
/* logic, */
/* resulting in version 6.4.0 */
/* */
/**************************************************************************/
UINT _lx_nand_flash_data_page_copy(LX_NAND_FLASH* nand_flash, ULONG logical_sector, ULONG source_block, USHORT src_block_status,
@@ -168,7 +171,7 @@ ULONG number_of_pages;
}
/* Check if the pages in destination block is still sequential. */
if ((destination_page) != (logical_sector + i % nand_flash -> lx_nand_flash_pages_per_block))
if (destination_page != ((logical_sector + i) % nand_flash -> lx_nand_flash_pages_per_block))
{
/* Mark the block status as non sequential. */
dest_block_status |= LX_NAND_BLOCK_STATUS_NON_SEQUENTIAL;
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+18 -14
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nand_flash_format PORTABLE C */
/* 6.2.1 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* Xiuwen Cai, Microsoft Corporation */
@@ -87,7 +86,12 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* avoided clearing user */
/* extension in flash control */
/* block, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nand_flash_format(LX_NAND_FLASH* nand_flash, CHAR* name,
@@ -102,8 +106,8 @@ UCHAR *page_buffer_ptr;
LX_PARAMETER_NOT_USED(name);
/* Clear the NAND flash control block. */
LX_MEMSET(nand_flash, 0, sizeof(LX_NAND_FLASH));
/* Clear the NAND flash control block. User extension is not cleared. */
LX_MEMSET(nand_flash, 0, (ULONG)((UCHAR*)&(nand_flash -> lx_nand_flash_open_previous) - (UCHAR*)nand_flash) + sizeof(nand_flash -> lx_nand_flash_open_previous));
/* Call the flash driver's initialization function. */
(nand_driver_initialize)(nand_flash);
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+19 -15
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nand_flash_open PORTABLE C */
/* 6.2.1 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* Xiuwen Cai, Microsoft Corporation */
@@ -85,7 +84,12 @@
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* avoided clearing user */
/* extension in flash control */
/* block, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *),
@@ -107,9 +111,9 @@ LX_INTERRUPT_SAVE_AREA
LX_PARAMETER_NOT_USED(name);
/* Clear the NAND flash control block. */
LX_MEMSET(nand_flash, 0, sizeof(LX_NAND_FLASH));
/* Clear the NAND flash control block. User extension is not cleared. */
LX_MEMSET(nand_flash, 0, (ULONG)((UCHAR*)&(nand_flash -> lx_nand_flash_open_previous) - (UCHAR*)nand_flash) + sizeof(nand_flash -> lx_nand_flash_open_previous));
/* Call the flash driver's initialization function. */
(nand_driver_initialize)(nand_flash);
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+52 -12
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_block_reclaim PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -83,6 +82,11 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added count for minimum */
/* erased blocks, added */
/* obsolete count cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_block_reclaim(LX_NOR_FLASH *nor_flash)
@@ -156,7 +160,15 @@ UINT status;
/* Return the error. */
return(status);
}
/* Determine if the erase count is at the minimum. */
if (erase_count == nor_flash -> lx_nor_flash_minimum_erase_count)
{
/* Yes, decrement the minimum erased block count. */
nor_flash -> lx_nor_flash_minimum_erased_blocks--;
}
/* Increment the erase count. */
erase_count++;
@@ -225,6 +237,16 @@ UINT status;
/* Update parameters of this flash. */
nor_flash -> lx_nor_flash_free_physical_sectors = nor_flash -> lx_nor_flash_free_physical_sectors + obsolete_sectors;
nor_flash -> lx_nor_flash_obsolete_physical_sectors = nor_flash -> lx_nor_flash_obsolete_physical_sectors - obsolete_sectors;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Check if the block is cached by obsolete count cache. */
if (erase_block < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Yes, clear the obsolete count for this block. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[erase_block] = 0;
}
#endif
}
else
{
@@ -489,6 +511,14 @@ UINT status;
return(status);
}
/* Determine if the erase count is at the minimum. */
if (erase_count == nor_flash -> lx_nor_flash_minimum_erase_count)
{
/* Yes, decrement the minimum erased block count. */
nor_flash -> lx_nor_flash_minimum_erased_blocks--;
}
/* Increment the erase count. */
erase_count++;
@@ -557,6 +587,16 @@ UINT status;
/* Update parameters of this flash. */
nor_flash -> lx_nor_flash_free_physical_sectors = nor_flash -> lx_nor_flash_free_physical_sectors + obsolete_sectors;
nor_flash -> lx_nor_flash_obsolete_physical_sectors = nor_flash -> lx_nor_flash_obsolete_physical_sectors - obsolete_sectors;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Check if the block is cached by obsolete count cache. */
if (erase_block < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Yes, clear the obsolete count for this block. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[erase_block] = 0;
}
#endif
}
}
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+181 -11
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_extended_cache_enable PORTABLE C */
/* 6.1.9 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -84,6 +83,10 @@
/* added check for out of */
/* bound memory access, */
/* resulting in version 6.1.9 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* added obsolete count cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_extended_cache_enable(LX_NOR_FLASH *nor_flash, VOID *memory, ULONG size)
@@ -93,6 +96,22 @@ UINT _lx_nor_flash_extended_cache_enable(LX_NOR_FLASH *nor_flash, VOID *memory,
UINT i;
ULONG cache_size;
ULONG *cache_memory;
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
ULONG mapping_bitmap_words;
ULONG mapping_bitmap_word;
ULONG logical_sector;
ULONG *mapping_bitmap_ptr;
#endif
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
ULONG obsolete_count_words;
ULONG obsolete_sectors;
#endif
#if defined(LX_NOR_ENABLE_MAPPING_BITMAP) || defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
ULONG *block_word_ptr;
UINT j;
UINT status;
ULONG block_word;
#endif
/* Determine if memory was specified but with an invalid size (less than one NOR sector). */
@@ -118,6 +137,157 @@ ULONG *cache_memory;
/* Setup cache memory pointer. */
cache_memory = (ULONG *) memory;
#if defined(LX_NOR_ENABLE_MAPPING_BITMAP) || defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
/* Check if the NOR flash is opened. */
if (nor_flash -> lx_nor_flash_state == LX_NOR_FLASH_OPENED)
{
#if defined(LX_NOR_ENABLE_MAPPING_BITMAP)
/* Get the mapping bitmap cache size. */
mapping_bitmap_words = (nor_flash -> lx_nor_flash_total_physical_sectors + 31) / 32;
/* Check if the mapping bitmap cache fits in the suppiled cache memory. */
if (cache_size < mapping_bitmap_words)
{
/* Update the cache size. */
mapping_bitmap_words = cache_size;
}
/* Setup the mapping bitmap cache. */
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap = cache_memory;
/* Setup the mapping bitmap cache size. */
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector = mapping_bitmap_words * 32;
/* Clear the mapping bitmap cache. */
for (i = 0; i < mapping_bitmap_words; i++)
{
cache_memory[i] = 0;
}
/* Update the cache memory pointer. */
mapping_bitmap_ptr = cache_memory;
/* Update the cache size. */
cache_size = cache_size - mapping_bitmap_words;
/* Update the cache memory pointer. */
cache_memory = cache_memory + mapping_bitmap_words;
#endif
#if defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
/* Get the obsolete count cache size. */
obsolete_count_words = nor_flash -> lx_nor_flash_total_blocks * sizeof(LX_NOR_OBSOLETE_COUNT_CACHE_TYPE) / 4;
/* Check if the obsolete count cache fits in the suppiled cache memory. */
if (cache_size < obsolete_count_words)
{
/* Update the cache size. */
obsolete_count_words = cache_size;
}
/* Setup the obsolete count cache. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count = (LX_NOR_OBSOLETE_COUNT_CACHE_TYPE*)cache_memory;
/* Setup the obsolete count cache size. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block = obsolete_count_words * 4 / sizeof(LX_NOR_OBSOLETE_COUNT_CACHE_TYPE);
/* Update the cache size. */
cache_size = cache_size - obsolete_count_words;
/* Update the cache memory pointer. */
cache_memory = cache_memory + obsolete_count_words;
#endif
/* Loop through the blocks. */
for (i = 0; i < nor_flash -> lx_nor_flash_total_blocks; i++)
{
/* Setup the block word pointer to the first word of the block. */
block_word_ptr = (nor_flash -> lx_nor_flash_base_address + (i * nor_flash -> lx_nor_flash_words_per_block));
#if defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
/* Initialize the obsolete count cache. */
obsolete_sectors = 0;
#endif
/* Now walk the list of logical-physical sector mapping. */
for (j = 0; j < nor_flash ->lx_nor_flash_physical_sectors_per_block; j++)
{
/* Read this word of the sector mapping list. */
#ifdef LX_DIRECT_READ
/* Read the word directly. */
block_word = *(block_word_ptr + nor_flash -> lx_nor_flash_block_physical_sector_mapping_offset + j);
#else
status = _lx_nor_flash_driver_read(nor_flash, (block_word_ptr + nor_flash -> lx_nor_flash_block_physical_sector_mapping_offset + j), &block_word, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return an error. */
return(LX_ERROR);
}
#endif
/* Determine if the entry hasn't been used. */
if (block_word == LX_NOR_PHYSICAL_SECTOR_FREE)
{
break;
}
/* Is this entry valid? */
if ((block_word & (LX_NOR_PHYSICAL_SECTOR_VALID | LX_NOR_PHYSICAL_SECTOR_MAPPING_NOT_VALID)) == LX_NOR_PHYSICAL_SECTOR_VALID)
{
#if defined(LX_NOR_ENABLE_MAPPING_BITMAP)
/* Yes, get the logical sector. */
logical_sector = block_word & LX_NOR_LOGICAL_SECTOR_MASK;
/* Get the mapping bitmap word. */
mapping_bitmap_word = logical_sector >> 5;
/* Check if the mapping bitmap word is within the cache. */
if (mapping_bitmap_word < mapping_bitmap_words)
{
/* Set the bit in the mapping bitmap. */
mapping_bitmap_ptr[mapping_bitmap_word] |= (ULONG)(1 << (logical_sector & 31));
}
#endif
}
else
{
#if defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
/* Increment the obsolete sector count. */
obsolete_sectors++;
#endif
}
}
#if defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
/* Check if the block is cached by obsolete count cache. */
if (i < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Yes, cache the obsolete sector count. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[i] = (LX_NOR_OBSOLETE_COUNT_CACHE_TYPE)obsolete_sectors;
}
#endif
}
}
#endif
/* Loop through the memory supplied and assign to cache entries. */
i = 0;
while (cache_size >= LX_NOR_SECTOR_SIZE)
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+146 -45
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_logical_sector_find PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -70,6 +69,7 @@
/* CALLS */
/* */
/* _lx_nor_flash_driver_read Driver flash sector read */
/* _lx_nor_flash_driver_write Driver flash sector write */
/* _lx_nor_flash_system_error Internal system error handler */
/* */
/* CALLED BY */
@@ -85,6 +85,12 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* added obsolete count cache, */
/* optimized full obsoleted */
/* block searching logic, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_logical_sector_find(LX_NOR_FLASH *nor_flash, ULONG logical_sector, ULONG superceded_check, ULONG **physical_sector_map_entry, ULONG **physical_sector_address)
@@ -102,7 +108,10 @@ ULONG i, j;
ULONG search_start;
LX_NOR_SECTOR_MAPPING_CACHE_ENTRY *sector_mapping_cache_entry_ptr = LX_NULL;
LX_NOR_SECTOR_MAPPING_CACHE_ENTRY temp_sector_mapping_cache_entry;
#ifndef LX_DIRECT_READ
#ifndef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
ULONG valid_sector_found;
#endif
#if !defined(LX_DIRECT_READ) || !defined(LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
UINT status;
#endif
@@ -118,6 +127,24 @@ UINT status;
/* No mapped sector so nothing can be found!. */
return(LX_SECTOR_NOT_FOUND);
}
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
/* Determine if the logical sector is in the range of mapping bitmap cache. */
if (logical_sector < nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector)
{
/* Determine if the logical sector is mapped. */
if ((nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap[logical_sector >> 5] & (ULONG)(1 << (logical_sector & 31))) == 0)
{
/* Not mapped, return not found. */
return(LX_SECTOR_NOT_FOUND);
}
}
#endif
#endif
/* Determine if the sector mapping cache is enabled. */
if (nor_flash -> lx_nor_flash_sector_mapping_cache_enabled)
@@ -223,6 +250,36 @@ UINT status;
/* Loop through the blocks to attempt to find the mapped logical sector. */
while (total_blocks--)
{
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Determine if the obsolete sector count is available in the cache. */
if (i < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Check if the block contains obsolete sectors only. */
if ((ULONG)nor_flash -> lx_nor_flash_extended_cache_obsolete_count[i] == nor_flash -> lx_nor_flash_physical_sectors_per_block)
{
/* Move to the next block. */
i++;
/* Determine if we have wrapped. */
if (i >= nor_flash -> lx_nor_flash_total_blocks)
{
/* Yes, we have wrapped, set to block 0. */
i = 0;
}
/* Start at the first sector in the next block. */
j = 0;
/* No point in looking further into this block, just continue the loop. */
continue;
}
}
#endif
/* Setup the block word pointer to the first word of the search block. */
block_word_ptr = (nor_flash -> lx_nor_flash_base_address + (i * nor_flash -> lx_nor_flash_words_per_block));
@@ -249,52 +306,68 @@ UINT status;
return(status);
}
#endif
/* Is the value valid? */
if (min_logical_sector != LX_ALL_ONES)
{
#ifdef LX_DIRECT_READ
/* Read the word directly. */
max_logical_sector = *(block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET);
/* Read the word directly. */
max_logical_sector = *(block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET);
#else
status = _lx_nor_flash_driver_read(nor_flash, block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET, &max_logical_sector, 1);
status = _lx_nor_flash_driver_read(nor_flash, block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET, &max_logical_sector, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return the error. */
return(status);
}
/* Return the error. */
return(status);
}
#endif
/* Are the values valid? */
if ((min_logical_sector != LX_ALL_ONES) && (max_logical_sector != LX_ALL_ONES))
{
/* Now let's check to see if the search sector is within this range. */
if ((logical_sector < min_logical_sector) || (logical_sector > max_logical_sector))
/* Is the value valid? */
if (max_logical_sector != LX_ALL_ONES)
{
/* Move to the next block. */
i++;
/* Determine if we have wrapped. */
if (i >= nor_flash -> lx_nor_flash_total_blocks)
/* Now let's check to see if the search sector is within this range. */
if ((logical_sector < min_logical_sector) || (logical_sector > max_logical_sector))
{
/* Yes, we have wrapped, set to block 0. */
i = 0;
}
/* Start at the first sector in the next block. */
j = 0;
/* No point in looking further into this block, just continue the loop. */
continue;
/* Move to the next block. */
i++;
/* Determine if we have wrapped. */
if (i >= nor_flash -> lx_nor_flash_total_blocks)
{
/* Yes, we have wrapped, set to block 0. */
i = 0;
}
/* Start at the first sector in the next block. */
j = 0;
/* No point in looking further into this block, just continue the loop. */
continue;
}
}
}
else
{
/* Set the max logical sector to all ones. */
max_logical_sector = LX_ALL_ONES;
}
#ifndef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Clear the valid sector found flag. */
valid_sector_found = LX_FALSE;
#endif
/* Setup the total number of sectors. */
total_sectors = nor_flash -> lx_nor_flash_physical_sectors_per_block;
@@ -440,6 +513,11 @@ UINT status;
return(LX_SUCCESS);
}
}
#ifndef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Set the valid sector found flag. */
valid_sector_found = LX_TRUE;
#endif
}
/* Move to the next list entry. */
@@ -453,6 +531,29 @@ UINT status;
j = 0;
}
}
#ifndef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Check if the block contains no valid sectors. */
if ((valid_sector_found == LX_FALSE) && (max_logical_sector != LX_ALL_ONES))
{
/* Clear max logical sector to indicate sectors are all obsoleted. */
max_logical_sector = 0;
/* Write the max logical sector to the block header. */
status = _lx_nor_flash_driver_write(nor_flash, block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET, &max_logical_sector, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return the error. */
return(status);
}
}
#endif
/* Determine if there are any more mapped sectors. */
if (mapped_sectors == 0)
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_next_block_to_erase_find PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -81,6 +80,12 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* added obsolete count cache, */
/* optimized full obsoleted */
/* block searching logic, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_next_block_to_erase_find(LX_NOR_FLASH *nor_flash, ULONG *return_erase_block, ULONG *return_erase_count, ULONG *return_mapped_sectors, ULONG *return_obsolete_sectors)
@@ -97,16 +102,23 @@ ULONG min_block_erase = 0;
ULONG min_block_erase_count;
ULONG min_block_obsolete_count = 0;
ULONG min_block_mapped_count = 0;
ULONG min_block_mapped_count_available = LX_FALSE;
ULONG max_obsolete_sectors;
ULONG max_obsolete_block = 0;
ULONG max_obsolete_erase_count = 0;
ULONG max_obsolete_mapped_count = 0;
ULONG max_obsolete_mapped_count_available = LX_FALSE;
ULONG min_system_block_erase_count;
ULONG system_min_erased_blocks;
ULONG max_system_block_erase_count;
ULONG erase_count_threshold;
ULONG min_logical_sector;
ULONG max_logical_sector;
#ifndef LX_DIRECT_READ
UINT status;
#endif
UINT obsolete_sectors_available;
UINT mapped_sectors_available;
/* Setup the block word pointer to the first word of the search block. */
@@ -117,6 +129,7 @@ UINT status;
/* Initialize the system minimum and maximum erase counts. */
min_system_block_erase_count = LX_ALL_ONES;
system_min_erased_blocks = 0;
max_system_block_erase_count = 0;
/* Initialize the maximum obsolete sector count. */
@@ -161,34 +174,71 @@ UINT status;
#endif
/* Update the system minimum and maximum erase counts. */
if (erase_count == min_system_block_erase_count)
{
system_min_erased_blocks ++;
}
if (erase_count < min_system_block_erase_count)
{
min_system_block_erase_count = erase_count;
system_min_erased_blocks = 1;
}
if (erase_count > max_system_block_erase_count)
max_system_block_erase_count = erase_count;
/* Compute the number of obsolete and mapped sectors for this block. */
obsolete_sectors = 0;
mapped_sectors = 0;
/* Initialize the obsolete and mapped sector count available flags. */
obsolete_sectors_available = LX_FALSE;
mapped_sectors_available = LX_FALSE;
/* Setup a pointer to the mapped list. */
list_word_ptr = block_word_ptr + nor_flash -> lx_nor_flash_block_physical_sector_mapping_offset;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Loop through the mapped list for this block. */
for (j = 0; j < nor_flash -> lx_nor_flash_physical_sectors_per_block; j++)
/* Determine if the obsolete sector count is available in the cache. */
if (i < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Yes, the obsolete sector count is available. */
obsolete_sectors_available = LX_TRUE;
/* Pickup the obsolete sector count from the cache. */
obsolete_sectors = (ULONG)nor_flash -> lx_nor_flash_extended_cache_obsolete_count[i];
}
else
{
#endif
/* Read the minimum and maximum logical sector values in this block. */
#ifdef LX_DIRECT_READ
/* Read the word directly. */
min_logical_sector = *(block_word_ptr + LX_NOR_FLASH_MIN_LOGICAL_SECTOR_OFFSET);
#else
status = _lx_nor_flash_driver_read(nor_flash, block_word_ptr + LX_NOR_FLASH_MIN_LOGICAL_SECTOR_OFFSET, &min_logical_sector, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Read the current mapping entry. */
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return the error. */
return(status);
}
#endif
/* Determine if the minimum logical sector is valid. */
if (min_logical_sector != LX_ALL_ONES)
{
#ifdef LX_DIRECT_READ
/* Read the word directly. */
list_word = *(list_word_ptr);
max_logical_sector = *(block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET);
#else
status = _lx_nor_flash_driver_read(nor_flash, list_word_ptr, &list_word, 1);
status = _lx_nor_flash_driver_read(nor_flash, block_word_ptr + LX_NOR_FLASH_MAX_LOGICAL_SECTOR_OFFSET, &max_logical_sector, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
@@ -196,33 +246,104 @@ UINT status;
return(status);
}
#endif
/* Determine if the entry hasn't been used. */
if (list_word == LX_NOR_PHYSICAL_SECTOR_FREE)
{
/* Since allocations are done sequentially in the block, we know nothing
else exists after this point. */
break;
}
/* Is this entry obsolete? */
if ((list_word & LX_NOR_PHYSICAL_SECTOR_VALID) == 0)
{
/* Increment the number of obsolete sectors. */
obsolete_sectors++;
}
else
{
/* Increment the number of mapped sectors. */
mapped_sectors++;
}
/* Move the list pointer ahead. */
list_word_ptr++;
/* Are the values valid? */
/* Now let's check to see if all the sector are obsoleted. */
if ((max_logical_sector != LX_ALL_ONES) && (max_logical_sector < min_logical_sector))
{
obsolete_sectors_available = LX_TRUE;
obsolete_sectors = nor_flash -> lx_nor_flash_physical_sectors_per_block;
}
}
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
}
#endif
/* Determine if the mapped sector count is available. */
if (obsolete_sectors_available == LX_FALSE)
{
/* Compute the number of obsolete and mapped sectors for this block. */
/* Initialize the obsolete and mapped sector counts. */
obsolete_sectors = 0;
mapped_sectors = 0;
/* Set the mapped sector count and obsolete sector count available flags. */
mapped_sectors_available = LX_TRUE;
obsolete_sectors_available = LX_TRUE;
/* Setup a pointer to the mapped list. */
list_word_ptr = block_word_ptr + nor_flash -> lx_nor_flash_block_physical_sector_mapping_offset;
/* Loop through the mapped list for this block. */
for (j = 0; j < nor_flash -> lx_nor_flash_physical_sectors_per_block; j++)
{
/* Read the current mapping entry. */
#ifdef LX_DIRECT_READ
/* Read the word directly. */
list_word = *(list_word_ptr);
#else
status = _lx_nor_flash_driver_read(nor_flash, list_word_ptr, &list_word, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return the error. */
return(status);
}
#endif
/* Determine if the entry hasn't been used. */
if (list_word == LX_NOR_PHYSICAL_SECTOR_FREE)
{
/* Since allocations are done sequentially in the block, we know nothing
else exists after this point. */
break;
}
/* Is this entry obsolete? */
if ((list_word & LX_NOR_PHYSICAL_SECTOR_VALID) == 0)
{
/* Increment the number of obsolete sectors. */
obsolete_sectors++;
}
else
{
/* Increment the number of mapped sectors. */
mapped_sectors++;
}
/* Move the list pointer ahead. */
list_word_ptr++;
}
}
/* Determine if this block contains full obsoleted sectors and the erase count is minimum. */
if ((obsolete_sectors == nor_flash -> lx_nor_flash_physical_sectors_per_block) &&
(erase_count == nor_flash -> lx_nor_flash_minimum_erase_count) &&
(nor_flash -> lx_nor_flash_minimum_erased_blocks > 0))
{
/* Yes, we have a full obsoleted block with minimum erase count. */
*return_erase_block = i;
*return_erase_count = erase_count;
*return_obsolete_sectors = obsolete_sectors;
*return_mapped_sectors = mapped_sectors;
break;
}
/* Determine if we have a block with a new maximum number of obsolete sectors. */
if ((obsolete_sectors > max_obsolete_sectors) && (erase_count <= erase_count_threshold))
@@ -233,6 +354,8 @@ UINT status;
max_obsolete_block = i;
max_obsolete_erase_count = erase_count;
max_obsolete_mapped_count = mapped_sectors;
max_obsolete_mapped_count_available = mapped_sectors_available;
}
else if ((max_obsolete_sectors) && (obsolete_sectors == max_obsolete_sectors) && (erase_count <= erase_count_threshold))
{
@@ -247,6 +370,7 @@ UINT status;
max_obsolete_block = i;
max_obsolete_erase_count = erase_count;
max_obsolete_mapped_count = mapped_sectors;
max_obsolete_mapped_count_available = mapped_sectors_available;
}
}
@@ -259,36 +383,105 @@ UINT status;
min_block_erase = i;
min_block_obsolete_count = obsolete_sectors;
min_block_mapped_count = mapped_sectors;
min_block_mapped_count_available = mapped_sectors_available;
}
/* Move to the next block. */
block_word_ptr = block_word_ptr + nor_flash -> lx_nor_flash_words_per_block;
}
/* Determine if we can erase the block with the most obsolete sectors. */
if (max_obsolete_sectors)
/* Determine if we found a block with full obsoleted sector and the erase count is minimum. */
if (i == nor_flash -> lx_nor_flash_total_blocks)
{
/* Erase the block with the most obsolete sectors. */
*return_erase_block = max_obsolete_block;
*return_erase_count = max_obsolete_erase_count;
*return_obsolete_sectors = max_obsolete_sectors;
*return_mapped_sectors = max_obsolete_mapped_count;
}
else
{
/* Otherwise, choose the block with the smallest erase count. */
*return_erase_block = min_block_erase;
*return_erase_count = min_block_erase_count;
*return_obsolete_sectors = min_block_obsolete_count;
*return_mapped_sectors = min_block_mapped_count;
/* Determine if we can erase the block with the most obsolete sectors. */
if (max_obsolete_sectors)
{
/* Erase the block with the most obsolete sectors. */
*return_erase_block = max_obsolete_block;
*return_erase_count = max_obsolete_erase_count;
*return_obsolete_sectors = max_obsolete_sectors;
*return_mapped_sectors = max_obsolete_mapped_count;
mapped_sectors_available = max_obsolete_mapped_count_available;
}
else
{
/* Otherwise, choose the block with the smallest erase count. */
*return_erase_block = min_block_erase;
*return_erase_count = min_block_erase_count;
*return_obsolete_sectors = min_block_obsolete_count;
*return_mapped_sectors = min_block_mapped_count;
mapped_sectors_available = min_block_mapped_count_available;
}
/* Update the overall minimum and maximum erase count. */
nor_flash -> lx_nor_flash_minimum_erase_count = min_system_block_erase_count;
nor_flash -> lx_nor_flash_minimum_erased_blocks = system_min_erased_blocks;
nor_flash -> lx_nor_flash_maximum_erase_count = max_system_block_erase_count;
}
/* Update the overall minimum and maximum erase count. */
nor_flash -> lx_nor_flash_minimum_erase_count = min_system_block_erase_count;
nor_flash -> lx_nor_flash_maximum_erase_count = max_system_block_erase_count;
/* Determine if the mapped sector count is available. */
if (mapped_sectors_available == LX_FALSE)
{
/* Compute the number of obsolete and mapped sectors for this block. */
mapped_sectors = 0;
/* Setup a pointer to the mapped list. */
block_word_ptr = nor_flash -> lx_nor_flash_base_address + *return_erase_block * nor_flash -> lx_nor_flash_words_per_block;
list_word_ptr = block_word_ptr + nor_flash -> lx_nor_flash_block_physical_sector_mapping_offset;
/* Loop through the mapped list for this block. */
for (j = 0; j < nor_flash -> lx_nor_flash_physical_sectors_per_block; j++)
{
/* Read the current mapping entry. */
#ifdef LX_DIRECT_READ
/* Read the word directly. */
list_word = *(list_word_ptr);
#else
status = _lx_nor_flash_driver_read(nor_flash, list_word_ptr, &list_word, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */
if (status)
{
/* Call system error handler. */
_lx_nor_flash_system_error(nor_flash, status);
/* Return the error. */
return(status);
}
#endif
/* Determine if the entry hasn't been used. */
if (list_word == LX_NOR_PHYSICAL_SECTOR_FREE)
{
/* Since allocations are done sequentially in the block, we know nothing
else exists after this point. */
break;
}
/* Is this entry mapped? */
if ((list_word & LX_NOR_PHYSICAL_SECTOR_VALID) != 0)
{
/* Increment the number of mapped sectors. */
mapped_sectors++;
}
/* Move the list pointer ahead. */
list_word_ptr++;
}
/* Return the mapped sector count. */
*return_mapped_sectors = mapped_sectors;
}
/* Return success. */
return(LX_SUCCESS);
}
+37 -16
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_open PORTABLE C */
/* 6.2.1 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -94,7 +93,15 @@
/* resulting in version 6.1.7 */
/* 03-08-2023 Xiuwen Cai Modified comment(s), */
/* added new driver interface, */
/* resulting in version 6.2.1 */
/* resulting in version 6.2.1 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added count for minimum */
/* erased blocks, added */
/* obsolete count cache, */
/* avoided clearing user */
/* extension in flash control */
/* block, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *))
@@ -112,7 +119,7 @@ ULONG free_sectors;
ULONG used_sectors;
ULONG *new_map_entry;
ULONG *new_sector_address;
ULONG erased_count, min_erased_count, max_erased_count, temp_erased_count;
ULONG erased_count, min_erased_count, max_erased_count, temp_erased_count, min_erased_blocks;
ULONG j, k, l;
UINT status;
#ifdef LX_FREE_SECTOR_DATA_VERIFY
@@ -124,8 +131,8 @@ LX_INTERRUPT_SAVE_AREA
LX_PARAMETER_NOT_USED(name);
/* Clear the NOR flash control block. */
LX_MEMSET(nor_flash, 0, sizeof(LX_NOR_FLASH));
/* Clear the NOR flash control block. User extension is not cleared. */
LX_MEMSET(nor_flash, 0, (ULONG)((UCHAR*)&(nor_flash -> lx_nor_flash_open_previous) - (UCHAR*)nor_flash) + sizeof(nor_flash -> lx_nor_flash_open_previous));
/* Call the flash driver's initialization function. */
(nor_driver_initialize)(nor_flash);
@@ -213,6 +220,7 @@ LX_INTERRUPT_SAVE_AREA
/* Setup default values for the max/min erased counts. */
min_erased_count = LX_ALL_ONES;
min_erased_blocks = 0;
max_erased_count = 0;
/* Setup the block word pointer to the first word of the first block, which is effectively the
@@ -254,13 +262,24 @@ LX_INTERRUPT_SAVE_AREA
/* No, valid block. Isolate the erased count. */
erased_count = (block_word & LX_BLOCK_ERASE_COUNT_MASK);
/* Is the erased count the minimum? */
if (erased_count == min_erased_count)
{
/* Yes, increment the minimum erased block count. */
min_erased_blocks++;
}
/* Is this the new minimum? */
if (erased_count < min_erased_count)
{
/* Yes, remember the new minimum. */
min_erased_count = erased_count;
/* Reset the minimum erased block count. */
min_erased_blocks = 1;
}
/* Is this the new maximum? */
@@ -327,6 +346,7 @@ LX_INTERRUPT_SAVE_AREA
/* Update the overall minimum and maximum erase count. */
nor_flash -> lx_nor_flash_minimum_erase_count = 1;
nor_flash -> lx_nor_flash_minimum_erased_blocks = nor_flash -> lx_nor_flash_total_blocks;
nor_flash -> lx_nor_flash_maximum_erase_count = 1;
/* Update the number of free physical sectors. */
@@ -806,6 +826,7 @@ LX_INTERRUPT_SAVE_AREA
/* Update the overall minimum and maximum erase count. */
nor_flash -> lx_nor_flash_minimum_erase_count = min_erased_count;
nor_flash -> lx_nor_flash_minimum_erased_blocks = min_erased_blocks;
nor_flash -> lx_nor_flash_maximum_erase_count = max_erased_count;
/* Determine if we need to update the free sector search pointer. */
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+25 -11
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_sector_read PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -84,6 +83,9 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_sector_read(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer)
@@ -179,6 +181,18 @@ ULONG *sector_address;
/* Return status. */
return(LX_ERROR);
}
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
/* Determine if the logical sector is within the mapping bitmap. */
if (logical_sector < nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector)
{
/* Set the bit in the mapping bitmap. */
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap[logical_sector >> 5] |= (ULONG)(1 << (logical_sector & 31));
}
#endif
#endif
/* Increment the number of mapped physical sectors. */
nor_flash -> lx_nor_flash_mapped_physical_sectors++;
+44 -11
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_sector_release PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -84,6 +83,10 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* added obsolete count cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_sector_release(LX_NOR_FLASH *nor_flash, ULONG logical_sector)
@@ -94,6 +97,9 @@ ULONG *mapping_address;
ULONG mapping_entry;
ULONG *sector_address;
ULONG i;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
ULONG block;
#endif
#ifdef LX_THREAD_SAFE_ENABLE
@@ -164,9 +170,36 @@ ULONG i;
return(LX_ERROR);
}
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
/* Determine if the logical sector is within the mapping bitmap. */
if (logical_sector < nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector)
{
/* Set the bit in the mapping bitmap. */
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap[logical_sector >> 5] &= (ULONG)~(1 << (logical_sector & 31));
}
#endif
#endif
/* Increment the number of obsolete physical sectors. */
nor_flash -> lx_nor_flash_obsolete_physical_sectors++;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Get the block number from mapping address. */
block = (ULONG)(mapping_address - nor_flash -> lx_nor_flash_base_address) / nor_flash -> lx_nor_flash_words_per_block;
/* Determine if this block is within the range of the obsolete count cache. */
if (block < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Increment the obsolete count for this block. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[block] ++;
}
#endif
/* Decrement the number of mapped physical sectors. */
nor_flash -> lx_nor_flash_mapped_physical_sectors--;
+43 -12
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
@@ -40,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _lx_nor_flash_sector_write PORTABLE C */
/* 6.1.7 */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
@@ -87,6 +86,10 @@
/* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
/* added mapping bitmap cache, */
/* added obsolete count cache, */
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
UINT _lx_nor_flash_sector_write(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer)
@@ -101,7 +104,9 @@ ULONG new_mapping_entry;
ULONG i;
LX_NOR_SECTOR_MAPPING_CACHE_ENTRY *sector_mapping_cache_entry_ptr;
UINT status;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
ULONG block;
#endif
#ifdef LX_THREAD_SAFE_ENABLE
@@ -269,6 +274,18 @@ UINT status;
/* Return status. */
return(LX_ERROR);
}
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
/* Determine if the logical sector is within the mapping bitmap. */
if (logical_sector < nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector)
{
/* Set the bit in the mapping bitmap. */
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap[logical_sector >> 5] |= (ULONG)(1 << (logical_sector & 31));
}
#endif
#endif
/* Increment the number of mapped physical sectors. */
nor_flash -> lx_nor_flash_mapped_physical_sectors++;
@@ -303,6 +320,20 @@ UINT status;
/* Increment the number of obsolete physical sectors. */
nor_flash -> lx_nor_flash_obsolete_physical_sectors++;
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
/* Get the block number from mapping address. */
block = (ULONG)(old_mapping_address - nor_flash -> lx_nor_flash_base_address) / nor_flash -> lx_nor_flash_words_per_block;
/* Determine if this block is within the range of the obsolete count cache. */
if (block < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
{
/* Increment the obsolete count for this block. */
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[block] ++;
}
#endif
/* Decrement the number of mapped physical sectors. */
nor_flash -> lx_nor_flash_mapped_physical_sectors--;
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+9 -10
View File
@@ -1,13 +1,12 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
+197
View File
@@ -0,0 +1,197 @@
LevelX
For version 6 and higher, please refer to the release notes on GitHub at https://github.com/eclipse-threadx/levelx/releases.
Below is the revision history for 5.x.
08/15/2019 LevelX generic code version 5.6. This release includes the
following major features:
Files are modified to fix compiler warnings:
demo_filex_nand_flash.c
demo_filex_nor_flash.c
lx_nand_flash_256byte_ecc_check.c
lx_nand_flash_256byte_ecc_compute.c
10/10/2018 LevelX generic code version 5.5. This release includes the following
modifications:
lx_api.h Removed compiler warnings, added extended NOR cache
support, new APIs, and new constants.
lx_nand_flash_256byte_ecc_check.c Removed compiler warnings.
lx_nand_flash_256byte_ecc_compute.c Removed compiler warnings.
lx_nand_flash_block_obsoleted_check.c Added logic to mark the beginning of block erase.
lx_nand_flash_block_reclaim.c Removed compiler warnings, and added logic to mark
the beginning of block erase.
lx_nand_flash_logical_sector_find.c Removed compiler warnings, and added logic to use
and maintain the last found page.
lx_nand_flash_next_block_to_erase_find.c Removed compiler warnings.
lx_nand_flash_open.c Added logic to detect start of a block erase that
was interrupted, removed system error call for more
than one page being obsoleted since this can happen
normally, removed compiler warnings, and added logic
to initialize the last found page.
lx_nand_flash_partial_defragment.c Added file in this release.
lx_nand_flash_sector_release.c Removed compiler warnings.
lx_nand_flash_sector_write.c Removed compiler warnings.
lx_nor_flash_block_reclaim.c Removed direct driver access for erases/reads/writes,
removed compiler warnings, and added logic to mark
the beginning of block erase.
lx_nor_flash_driver_block_erase.c Added file in this release.
lx_nor_flash_driver_read.c Added file in this release.
lx_nor_flash_driver_write.c Added file in this release.
lx_nor_flash_extended_cache_enable.c Added file in this release.
lx_nor_flash_logical_sector_find.c Removed direct driver access for reads, removed compiler
warnings, and added logic to use and maintain the last
found sector/block.
lx_nor_flash_next_block_to_erase_find.c Removed compiler warnings, and removed direct driver
access for reads.
lx_nor_flash_open.c Removed direct driver access for erases/reads/writes,
added logic to detect start of a block erase that was
interrupted, removed system error call for more than
one page being obsoleted since this can happen normally,
removed compiler warnings, and added logic to initialize
the last found sector/block.
lx_nor_flash_partial_defragment.c Added file in this release.
lx_nor_flash_physical_sector_allocate.c Removed direct driver access for reads/writes.
lx_nor_flash_sector_read.c Removed direct driver access for reads/writes.
lx_nor_flash_sector_release.c Removed direct driver access for reads/writes.
lx_nor_flash_sector_write.c Removed direct driver access for reads/writes.
lx_nor_flash_simulator.c Removed compiler warnings.
lx*.c Changed comments and copyright header, and added
conditional around disabling ThreadX error checking.
lx*.h Changed comments and copyright header.
05/01/2018 LevelX generic code version 5.4. This release includes the following
modifications:
lx_api.h Added NOR flash RAM buffer, added bit constant
for both NOR and NAND flash to indicate when
mapping write is valid, added diagnostic counter
for tracking when incomplete mapping is detected
on open, add added new error code when driver
does not supply a sector/page RAM buffer.
fx_nand_flash_simulated_driver.c Added error checking, and corrected sector
read/write processing.
fx_nor_flash_simulator_driver.c Added error checking.
lx_nand_flash_block_reclaim.c Added clearing of additional bit to indicate when
mapping is valid, and corrected logic that could
cause a newly mapped sector to be erased.
lx_nand_flash_logical_sector_find.c Added logic to make sure the sector mapping is valid.
lx_nand_flash_next_block_to_erase_find.c Added logic to improve search for free sectors.
lx_nand_flash_open.c Added logic to detect and handle a mapping entry
interrupted before completion, and added logic to
ensure there is a page buffer supplied by the
driver.
lx_nand_flash_sector_release.c Added reclaim logic to help increase free sectors.
lx_nand_flash_sector_write.c Added clearing of additional bit to indicate when
mapping is valid.
lx_nor_flash_block_reclaim.c Added clearing of additional bit to indicate when
mapping is valid, added logic to read NOR sector
into RAM buffer if direct NOR access is not possible,
and corrected logic that could cause a newly mapped
sector to be erased.
lx_nor_flash_logical_sector_find.c Added logic to make sure the sector mapping is valid.
lx_nor_flash_next_block_to_erase_find.c Added logic to improve search for free sectors.
lx_nor_flash_open.c Added logic to detect and handle a mapping entry
interrupted before completion, and added logic to
ensure there is a sector buffer supplied by the
driver if LX_DIRECT_READ is not specified.
lx_nor_flash_sector_release.c Added reclaim logic to help increase free sectors.
lx_nor_flash_sector_write.c Added clearing of additional bit to indicate when
mapping is valid, and removed optimization to ensure
atomic sector write.
lx_nor_flash_simulator.c Added logic to supply RAM buffer for reading
sector when LX_DIRECT_READ is not specified,
and removed write attempt to already written
sector, since this is no longer required.
fx*.c Changed comments and copyright header.
lx*.c Changed comments and copyright header.
lx*.h Changed comments and copyright header.
11/01/2017 LevelX generic code version 5.3. This release includes the following
modifications:
lx_nand_flash_block_full_update.c Added check to make sure the block is
actually full.
lx_nand_flash_block_reclaim.c Added support for direct logical sector
cache.
lx_nand_flash_logical_sector_find.c Added adjustment of mapped sectors when
examining the mapped list, added support
for direct logical sector cache.
lx_nand_flash_open.c Added support for direct logical sector cache,
and updated diagnostics.
lx_nand_flash_physical_page_allocate.c Added adjustment of the search pointer for
next allocate request.
lx_nand_flash_sector_mapping_cache_invalidate.c Added support for direct logical sector cache.
lx_nand_flash_sector_release.c Added logic to update the page 0 mapping list
if present.
lx_nand_flash_sector_write.c Added logic to update the page 0 mapping list
if present, and added check to make sure the
new mapping wasn't moved, added direct logical
sector cache.
fx*.c Changed comments and copyright header.
lx*.c Changed comments and copyright header.
lx*.h Changed comments and copyright header.
03/01/2017 LevelX generic code version 5.2. This release includes the following
modifications:
lx_nand_flash_block_full_update.c Reduced the number of words accessed in
page 0, added driver interface layer,
and modified the extra bytes usage in
page 0 to support block valid-full-empty.
lx_nand_flash_block_obsoleted_check.c Added file in this release.
lx_nand_flash_block_reclaim.c Added logic to update page 0 on a full
block update, added driver interface layer,
and added additional diagnostic information.
lx_nand_flash_driver_block_erase.c Added file in this release.
lx_nand_flash_driver_block_erased_verify.c Added file in this release.
lx_nand_flash_driver_block_status_get.c Added file in this release.
lx_nand_flash_driver_block_status_set.c Added file in this release.
lx_nand_flash_driver_extra_bytes_get.c Added file in this release.
lx_nand_flash_driver_extra_bytes_set.c Added file in this release.
lx_nand_flash_driver_page_erased_verify.c Added file in this release.
lx_nand_flash_driver_read.c Added file in this release.
lx_nand_flash_driver_write.c Added file in this release.
lx_nand_flash_extended_cache_enable.c Added file in this release.
lx_nand_flash_logical_sector_find.c Reduced the number of words accessed in
page 0, corrected check for valid sector
mapping list, added max mapped sector logic,
added driver interface layer, and added logic
to use and maintain the last found sector block.
lx_nand_flash_next_block_to_erase_find.c Reduced the number of words accessed in page 0,
and added driver interface layer.
lx_nand_flash_open.c Reduced the number of words accessed in page 0,
added driver interface layer, added additional
diagnostic information, added logic to initialize
the maximum mapped logical sector, and added
initialization of the last found sector block.
lx_nand_flash_physical_page_allocate.c Reduced the number of words accessed in page 0,
added driver interface layer, and added logic
to use page 0's extra bytes to determine if
block has available pages.
lx_nand_flash_sector_read.c Added driver interface layer.
lx_nand_flash_sector_release.c Added logic to maintain the maximum mapped
sector, and added driver interface layer.
lx_nand_flash_sector_write.c Added call to see if the block is completely
obsoleted, added logic to remember the maximum
mapped sector, and added driver interface layer.
fx_nand_flash_simulator_driver.c Removed sector packing by requiring sector and
cluster size to match, and added release sector
support.
fx*.c Changed comments and copyright header.
lx*.c Changed comments and copyright header.
lx*.h Changed comments and copyright header.
08/01/2016 LevelX generic code version 5.1. This release includes the following
modifications:
lx_nor_flash_physical_sector_allocate.c Corrected problem with more than 32 sectors per
flash block.
fx*.c Changed comments and copyright header.
lx*.c Changed comments and copyright header.
lx*.h Changed comments and copyright header.
01/22/2015 Initial LevelX generic code version 5.0.
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
$(dirname `realpath $0`)/../test/cmake/run.sh build all
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Remove large folder
rm -rf /opt/hostedtoolcache
# Install necessary softwares for Ubuntu.
sudo apt-get update
sudo apt-get install -y \
gcc-multilib \
git \
g++ \
python3-pip \
ninja-build \
unifdef \
p7zip-full \
tofrodos \
gawk \
software-properties-common
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
CODENAME=$(lsb_release -c | cut -f2 -d':' | sed 's/\t//')
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $CODENAME main"
python3 -m pip install --upgrade pip
pip3 install gcovr==4.1
pip install --upgrade cmake
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
$(dirname `realpath $0`)/../test/cmake/run.sh test all
+4
View File
@@ -0,0 +1,4 @@
threadx
filex
coverage_report
.run.sh
+128
View File
@@ -0,0 +1,128 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
project(levelx_test LANGUAGES C)
# Set build configurations
set(BUILD_CONFIGURATIONS default_build_coverage
free_sector_verify_build
full_build
standalone_build
standalone_free_sector_verify_build
standalone_full_build
new_driver_interface_build
nor_obsolete_cache_build
nor_mapping_cache_build
nor_obsolete_mapping_cache_build)
set(CMAKE_CONFIGURATION_TYPES
${BUILD_CONFIGURATIONS}
CACHE STRING "list of supported configuration types" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
${CMAKE_CONFIGURATION_TYPES})
list(GET CMAKE_CONFIGURATION_TYPES 0 BUILD_TYPE)
if((NOT CMAKE_BUILD_TYPE) OR (NOT ("${CMAKE_BUILD_TYPE}" IN_LIST
CMAKE_CONFIGURATION_TYPES)))
set(CMAKE_BUILD_TYPE
"${BUILD_TYPE}"
CACHE STRING "Build Type of the project" FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
set(FX_FAULT_TOLERANT_DEFINITIONS
-DFX_ENABLE_FAULT_TOLERANT -DFX_UPDATE_FILE_SIZE_ON_ALLOCATE
-DFX_FAULT_TOLERANT_TRANSACTION_FAIL_FUNCTION)
set(default_build_coverage "")
set(free_sector_verify_build -DLX_FREE_SECTOR_DATA_VERIFY)
set(full_build -DLX_FREE_SECTOR_DATA_VERIFY
-DLX_DIRECT_READ
-DLX_NAND_FLASH_DIRECT_MAPPING_CACHE
-DLX_NOR_DISABLE_EXTENDED_CACHE
-DLX_THREAD_SAFE_ENABLE)
# For Standalone builds LX_STANADLONE_ENABLE is defined in line 61
set(standalone_build -DLX_STANDALONE_ENABLE)
set(standalone_free_sector_verify_build -DLX_STANDALONE_ENABLE ${free_sector_verify_build})
set(standalone_full_build -DLX_STANDALONE_ENABLE ${full_build})
set(new_driver_interface_build -DLX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
-DLX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE)
set(nor_obsolete_cache_build -DLX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
set(nor_mapping_cache_build -DLX_NOR_ENABLE_MAPPING_BITMAP)
set(nor_obsolete_mapping_cache_build -DLX_NOR_ENABLE_MAPPING_BITMAP
-DLX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
add_compile_options(
-m32
-std=c99
-ggdb
-g3
-gdwarf-2
-fdiagnostics-color
-Werror
${${CMAKE_BUILD_TYPE}})
add_link_options(-m32)
enable_testing()
if(CMAKE_BUILD_TYPE MATCHES "standalone.*")
set(LX_STANDALONE_ENABLE
ON
CACHE BOOL "LevelX standalone enabled(No Azure RTOS ThreadX)" FORCE)
set(FX_STANDALONE_ENABLE
ON
CACHE BOOL "FileX standalone enabled(No Azure RTOS ThreadX)" FORCE)
endif()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../.. levelx)
add_subdirectory(regression)
add_subdirectory(samples)
# Coverage
if(CMAKE_BUILD_TYPE MATCHES ".*_coverage")
target_compile_options(levelx PRIVATE -fprofile-arcs -ftest-coverage)
target_link_options(levelx PRIVATE -fprofile-arcs -ftest-coverage)
endif()
# Build ThreadX library once
execute_process(COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh build_libs)
add_custom_target(build_libs ALL COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh
build_libs)
add_dependencies(levelx build_libs)
target_include_directories(levelx PUBLIC ${CMAKE_BINARY_DIR}/../libs/inc)
if(NOT LX_STANDALONE_ENABLE)
add_library(threadx SHARED IMPORTED GLOBAL)
add_library("azrtos::threadx" ALIAS threadx)
set_target_properties(
threadx PROPERTIES IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/../libs/threadx/libthreadx.so)
add_library(filex SHARED IMPORTED GLOBAL)
add_library("azrtos::filex" ALIAS filex)
set_target_properties(filex PROPERTIES IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/../libs/filex/libfilex.so)
else()
get_filename_component(
externals ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
add_subdirectory(${externals}/filex filex)
add_library("azrtos::filex" ALIAS filex)
endif()
target_compile_options(
levelx
PRIVATE -Werror
-Wall
-Wextra
-pedantic
-fmessage-length=0
-fsigned-char
-ffunction-sections
-fdata-sections
-Wunused
-Wuninitialized
-Wmissing-declarations
-Wconversion
-Wpointer-arith
-Wshadow
-Wlogical-op
-Waggregate-return
-Wfloat-equal)
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
set -e
cd $(dirname $0)
mkdir -p coverage_report/$1
gcovr --object-directory=build/$1/levelx/CMakeFiles/levelx.dir/common/src -r ../../common/src --xml-pretty --output coverage_report/$1.xml
gcovr --object-directory=build/$1/levelx/CMakeFiles/levelx.dir/common/src -r ../../common/src --html --html-details --output coverage_report/$1/index.html
+38
View File
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(libs LANGUAGES C)
if($ENV{ENABLE_64})
message(STATUS "Building for 64bit")
else()
add_compile_options(-m32)
add_link_options(-m32)
message(STATUS "Building for 32bit")
endif()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
get_filename_component(
externals ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
if(NOT LX_STANDALONE_ENABLE)
add_subdirectory(${externals}/threadx threadx)
endif()
add_subdirectory(${externals}/filex filex)
target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE)
if(NOT DEFINED ENV{ENABLE_IDLE})
target_compile_options(threadx PRIVATE -DTX_LINUX_NO_IDLE_ENABLE)
endif()
if((NOT LX_STANDALONE_ENABLE) OR (NOT FX_STANDALONE_ENABLE))
foreach(lib threadx filex)
get_target_property(dirs ${lib} INCLUDE_DIRECTORIES)
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc)
foreach(dir ${dirs})
file(GLOB header_files ${dir}/*.h)
foreach(header_file ${header_files})
execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc)
endforeach()
endforeach()
endforeach()
endif()
+20
View File
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_policy(SET CMP0057 NEW)
project(regression_test LANGUAGES C)
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../regression)
set(regression_test_cases
${SOURCE_DIR}/levelx_nand_flash_test.c
${SOURCE_DIR}/levelx_nor_flash_test.c
${SOURCE_DIR}/levelx_nor_flash_test_cache.c)
foreach(test_case ${regression_test_cases} ${regression_test_cases_exfat})
get_filename_component(test_name ${test_case} NAME_WE)
add_executable(${test_name} ${test_case})
target_link_libraries(${test_name} PRIVATE azrtos::filex)
target_link_libraries(${test_name} PRIVATE azrtos::levelx)
target_compile_definitions(${test_name} PRIVATE BATCH_TEST)
add_test(${CMAKE_BUILD_TYPE}::${test_name} ${test_name})
endforeach()
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
cd $(dirname $0)
# if threadx repo does not exist, clone it
[ -d threadx ] || git clone https://github.com/eclipse-threadx/threadx.git --depth 1
[ -d filex ] || git clone https://github.com/eclipse-threadx/filex.git --depth 1
[ -f .run.sh ] || ln -sf threadx/scripts/cmake_bootstrap.sh .run.sh
./.run.sh $*
+17
View File
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_policy(SET CMP0057 NEW)
project(samples LANGUAGES C)
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../samples)
set(sample_files
${SOURCE_DIR}/demo_filex_nand_flash.c
${SOURCE_DIR}/demo_filex_nor_flash.c)
foreach(sample_file ${sample_files})
get_filename_component(sample_file_name ${sample_file} NAME_WE)
add_executable(${sample_file_name} ${sample_file})
target_link_libraries(${sample_file_name} PRIVATE azrtos::filex)
target_link_libraries(${sample_file_name} PRIVATE azrtos::levelx)
endforeach()
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff