diff --git a/.gitmodules b/.gitmodules index 0a2666262..7cb62f668 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,6 @@ [submodule "src/lib/tinyusb"] path = src/lib/tinyusb url = https://github.com/hathach/tinyusb +[submodule "tools/alif"] + path = tools/alif + url = https://github.com/micropython/alif-security-toolkit.git diff --git a/tools/alif b/tools/alif new file mode 160000 index 000000000..46347f974 --- /dev/null +++ b/tools/alif @@ -0,0 +1 @@ +Subproject commit 46347f97411337fd753ab4ee47fede967b51963c diff --git a/tools/alif/LICENSE b/tools/alif/LICENSE deleted file mode 100644 index 8c952a6a2..000000000 --- a/tools/alif/LICENSE +++ /dev/null @@ -1,131 +0,0 @@ - Alif Semiconductor Software License Agreement - ============================================= - -IMPORTANT: PLEASE READ CAREFULLY THE FOLLOWING ALIF SEMICONDUCTOR SINGAPORE -PTE. LTD. ("ALIF") SOFTWARE LICENSE AGREEMENT ("AGREEMENT"). -BY INSTALLING, COPYING, DOWNLOADING, ACCESSING OR OTHERWISE USING THIS -SOFTWARE PACKAGE OR ANY PART THEREOF (AND THE RELATED DOCUMENTATION) FROM -Alif SEMICONDUCTOR, YOU AGREE ON BEHALF OF YOURSELF OR ON BEHALF OF ANY -ENTITY BY WHICH YOU ARE EMPLOYED TO BE BOUND BY THIS AGREEMENT. - -Under Alif Semiconductors' intellectual property rights and subject to -applicable licensing terms for any third-party software incorporated in this -software package and applicable Open Source Terms (as defined here below), -You may use and redistribute the Software, in source and binary forms, with -or without modification, provided that the following conditions are met: - -1. Redistributions in source form (including any additions or modifications -to or derivative works of the Software) must retain Alif's copyright notice -and all other copyright notices, this list of conditions and the following -disclaimers and terms. - -2. Redistributions in binary form, except as embedded into microcontroller -or microprocessor device manufactured by or for Alif Semiconductor, or a -software update for such device, must reproduce Alif's copyright notice, this -list of conditions and the following disclaimers and terms in the Software -and in the documentation and any other materials provided with the -distribution. - -3. Neither the name of Alif nor the names of its suppliers may be used to -endorse or promote products derived from this Software without specific prior -written permission. - -4. The Software (including any additions or modifications to or derivative -works of the Software) may only be used with and executed on Alif -Semiconductors microcontroller, integrated circuits and SOC products. - -5. Any use, reproduction, or redistribution of the Software (including any -derivative works thereof) may not be done in a manner or way that would -subject the Software to any "copyleft" license or other similar licensing -or distribution model, including any which would require the Software be -licensed under any such license. "Copyleft" license includes the GNU -General Public License, the GNU Library General Public License, the GNU -Lesser General Public License, the Affero General Public License, the -Mozilla Public License, the Common Development and Distribution License, -the Eclipse Public License, and any Creative Commons "sharealike" license. - -6. You shall comply with all laws and regulations applicable to your use, -transfer, import or export of the Software (including any derivative works -thereof), including any applicable export control law or regulation. - -Alif and its suppliers own all right, title and interest in and to the -Software, including all copies thereof. Except as provided in the preceding -section, Alif grants no licenses or other rights by implication, estoppel or -otherwise to, any patent, copyright, trademark, trade name, service mark or -other intellectual property licenses or rights of Alif. All rights not -expressly granted by Alif are hereby reserved. There are no implied rights. - -This Agreement will automatically terminate if you fail to comply with any -terms or conditions of this Agreement, including any of the above conditions. -Your license to use the Software immediately terminates if you breach this -Agreement. - -Alif may make changes to the Software, at any time without notice. Alif has -no obligation to update, support, or provide training for the Software. - -The Software may contain open source software, third party software, or other -Alif software, including any that may be identified in the Software itself or -in the files (if any) accompanying the Software as licensed separately under -the terms of another license or agreement (collectively, the "Other -Software"). The Other Software is not licensed under this Agreement. Rather, -it is licensed to you under the terms of the applicable open source licenses, -third party license or other Alif license agreements (the "Other Software -Terms"), including any that may accompany the Software. Copyrights to the -Other Software are held by copyright holders indicated in the Other Software -Terms. To the extent required by the Other Software Terms, Alif will make -such open source software available upon written request to Alif. - -ALIF PROVIDES THE SOFTWARE "AS-IS." TO THE MAXIMUM EXTENT PERMITTED BY -APPLICABLE LAW, ALIF DISCLAIMS AND EXCLUDES ALL WARRANTIES AND CONDITIONS, -WHETHER STATUTORY, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -TITLE, QUIET ENJOYMENT, ACCURACY, AND NON-INFRINGEMENT OF THIRD-PARTY RIGHTS. -The Software is not intended for use in nuclear power, military, emergency, -or medical settings or applications or any life safety, critical purpose, or -other systems or applications where the use or failure of the Software may -lead to death, bodily injury, damage to person or property or environmental -damage. You agree that you are fully responsible for any claims, costs, -damages, expenses, and attorneys' fees arising out of any such use, even if -any claim alleges that Alif was negligent regarding the design or manufacture -of the Software. - -IN NO EVENT SHALL ALIF OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR FOR ANY COST OF -COVER, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR -PROFITS, BUSINESS INTERRUPTION, OR OTHER LOSS ARISING OUT OF OR IN CONNECTION -WITH THE SOFTWARE, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -SOUNDING IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE), EVEN IF ALIF HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, -NOTWITHSTANDING ANY FAILURE OF THE ESSENTIAL PURPOSE OF THIS AGREEMENT OR ANY -LIMITED REMEDY HEREUNDER. - -If you provide Alif with any feedback, suggestions, comments, modifications, -corrections, enhancements or other input relating to the Software -("Feedback"), Alif will be free to use, disclose, reproduce, license, -distribute and otherwise exploit the Feedback in its sole discretion without -any obligations or restrictions of any kind, including without limitation, -intellectual property rights or licensing obligations. Alif has no obligation -to use any Feedback. - -The laws of the State of California and the United States govern all matters -arising out of this Agreement, excluding their conflicts of laws principles. -All disputes will be brought exclusively in the state or federal courts in -the Northern District of California, except Alif may bring an action, suit -or proceeding anywhere as needed to protect its technology and intellectual -property rights. Each party agrees that it submits to the personal -jurisdiction and venue of the state or federal courts in the Northern -District of California and waives any objections. The United Nations -Convention on Contracts for the International Sale of Goods (1980) is hereby -excluded in its entirety from Software to this Agreement. - -If any provision of this Agreement is found to be invalid, illegal or -unenforceable, the validity, legality and enforceability of any of the -remaining provisions shall not in any way be affected or impaired and a -valid, legal and enforceable provision of similar intent and economic impact -shall be substituted therefore. This Agreement sets forth the entire -understanding and agreement between you and Alif, supersedes all prior -agreements, whether written or oral, with respect to the Software, and may -be amended only in a writing signed by both parties that identifies itself -as an amendment to this Agreement. - -Rev. 10/2022 diff --git a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin deleted file mode 100755 index fb17629f8..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin.sign deleted file mode 100755 index 59e2abef5..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin deleted file mode 100755 index 03c443aae..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin.sign deleted file mode 100755 index 2e2e64b87..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin deleted file mode 100755 index f0a8e8176..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin.sign deleted file mode 100755 index 541c88329..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin deleted file mode 100755 index e1b76b21f..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin.sign deleted file mode 100755 index 5f4101695..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41010PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin deleted file mode 100755 index d9cfeed9e..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin.sign deleted file mode 100755 index 92aa3d29e..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin deleted file mode 100755 index f97f8d975..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin.sign deleted file mode 100755 index ec6b6be84..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin deleted file mode 100755 index 51ef4a484..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin.sign deleted file mode 100755 index eccb76896..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin deleted file mode 100755 index 84e32fb1e..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin.sign deleted file mode 100755 index e05f8ceff..000000000 Binary files a/tools/alif/alif/SP-AB1C1F1M41820PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin deleted file mode 100755 index 578b080f7..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin.sign deleted file mode 100755 index 63ea00dda..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin deleted file mode 100755 index 09adac8da..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin.sign deleted file mode 100755 index 617242f63..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin b/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin deleted file mode 100755 index c4c4cc531..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin.sign deleted file mode 100755 index 7c72faa1d..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin b/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin deleted file mode 100755 index 5f178d4f5..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin.sign b/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin.sign deleted file mode 100755 index cddd76714..000000000 Binary files a/tools/alif/alif/SP-AB1C1F4M51820PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin deleted file mode 100755 index efd2616a2..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin.sign deleted file mode 100755 index 4eb3d766e..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin deleted file mode 100755 index 8667efd00..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin.sign deleted file mode 100755 index b39e209e7..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin deleted file mode 100755 index 3490d2d5a..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin.sign deleted file mode 100755 index b3a138a51..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin deleted file mode 100755 index 1d2c4bacc..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin.sign deleted file mode 100755 index 41068337b..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin deleted file mode 100755 index 0b39c0a33..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin.sign deleted file mode 100755 index efe17a802..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin b/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin deleted file mode 100755 index dea047003..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin.sign b/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin.sign deleted file mode 100755 index b66e8c2eb..000000000 Binary files a/tools/alif/alif/SP-AE101F4071542LH-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin deleted file mode 100755 index 3f6639216..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin.sign deleted file mode 100755 index 3e696826b..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin b/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin deleted file mode 100755 index 7e264d24f..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin.sign deleted file mode 100755 index f94a9a38c..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10405055H-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin deleted file mode 100755 index f939d9055..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin.sign deleted file mode 100755 index 3ff0152aa..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin deleted file mode 100755 index c840de82b..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin.sign deleted file mode 100755 index 6e441f5ce..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin deleted file mode 100755 index 232c4abb3..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin.sign deleted file mode 100755 index 4f5081c8b..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin deleted file mode 100755 index 5b08685ae..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin.sign deleted file mode 100755 index 46de10ffd..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1040505PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin deleted file mode 100755 index 32ac683b9..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin.sign deleted file mode 100755 index 72d3a651a..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin b/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin deleted file mode 100755 index e0c5166a4..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin.sign deleted file mode 100755 index 22f53fc14..000000000 Binary files a/tools/alif/alif/SP-AE1C1F10410105H-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin deleted file mode 100755 index f94714b13..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin.sign deleted file mode 100755 index dce7ea566..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin deleted file mode 100755 index 9df9a5f40..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin.sign deleted file mode 100755 index c428820ca..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin deleted file mode 100755 index 283ea4e20..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin.sign deleted file mode 100755 index 494037aa4..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin deleted file mode 100755 index fc85a6c02..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin.sign deleted file mode 100755 index 52280b830..000000000 Binary files a/tools/alif/alif/SP-AE1C1F1041010PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin deleted file mode 100755 index 7d591cf4f..000000000 Binary files a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin.sign deleted file mode 100755 index ef21c108c..000000000 Binary files a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin b/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin deleted file mode 100755 index b3de74bee..000000000 Binary files a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin.sign deleted file mode 100755 index 124d3ed98..000000000 Binary files a/tools/alif/alif/SP-AE1C1F40319205H-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin deleted file mode 100755 index a273cec96..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin.sign deleted file mode 100755 index bccf57067..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin deleted file mode 100755 index 85fc3145e..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin.sign deleted file mode 100755 index 75dae6637..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920HH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin b/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin deleted file mode 100755 index 3281b6187..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin.sign b/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin.sign deleted file mode 100755 index 24fe92c1c..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin b/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin deleted file mode 100755 index 024a643e0..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin.sign b/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin.sign deleted file mode 100755 index 169a851d2..000000000 Binary files a/tools/alif/alif/SP-AE1C1F4051920PH-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin deleted file mode 100755 index 012dd521c..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin.sign deleted file mode 100755 index 50100b249..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin deleted file mode 100755 index 735425f63..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin.sign deleted file mode 100755 index 1cb0c53a9..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin deleted file mode 100755 index f6a71e9f3..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin.sign deleted file mode 100755 index 5a33a1cfc..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin deleted file mode 100755 index 87c9dba0b..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin.sign deleted file mode 100755 index 0d831620b..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin deleted file mode 100755 index 61e577977..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin.sign deleted file mode 100755 index aed41310f..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin b/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin deleted file mode 100755 index 948027e19..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin.sign deleted file mode 100755 index 643c84cc0..000000000 Binary files a/tools/alif/alif/SP-AE302F40C1537LE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin deleted file mode 100755 index a7b55cab8..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin.sign deleted file mode 100755 index 0c627f225..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin deleted file mode 100755 index eb6d3573a..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin.sign deleted file mode 100755 index b39d69d54..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin deleted file mode 100755 index 068143974..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin.sign deleted file mode 100755 index 579b0459b..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin deleted file mode 100755 index a3a801022..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin.sign deleted file mode 100755 index fc501de12..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin deleted file mode 100755 index cbb36f56e..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin.sign deleted file mode 100755 index 93003e556..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin b/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin deleted file mode 100755 index 21671cbe7..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin.sign deleted file mode 100755 index 156c5c189..000000000 Binary files a/tools/alif/alif/SP-AE302F80C1557LE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin deleted file mode 100755 index 47c5e34a2..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin.sign deleted file mode 100755 index f9df86d5e..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin b/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin deleted file mode 100755 index 6a34e08b7..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin.sign deleted file mode 100755 index 6e68274ed..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin deleted file mode 100755 index 68f6a2977..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin.sign deleted file mode 100755 index 090b081ae..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin b/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin deleted file mode 100755 index 6da511feb..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin.sign deleted file mode 100755 index 9dec78d65..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582AE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin deleted file mode 100755 index 22adfea69..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin.sign deleted file mode 100755 index 68b3914af..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin b/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin deleted file mode 100755 index 2f1504cc6..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin.sign deleted file mode 100755 index dd1286746..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin deleted file mode 100755 index 0f8b30c26..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin.sign deleted file mode 100755 index d34b3a685..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin b/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin deleted file mode 100755 index b4c2db771..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin.sign deleted file mode 100755 index 3557ac712..000000000 Binary files a/tools/alif/alif/SP-AE302F80F5582LE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin deleted file mode 100755 index e56fddafe..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin.sign deleted file mode 100755 index 655881b40..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin deleted file mode 100755 index 366fdddec..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin.sign deleted file mode 100755 index 5158f50c0..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin deleted file mode 100755 index 57777de09..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin.sign deleted file mode 100755 index 64b41991f..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin deleted file mode 100755 index 1a215d868..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin.sign deleted file mode 100755 index 7d032984d..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin deleted file mode 100755 index 44ef8cf38..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin.sign deleted file mode 100755 index a01579f84..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin deleted file mode 100755 index b8b0fdd84..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin.sign deleted file mode 100755 index 7aee2d13b..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5AE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin deleted file mode 100755 index df7213e5c..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin.sign deleted file mode 100755 index 0989e72da..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin deleted file mode 100755 index 6c98c03c9..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin.sign deleted file mode 100755 index 76cccc90a..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin deleted file mode 100755 index 32f8ac9e5..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin.sign deleted file mode 100755 index 7eb27da1f..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin deleted file mode 100755 index 2a0bbef09..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin.sign deleted file mode 100755 index 6dfb9fa50..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin deleted file mode 100755 index fc2e76884..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin.sign deleted file mode 100755 index c117cd5c8..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin deleted file mode 100755 index 017a4a857..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin.sign b/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin.sign deleted file mode 100755 index 289532e50..000000000 Binary files a/tools/alif/alif/SP-AE302F80F55D5LE-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin b/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin deleted file mode 100755 index 34f20b9df..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin.sign deleted file mode 100755 index 2c4adace3..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin b/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin deleted file mode 100755 index d3baac21e..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin.sign b/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin.sign deleted file mode 100755 index 24ca1733b..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin b/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin deleted file mode 100755 index aa367f47a..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin.sign deleted file mode 100755 index 1f0f339de..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin b/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin deleted file mode 100755 index 5ece2c988..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin.sign b/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin.sign deleted file mode 100755 index db3595cb6..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582AS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin b/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin deleted file mode 100755 index 608e5485a..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin.sign deleted file mode 100755 index adc1d5598..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin b/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin deleted file mode 100755 index 13af01ebe..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin.sign b/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin.sign deleted file mode 100755 index 7f493e96e..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin b/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin deleted file mode 100755 index bdb0544cf..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin.sign deleted file mode 100755 index a95f9b46c..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin b/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin deleted file mode 100755 index 15136aee6..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin.sign b/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin.sign deleted file mode 100755 index 323180639..000000000 Binary files a/tools/alif/alif/SP-AE512F80F5582LS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin deleted file mode 100755 index 8c10775cc..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin.sign deleted file mode 100755 index c2e618607..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin deleted file mode 100755 index 03dd92d2f..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin.sign deleted file mode 100755 index 44470b1d0..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin deleted file mode 100755 index 88d4309bc..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin.sign deleted file mode 100755 index f042f81d5..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin deleted file mode 100755 index cfe40b161..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin.sign deleted file mode 100755 index b3042381e..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin deleted file mode 100755 index 3cdff737e..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin.sign deleted file mode 100755 index a0e1bba15..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin deleted file mode 100755 index e2a2f28f0..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin.sign b/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin.sign deleted file mode 100755 index 3da96c8c4..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5AS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin deleted file mode 100755 index 70c252454..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin.sign deleted file mode 100755 index d9da0d436..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin deleted file mode 100755 index 375be50c8..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin.sign deleted file mode 100755 index 9ff39ada2..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin deleted file mode 100755 index 5be74d50a..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin.sign deleted file mode 100755 index bd7f1558e..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin deleted file mode 100755 index ab5693a72..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin.sign deleted file mode 100755 index 667519c7c..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin deleted file mode 100755 index 58571601b..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin.sign deleted file mode 100755 index 638b70f00..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin deleted file mode 100755 index cc299b458..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin.sign b/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin.sign deleted file mode 100755 index 8d788309a..000000000 Binary files a/tools/alif/alif/SP-AE512F80F55D5LS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin deleted file mode 100755 index da2301092..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin.sign deleted file mode 100755 index 6f1291d11..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin deleted file mode 100755 index f19033112..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin.sign deleted file mode 100755 index cbc491c14..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin deleted file mode 100755 index ec7be23cc..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin.sign deleted file mode 100755 index 3a9fe44ff..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin deleted file mode 100755 index 873963c7a..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin.sign deleted file mode 100755 index 1fd04a875..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin deleted file mode 100755 index 96e90876d..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin.sign deleted file mode 100755 index 20e675b60..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin deleted file mode 100755 index 97b867067..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin.sign b/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin.sign deleted file mode 100755 index a26342256..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5AS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin deleted file mode 100755 index 43101169c..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin.sign deleted file mode 100755 index 0f052251e..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin deleted file mode 100755 index aef4c27b8..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin.sign deleted file mode 100755 index 129e8a595..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin deleted file mode 100755 index 81f87b0f5..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin.sign deleted file mode 100755 index 72cf1508e..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin deleted file mode 100755 index 8d9995194..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin.sign deleted file mode 100755 index ac4f9d595..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin deleted file mode 100755 index 08b88ca09..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin.sign deleted file mode 100755 index 0ab566d47..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin deleted file mode 100755 index 3228eb5bd..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin.sign b/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin.sign deleted file mode 100755 index c7521f03e..000000000 Binary files a/tools/alif/alif/SP-AE722F80F55D5LS-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-08-rev-a0-dev.bin b/tools/alif/alif/offset-08-rev-a0-dev.bin deleted file mode 100755 index 475c82b44..000000000 Binary files a/tools/alif/alif/offset-08-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-08-rev-a0-dev.bin.sign b/tools/alif/alif/offset-08-rev-a0-dev.bin.sign deleted file mode 100755 index 781991c7d..000000000 Binary files a/tools/alif/alif/offset-08-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-08-rev-a0.bin b/tools/alif/alif/offset-08-rev-a0.bin deleted file mode 100755 index 475c82b44..000000000 Binary files a/tools/alif/alif/offset-08-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/offset-08-rev-a0.bin.sign b/tools/alif/alif/offset-08-rev-a0.bin.sign deleted file mode 100755 index d7d8ae477..000000000 Binary files a/tools/alif/alif/offset-08-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-10-rev-a0-dev.bin b/tools/alif/alif/offset-10-rev-a0-dev.bin deleted file mode 100755 index 27177c951..000000000 Binary files a/tools/alif/alif/offset-10-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-10-rev-a0-dev.bin.sign b/tools/alif/alif/offset-10-rev-a0-dev.bin.sign deleted file mode 100755 index f846e8c8b..000000000 Binary files a/tools/alif/alif/offset-10-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-10-rev-a0.bin b/tools/alif/alif/offset-10-rev-a0.bin deleted file mode 100755 index 27177c951..000000000 Binary files a/tools/alif/alif/offset-10-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/offset-10-rev-a0.bin.sign b/tools/alif/alif/offset-10-rev-a0.bin.sign deleted file mode 100755 index 908ba5c6a..000000000 Binary files a/tools/alif/alif/offset-10-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b2-dev.bin b/tools/alif/alif/offset-18-rev-b2-dev.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b2-dev.bin.sign b/tools/alif/alif/offset-18-rev-b2-dev.bin.sign deleted file mode 100755 index 7034c7dc3..000000000 Binary files a/tools/alif/alif/offset-18-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b2.bin b/tools/alif/alif/offset-18-rev-b2.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b2.bin.sign b/tools/alif/alif/offset-18-rev-b2.bin.sign deleted file mode 100755 index d67f3b27b..000000000 Binary files a/tools/alif/alif/offset-18-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b3-dev.bin b/tools/alif/alif/offset-18-rev-b3-dev.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b3-dev.bin.sign b/tools/alif/alif/offset-18-rev-b3-dev.bin.sign deleted file mode 100755 index a071b8273..000000000 Binary files a/tools/alif/alif/offset-18-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b3.bin b/tools/alif/alif/offset-18-rev-b3.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b3.bin.sign b/tools/alif/alif/offset-18-rev-b3.bin.sign deleted file mode 100755 index d1e8fbd5d..000000000 Binary files a/tools/alif/alif/offset-18-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b4-dev.bin b/tools/alif/alif/offset-18-rev-b4-dev.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b4-dev.bin.sign b/tools/alif/alif/offset-18-rev-b4-dev.bin.sign deleted file mode 100755 index 876eab8d6..000000000 Binary files a/tools/alif/alif/offset-18-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b4.bin b/tools/alif/alif/offset-18-rev-b4.bin deleted file mode 100755 index 2a70d3c62..000000000 Binary files a/tools/alif/alif/offset-18-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/offset-18-rev-b4.bin.sign b/tools/alif/alif/offset-18-rev-b4.bin.sign deleted file mode 100755 index 8fecd4833..000000000 Binary files a/tools/alif/alif/offset-18-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-1C-rev-a0-dev.bin b/tools/alif/alif/offset-1C-rev-a0-dev.bin deleted file mode 100755 index 4d7559f84..000000000 Binary files a/tools/alif/alif/offset-1C-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-1C-rev-a0-dev.bin.sign b/tools/alif/alif/offset-1C-rev-a0-dev.bin.sign deleted file mode 100755 index e5503063d..000000000 Binary files a/tools/alif/alif/offset-1C-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-1C-rev-a0.bin b/tools/alif/alif/offset-1C-rev-a0.bin deleted file mode 100755 index 4d7559f84..000000000 Binary files a/tools/alif/alif/offset-1C-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/offset-1C-rev-a0.bin.sign b/tools/alif/alif/offset-1C-rev-a0.bin.sign deleted file mode 100755 index 4588f1a4d..000000000 Binary files a/tools/alif/alif/offset-1C-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-1D-rev-a0-dev.bin b/tools/alif/alif/offset-1D-rev-a0-dev.bin deleted file mode 100755 index 2a08aad1e..000000000 Binary files a/tools/alif/alif/offset-1D-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-1D-rev-a0-dev.bin.sign b/tools/alif/alif/offset-1D-rev-a0-dev.bin.sign deleted file mode 100755 index 1cf138715..000000000 Binary files a/tools/alif/alif/offset-1D-rev-a0-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-1D-rev-a0.bin b/tools/alif/alif/offset-1D-rev-a0.bin deleted file mode 100755 index 2a08aad1e..000000000 Binary files a/tools/alif/alif/offset-1D-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/offset-1D-rev-a0.bin.sign b/tools/alif/alif/offset-1D-rev-a0.bin.sign deleted file mode 100755 index d73627dc7..000000000 Binary files a/tools/alif/alif/offset-1D-rev-a0.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b2-dev.bin b/tools/alif/alif/offset-58-rev-b2-dev.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b2-dev.bin.sign b/tools/alif/alif/offset-58-rev-b2-dev.bin.sign deleted file mode 100755 index 685053ce2..000000000 Binary files a/tools/alif/alif/offset-58-rev-b2-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b2.bin b/tools/alif/alif/offset-58-rev-b2.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b2.bin.sign b/tools/alif/alif/offset-58-rev-b2.bin.sign deleted file mode 100755 index 5178c9bd5..000000000 Binary files a/tools/alif/alif/offset-58-rev-b2.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b3-dev.bin b/tools/alif/alif/offset-58-rev-b3-dev.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b3-dev.bin.sign b/tools/alif/alif/offset-58-rev-b3-dev.bin.sign deleted file mode 100755 index 6ce4cdf66..000000000 Binary files a/tools/alif/alif/offset-58-rev-b3-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b3.bin b/tools/alif/alif/offset-58-rev-b3.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b3.bin.sign b/tools/alif/alif/offset-58-rev-b3.bin.sign deleted file mode 100755 index a170054b9..000000000 Binary files a/tools/alif/alif/offset-58-rev-b3.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b4-dev.bin b/tools/alif/alif/offset-58-rev-b4-dev.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b4-dev.bin.sign b/tools/alif/alif/offset-58-rev-b4-dev.bin.sign deleted file mode 100755 index 198183f9e..000000000 Binary files a/tools/alif/alif/offset-58-rev-b4-dev.bin.sign and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b4.bin b/tools/alif/alif/offset-58-rev-b4.bin deleted file mode 100755 index 6b58fa966..000000000 Binary files a/tools/alif/alif/offset-58-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/offset-58-rev-b4.bin.sign b/tools/alif/alif/offset-58-rev-b4.bin.sign deleted file mode 100755 index e5957f2a2..000000000 Binary files a/tools/alif/alif/offset-58-rev-b4.bin.sign and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0-dev.bin deleted file mode 100755 index a27ffdb9d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0.bin deleted file mode 100755 index 5b05fde29..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0-dev.bin deleted file mode 100755 index dcd241f6b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0.bin deleted file mode 100755 index 0a9e914d7..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41010PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0-dev.bin deleted file mode 100755 index 100d0e804..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0.bin deleted file mode 100755 index c19d51a7b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0-dev.bin deleted file mode 100755 index 7722007c8..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0.bin deleted file mode 100755 index e80dd7dc7..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F1M41820PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0-dev.bin deleted file mode 100755 index 8906e6eeb..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0.bin deleted file mode 100755 index bc7f7fd32..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0-dev.bin deleted file mode 100755 index 5dd8b76a3..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0.bin deleted file mode 100755 index c09196244..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AB1C1F4M51820PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2-dev.bin deleted file mode 100755 index 3feb63ba4..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2.bin deleted file mode 100755 index 40d6af91c..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3-dev.bin deleted file mode 100755 index a7ed79f07..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3.bin deleted file mode 100755 index 5afef81d1..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4-dev.bin deleted file mode 100755 index b26b8403b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4.bin deleted file mode 100755 index 0d74b9974..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE101F4071542LH-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0-dev.bin deleted file mode 100755 index e60beb412..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0.bin deleted file mode 100755 index d9d91877a..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10405055H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0-dev.bin deleted file mode 100755 index b9ab3823d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0.bin deleted file mode 100755 index 000241754..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0-dev.bin deleted file mode 100755 index 41f84701d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0.bin deleted file mode 100755 index 08bdcc73f..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1040505PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0-dev.bin deleted file mode 100755 index 31b6c4a14..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0.bin deleted file mode 100755 index 408c56d0d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F10410105H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0-dev.bin deleted file mode 100755 index 0e8f8a9e1..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0.bin deleted file mode 100755 index 325faea74..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0-dev.bin deleted file mode 100755 index ba125ee7d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0.bin deleted file mode 100755 index 7fa5cb0dc..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F1041010PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0-dev.bin deleted file mode 100755 index 0aa13a7b0..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0.bin deleted file mode 100755 index e11da6b4d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F40319205H-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0-dev.bin deleted file mode 100755 index 885ce66d5..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0.bin deleted file mode 100755 index e37b2f6f5..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920HH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0-dev.bin deleted file mode 100755 index 5c079fcba..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0.bin deleted file mode 100755 index ed0767a3b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE1C1F4051920PH-rev-a0.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2-dev.bin deleted file mode 100755 index 04d599e6e..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2.bin deleted file mode 100755 index d4df7462b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3-dev.bin deleted file mode 100755 index 69c770785..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3.bin deleted file mode 100755 index 3f782c91e..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4-dev.bin deleted file mode 100755 index 929262c72..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4.bin deleted file mode 100755 index 340a81c57..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F40C1537LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2-dev.bin deleted file mode 100755 index eae7ab952..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2.bin deleted file mode 100755 index 119aad8ab..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3-dev.bin deleted file mode 100755 index ba4c02df9..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3.bin deleted file mode 100755 index 39500f00b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4-dev.bin deleted file mode 100755 index 20392cc91..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4.bin deleted file mode 100755 index bfdc1ef34..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80C1557LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3-dev.bin deleted file mode 100755 index f2de27b00..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3.bin deleted file mode 100755 index 5f07afc05..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4-dev.bin deleted file mode 100755 index 49e136bd7..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4.bin deleted file mode 100755 index 49f2ecfe0..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582AE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3-dev.bin deleted file mode 100755 index 03e6c9882..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3.bin deleted file mode 100755 index 4c57b7cb6..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4-dev.bin deleted file mode 100755 index 9ebe9ac49..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4.bin deleted file mode 100755 index 047589885..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F5582LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2-dev.bin deleted file mode 100755 index 483aa0590..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2.bin deleted file mode 100755 index bd1c4da38..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3-dev.bin deleted file mode 100755 index f7314b923..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3.bin deleted file mode 100755 index dd83740eb..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4-dev.bin deleted file mode 100755 index 9557fae8d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4.bin deleted file mode 100755 index efb7df553..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5AE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2-dev.bin deleted file mode 100755 index a8fbbfbc6..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2.bin deleted file mode 100755 index 85f8e75cb..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3-dev.bin deleted file mode 100755 index a3e4b2ce3..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3.bin deleted file mode 100755 index e0a0a55da..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4-dev.bin deleted file mode 100755 index e11fe04e5..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4.bin deleted file mode 100755 index 3d593f824..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE302F80F55D5LE-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3-dev.bin deleted file mode 100755 index b8ca06876..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3.bin deleted file mode 100755 index 8874002a5..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4-dev.bin deleted file mode 100755 index 2605841ca..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4.bin deleted file mode 100755 index 8e4933e1c..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3-dev.bin deleted file mode 100755 index 3d4248166..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3.bin deleted file mode 100755 index 27bb97b8d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4-dev.bin deleted file mode 100755 index 877afbb06..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4.bin deleted file mode 100755 index 5b28d2d5a..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F5582LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2-dev.bin deleted file mode 100755 index fef57c2f4..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2.bin deleted file mode 100755 index 2d1e37cc0..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3-dev.bin deleted file mode 100755 index e941f4b29..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3.bin deleted file mode 100755 index 70788e72b..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4-dev.bin deleted file mode 100755 index 479b997dc..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4.bin deleted file mode 100755 index ff9481f62..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2-dev.bin deleted file mode 100755 index 5e26dd8de..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2.bin deleted file mode 100755 index 92b865eb1..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3-dev.bin deleted file mode 100755 index 54c04292c..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3.bin deleted file mode 100755 index 4dc7d9636..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4-dev.bin deleted file mode 100755 index 6fe039e4c..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4.bin deleted file mode 100755 index 2c496d5bb..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE512F80F55D5LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2-dev.bin deleted file mode 100755 index b46f35d0e..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2.bin deleted file mode 100755 index 5203ff478..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3-dev.bin deleted file mode 100755 index 974cc2333..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3.bin deleted file mode 100755 index d5b6475c8..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4-dev.bin deleted file mode 100755 index 4afe32e03..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4.bin deleted file mode 100755 index 82e40349c..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5AS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2-dev.bin deleted file mode 100755 index 4e954672a..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2.bin deleted file mode 100755 index 3dc181e8d..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b2.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3-dev.bin deleted file mode 100755 index 46ce37c14..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3.bin deleted file mode 100755 index a7d9581ab..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b3.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4-dev.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4-dev.bin deleted file mode 100755 index 1c39265ef..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4-dev.bin and /dev/null differ diff --git a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4.bin b/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4.bin deleted file mode 100755 index 858116fa1..000000000 Binary files a/tools/alif/alif/upd-packages/full-upd-SP-AE722F80F55D5LS-rev-b4.bin and /dev/null differ diff --git a/tools/alif/app-assets-gen.py b/tools/alif/app-assets-gen.py deleted file mode 100755 index 84d21c09d..000000000 --- a/tools/alif/app-assets-gen.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env python3 -import sys -import os -import struct -import argparse -from utils.config import * -from utils.toc_common import * -import json -from json.decoder import JSONDecodeError - -# Define Version constant for each separate tool -#0.01.000 Initial version -#0.02.000 added checksum for integrity -# passed ASSET_TYPE as a flag and used this placeholder for checksum -TOOL_VERSION ="0.02.000" - -EXIT_WITH_ERROR = 1 - -#OUTPUT_FILE = 'build/assets-rev-b0.bin' -ASSET_ID = "APPASSET" -ASSET_VER = 1 -CHECK_SUM = 0x00 - -HBK0_KEY = 'utils/key/hbk1.bin' -PROV_KEY = 'utils/key/oem_prov_asset.bin' -ENC_KEY = 'utils/key/oem_enc_asset.bin' - -# DO NOT Alter the sequence of the following items in the list as it determines -# the bit position in the final value -OPTIONS = ['ENCRYPTED_ASSETS','TEST_MODE'] - -OPTION_FLAGS = 0x00 - -def read_asset_config(cfgFile): - f = open(cfgFile, 'r') - try: - cfg = json.load(f) - - except JSONDecodeError as e: - print("ERROR in JSON file.") - print(str(e)) - sys.exit(EXIT_WITH_ERROR) - - except ValueError as v: - print("ERROR in JSON file:") - print(str(v)) - sys.exit(EXIT_WITH_ERROR) - - except: - print("ERROR: Unknown error loading JSON file") - sys.exit(EXIT_WITH_ERROR) - - f.close() - return cfg - -def create_package(outFile): - print('Creating Assets Package...') - with open(outFile, 'wb') as f: - f.write(ASSET_ID.encode('utf8')) - f.write(struct.pack("H", ASSET_VER)) - f.write(struct.pack("H", CHECK_SUM)) - f.write(struct.pack("I", OPTION_FLAGS)) - with open(HBK0_KEY, 'rb') as i: - f.write(i.read()) - with open(PROV_KEY, 'rb') as i: - f.write(i.read()) - f.write(('\0' * 48).encode('utf8')) - with open(ENC_KEY, 'rb') as i: - f.write(i.read()) - f.write(('\0' * 48).encode('utf8')) - -def decodeFlags(assetFlags): - print('') - print('Provisioning Options:') - for option in OPTIONS: - fill = 20 - len(option) - label = option + (fill * ' ') - if assetFlags & (1< ") - if confirmResponse == confirmRequest: - print("The APP RoT WILL BE DELETED!!!. Enter Yes to continue (or any key to abort)") - continueConfirmation = input('> ') - if continueConfirmation.upper() == 'YES': - cleanRoT() - print('\nThe RoT was deleted!') - return - - print('Operation aborted!') - sys.exit(EXIT_WITH_ERROR) - -def main(): - if sys.version_info.major == 2: - print("You need Python 3 for this application!") - return 0 - - parser = argparse.ArgumentParser(description='Generate Application Root of Trust', - epilog="\N{COPYRIGHT SIGN} ALIF Semiconductor, 2021") - parser.add_argument("-v" ,"--version", help="Display Version Number", action="store_true") - parser.add_argument("-c" ,"--clean", help="Clean (delete) the APP RoT", action="store_true") - parser.add_argument("-o" ,"--overwrite", help="Overwrite the existing APP RoT", action="store_true") - - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - if args.clean: - confirm_clean() - sys.exit() - - if os.path.isfile('utils/key/OEMRoT.pem') == True and args.overwrite == False: - print('APP Root of Trust already exist!') - print('If you want to overwrite the existing RoT, please use the --overwrite flag ') - sys.exit() - - # we continue generating a new RoT - # (but first, we delete the current one if it exists) - if os.path.isfile('utils/key/OEMRoT.pem') == True: - confirm_clean() - - if os.path.isfile(PASS_FILENAME) == False: - keysPwd = input("Please enter a new password for the keys to generate:") - f = open(PASS_FILENAME, 'w') - f.write(keysPwd) - f.close() - else: - print("File " + PASS_FILENAME + " with 'keys password' already exist and it will be used. If new password is required, delete this file and run again!") - - print("Generating APP RoT keys (to be used in Key 1 Certificate)") - rsa_keygen.main(['utils/key/OEMRoT.pem', "-p", 'utils/key/oem_keys_pass.pwd', "-k", 'utils/key/OEMRoTPublic.pem', "-l", 'build/logs/key_gen_log.log']) - - print("Generating APP SB Key keys (to be used in Key 2 Certificate)") - rsa_keygen.main(['utils/key/OEMSBKey.pem', "-p", 'utils/key/oem_keys_pass.pwd', "-k", 'utils/key/OEMSBKeyPublic.pem', "-l", 'build/logs/key_gen_log.log']) - - print("Generating APP SB Content keys (to be used in Content Certificates)") - rsa_keygen.main(['utils/key/OEMSBContent.pem', "-p", 'utils/key/oem_keys_pass.pwd', "-k", 'utils/key/OEMSBContentPublic.pem', "-l", 'build/logs/key_gen_log.log']) - - print("Generating APP Hbk1") - hbk_gen_util.main(["-f", 'SHA256_TRUNC', "-k", 'utils/key/OEMRoTPublic.pem', "-o", 'utils/key/hbk1_hash.txt', "-l", 'build/logs/gen_hbk_log.log']) - - # create Hbk1 in binary format (required by dmpu_asset_util.py) - convertToBinary('utils/key/hbk1_hash.txt', 'utils/key/hbk1.bin') - - # generate Encryption key (Kce) - # - text format: required by OEM SB Content Certificate generator to encrypt images - # - binary format: required by dmpu_asset_util.py to create Asset Package (for key injection) - print("Generating OEM kce") - kce = gen_AES() - createTextFormat('utils/key/kce.txt', kce) - createBinaryFile('utils/key/oem_enc_asset.bin', kce) - - # generate Provision key (Kcp) - # - binary format: required by dmpu_asset_util.py to create Asset Package (for key injection) - print("Generating OEM kcp") - kcp = gen_AES() - createBinaryFile('utils/key/oem_prov_asset.bin', kcp) - - print("Generating APP SB Key 1 Certificate") - cert_key_util.main(['utils/cfg/OEMSBKey1.cfg', 'build/logs/OEMSBKey1.log']) - - print("Generating APP SB Key 2 Certificate") - cert_key_util.main(['utils/cfg/OEMSBKey2.cfg', 'build/logs/OEMSBKey2.log']) - - - print("\nCheck logs in build/logs/ directory") - print("Done!") - return 0 - -if __name__ == "__main__": - main() - - - diff --git a/tools/alif/app-gen-toc.py b/tools/alif/app-gen-toc.py deleted file mode 100755 index 7642963d1..000000000 --- a/tools/alif/app-gen-toc.py +++ /dev/null @@ -1,682 +0,0 @@ -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string - -""" - __author__ = "" - __copyright__ =Copyright 2021, ALIF Semiconductor" - __version__ = "0.06.000" - - - -where: - OBJECT_TYPE: FIREWALL or IMAGE - CPU_ID: A32_0, A32_1, A32_2, A32_3, M55_HP, M55_HE - FLAGS: COMPRESS, ENCRYPT, LOAD and BOOT - -""" - -import os -import sys -import struct -import argparse -from pathlib import Path -import zlib -import json -from utils import toc_common -from utils.config import * -from utils.toc_common import * -from json.decoder import JSONDecodeError -from utils.device_config import gen_device_config -from utils.sign_image_util import sign_image -from printInfo import * -from utils.gen_fw_cfg import * - -# Define Version constant for each separate tool -# 0.30.000 includes image signing -# 0.31.000 strip console output to a minimum (includes printInfo) -# 0.32.000 split image signature -# 0.33.000 add mramAddress as sufix in content certificate name (to differentiate when using the same image name...) -TOOL_VERSION = "0.33.000" - -EXIT_WITH_ERROR = 1 - - -# memory defines for Alif/OEM MRAM Addresses and Sizes -#ALIF_BASE_ADDRESS = utils.mem_defs.ALIF_BASE_ADDRESS -#OEM_BASE_ADDRESS = utils.mem_defs.OEM_BASE_ADDRESS -#MRAM_BASE_ADDRESS = utils.mem_defs.MRAM_BASE_ADDRESS - -# OEM TOC sizes -TOC_ENTRY_SIZE = 32 -TOC_HEADER_SIZE = 32 -TOC_TAIL_SIZE = 16 -TOC_HEADER_VERSION = 1 - -# Supported CPU_ID for IMAGE object type -SUPPORTED_CPU_ID = ['A32_0', - 'A32_1', - 'A32_2', - 'A32_3', - 'M55_HP', - 'M55_HE'] - -# Supported flags for IMAGE object type -SUPPORTED_FLAGS = ['COMPRESS', - 'LOAD', - 'BOOT', - 'ENCRYPT', - 'DEFERRED'] - - -# Supported Attributes for JSON configuration file -SUPPORTED_ATTRIBUTES = [ - 'disabled', - 'binary', - 'signed', - 'loadAddress', - 'version', - 'mramAddress', - 'cpu_id', - 'flags', - 'extensions' -] - -# Swtchers: there are different options for ICV and OEM... -# switcher for getObjectType() -image_switcher = { - 'DEVICE' : 3 - } - -# switcher for getCPUID() -cpuid_switcher = { - 'A32_0' : 0, - 'A32_1' : 1, - 'M55_HP' : 2, - 'M55_HE' : 3 - } - - -certPath = Path("cert/") -imagePath = Path("build/images") - -# sizes of Certificates -CERT_CHAIN_SIZE = utils.toc_common.CERT_CHAIN_SIZE -CONT_CERT_SIZE = utils.toc_common.CONT_CERT_SIZE -CERT_CHAIN_SIZE = utils.toc_common.CERT_CHAIN_SIZE - -# Global Variables -numImages = 0 -oemManagedAreaStartAddress = 0 -oemManagedAreaSize = 0 -otocStartAddress = 0 -unmanaged = [] - - -def createOemTocPackage(fwsections, outputFile): - global oemManagedAreaStartAddress - global oemManagedAreaSize - global otocStartAddress - global unmanaged - - print('Creating APP TOC Package...') - # Start by loading the Key1/Key2 Certificates for later on - printInfo("Loading Key1 Cert...") - key1Cert = getBlob(certPath / 'OEMSBKey1.crt') - printInfo("Loading Key2 Cert...") - key2Cert = getBlob(certPath / 'OEMSBKey2.crt') - - # create the output file - outf = open(outputFile, 'wb') - - # create a memory layout map for debugging - mapf = open('build/app-package-map.txt', 'w') - mapf.write('* * * User managed MRAM locations* * * \n') - - debugScript = '' - for img in unmanaged: - printInfo('Unmanaged Images:') - imgFile = img[4] - if img[5] == 'compressed': - imgFile += '.lzf' - - if img[6] == 'encrypted': - imgFile = img[4][:-4] + '_enc.bin' - - printInfo(img) - mapf.write(f'{img[1]}\t{hex(img[2])}\t{img[2]}\t{img[3]}\t{imgFile}\n') - debugScript += '../build/images/' + imgFile + ' ' + img[1] + ' ' - sign_image('build/images/' + imgFile, int(img[1], 16), 0xFFFFFFFF, "OEM") - - - # create a pointer to keep track addresses of components (object_address in OTOC) - mPointer = oemManagedAreaStartAddress - #print(f'mPointer start: {mPointer - oemManagedAreaStartAddress}') - mapf.write('\n* * * APP Package Start Address* * * \n') - mapf.write('\n - Certificates for User managed images\n') - printInfo('Unmanaged images certificates') - # start adding all Certificate Chains for Unmanaged images - for sec in fwsections: - # filter out disabled images - if sec['disabled'] == True: - continue - - # filter out Managed components (they will be included after) - if sec['location'] == 'managed': - continue - - # update MRAM position for object_address in OTOC - sec['object_address'] = hex(mPointer) - - if sec['signed'] != False: - #print('...including Key1/key2 certs') - outf.write(key1Cert) - outf.write(key2Cert) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\t{(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\tKey1/Key2 Certificates \n") - mapf.write(f"{hex(mPointer)}\t{hex(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\t{(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\tKey1/Key2 Certificates \n") - mPointer += (CERT_CHAIN_SIZE - CONT_CERT_SIZE) - #print(f'mPointer KC un: {mPointer - oemManagedAreaStartAddress}') - # copy the Content Certificate (for signed or unsigned images) - addContentCertificate(outf, sec['binary'] + "_" + str(sec['mramAddress'])) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(CONT_CERT_SIZE)}\t{(CONT_CERT_SIZE)}\tSB" + sec['binary'] + ".crt\n") - mapf.write(f"{hex(mPointer)}\t{hex(CONT_CERT_SIZE)}\t{(CONT_CERT_SIZE)}\tSB" + sec['binary'] + ".crt\n") - mPointer += CONT_CERT_SIZE - #print(f'mPointer CC un: {mPointer - oemManagedAreaStartAddress}') - - # add Managed components with their respective Certificates in front of them - printInfo('Managed components') - mapf.write('\n - Certificates & images for Tool managed images\n') - for sec in fwsections: - # filter out disabled images - if sec['disabled'] == True: - continue - - # filter out Unmanaged components (they were already included above) - if sec['location'] == 'unmanaged': - continue - - # update MRAM position for object_address in OTOC - sec['object_address'] = hex(mPointer) - - # for each managed component, copy certificates and image - if sec['signed'] != False: - #print('...including Key1/key2 certs') - outf.write(key1Cert) - outf.write(key2Cert) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\t{(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\tKey1/Key2 Certificates \n") - mapf.write(f"{hex(mPointer)}\t{hex(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\t{(CERT_CHAIN_SIZE - CONT_CERT_SIZE)}\tKey1/Key2 Certificates \n") - mPointer += (CERT_CHAIN_SIZE - CONT_CERT_SIZE) - #print(f'mPointer - KCs: {mPointer - oemManagedAreaStartAddress}') - # copy the Content Certificate (for signed or unsigned images) - addContentCertificate(outf, sec['binary'] + "_" + str(sec['mramAddress'])) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(CONT_CERT_SIZE)}\t{(CONT_CERT_SIZE)}\tSB" + sec['binary'] + ".crt\n") - mapf.write(f"{hex(mPointer)}\t{hex(CONT_CERT_SIZE)}\t{(CONT_CERT_SIZE)}\tSB" + sec['binary'] + ".crt\n") - mPointer += CONT_CERT_SIZE - #print(f'mPointer - CC: {mPointer - oemManagedAreaStartAddress}') - # copy image (check for encryption or compression - both are not supported!) - binFile = sec['binary'] - if 'ENCRYPT' in sec['flags']: - binFile = binFile[:-4] + "_enc.bin" - - if 'COMPRESS' in sec['flags']: - binFile += '.lzf' - - #print("Copying: " + binFile) - outf.write(getBlob(imagePath / binFile)) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(sec['size'])}\t{sec['size']}\t" + binFile + "\n") - mapf.write(f"{hex(mPointer)}\t{hex(sec['size'])}\t{sec['size']}\t" + binFile + "\n") - mPointer += sec['size'] - #print(f'mPointer - size: {mPointer - oemManagedAreaStartAddress}') - # padding with 0s - if sec['padlen'] > 0: - outf.write(('\0' * sec['padlen']).encode('utf8')) - #mapf.write(f"{hostAddress(mPointer)}\t{hex(sec['padlen'])}\t{sec['padlen']}\tPadding\n") - mapf.write(f"{hex(mPointer)}\t{hex(sec['padlen'])}\t{sec['padlen']}\tPadding\n") - mPointer += sec['padlen'] - #print(f'mPointer - pad: {mPointer - oemManagedAreaStartAddress}') - - - # finally, create the OEM TOC (verify the current pointer matches the OEM TOC Address we previously calculated) - if mPointer != otocStartAddress: - print("[ERROR] ATOC STARTS IS DIFFERENT THAN THE CALCULATED ONE!!!") - #print(f"ATOC Starts at {hostAddress(mPointer)}") - print(f"ATOC Starts at {hex(mPointer)}") - #print(f"ATOC calculated at {hostAddress(otocStartAddress)}") - print(f"ATOC calculated at {hex(otocStartAddress)}") - sys.exit(EXIT_WITH_ERROR) - - #print(f"Start of ATOC: {hostAddress(otocStartAddress)}") - printInfo(f"Start of ATOC: {hex(otocStartAddress)}") - mapf.write('\n - APP TOC (Table of Content)\n') - # create the OEM TOC Header - print("Adding ATOC...") - # TOC token (identifier) - outf.write("OEMTOC01".encode('utf8')) - # TOC Header size (in bytes) - outf.write(struct.pack("H", TOC_HEADER_SIZE)) - # Number of TOC entries and size - outf.write(struct.pack("H", numImages)) - outf.write(struct.pack("H", TOC_ENTRY_SIZE)) - # TOC version - outf.write(struct.pack("H", TOC_HEADER_VERSION)) - # pad 16 bytes with 00s - outf.write(('\0' * 16).encode('utf8')) - - #mapf.write(f"{hostAddress(mPointer)}\t{hex(TOC_HEADER_SIZE)}\t{TOC_HEADER_SIZE}\tAPP TOC Header\n") - mapf.write(f"{hex(mPointer)}\t{hex(TOC_HEADER_SIZE)}\t{TOC_HEADER_SIZE}\tAPP TOC Header\n") - mPointer += TOC_HEADER_SIZE - #print(f'mPointer otoc hdr: {mPointer - oemManagedAreaStartAddress}') - # create OEM TOC (numImages entries) - for sec in fwsections: - # filter out disabled images - if sec['disabled'] == True: - continue - - #print(sec) - # Object_address - outf.write(struct.pack("I", int(sec['object_address'], 16))) - # object_length - outf.write(struct.pack("I", sec['size'])) # do not need to declare the pad as seram doesn't need it - # object_type - outf.write(struct.pack("I", getObjectType(sec['identifier'].rstrip('\0'), image_switcher))) - # flags - outf.write(struct.pack("I", getObjectFlags(sec['flags']) + getCPUID(sec['cpu_id'], cpuid_switcher) )) - - # version - outf.write(struct.pack("I", getObjectVersion(sec['version']))) - # image_identifier - outf.write(sec['identifier'][:8].encode('utf8')) - # extension_header - outf.write(struct.pack("I", 0)) - - #mapf.write(f"{hostAddress(mPointer)}\t{hex(TOC_ENTRY_SIZE)}\t{TOC_ENTRY_SIZE}\tAPP TOC entry for {sec['identifier']} obj_address {hostAddress(int(sec['object_address'],16))}\n") - mapf.write(f"{hex(mPointer)}\t{hex(TOC_ENTRY_SIZE)}\t{TOC_ENTRY_SIZE}\tAPP TOC entry for {sec['identifier']} obj_address {sec['object_address']}\n") - mPointer += TOC_ENTRY_SIZE - #print(f'mPointer otoc entry: {mPointer - oemManagedAreaStartAddress}') - - # write current data to file, so we can read back and calculate CRC32 - outf.flush() - - # create Checksum (crc32) - f = open(outputFile, "rb") - # locate start of OTOC - s = otocStartAddress - oemManagedAreaStartAddress - f.seek(s) - #f.seek((TOC_ENTRY_SIZE * numImages) + TOC_HEADER_SIZE, 2) - otoc = f.read() - f.close() - crc32 = zlib.crc32(otoc) - printInfo('Calculated CRC32: ' + hex(crc32)) - - # now, in the OEM, we are adding other fields in the TOC Tail - # OTOC crc32 + OTOC_startAddress + OEM_packageStart + OEM_packageSize - outf.write(struct.pack("I", crc32)) - outf.write(struct.pack("I", otocStartAddress)) - outf.write(struct.pack("I", oemManagedAreaStartAddress)) - outf.write(struct.pack("I", oemManagedAreaSize)) - - #mapf.write(f"{hostAddress(mPointer)}\t{hex(TOC_TAIL_SIZE)}\t{TOC_TAIL_SIZE}\tAPP TOC Tail\n") - mapf.write(f"{hex(mPointer)}\t{hex(TOC_TAIL_SIZE)}\t{TOC_TAIL_SIZE}\tAPP TOC Tail\n") - mPointer += TOC_TAIL_SIZE - printInfo(f'mPointer atoc tail - end: {mPointer - oemManagedAreaStartAddress}') - - # check the OEM Package size is the same we calculated before - if (mPointer - oemManagedAreaStartAddress) != oemManagedAreaSize: - print('[ERROR] Something is wrong! Final APP Package size is different than the calculated one...') - print(f'Calculated: {oemManagedAreaSize} bytes') - print(f'Real size: {mPointer - oemManagedAreaStartAddress} bytes') - sys.exit(EXIT_WITH_ERROR) - - mapf.write("\nAPP Package Summary:\n") - mapf.write(f" - APP Package total size: {mPointer - oemManagedAreaStartAddress} bytes\n") - #mapf.write(f" - APP Package Start Address: {hostAddress(oemManagedAreaStartAddress)}\n") - mapf.write(f" - APP Package Start Address: {hex(oemManagedAreaStartAddress)}\n") - mapf.write(f" - APP TOC size: {(TOC_ENTRY_SIZE * numImages) + TOC_HEADER_SIZE + TOC_TAIL_SIZE} bytes\n") - #mapf.write(f" - APP TOC Start Address: {hostAddress(otocStartAddress)}\n") - mapf.write(f" - APP TOC Start Address: {hex(otocStartAddress)}\n") - mapf.write(f" - APP CRC32: {hex(crc32)}\n") - - mapf.write('\n* * * END of APP Package * * * \n') - - debugScript += '../' + outputFile + ' ' + hex(oemManagedAreaStartAddress) - - # close the file - outf.close() - - mapf.close() - - # generate debug script file - dsFile = 'bin/application_package.ds' # Was bin/oempackage.ds - try: - os.makedirs(os.path.dirname(dsFile), exist_ok=True) - ds = open(dsFile, 'w') - #f.write('reset system\n') - ds.write('set semihosting args ' + debugScript + '\n' ) - ds.write('continue\n') - ds.write('wait\n') - ds.write('reset reset.hardware\n') - ds.close() - - except: - print('[ERROR] generating debug script file!') - sys.exit(EXIT_WITH_ERROR) - - printInfo('Write the APP TOC package to ' + hex(oemManagedAreaStartAddress)) - -# take second element for sort -def orderByAddress(elem): - return elem[1] - -def calcOemManagedArea(fwsections): - global numImages - global oemManagedAreaStartAddress - global oemManagedAreaSize - global otocStartAddress - global unmanaged - - # verify images exist and calculate size and padding - numSignedImages = 0 - numManagedImages = 0 - sizeManagedImages = 0 - - print('Calculating APP area...') - for sec in fwsections: - # check if entry is disabled - if sec['disabled'] == True: - printInfo('Entry disabled:' + sec['identifier']) - continue - - numImages += 1 - - # determine the size of file and if padding is needed - fsize, padlen = getImageSize('build/images/' + sec['binary']) - # update the size and padding information - sec['size'] = fsize - sec['padlen'] = padlen - - # check if image requires compression - # if so, create the file using lzf utility - compressLabel = 'uncompressed' - if 'COMPRESS' in sec['flags']: - compressLabel = 'compressed' - compressImage('build/images/' + sec['binary']) - # we should have the (new) compressed file, so we will check if this is the case... - - # determine the size of (compressed) file and if padding is needed - fsize, padlen = getImageSize('build/images/' + sec['binary'] + '.lzf') - # add compressed file size and update padding information - # (the compressed image will be included in the package so pad should be calculated for - # compressed file size) - sec['uncompressedSize'] = sec['size'] # uncompressed Size will be used by the certificate creation process - sec['size'] = fsize - sec['padlen'] = padlen - - # check encryption - encryptionLabel = 'unencrypted' - if 'ENCRYPT' in sec['flags']: - encryptionLabel = 'encrypted' - - - # if image is signed - if sec['signed'] != False: - numSignedImages += 1 - - # if image is Managed (not Fixed Address => mramAddress different than 0 or none) - if sec['mramAddress'] == 'none' or sec['mramAddress'] == 0: - numManagedImages += 1 - sizeManagedImages += ( sec['size'] + sec['padlen'] ) - sec['location'] = 'managed' - else: - sec['location'] = 'unmanaged' - if sec['signed'] == False: - signature = 'unsigned' - else: - signature = 'signed' - - printInfo(f"Unmanaged: {sec['identifier']}") - tmp = (sec['identifier'], sec['mramAddress'], fsize + padlen, signature, sec['binary'], compressLabel, encryptionLabel) # we normally don't pad unmanaged images, but just in case this change in the future... - unmanaged.append(tmp) - - printInfo(f"Signed Images: {numSignedImages}") - printInfo(f"Managed Images: {numManagedImages}") - printInfo(f"Managed Images total size: {sizeManagedImages:,} bytes") - - # First Check: Total Managed Images should not be greater than APP MRAM SIZE - if sizeManagedImages > APP_MRAM_SIZE: - print('\n[ERROR] Images DO NOT FIT in available space. Please review images sizes \nconsidering this information:') - print(f'Total APP MRAM size: {APP_MRAM_SIZE:,} bytes') - sys.exit(EXIT_WITH_ERROR) - - # calculate size of OEM TOC - otocSize = (TOC_ENTRY_SIZE * numImages) + TOC_HEADER_SIZE + TOC_TAIL_SIZE - printInfo(f"APP TOC Size: {hex(otocSize)}") - # calculate OEM TOC Starting Address in MRAM - otocStartAddress = ALIF_BASE_ADDRESS - otocSize - printInfo(f"APP TOC Address: {hex(otocStartAddress)}") - - # calculate size of OEM Managed Area (total of OEM Package - don't include images with fixed addresses) - # OEM Managed Area size = size(OTOC) + size(Managed Images with Padding) + (numSignedImages * CERT_CHAIN_SIZE) + (numUnsignedImages * CONT_CERT_SIZE) - oemManagedAreaSize = otocSize + sizeManagedImages + ( numSignedImages * CERT_CHAIN_SIZE) + ( (numImages - numSignedImages) * CONT_CERT_SIZE) - printInfo(f"APP Managed Area size: {oemManagedAreaSize}") - - # calculate OEM Managed Area Starting Addresses - oemManagedAreaStartAddress = ALIF_BASE_ADDRESS - oemManagedAreaSize - printInfo(f"APP Package Start Address: {hex(oemManagedAreaStartAddress)}") - - # now that we know where OEM Managed Area will start (oemManagedAreaStartAddress), - # we should verify that OEM Unmanaged Area is below above address - boundary = 0 - # sort list with key - unmanaged.sort(key=orderByAddress) - printInfo("Unmanaged Images - Ordered by MRAM Address") - for img in unmanaged: - printInfo(img) - - startAddress = int(img[1], 16) - size = img[2] - # check overlap with previous image - if startAddress < boundary: - print('[ERROR] There is an overlap between image ' + img[0] + ' and previous image!') - print('Please correct this to continue.') - sys.exit(EXIT_WITH_ERROR) - - boundary = startAddress + size - #print(hex(boundary)) - - - - # check boundary is below OEM Managed Area Starting Address - if boundary > oemManagedAreaStartAddress: - print('\n[ERROR] Images DO NOT FIT in available space. Please review layout \nconsidering this information:') - print(f'Available space is {otocStartAddress - OEM_BASE_ADDRESS} bytes starting at MRAM address {hex(OEM_BASE_ADDRESS)}') - sys.exit(EXIT_WITH_ERROR) - else: - if boundary == 0: - boundary += MRAM_BASE_ADDRESS - printInfo(f"Final boundary: {hex(boundary)}") - printInfo(f"Available MRAM: {oemManagedAreaStartAddress - boundary} bytes") - - - # now that we know everything fits well, we can proceed to calculate the - # the MRAM addresses for the managed images, to update the 'mramAddress' field - # (we need the MRAM address to generate the Content Certificates before start - # creating the OEM Package binary) - - # we keep a pointer starting at OEM Managed Area address - mPointer = oemManagedAreaStartAddress - # we will start the OEM Managed Area layout with all certificates for Unmanaged Images - # so we need to know How many Unmanaged images are and from those, how many are Signed - # and how many are Unsigned (because we need more space for signed images than for unsigned ones) - - for img in unmanaged: - if img[3] == 'signed': - mPointer += CERT_CHAIN_SIZE - else: - mPointer += CONT_CERT_SIZE - - for sec in fwsections: - # check if entry is disabled - if sec['disabled'] == True: - continue - - # we won't create Content Certificate for Device COnfiguration (at the moment...) - #if sec['identifier'] == 'FIREWALL': - # continue - - # if image is Managed (not Fixed Address => mramAddress different than 0 or none) - if sec['mramAddress'] == 'none' or sec['mramAddress'] == 0: - # for each managed image, we need to calculate the image storage address in MRAM, - # needed to create the Content Certificate for each image - if sec['signed'] == False: - mPointer += CONT_CERT_SIZE - else: - mPointer += CERT_CHAIN_SIZE - - # save the MRAM store address for Managed images - sec['mramAddress'] = hex(mPointer) - #print(sec['identifier'], sec['mramAddress']) - - # move the pointer to the end of the image - mPointer += ( sec['size'] + sec['padlen']) - - -def validateVersAttr(version): - items = version.split('.') - if len(items)>3: - print("[ERROR] Invalid version string. Please use 'xxx.yyy.zzz' format") - sys.exit(EXIT_WITH_ERROR) - - for item in items: - try: - i = int(item) - if i>=0 and i<=255: - continue - print("[ERROR] Invalid value '" + item + "' in version string: " + version) - except: - print("[ERROR] Invalid item '" + item + "' in version string: " + version) - - sys.exit(EXIT_WITH_ERROR) - -def updateDeviceConfig(file): - #print('*** updateDeviceConfig: ', file) - # Update the firewall configuration in the OEM DEVICE config file - update_fw_cfg_oem(file) - - cfg = read_global_config('build/config/' + file) - if 'miscellaneous' in cfg: - for item in cfg['miscellaneous']: - item.pop('sdesc', None) - item.pop('ldesc', None) - item.pop('options', None) - with open('build/config/' + file, "w") as json_file: - json.dump(cfg, json_file, indent=2) - - -def main(): - cwd_path = os.getcwd() - os.chdir(cwd_path) - global MRAM_BASE_ADDRESS - global ALIF_BASE_ADDRESS - global OEM_BASE_ADDRESS - global APP_MRAM_SIZE - - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - """ - Parse user arguments - """ - parser = argparse.ArgumentParser(description='Generate APP TOC Package', - epilog="\N{COPYRIGHT SIGN} ALIF Semiconductor, 2023") - parser.add_argument("-f", "--filename", type=str, - default="build/config/app-cfg.json", - help="input file (check build/config/app-cfg.json as an example") - parser.add_argument("-o", "--output", type=str, - default="build/AppTocPackage.bin", - help="output file (default is build/AppTocPackage.bin") - parser.add_argument("-V", "--version", help="Display Version Number", action="store_true") - parser.add_argument("-c" ,"--clean", help="Clean build workspace (restore initial state)", action="store_true") - parser.add_argument("-v" , "--verbose", help="verbosity mode", action="store_true") - - args = parser.parse_args() - - if args.version: - print(TOOL_VERSION) - sys.exit() - - if args.clean: - cleanBuild(['build/AppTocPackage.bin', 'build/App-package-map.txt', 'build/images/*_enc.bin', 'build/images/*.lzf', 'cert/SB*.crt']) - sys.exit() - - # set verbose option - verboseModeSet(args.verbose) - - # memory defines for Alif/OEM MRAM Addresses and Sizes - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - ALIF_BASE_ADDRESS = utils.config.ALIF_BASE_ADDRESS - MRAM_BASE_ADDRESS = utils.config.MRAM_BASE_ADDRESS - OEM_BASE_ADDRESS = utils.config.APP_BASE_ADDRESS - APP_MRAM_SIZE = utils.config.APP_MRAM_SIZE - - print('Generating APP Package with:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - - print('- System MRAM Base Address: ' + hex(ALIF_BASE_ADDRESS)) - print('- APP MRAM Base Address: ' + hex(OEM_BASE_ADDRESS)) - print('- APP MRAM Size: ' + str(APP_MRAM_SIZE)) - print('- Configuration file: ' + args.filename) - print('- Output file: ' + args.output) - print('') - fwsections = read_json_file(args.filename, SUPPORTED_ATTRIBUTES, SUPPORTED_FLAGS, SUPPORTED_CPU_ID) - - validateOptions(fwsections) - - for sec in fwsections: - # check if entry is disabled - if sec['disabled'] is True: - print('Entry disabled:' + sec['identifier']) - continue - - # check version string (format 'xx.yy.zz' where each item should be between 0 and 255) - validateVersAttr(sec['version']) - - # update the size and padding information - if sec['identifier'].strip('\0') != 'DEVICE': - continue - - print('Generating Device Configuration for: ' + sec['binary']) - updateDeviceConfig(sec['binary']) - gen_device_config(sec['binary'], False) - sec['binary'] = sec['binary'][:-5] + '.bin' - - # also check unmanaged images (mramAddress != 0) are between boundaries (OEM_BASE_ADDRESS - only in Rev_A as in Rev_B will be 0) - # and images don't overlap... Also, advice is GAPs (big ones) exist - especially if tool can't create the layout... - calcOemManagedArea(fwsections) - - printInfo(f"Images: {numImages}") - - #for sec in fwsections: - # print(sec) - - createContentCerts(fwsections, 'OEM') - - createOemTocPackage(fwsections, args.output) - - # checking the OEM TOC Package size - try: - fsize = os.path.getsize(args.output) - print("APP TOC Package size: " + str(fsize) + " bytes") - except: - print(sys.exc_info()[0]) - print("ERROR: veryfing APP TOC Package size") - sys.exit(EXIT_WITH_ERROR) - - sign_image(args.output, oemManagedAreaStartAddress, 0xFFFFFFFF, "OEM") - - print("Done!") - return 0 - -if __name__ == "__main__": - main() diff --git a/tools/alif/app-provision.py b/tools/alif/app-provision.py deleted file mode 100755 index 610de6684..000000000 --- a/tools/alif/app-provision.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python3 -""" - Test file for the DMPU function in SERAM - - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.1.0" - __status__ = "Dev" -""" -# pylint: disable=unused-argument, invalid-name, bare-except -import os -import sys -import signal -import argparse -sys.path.append("./isp") -import subprocess -from serialport import serialPort -import utils.config -from utils.config import * -from utils.user_validations import validateArgList -from isp_core import * -from isp_util import * - -TOOL_VERSION ="0.1.000" # Define Version constant for each separate tool - -def run_dmpu(isp, fileName): - """ - run_dmpu - """ - if sys.platform == "linux" or sys.platform == "darwin": - fileName = fileName.replace('\\','/') - else: - fileName = fileName.replace('/','\\') - fileName = fileName.replace('..\\','') - - try: - f = open(fileName, 'rb') - except IOError as e: - print('[ERROR] {0}'.format(e)) - sys.exit(1) - - print("[INFO] Running APP Provisioning code...") - with f: - fileSize = file_get_size(f) - offset = 0 - data_size = DATA_CHUNK_SIZE - if fileSize < data_size: # Deal with small ones - data_size = 16 # CHUNK_SIZE - - isp_build_packet(isp, ISP_COMMAND_DMPU) - - while offset < fileSize: - f.seek(offset) - data_line = f.read(data_size) - if isp_download_data(isp, data_line) == False: - break - offset = offset + data_size - - isp_download_done(isp) - - print("[INFO] Done") - - -def main(): - """ - DMPU - """ - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(1) - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'APP Provision tool') - parser.add_argument("-d" , "--discover", action='store_true', \ - default=False, help="(isp) COM port discovery") - parser.add_argument("-b", "--baudrate", help="serial port baud rate", - type=int) - parser.add_argument("-a", "--asset", type=str, - help='APP Provision Assets (default assets: build/assets-app-cfg.bin)', default='build/assets-app-cfg.bin') - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - parser.add_argument("-v" , "--verbose", - help="verbosity mode", action="store_true") - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit(1) - - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - DEVICE_REV_BAUD_RATE = utils.config.DEVICE_REV_BAUD_RATE - - print('APP Provision with parameters:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - print('Assets file: ' + args.asset + '\n') - if args.asset == None: - print('[ERROR] No asset file specified') - sys.exit(1) - - baud_rate = DEVICE_REV_BAUD_RATE[DEVICE_REVISION] - if args.baudrate is not None: - baud_rate = args.baudrate - - isp = serialPort(baud_rate) # Serial dabbling open up port. - - if args.discover: # discover the COM ports if requested - isp.discoverSerialPorts() - - errorCode = isp.openSerial() - if errorCode is False: - print("[ERROR] isp openSerial failed for %s" %isp.getPort()) - sys.exit(1) - print("[INFO] %s open Serial port success" %isp.getPort()) - - isp.setBaudRate(baud_rate) - isp.setVerbose(args.verbose) - - isp_start(isp) # Begin the ISP sequence - - asset_file = args.asset - run_dmpu(isp, asset_file) - - isp_stop(isp) - isp.closeSerial() - -if __name__ == "__main__": - main() diff --git a/tools/alif/app-secure-debug.py b/tools/alif/app-secure-debug.py deleted file mode 100755 index 7b43b7c19..000000000 --- a/tools/alif/app-secure-debug.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 -""" - Perform Secure Debug unlocking - - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.1.0" - __status__ = "Dev" -""" -# pylint: disable=unused-argument, invalid-name, bare-except -import os -import sys -import signal -import argparse -sys.path.append("./isp") -import subprocess -from serialport import serialPort -import utils.config -from utils.config import * -from utils.user_validations import validateArgList -from isp_core import * -from isp_util import * -from utils.sign_image_util import sign_image - - -#import gen_debug_certs - -TOOL_VERSION ="0.1.000" # Define Version constant for each separate tool - - - -def secure_debug_alif(isp, rma): - """ - secure_debug_alif - Secure Debug unlocking using Alif certificates - """ - print("[INFO] Alif secure debug") - - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_SECURE_DEBUG_TOKENS]) - - if rma == False: - # DCU values - all 1's - secure_debug_content = [0xFF] * 16 - else: - # Magic test pattern for RMA - secure_debug_content = [0xAA] * 16 - - # append the challenge bytes received by the device - secure_debug_content.extend(message[6:22]) - - fileName = "build/alif_secure_debug.bin" - f = open(fileName, 'wb') - f.write(bytes(secure_debug_content)) - f.close() - - address = int.from_bytes(message[2:6],"little") - #print("*** address: ", hex(address)) - sign_image(fileName, address, 0xFFFFFFFF, 'OEM') - token = authenticate_image(isp, fileName) - - isp_secure_debug(isp, token, secure_debug_content) - print("\r") - -def main(): - """ - secure debug - """ - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(1) - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'Secure Debug tool') - parser.add_argument("-d" , "--discover", action='store_true', \ - default=False, help="(isp) COM port discovery") - parser.add_argument("-b", "--baudrate", help="serial port baud rate", - type=int) - parser.add_argument("-r", "--rma", default=False, - help="Perform RMA transition (test)", action="store_true") - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - parser.add_argument("-v" , "--verbose", - help="verbosity mode", action="store_true") - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit(1) - - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - DEVICE_REV_BAUD_RATE = utils.config.DEVICE_REV_BAUD_RATE - - print('Secure Debug with parameters:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - - baud_rate = DEVICE_REV_BAUD_RATE[DEVICE_REVISION] - if args.baudrate is not None: - baud_rate = args.baudrate - isp = serialPort(baud_rate) # Serial dabbling open up port. - - if args.discover: # discover the COM ports if requested - isp.discoverSerialPorts() - - errorCode = isp.openSerial() - if errorCode is False: - print("[ERROR] isp openSerial failed for %s" %isp.getPort()) - sys.exit(1) - print("[INFO] %s open Serial port success" %isp.getPort()) - - isp.setBaudRate(baud_rate) - isp.setVerbose(args.verbose) - - isp_start(isp) # Begin the ISP sequence - - secure_debug_alif(isp, args.rma) - - isp_stop(isp) - isp.closeSerial() - -if __name__ == "__main__": - main() diff --git a/tools/alif/app-sign-image.py b/tools/alif/app-sign-image.py deleted file mode 100755 index 4564c1c12..000000000 --- a/tools/alif/app-sign-image.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python3 -""" - Perform Image signing - - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.1.0" - __status__ = "Dev" -""" -# pylint: disable=unused-argument, invalid-name, bare-except -import sys -import argparse -import utils.config -from utils.config import * -from utils.sign_image_util import sign_image - -# 0.3.000 - added support for Azure Storage (Public Keys and Certs) -# 0.4.000 - split image signature functionality -# 0.5.000 - verbosity removed (it only applies to ISP-related tools) -TOOL_VERSION ="0.5.000" # Define Version constant for each separate tool - - - -def main(): - """ - sign an image - """ - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'Image Signature tool') - parser.add_argument("-i", "--images", type=str, - help='Images to sign\ - ("/path/image1.bin 0x30020000")') - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - if args.images == None: - print('No image list provided') - sys.exit(EXIT_WITH_ERROR) - - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - - print('Signing images with parameters:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - - argList = args.images - - if sys.platform == "linux": - argList = argList.replace('\\','/') - else: - argList = argList.replace('/','\\') - - items = argList.split(' ') - - for e in range(1, len(items),2): - addr = items[e] - address = int(addr,base=16) - - fileName = items[e-1] - fileName = fileName.replace('..\\','') - - sign_image(fileName, address, 0xFFFFFFFF, "OEM") - -if __name__ == "__main__": - main() diff --git a/tools/alif/app-write-mram.py b/tools/alif/app-write-mram.py deleted file mode 100755 index 3f17cc4d7..000000000 --- a/tools/alif/app-write-mram.py +++ /dev/null @@ -1,397 +0,0 @@ -#!/usr/bin/env python3 -""" - MRAM (NVM) burning / writing utility - Support - - APPLICATION TOC package writing - - image write at any address in NVM (MRAM) - - image erase of any | range of addresses in NVM (MRAM) - - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.16.0" - __status__ = "Dev" " -""" -import os -import sys -import signal -import argparse -from utils.discover import getValues, getJlinkSN -import utils.config -from utils.config import * -from utils.user_validations import validateArgList -sys.path.append("./isp") -from serialport import serialPort -from serialport import COM_BAUD_RATE_MAXIMUM -#import ispcommands -from isp_core import * -from isp_util import * -import device_probe -import pylink -import datetime -#from array import array - -# Version Feature -# 0.23.000 Added probing to detect device stage/Part#/Rev -# 0.22.000 Added support for MAC OS (J-Link not included yet) -# 0.21.000 get baudrate from DBs -# 0.20.007 Added padding option for binaries not multiple of 16 -# 0.20.006 Added Python error exit code -# 0.20.005 Fixed J-Link+Pylink issue writing binaries -# 0.20.004 REV_A0 dynamic baud rate support -# 0.20.003 remove maintenance mode output unless -v is used) -# 0.20.002 Reset option set as default -# 0.20.001 Added Erase option -# 0.20.000 Added option to skip user managed images -# 0.19.000 Removed JTAG access -# 0.16.000 Addition of baud rate increase for bulk transfer -# 0.15.000 Fixes for Block sizes and left overs -TOOL_VERSION ="0.23.000" # Define Version constant for each separate tool - -EXIT_WITH_ERROR = 1 - -def readImageList(dsFile): - """ - readImageList = read images from arm-ds command file - """ - try: - f = open(dsFile, 'r') - imageList = f.read() - f.close() - # search for image list - start = imageList.find('args') - end = imageList.find('continue') - if start == -1 or end == -1: - print('[ERROR] There is a problem with the Debug Script information') - sys.exit(EXIT_WITH_ERROR) - imageList = imageList[start + 5: end] - except: - print('[ERROR] opening Debug Script file',dsFile) - sys.exit(EXIT_WITH_ERROR) - - return imageList - -def app_mram_erase(isp,args, ALIF_BASE_ADDRESS, ALIF_MRAM_SIZE): - """ - app_mram_erase - - erase the Application are of MRAM - args - argv[0] 'erase' Operation, can be ignored - argv[1]
Starting address - argv{2] Length of bytes to erase - argv[3] Optional pattern to erase with - argc Checked before this is called - """ - argv = args.split() - argc = len(argv) - - # nombres magiques, maybe not needed? - address = 0x80000000 - erase_len = 16 - pattern = 0x00000000 - - if argc >= 3: - address = int(argv[1],base=16) - erase_len = int(argv[2],base=16) - erase_len_fmt = "{:,}".format(erase_len) - - if argc == 4: - pattern = int(argv[3],base=16) - print("[INFO] %s 0x%x %d (%s)" %(argv[0],address,erase_len, - erase_len_fmt)) - - # Validate user request for erasing is in OEM - if (address > ALIF_BASE_ADDRESS or - address + erase_len > ALIF_BASE_ADDRESS): - - if address + erase_len > ALIF_BASE_ADDRESS: - print("[ERROR] illegal address " + hex(address+erase_len) + - " (" + hex(address) + " + " + hex(erase_len) + ")") - else: - print("[ERROR] illegal address " + hex(address)) - return - - isp_mram_erase(isp,address,erase_len,pattern) - -def main(): - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - exit_code = 0 - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'NVM Burner for Application TOC Package') - parser.add_argument("-d" , "--discover", action='store_true', \ - default=False, help="COM port discovery") - parser.add_argument("-b", "--baudrate", help="serial port baud rate", - type=int) - parser.add_argument("-e", "--erase", type=str, - help='ERASE [APP | [] ]') - # creating a mutually exclusive group for -i IMAGES and -S - # (skip option doesn't make sense in a user provided list...) - group = parser.add_mutually_exclusive_group() - group.add_argument("-i", "--images", type=str, - default="Application TOC Package", - help='images list to burn into NVM \ - ("/path/image1.bin 0x80001000 /path/image2.bin 0x80003000")') - parser.add_argument("-a", "--auth_image", action='store_true', - help="authenticate the image by sending its signature file", - default=False) - parser.add_argument("-m", "--method", type=str, - help="loading method [JTAG | ISP]") - group.add_argument("-S", "--skip", - help='write ATOC only - skip user managed images', - action="store_true") - parser.add_argument("-s", "--switch", - help="dynamic baud rate switch toggle, default=on", - action="store_false") - parser.add_argument("-p", "--pad", - help="pad the binary if size is not multiple of 16", action="store_true") - parser.add_argument("-nr", "--no_reset", default=False, - help="do not reset target before operation", action="store_true") - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - parser.add_argument("-v" , "--verbose", - help="verbosity mode", action="store_true") - - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - # memory defines for Alif/OEM MRAM Addresses and Sizes - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - DEVICE_REV_BAUD_RATE = utils.config.DEVICE_REV_BAUD_RATE - MRAM_BASE_ADDRESS = utils.config.MRAM_BASE_ADDRESS - ALIF_BASE_ADDRESS = utils.config.ALIF_BASE_ADDRESS - OEM_BASE_ADDRESS = utils.config.APP_BASE_ADDRESS - MRAM_SIZE = utils.config.MRAM_SIZE - ALIF_MRAM_SIZE = utils.config.ALIF_MRAM_SIZE - OEM_MRAM_SIZE = utils.config.APP_MRAM_SIZE - MRAM_BURN_INTERFACE = utils.config.MRAM_BURN_INTERFACE - JTAG_ADAPTER = utils.config.JTAG_ADAPTER - - os.system('') # Help MS-DOS window with ESC sequences - - print('Writing MRAM with parameters:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - print('- Available MRAM: ' + str(OEM_MRAM_SIZE) + ' bytes') - -# baud_rate = args.baudrate -# if DEVICE_REVISION == 'A0': -# """ -# For REV_A0 we need to change the default used by ALL other devices -# """ -# default_baud_rate = COM_BAUD_RATE_REV_A0 -# if baud_rate == COM_BAUD_RATE_DEFAULT: -# baud_rate = default_baud_rate -# else: -# default_baud_rate = COM_BAUD_RATE_DEFAULT -# baud_rate = args.baudrate - -# if baud_rate != default_baud_rate: -# dynamic_baud_rate_switch = False -# else: -# dynamic_baud_rate_switch = args.switch - - baud_rate = DEVICE_REV_BAUD_RATE[DEVICE_REVISION] - if args.baudrate is not None: - baud_rate = args.baudrate - - dynamic_baud_rate_switch = args.switch - - argList = '' - action = 'Burning: ' - method = None - - if args.method == None: - method = MRAM_BURN_INTERFACE - elif args.method.upper() == 'ISP': - method = 'isp' - elif args.method.upper() == 'JTAG': - method = 'jtag' - else: - print("[ERROR] Unknown connection method", args.method) - sys.exit(EXIT_WITH_ERROR) - - if args.erase: - action = 'Erasing: ' - argList = 'erase ' - if args.erase.upper() == 'APP': - argList += hex(OEM_BASE_ADDRESS) + ' ' + hex(OEM_MRAM_SIZE) - else: - if args.erase.strip() == '': - print("[ERROR] erase arguments are empty") - sys.exit(EXIT_WITH_ERROR) - argList += args.erase - elif args.images != "Application TOC Package": - argList = args.images - else: - dsFile = 'bin/application_package.ds' - argList = readImageList(dsFile) - - if args.skip: - idx = argList.find('../build/AppTocPackage.bin 0x') - argList = argList[idx: idx + 37] - - # validate all parameters - argList = validateArgList(action, argList.strip(), args.pad) - - if sys.platform == "linux" or sys.platform == "darwin": - argList = argList.replace('../','') - - print("[INFO]", action + argList) - - - if method == 'jtag' and not args.erase: # erase via jtag not yet supported! - jlinkSN = getJlinkSN() - if jlinkSN == -1: - print('J-Link device not found!') - sys.exit(EXIT_WITH_ERROR) - - print('J-Link SN: ' + jlinkSN) - - jlink = pylink.JLink() - jlink.open(serial_no=int(jlinkSN)) - print(jlink.product_name) - if not jlink.opened(): - print('Error opening J-Link') - sys.exit(EXIT_WITH_ERROR) - - if not jlink.connected(): - print('Error connecting J-Link') - sys.exit(EXIT_WITH_ERROR) - - print("about to connect to M0+..") - jlink.connect("CORTEX-M0+", verbose=True) - #jlink.connect('AC302F8A82562_HE', verbose=True) - if not jlink.target_connected(): - print('Error connecting target') - print('Please, power-cycle the board') - sys.exit(EXIT_WITH_ERROR) - - argParams = argList.strip().split(" ") - lenParams = len(argParams) - i = 0 - while i < lenParams: - f = argParams[i][3:] - if sys.platform == "linux": - f = argParams[i][:] - - print('File name: ' + f) - file_size = os.path.getsize(f) - print("File Size is :", file_size, "bytes") - print('MRAM starting address: ' + argParams[i+1]) - addr = globalToLocalAddress(argParams[i+1]) - print("Writing the file to MRAM...") - # read the file - f = open(f,"rb") - #fileData = array("I") - #fileData.fromfile(f, int(file_size/4)) - fileData = list(f.read(file_size)) - f.close() - - # write the data to MRAM - t1 = datetime.datetime.now() - #jlink.memory_write32(int(addr, 16), fileData) - jlink.memory_write8(int(addr, 16), fileData) - t2 = datetime.datetime.now() - print('Done in ' + str(t2-t1)) - i += 2 - - #jlink.reset() # the reset causes an issue and the board will need to power cycle... - - return # end jlink tests - - if method == 'jtag' and args.erase: # erase via jtag not yet supported! - print('[INFO] Erase is only supported via ISP') - - dynamic_string = "Enabled" if dynamic_baud_rate_switch else "Disabled" - print("[INFO] baud rate ", baud_rate) - print("[INFO] dynamic baud rate change ", dynamic_string) - - handler = CtrlCHandler() - isp = serialPort(baud_rate) # Serial dabbling open up port. - - if args.discover: # discover the COM ports if requested - isp.discoverSerialPorts() - - errorCode = isp.openSerial() - if errorCode is False: - print("[ERROR] isp openSerial failed for %s" %isp.getPort()) - sys.exit(EXIT_WITH_ERROR) - - print("[INFO] %s open Serial port success" %isp.getPort()) - - isp.setBaudRate(baud_rate) - isp.setVerbose(args.verbose) - - # be sure device is not in SEROM Recovery Mode - device = device_probe.device_get_attributes(isp) - if device.stage != device_probe.STAGE_SERAM: - print('[ERROR] The device is in RECOVERY MODE! Please use Recovery option in Maintenance Tool to recover the device!') - sys.exit(EXIT_WITH_ERROR) - - print('[INFO] Detected Device:') - partDetected = device.part_number - print('Part# ' + partDetected + ' - Rev: ' + device.revision) - - partDescription = getPartDescription(partDetected) - - if partDescription != DEVICE_PART_NUMBER: - print('[WARN] ************ Part# detected is different than the one configured in tools-config tool!') - - if device.revision != DEVICE_REVISION: - print('[WARN] ************ Part Revision detected is different than the one configured in tools-config tool!') - - - if not args.no_reset: - put_target_in_maintenance_mode(isp, baud_rate, args.verbose) - - if sys.platform == "linux" or sys.platform == "darwin": - argList = argList.replace('\\','/') - else: - argList = argList.replace('/','\\') - - items = argList.split(' ') - - isp_start(isp) # Start ISP Sequence - - if args.erase: - app_mram_erase(isp,argList,ALIF_BASE_ADDRESS, ALIF_MRAM_SIZE) - else: - if dynamic_baud_rate_switch: - isp_set_baud_rate(isp,COM_BAUD_RATE_MAXIMUM) # Jack up Baud rate - isp.setBaudRate(COM_BAUD_RATE_MAXIMUM) # Sets the HOST baud rate - - # issue enquiry command to check if SERAM is in Maintenance Mode - mode = isp_get_maintenance_status(isp) - isp_show_maintenance_mode(isp, mode) - - for e in range(1, len(items),2): - addr = items[e] - address = int(addr,base=16) - fileName = items[e-1] - fileName = fileName.replace('..\\','') - - if burn_mram_isp(isp, handler, fileName, address, - args.verbose, args.auth_image) == False: - - exit_code = EXIT_WITH_ERROR - break - - # Restore the default Baud rate - if dynamic_baud_rate_switch: - isp_set_baud_rate(isp,baud_rate) - isp.setBaudRate(baud_rate) - - isp_stop(isp) # Stop ISP Sequence - isp_reset(isp) - - isp.closeSerial() - sys.exit(exit_code) - -if __name__ == "__main__": - main() diff --git a/tools/alif/build/assets-app-cfg.bin b/tools/alif/build/assets-app-cfg.bin deleted file mode 100755 index e47993728..000000000 Binary files a/tools/alif/build/assets-app-cfg.bin and /dev/null differ diff --git a/tools/alif/build/config/app-cfg-1c.json b/tools/alif/build/config/app-cfg-1c.json deleted file mode 100755 index 318515908..000000000 --- a/tools/alif/build/config/app-cfg-1c.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "DEVICE": { - "disabled": false, - "binary": "app-device-config-1c.json", - "version" : "0.5.00", - "signed": true - }, - "BLINK-HE": { - "disabled": false, - "binary": "m55_blink_he_1c.bin", - "version" : "1.0.0", - "signed": true, - "cpu_id": "M55_HE", - "loadAddress": "0x58000000", - "flags": ["load", "boot"] - } -} \ No newline at end of file diff --git a/tools/alif/build/config/app-cfg.json b/tools/alif/build/config/app-cfg.json deleted file mode 100755 index e89e6c796..000000000 --- a/tools/alif/build/config/app-cfg.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "DEVICE": { - "disabled": false, - "binary": "app-device-config.json", - "version" : "0.5.00", - "signed": true - }, - "BLINK-HE": { - "disabled": false, - "binary": "m55_blink_he.bin", - "version" : "1.0.0", - "signed": true, - "cpu_id": "M55_HE", - "loadAddress": "0x58000000", - "flags": ["load", "boot"] - } -} \ No newline at end of file diff --git a/tools/alif/build/config/app-cpu-stubs.json b/tools/alif/build/config/app-cpu-stubs.json deleted file mode 100755 index a9cc67532..000000000 --- a/tools/alif/build/config/app-cpu-stubs.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "DEVICE": { - "disabled" : false, - "binary": "app-device-config.json", - "version" : "0.5.00", - "signed": true - }, - "A32_APP": { - "disabled": false, - "binary": "a32_stub_0.bin", - "version" : "1.0.0", - "signed": true, - "loadAddress": "0x02000000", - "cpu_id": "A32_0", - "flags": ["load","boot"] - }, - "HP_APP": { - "disabled": false, - "binary": "m55_stub_hp.bin", - "version" : "1.0.0", - "signed": true, - "loadAddress": "0x50000000", - "cpu_id": "M55_HP", - "flags": ["load","boot"] - }, - "HE_APP": { - "disabled": false, - "binary": "m55_stub_he.bin", - "version" : "1.0.0", - "signed": true, - "loadAddress": "0x58000000", - "cpu_id": "M55_HE", - "flags": ["load", "boot"] - } -} \ No newline at end of file diff --git a/tools/alif/build/config/app-device-config-1c.json b/tools/alif/build/config/app-device-config-1c.json deleted file mode 100755 index cada4dcea..000000000 --- a/tools/alif/build/config/app-device-config-1c.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "metadata": { - "device": "AB1C1F4M51820PH", - "project": "", - "external_clock_sources": [ - { - "id": "OSC_HFXO", - "enabled": true, - "frequency": 38400000 - }, - { - "id": "OSC_LFXO", - "enabled": false, - "frequency": 32768 - } - ] - }, - "firewall": { - "firewall_components": [] - }, - "pinmux": [], - "clocks": {}, - "miscellaneous": [ - { - "id": "LFXO_CAP_CTRL", - "value": 8 - }, - { - "id": "LFXO_GM_CTRL", - "value": 15 - }, - { - "id": "HFXO_CAP_CTRL", - "value": 2 - }, - { - "id": "HFXO_PFET_GM_CTRL", - "value": 16 - }, - { - "id": "HFXO_NFET_GM_CTRL", - "value": 16 - }, - { - "id": "SE_BOOT_INFO", - "value": 1 - } - ] -} \ No newline at end of file diff --git a/tools/alif/build/config/app-device-config.json b/tools/alif/build/config/app-device-config.json deleted file mode 100755 index fb76eebe1..000000000 --- a/tools/alif/build/config/app-device-config.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "metadata": { - "device": "AE722F80F55D5AS", - "project": "", - "external_clock_sources": [ - { - "id": "OSC_HFXO", - "enabled": true, - "frequency": 38400000 - }, - { - "id": "OSC_LFXO", - "enabled": false, - "frequency": 32768 - } - ] - }, - "firewall": { - "firewall_components": [ - { - "component_id": 4, - "configured_regions": [ - { - "region_index": 1, - "start_address": "0x08000000", - "end_address": "0xFFFFFFFF", - "size": "0x1B", - "addr_trans_en": false, - "mpe_list": [ - { - "mpe_id": 0, - "any_master": true, - "master_id": 0, - "permissions": "0xfff" - } - ], - "mul_n_po2": false, - "ma_trans_en": false, - "translation_flags": "0x0" - } - ] - }, - { - "component_id": 5, - "configured_regions": [ - { - "region_index": 1, - "start_address": "0x02000000", - "end_address": "0xFFFFFFFF", - "size": "0x19", - "addr_trans_en": false, - "mpe_list": [ - { - "mpe_id": 0, - "any_master": true, - "master_id": 0, - "permissions": "0xfff" - } - ], - "mul_n_po2": false, - "ma_trans_en": false, - "translation_flags": "0x0" - } - ] - }, - { - "component_id": 11, - "configured_regions": [ - { - "region_index": 1, - "start_address": "0x40000000", - "end_address": "0xFFFFFFFF", - "size": "0x1D", - "addr_trans_en": false, - "mpe_list": [ - { - "mpe_id": 0, - "any_master": true, - "master_id": 0, - "permissions": "0xfff" - } - ], - "mul_n_po2": false, - "ma_trans_en": false, - "translation_flags": "0x0" - } - ] - }, - { - "component_id": 12, - "configured_regions": [ - { - "region_index": 1, - "start_address": "0x60000000", - "end_address": "0xFFFFFFFF", - "size": "0x1D", - "addr_trans_en": false, - "mpe_list": [ - { - "mpe_id": 0, - "any_master": true, - "master_id": 0, - "permissions": "0xfff" - } - ], - "mul_n_po2": false, - "ma_trans_en": false, - "translation_flags": "0x0" - } - ] - } - ] - }, - "pinmux": [], - "clocks": {}, - "miscellaneous": [ - { - "id": "LFXO_CAP_CTRL", - "value": 8 - }, - { - "id": "LFXO_GM_CTRL", - "value": 15 - }, - { - "id": "HFXO_CAP_CTRL", - "value": 8 - }, - { - "id": "HFXO_PFET_GM_CTRL", - "value": 16 - }, - { - "id": "HFXO_NFET_GM_CTRL", - "value": 16 - }, - { - "id": "SE_BOOT_INFO", - "value": 1 - } - ] -} \ No newline at end of file diff --git a/tools/alif/build/config/assets-app-cfg.json b/tools/alif/build/config/assets-app-cfg.json deleted file mode 100755 index 4cf16d1e4..000000000 --- a/tools/alif/build/config/assets-app-cfg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "ENCRYPTED_ASSETS" : "OFF", - "TEST_MODE" : "ON" -} \ No newline at end of file diff --git a/tools/alif/build/images/a32_stub_0.bin b/tools/alif/build/images/a32_stub_0.bin deleted file mode 100755 index c6d3a93a3..000000000 Binary files a/tools/alif/build/images/a32_stub_0.bin and /dev/null differ diff --git a/tools/alif/build/images/app-device-config.bin b/tools/alif/build/images/app-device-config.bin deleted file mode 100755 index 10fb7dd18..000000000 Binary files a/tools/alif/build/images/app-device-config.bin and /dev/null differ diff --git a/tools/alif/build/images/fw_temp.bin b/tools/alif/build/images/fw_temp.bin deleted file mode 100755 index fa514d302..000000000 Binary files a/tools/alif/build/images/fw_temp.bin and /dev/null differ diff --git a/tools/alif/build/images/m55_blink_he.bin b/tools/alif/build/images/m55_blink_he.bin deleted file mode 100755 index 4f4970c0d..000000000 Binary files a/tools/alif/build/images/m55_blink_he.bin and /dev/null differ diff --git a/tools/alif/build/images/m55_blink_he_1c.bin b/tools/alif/build/images/m55_blink_he_1c.bin deleted file mode 100755 index d7229877c..000000000 Binary files a/tools/alif/build/images/m55_blink_he_1c.bin and /dev/null differ diff --git a/tools/alif/build/images/m55_blink_hp.bin b/tools/alif/build/images/m55_blink_hp.bin deleted file mode 100755 index 4f4970c0d..000000000 Binary files a/tools/alif/build/images/m55_blink_hp.bin and /dev/null differ diff --git a/tools/alif/build/images/m55_stub_he.bin b/tools/alif/build/images/m55_stub_he.bin deleted file mode 100755 index 7ef0b3811..000000000 Binary files a/tools/alif/build/images/m55_stub_he.bin and /dev/null differ diff --git a/tools/alif/build/images/m55_stub_hp.bin b/tools/alif/build/images/m55_stub_hp.bin deleted file mode 100755 index 7ef0b3811..000000000 Binary files a/tools/alif/build/images/m55_stub_hp.bin and /dev/null differ diff --git a/tools/alif/cert/OEMSBKey1.crt b/tools/alif/cert/OEMSBKey1.crt deleted file mode 100755 index 16a1a6ff2..000000000 Binary files a/tools/alif/cert/OEMSBKey1.crt and /dev/null differ diff --git a/tools/alif/cert/OEMSBKey2.crt b/tools/alif/cert/OEMSBKey2.crt deleted file mode 100755 index 7ef0b885a..000000000 Binary files a/tools/alif/cert/OEMSBKey2.crt and /dev/null differ diff --git a/tools/alif/cert/SBapp-device-config.bin_0x9057c950.crt b/tools/alif/cert/SBapp-device-config.bin_0x9057c950.crt deleted file mode 100755 index e1da41f16..000000000 Binary files a/tools/alif/cert/SBapp-device-config.bin_0x9057c950.crt and /dev/null differ diff --git a/tools/alif/cert/SBm55_blink_he.bin_0x9057d480.crt b/tools/alif/cert/SBm55_blink_he.bin_0x9057d480.crt deleted file mode 100755 index 911c4ca2c..000000000 Binary files a/tools/alif/cert/SBm55_blink_he.bin_0x9057d480.crt and /dev/null differ diff --git a/tools/alif/docs/AUGD0005-Alif-Security-Toolkit-User-Guide-v1.104.0.pdf b/tools/alif/docs/AUGD0005-Alif-Security-Toolkit-User-Guide-v1.104.0.pdf deleted file mode 100755 index 6eb53ab2f..000000000 Binary files a/tools/alif/docs/AUGD0005-Alif-Security-Toolkit-User-Guide-v1.104.0.pdf and /dev/null differ diff --git a/tools/alif/isp/clock_decode.py b/tools/alif/isp/clock_decode.py deleted file mode 100755 index 63f1a62f4..000000000 --- a/tools/alif/isp/clock_decode.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/python3 -""" - @brief Clock Info decode and display - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name, consider-using-f-string -import struct -import ctypes -from isp_print import isp_print_color - -c_uint32 = ctypes.c_uint32 - -PLL_CLK_STATUS_XTAL_STARTED = (1 << 0) -PLL_CLK_STATUS_PLL_LOCKED = (1 << 1) -PLL_CLK_STATUS_SE_CLOCK_PLL = (1 << 2) - -CLOCK_FREQUENCY_800MHZ = 0 -CLOCK_FREQUENCY_400MHZ = 1 -CLOCK_FREQUENCY_300MHZ = 2 -CLOCK_FREQUENCY_200MHZ = 3 -CLOCK_FREQUENCY_160MHZ = 4 -CLOCK_FREQUENCY_120MHZ = 5 -CLOCK_FREQUENCY_80MHZ = 6 -CLOCK_FREQUENCY_60MHZ = 7 -CLOCK_FREQUENCY_100MHZ = 8 -CLOCK_FREQUENCY_50MHZ = 9 -CLOCK_FREQUENCY_20MHZ = 10 -CLOCK_FREQUENCY_10MHZ = 11 -CLOCK_FREQUENCY_76_8_RC_MHZ = 12 -CLOCK_FREQUENCY_38_4_RC_MHZ = 13 -CLOCK_FREQUENCY_76_8_XO_MHZ = 14 -CLOCK_FREQUENCY_38_4_XO_MHZ = 15 -CLOCK_FREQUENCY_DISABLED = 16 - -clk_frequency_lut = { - CLOCK_FREQUENCY_800MHZ : "800Mhz", - CLOCK_FREQUENCY_400MHZ : "400Mhz", - CLOCK_FREQUENCY_300MHZ : "300Mhz", - CLOCK_FREQUENCY_200MHZ : "200Mhz", - CLOCK_FREQUENCY_160MHZ : "160Mhz", - CLOCK_FREQUENCY_120MHZ : "120Mhz", - CLOCK_FREQUENCY_80MHZ : "80Mhz", - CLOCK_FREQUENCY_60MHZ : "60Mhz", - CLOCK_FREQUENCY_100MHZ : "100Mhz", - CLOCK_FREQUENCY_50MHZ : "50Mhz", - CLOCK_FREQUENCY_20MHZ : "20Mhz" , - CLOCK_FREQUENCY_10MHZ : "10Mhz", - CLOCK_FREQUENCY_76_8_RC_MHZ : "76.8Mhz RC", - CLOCK_FREQUENCY_38_4_RC_MHZ : "38.4Mhz RC", - CLOCK_FREQUENCY_76_8_XO_MHZ : "76.8Mhz XO", - CLOCK_FREQUENCY_38_4_XO_MHZ : "38.4Mhz XO", - CLOCK_FREQUENCY_DISABLED : "Disabled" -} - -register_names = [ - "HOSTCPUCLK_CTRL", "HOSTCPUCLK_DIV0", "HOSTCPUCLK_DIV1", "ACLK_CTRL", "ACLK_DIV0", - "OSC_CTRL", "PLL_LOCK_CTRL", "PLL_CLK_SEL", "ESCLK_SEL", "CLK_ENA", - "SYSTOP_CLK_DIV", "MISC_REG1", "XO_REG1", "PD4_CLK_SEL", "PD4_CLK_PLL", - "MISC_CTRL", "DCDC_REG1", "DCDC_REG2", "VBAT_ANA_REG1", "VBAT_ANA_REG2" -] - -class xo_reg1_bits(ctypes.LittleEndianStructure): - _fields_ = [ - ("en_xtal" , c_uint32, 1), - ("faststart" , c_uint32, 1), - ("__reserved__0" , c_uint32, 1), - ("en_bfr_clkpll" , c_uint32, 1), - ("en_bfr_dig_2x" , c_uint32, 1), - ("en_bfr_dig" , c_uint32, 1), - ("boost" , c_uint32, 1), - ("xtal_cap" , c_uint32, 4), - ("gm_pfet" , c_uint32, 5), - ("gm_nfet" , c_uint32, 5), - ("sel_doubler_output_duty_cycle" , c_uint32, 2), - ("sel_doubler_input_duty_cycle" , c_uint32, 5), - ("sel_ibg" , c_uint32, 1), - ("ibres_cont" , c_uint32, 2), - ("__reserved__1" , c_uint32, 1) - ] -class XO_REG1(ctypes.Union): - _fields_ = [("b", xo_reg1_bits), ("w", c_uint32)] - -class vbat_ana_reg1_bits(ctypes.LittleEndianStructure): - _fields_ = [ - ("osc_rc_32k_freq_cont" , c_uint32, 4), - ("ret_ldo_cont_3_0" , c_uint32, 4), - ("ret_ldo_vbat_en" , c_uint32, 1), - ("ret_ldo_vbat_shunt_en" , c_uint32, 1), - ("ret_ldo_vddmain_en" , c_uint32, 1), - ("ret_ldo_vdd_main_shunt_en", c_uint32, 1), - ("xtal32k_en" , c_uint32, 1), - ("xtal32k_kick" , c_uint32, 1), - ("lpcomp_clk32k_en" , c_uint32, 1), - ("xtal32k_gm_cont" , c_uint32, 4), - ("xtal32k_cap_cont" , c_uint32, 6), - ("bor_en" , c_uint32, 1), - ("bor_hyst" , c_uint32, 3), - ("bor_thresh" , c_uint32, 3) - ] -class VBAT_ANA_REG1(ctypes.Union): - _fields_ = [("b", vbat_ana_reg1_bits), ("w", c_uint32)] - -class vbat_ana_reg2_bits(ctypes.LittleEndianStructure): - _fields_ = [ - ("__reserved__" , c_uint32, 1), - ("pmubg_vref_cont" , c_uint32, 4), - ("dig_ldo_18_en" , c_uint32, 1), - ("dig_ldo_cont" , c_uint32, 4), - ("osc_76Mrc_cont_bit0" , c_uint32, 1), - ("osc_76M_div_cont_fast" , c_uint32, 3), - ("osc_76Mrc_cont" , c_uint32, 5), - ("osc_76M_div_cont_slow" , c_uint32, 3), - ("ana_periph_bg_ena" , c_uint32, 1), - ("ana_periph_LDO_en" , c_uint32, 1), - ("comp_lp_en" , c_uint32, 1), - ("comp_lp0_in_p_sel" , c_uint32, 2), - ("comp_lp0_in_m_sel" , c_uint32, 2), - ("comp_lp0_hyst" , c_uint32, 3) - ] - -class VBAT_ANA_REG2(ctypes.Union): - _fields_ = [("b", vbat_ana_reg2_bits), ("w", c_uint32)] - - -def clk_frequency_to_string(clk_frequency): - """ - Convert input to string - - @param clk_frequency: - @return: string based on input - """ - - return clk_frequency_lut.get(clk_frequency) - -def clk_status_to_string(clk_status): - """ - parse the bit fields and return a printable string - @param clk_status: bit encoded values - @return: string based on input - """ - status_string = '' - if clk_status & PLL_CLK_STATUS_XTAL_STARTED: - status_string += " HFXTAL STARTED\n" - else: - status_string += " HFXTAL OFF\n" - if clk_status & PLL_CLK_STATUS_PLL_LOCKED: - status_string += " PLL LOCKED\n" - else: - status_string += " PLL OFF\n" - if clk_status & PLL_CLK_STATUS_SE_CLOCK_PLL: - status_string += " SE CLOCK: PLL\n" - else: - status_string += " SE CLOCK: HFRC\n" - - return status_string - -def display_clock_info(message): - """ - display clock, pll, xtal entries sent back from Target - message -- ISP data to parse - """ - - # word 0 is the status word - (status,) = struct.unpack("> 8 - isp_print_color("blue" ,"CLK freq A32 %s\n" % (clk_frequency_to_string(frequency))) - # M55-HP frequency - frequency = (status & 0x00FF0000) >> 16 - isp_print_color("blue" ,"CLK freq M55-HP %s\n" % (clk_frequency_to_string(frequency))) - # M55-HE frequency - frequency = (status & 0xFF000000) >> 24 - isp_print_color("blue" ,"CLK freq M55-HE %s\n" % (clk_frequency_to_string(frequency))) - - # word 1 is the CM0+ frequency - (cm0_freq,) = struct.unpack("= TOC_IMAGE_CPU_LAST: # valid values [0..8] - continue - if booted > 1: # valid values: 0 or 1 - continue - - boot_string = "YES" if booted else " " - - isp_print_color("blue", - " |%7s |%6s| %10s |\n" % ( - format_cpu(cpu_id), - boot_string.center(6), - format_hex(address) - )) - - isp_print_color("blue", " +--------+------+------------+\n") - print(" ") diff --git a/tools/alif/isp/device_probe.py b/tools/alif/isp/device_probe.py deleted file mode 100755 index d0746d44b..000000000 --- a/tools/alif/isp/device_probe.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python3 -""" - device_probe.py - discovery class for finding out what is on the other end of the SE-UART -""" -import sys -import struct -from isp_core import isp_start -from isp_core import isp_stop -from isp_core import isp_build_packet -from isp_util import close_isp_and_exit -from isp_protocol import ISP_COMMAND_DATA_RESPONSE -from isp_protocol import ISP_COMMAND_ENQUIRY -from isp_protocol import ISP_COMMAND_GET -from isp_protocol import ISP_PACKET_DATA_FIELD -from isp_protocol import ISP_PACKET_COMMAND_FIELD -from isp_protocol import ISP_SOURCE_SEROM -from isp_protocol import ISP_SOURCE_SERAM -from isp_protocol import ISP_GET_REVISION - -# Part# & Rev definitions -PART_UNKNOWN = 0 -REVISIONS = { - '0 0 0 0' : 'UNKNOWN', - '0 161 0 0' : 'A1', - '0 165 0 0' : 'A5', # E1C - '0 176 0 0' : 'B0', - '0 178 0 0' : 'B2', - '0 179 0 0' : 'B3', - '0 180 0 0' : 'B4', - '1 160 0 0' : 'A0', - '1 165 0 0' : 'A5', - '160 2 0 0' : 'EG' # super hack... - } - -# bootloader stages -STAGE_UNKOWN = 0 -STAGE_SEROM = 1 -STAGE_SERAM = 2 -STAGE_TEXT = ['UNKNOWN','SEROM','SERAM'] - -EXPECTED_PACKET_LENGTH = 136 - -class device_get_attributes: - """ device_get_attributes - """ - # attributes from the device - part_number = 'PART_UNKNOWN' - revision = 'UNKNOWN' - stage = STAGE_UNKOWN - env = 'UNKNOWN' # DEV or PROD environment - - def __init__(self, isp): - """ - ctor - """ - self.isp = isp - # retrieve device Part# - - # retrieve device revision - self.revision, self.part_number, self.env = self.__get_device_info(isp) - # probe and set device bootloader stage - self.stage = self.__get_device_stage(isp) - - def __get_device_info(self, isp): - """ - obtain the SoC Device information - """ - isp_start(isp) - rev = 'ERROR' - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_REVISION]) - - if len(message) == 0: - close_isp_and_exit(isp, "[ERROR] Target did not respond") - - if len(message) != EXPECTED_PACKET_LENGTH or message[0] != EXPECTED_PACKET_LENGTH: - close_isp_and_exit(isp, "[ERROR] Malformed packet received from target") - - cmd = message[ISP_PACKET_COMMAND_FIELD] - if cmd == ISP_COMMAND_DATA_RESPONSE: - # silicon revision - lst = message[2:6] - rev1 = ' '.join(map(str,lst)) - (version,) = struct.unpack(" ISP_PACKET_HEADER_LENGTH: - lastbyte = len(packet) - command = packet[ISP_PACKET_COMMAND_FIELD] -# Uncomment for more details -# hexized = [hex(x) for x in packet] -# print(hexized) - - cmdstr = isp_command_lookup.get(command) - if not cmdstr: - cmdstr = ">> COMMAND_UNKNOWN << " - command = ISP_UNKNOWN_COMMAND - if isp.getVerbose() is True: - print(" cmd = %3x" %command, end='') - print(" command=", cmdstr, end='') - if (command == ISP_COMMAND_GET or command == ISP_COMMAND_SET): - sub_command = int.from_bytes(packet[2:6], "little") - sub_command_str = isp_subcommand_lookup.get(sub_command) - if not sub_command_str: - sub_command_str = ">> SUB COMMAND UNKNOWN <<" - print(" sub command= %4x %s" - %(sub_command, sub_command_str),end='') - if sub_command == ISP_GET_PEEK_ADDRESS: - address = int.from_bytes(packet[6:10], "little") - print("address= 0x%8x" %(address)) - if sub_command == ISP_SET_POKE_ADDRESS: - address = int.from_bytes(packet[6:10], "little") - data = int.from_bytes(packet[10:14], "little") - print("address= 0x%x, data= 0x%x" %(address,data)) - print(" chksum =", hex(packet[lastbyte-1]),end='') - -# if command != ISP_COMMAND_DOWNLOAD_DATA: -# print(" packet=", packet,end='') - - if command == ISP_COMMAND_NAK: # NACK, check error code# -# Uncomment for more details -# hexized = [hex(x) for x in packet] -# print(hexized) - errstr = error_lookup.get(packet[ISP_PACKET_DATA_FIELD]) - - if not errstr: - errstr = ">> ERROR UNKNOWN (" + hex(packet[ISP_PACKET_DATA_FIELD]) + ") <<" - if isp.getVerbose() is False: - print("%s" %prompt_str, end='') - print(" length= %3d" %len(packet), end='') - print(" command=", cmdstr, end='') - print(" chksum=", hex(packet[lastbyte-1]),end='') - print(" error=", errstr) - else: - print(" error=", errstr, end='') - - # print the extended error code, if it exist - payload_begin = ISP_PACKET_DATA_FIELD + 1 # skip the NACK error code - payload_end = len(packet) - 1 # skip the checksum - - payload = packet[payload_begin:payload_end] - if len(payload) > 0: - hexized = [hex(x) for x in payload] - print(" extended error=", hexized) - - if command == ISP_COMMAND_DATA_RESPONSE: - payload = packet[ISP_PACKET_DATA_FIELD:len(packet)-1] - if isp.getVerbose() is True: - if packet[ISP_TOC_COMMAND_FIELD] == ISP_TOC_INFO_START_MARKER: - print(" ISP_TOC_INFO_START_MARKER ", end='') - if packet[ISP_TOC_COMMAND_FIELD] == ISP_TOC_INFO_END_MARKER: - print(" ISP_TOC_INFO_STOP_MARKER ", end='') - if packet[ISP_TOC_COMMAND_FIELD] == ISP_DATA_START_MARKER: - print(" ISP_DATA_START_MARKER ", end='') - if packet[ISP_TOC_COMMAND_FIELD] == ISP_DATA_END_MARKER: - print(" ISP_DATA_END_MARKER ", end='') - -# for each_word in range(0,160,4): -# trace_value = payload[each_word:each_word+4] -# value = int.from_bytes(trace_value,byteorder='little') -# print("{:4d} 0x{:08x} ".format(each_word,value)) - - hexed = [hex(x) for x in payload] - print(" response payload=", hexed, end='') - print(hexed) - - if isp.getVerbose() is True: - print(" ") - sys.stdout.flush() - - return command - -def isp_readmessage(isp): - """ - read a message from the serial port - - Length; Command; []; Checksum - """ - - packet_header = isp.readSerial(ISP_PACKET_HEADER_LENGTH) - if len(packet_header) != ISP_PACKET_HEADER_LENGTH: - return [] - - packet_length = packet_header[ISP_PACKET_LENGTH_FIELD] - if packet_length < ISP_PACKET_HEADER_LENGTH + 1: - return [] - -# Uncomment to test NAK packages with payload (also indent the lines after 'else:' so that Python doesn't complain - #if packet_header[ISP_PACKET_COMMAND_FIELD] == ISP_COMMAND_NAK: - # packet_contents = list(bytearray(isp.readSerial(packet_length - 3))) - # packet_contents += [0x1, 0x2, 0x3, 0x4] - # packet_contents += list(bytearray(isp.readSerial(1))) - #else: - # read the rest of the packet (including the checksum) - packet_contents = list(bytearray(isp.readSerial(packet_length - ISP_PACKET_HEADER_LENGTH))) - if packet_contents == []: - return [] - - packet = packet_header + packet_contents -# print("message = ", packet) - - return packet - -def isp_wait(isp): - """ - wait for trigger to proceed - """ - _event = isp.eventFlag.wait(1) # Wait for operation to complete - isp.eventFlag.clear() - -def isp_signal(isp): - """ - tigeger signal to wait - """ - isp.eventFlag.set() # tell TX we are done - - -def isp_build_packet(isp, isp_command, isp_sub_commands = None, delay=0): - """ - build the packet and send, receive and decode response - """ - if isp_sub_commands is None: - isp_sub_commands = [] - - cmd_packet = [0x00, isp_command] - - for sub in isp_sub_commands: - if sub == 'padding': - cmd_packet.append(0x55) - continue - - if isinstance( sub, int ): - cmd_packet = cmd_packet + list(int_to_bytes(sub)) - else: - cmd_packet = cmd_packet + list(sub) - - cmd_packet[0] = len(cmd_packet) + 1 - cmd_packet = isp.checkSum(cmd_packet) # add the checksum packet - - isp.writeSerial(bytearray(cmd_packet)) - isp_decode_packet(isp,"TX--> ", cmd_packet) - if delay>0: - time.sleep(delay) - message = isp_readmessage(isp) - command = isp_decode_packet(isp,"RX<-- ", message) - - while command == ISP_COMMAND_PRINT_DATA: - isp_print_message('blue', message) - - message = isp_readmessage(isp) - command = isp_decode_packet(isp,"RX<-- ", message) - - return message - -def isp_test_target(baud_rate, isp): - """ - isp_test_target - - This command is similar to isp_start() but it does NOT exit - when the target did not respond...Int rather resturns: - 1 - when target responded - -1 - when target did not respond - """ - cmd_packet = [0x03, ISP_COMMAND_START_ISP] # start isp - cmd_packet = isp.checkSum(cmd_packet) # add the checksum packet - - isp.writeSerial(bytearray(cmd_packet)) - isp_decode_packet(isp,"TX--> ", cmd_packet) - - # ISP START always succeeds, so there is no need to read the Ack like for the other commands. - # Two things to look for are - - # 1. ISP_COMMAND_ACK byte - to verify that the target responded - # 2. Any leftover data, e.g., Flicker animations - it needs to be read/flushed - got_ack = False - while True: - data = isp.readSerial(1) - if len(data) == 0: - break - if data[0] == ISP_COMMAND_ACK: - got_ack = True - if not got_ack: - sys.stdout.flush() - return -1 - - if isp.getVerbose() is True: - print("RX<-- command= COMMAND_ACK") - - if got_ack == True: - return 1 - -def isp_start(isp): - """ - isp_start - - ISP_COMMAND_START puts the SERAM isp_handler into an ISP mode. Flicker - will be disabled, however there maybe some residual characters which - get consumed. - """ - cmd_packet = [0x03, ISP_COMMAND_START_ISP] # start isp - cmd_packet = isp.checkSum(cmd_packet) # add the checksum packet - - isp.writeSerial(bytearray(cmd_packet)) - isp_decode_packet(isp,"TX--> ", cmd_packet) - - # ISP START always succeeds, so there is no need to read the Ack like for the other commands. - # Two things to look for are - - # 1. ISP_COMMAND_ACK byte - to verify that the target responded - # 2. Any leftover data, e.g., Flicker animations - it needs to be read/flushed - got_ack = False - while True: - data = isp.readSerial(1) - if len(data) == 0: - break - if data[0] == ISP_COMMAND_ACK: - got_ack = True - if not got_ack: - print("[ERROR] Target did not respond") - sys.stdout.flush() - # isp_start is called before any dynamic baud rate change, so it is ok to sys.exit() - isp.closeSerial() - sys.exit(EXIT_WITH_ERROR) - - if isp.getVerbose() is True: - print("RX<-- command= COMMAND_ACK") - -def isp_stop(isp): - """ - isp_Stop - - Send Command to Stop the isp handler on the target - """ - isp_build_packet(isp, ISP_COMMAND_STOP_ISP) - -def getFilesize(fileHandle): - """ - getFileSize - - given a file handle return the size in bytes - """ - fileHandle.seek(0,os.SEEK_END) - sizeinbytes = fileHandle.tell() - - return sizeinbytes - -def isp_reset(isp): - """ - isp_reset - """ - isp_build_packet(isp, ISP_COMMAND_RESET_DEVICE) - -def isp_secure_debug(isp, auth_token, data): - """ - isp_secure_debug - """ - subCmd = [] - if auth_token != 0x0: - subCmd.append(auth_token) - - if len(data) != 0: - subCmd.append(data) - - #print("*** sub command: ", subCmd) - isp_build_packet(isp, ISP_COMMAND_SECURE_DEBUG, subCmd) - -def isp_download_start(isp, address, size, auth_token): - """ - isp_download_start - """ - subCmd = [address,size] - if auth_token != 0x0: - subCmd.append(auth_token) - isp_build_packet(isp, ISP_COMMAND_DOWNLOAD_START, subCmd) - -def isp_download_data(isp, data): - """ - isp_download_data - """ - message = isp_build_packet(isp, ISP_COMMAND_DOWNLOAD_DATA, - ['padding', 'padding', bytearray(data)]) - if len(message) == 0: - print("[ERROR] No response") - return False - - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: - print("[ERROR] Command NAK") - return False - - return True - -def isp_download_done(isp, delay = 0): - """ - isp_download_done - Does not wait for reader task - """ - isp_build_packet(isp, ISP_COMMAND_DOWNLOAD_DONE, None, delay) - -def isp_burn_mram(isp, address, file_size, auth_token): - """ - isp_burn_mram - """ - subCmd = [address,file_size] - if auth_token != 0x0: - subCmd.append(auth_token) - message = isp_build_packet(isp, ISP_COMMAND_BURN_MRAM, subCmd) - - # same error handling as in isp_download_data - if len(message) == 0: - print("[ERROR] No response") - return False - - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: - print("[ERROR] Command NAK") - return False - - return True - - -def isp_enquiry(isp): - """ - isp_enquiry - """ - message = isp_build_packet(isp, ISP_COMMAND_ENQUIRY) - - if len(message) == 0: - return - - cmd = message[ISP_PACKET_COMMAND_FIELD] - if cmd == ISP_COMMAND_DATA_RESPONSE: - #isp_print_response("blue",message) - Maintenance_string = "" - error_string = "" - length = message[ISP_PACKET_LENGTH_FIELD] - state = message[ISP_PACKET_DATA_FIELD] - - ErrorCode = (message[3:7]) # bytes 3 through 6 (limit 7) - ExtendedErrorCode = [0,0,0,0] - ExtendedErrorCode = (message[7:11]) # bytes 7 through 10 (limit 11) - if state & ISP_SOURCE_SEROM: - isp_print_color("blue","SEROM") - error_string = serom_error_lookup.get(int.from_bytes(ErrorCode,"little")) - Maintenance_string = "" - if state & ISP_SOURCE_SERAM: - isp_print_color("blue","SERAM") - MaintenanceMode = int.from_bytes(message[11:15],"little") - Maintenance_string = "Enabled" if (MaintenanceMode == 1) else "Disabled " - - isp_print_color("blue"," Error = ") - isp_print_color("blue",hex(int.from_bytes(ErrorCode,"little"))) - if error_string: - isp_print_color("blue"," (" + error_string + ") ") - isp_print_color("blue"," Extended Error = ") - isp_print_color("blue",hex(int.from_bytes(ExtendedErrorCode,"little"))) - isp_print_color("blue"," Maintenance Mode = " + Maintenance_string) - print(" ") - - -def isp_show_maintenance_mode(isp, maintenance_mode): - """ - isp_show_maintenance_mode - - disply the maintence mode status - """ - Maintenance_string = "Enabled" if (maintenance_mode == 1) else "Disabled " - isp_print_color("blue","Maintenance Mode = " + Maintenance_string) - print(" ") - -def isp_get_maintenance_status(isp): - """ - isp_get_maintenance_status - - This is wrapper around isp_enquiry which returns the error code - data as well, this is ignored. - """ - MaintenanceMode = 0 - message = isp_build_packet(isp, ISP_COMMAND_ENQUIRY) - if len(message) != 0: - cmd = message[ISP_PACKET_COMMAND_FIELD] - - if cmd == ISP_COMMAND_DATA_RESPONSE: -# isp_print_response("blue",message) - length = message[ISP_PACKET_LENGTH_FIELD] - state = message[ISP_PACKET_DATA_FIELD] - if state & ISP_SOURCE_SERAM: - MaintenanceMode = int.from_bytes(message[11:15],"little") - - return MaintenanceMode - -def isp_get_revision(isp): - # we will add the source (SEROM or SERAM) - - """ - isp_enquiry - """ - message = isp_build_packet(isp, ISP_COMMAND_ENQUIRY) - if len(message) == 0: - return - cmd = message[ISP_PACKET_COMMAND_FIELD] - if cmd == ISP_COMMAND_DATA_RESPONSE: - state = message[ISP_PACKET_DATA_FIELD] - isp_print_color("blue"," Source\t\t= ") - if state & ISP_SOURCE_SEROM: - isp_print_color("blue","SEROM\n") - if state & ISP_SOURCE_SERAM: - isp_print_color("blue","SERAM\n") - - - - """ - isp_get_revision handler - """ - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_REVISION]) - - if len(message) == 0: - return - cmd = message[ISP_PACKET_COMMAND_FIELD] - - if cmd == ISP_COMMAND_DATA_RESPONSE: - version_decode(isp,message) - -def isp_get_baud_rate(isp): - """ - isp_get_baud_rate - """ - baud_rate = 0 - message = isp_build_packet(isp, ISP_COMMAND_GET_BAUD_RATE) - baud_rate = int.from_bytes(message[2:6],"little") - isp_print_color("blue",baud_rate) - print(" ") - - return baud_rate - -def isp_get_toc_data(isp): - """ - isp_get_toc_data - """ - isp_print_color("blue", - " +----------+--------+------------+------------+------------+------------+----------+-----------+--------+----------+\n") - isp_print_color("blue", - " | Name | CPU | Store Addr | Obj Addr | Dest Addr | Boot Addr | Size | Version | Flags | Time (ms)|\n") - isp_print_color("blue", - " +----------+--------+------------+------------+------------+------------+----------+-----------+--------+----------+\n") - - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_TOC_INFO]) - - if len(message) == 0: - return - - # This uses a "stream" of packets sent back from SERAM - while (message[ISP_PACKET_COMMAND_FIELD] == ISP_COMMAND_DATA_RESPONSE and - message[ISP_DATA_START_FIELD] == ISP_DATA_START_MARKER): - - display_toc_info(message[3::]) # Skip header, payload only - - message = isp_readmessage(isp) - command = isp_decode_packet(isp,"RX<-- ", message) - - if len(message) == 0: - return - isp_print_color("blue", - " +----------+--------+------------+------------+------------+------------+----------+-----------+--------+----------+\n") - -def isp_get_power_data(isp): - """ - isp_get_power_data - """ - - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_POWER_INFO]) - - if len(message) == 0: - return - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: - return - - display_power_info(message[2::]) # Skip header, payload only -# display_power_info(message) # Skip header, payload only - -def isp_get_clock_data(isp): - """ - isp_get_power_data - """ - - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_CLOCK_INFO]) - - if len(message) == 0: - return - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: - return - - display_clock_info(message[2::]) # Skip header, payload only - -def isp_get_banner(isp): - """ - isp_get_banner - retrieve seram banner - sub-command ISP_GET_BANNER - """ - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_BANNER]) - - if len(message) == 0: - return - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_DATA_RESPONSE: - isp_print_message("blue", message) - print(" ") - -def isp_get_mram_contents(isp): - """ - isp_get_mram_contents - retrieve MRAM details - sub-command ISP_GET_MRAM_CONTENTS - """ - delay = 10 - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_MRAM_CONTENTS], delay) - - if len(message) == 0: - return - - while (message[ISP_PACKET_COMMAND_FIELD] == ISP_COMMAND_DATA_RESPONSE and - message[ISP_TOC_COMMAND_FIELD] == ISP_TOC_INFO_START_MARKER): - toc_decode_toc_info(isp, message) - - message = isp_readmessage(isp) - isp_decode_packet(isp,"RX<-- ", message) - - if len(message) == 0: - return - -def isp_get_cpu_status(isp): - """ - isp_get_cpu_state - - ISP_DATA_RESPONSE packet for return data - - CPU_ID Booted Boot Addess - <1-byte> <1-byte> <4-bytes> = 6-bytes - """ - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_CPU_STATUS]) - - if len(message) == 0: # Nothing came back - return - command = message[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_DATA_RESPONSE: - display_cpu_info(message) - -def isp_get_seram_metrics(isp): - """ - isp_get_seram_metrics - - ISP_DATA_RESPONSE packet for return data - - Task Name Size Used - <16-bytes> <4-byte> <4-bytes> = 24-bytes - """ - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_SERAM_METRICS]) - - if len(message) == 0: # Nothing came back - return - - if message[ISP_PACKET_COMMAND_FIELD] == ISP_COMMAND_DATA_RESPONSE: - isp_print_color("blue", " +-------------------------------+\n") - isp_print_color("blue", " | TaskName | Size | Used |\n") - isp_print_color("blue", " +-----------------+------+------+\n") - - # unpack the data in the response. 2 CPUS x 6-bytes of data - # @todo magic numbers need to go away and less cut and paste code - packet_start = ISP_PACKET_DATA_FIELD - element = message[packet_start::] - - # uint32_t number of tasks - # uint32_t uptime - # struct { - # uint32_t stack_size - # uint32_t stack_used - # char task_name[16] - #} [number_of_tasks] - (number_of_tasks,) = struct.unpack(" ISP_PACKET_HEADER_LENGTH: - command = response[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: # NACK, DO NOT CONTINUE - print('ERROR: There was an error in the recovery process') - sys.exit(EXIT_WITH_ERROR) - else: - print('ERROR: There was an error in the recovery process ( invalid ISP PACKET HEADER LENGTH)!') - sys.exit(EXIT_WITH_ERROR) - -def isp_read_mram(isp,word_offset=0x0): - """ - isp_read_mram - retrieve mram @ word_offset - """ - response = isp_build_packet(isp, ISP_COMMAND_MRAM_READ, [int(word_offset),b'\x10']) - if len(response) == 0: - return - - command = response[ISP_PACKET_COMMAND_FIELD] - if command == ISP_COMMAND_NAK: - error_string = error_lookup.get(response[ISP_PACKET_DATA_FIELD]) - if not error_string: - error_string = "UNKNOWN" - isp_print_color("blue","[ERROR] 0x{:04x} {}".format( - word_offset, error_string)) - print(" ") - if command != ISP_COMMAND_DATA_RESPONSE: - return None - - # write out the 4 int32 values of the MRAM line - isp_print_color("blue","[0x{:x}] ".format(word_offset)) - for each_word in range(2,18,4): - mram_value = response[each_word:each_word+4] - value = int.from_bytes(mram_value,byteorder='little') - isp_print_color("blue","0x{:08x} ".format(value)) - print(" ") - -def isp_mram_erase(isp, address, size=0,pattern=0x00000000): - """ - isp_erase_mram - - erase ATOC memory from
for with - """ - delay = 0 - if size >= 1048576: # ACK will take some time at this size - delay = 20 - isp_build_packet(isp, ISP_COMMAND_ERASE_MRAM, [address,size,pattern], delay) - -def isp_sram_write(isp, offset, data): - """ - isp_Sram_Write - - send data to write to the SE RAM - SEROM only - (used by recovery-execute-package.py) - """ - - #print("* write to offset ", hex(offset)) - #print("* data: ", data) - isp_build_packet(isp, ISP_COMMAND_SRAM_WRITE, [offset, bytearray(data)]) - -def isp_set_maintenance_flag(isp): - """ - isp_set_maintenance_flag - - Send Command to set the maintenance flag on the target - """ - message = isp_build_packet(isp, ISP_COMMAND_SET_MAINTENANCE_FLAG) - -def isp_get_log_data(isp): - """ - isp_get_log_data - """ - - # get log buffer info - message = isp_build_packet(isp, ISP_COMMAND_GET, [ISP_GET_LOG_BUFFER_INFO]) - if len(message) == 0: - return None - - command = message[ISP_PACKET_COMMAND_FIELD] - if command != ISP_COMMAND_DATA_RESPONSE: - return None - - (buffer_size,) = struct.unpack("> 4)) diff --git a/tools/alif/isp/isp_print.py b/tools/alif/isp/isp_print.py deleted file mode 100755 index 9a57aa3d7..000000000 --- a/tools/alif/isp/isp_print.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python3 -""" - ISP printing - - Created to avoid circular references as used in more than place - - In System Programming (ISP) protocol implementation - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name -from isp_protocol import ISP_PACKET_DATA_FIELD - -# Colour table for ANSI terminal printing -ansi_fg_colour = { - "white" : "\033[97m", - "cyan" : "\033[96m", - "header" : "\033[95m]", - "blue" : "\033[94m", - "yellow" : "\033[93m", - "green" : "\033[92m", - "red" : "\033[91m", - "black" : "\033[90m", - "reset" : "\033[0m" -} - -def isp_print_color(fg, message_string): - """ - print a message - """ - print(ansi_fg_colour[fg],end='') - print(message_string, end='') - print(ansi_fg_colour["reset"],end='') - -def isp_print_response(fg, message): - """ - print a data response packet - This is an unknown response format so we just print each elementc - """ - print_message = message[ISP_PACKET_DATA_FIELD:len(message)-1] - - print(ansi_fg_colour[fg],end='') - for x in print_message: - print(hex(x), end='') - print(' ', end='') - print(ansi_fg_colour["reset"]) - -def isp_print_message(fg, message): - """ - print a PRINT_DATA message - This is a NULL terminated string - """ - print_message = bytes(message[ISP_PACKET_DATA_FIELD:len(message)-1]) - eoln = print_message.find(0) - print_message = print_message[:eoln] - print(ansi_fg_colour[fg], print_message.decode('utf-8'), \ - ansi_fg_colour["reset"]) - -def isp_print_terminal_reset(): - """ - isp_print_terminal_reset - reset the ANSI graphics Terminal - """ - print("\033[0m") - -def isp_print_cursor_disable(): - """ - isp_print_cursor_disable - Stop Cursor Blinking - """ - print("\033[?25l") # Cursor off - -def isp_print_cursor_enable(): - """ - isp_print_cursor_enable - reset the Cursor to Blinking - """ - print("\033[?25h") # Flicker enables Cusror hide DECTCEM, this reenables diff --git a/tools/alif/isp/isp_protocol.py b/tools/alif/isp/isp_protocol.py deleted file mode 100755 index ec35986ae..000000000 --- a/tools/alif/isp/isp_protocol.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/python3 - -""" - ISP Protocol - - - ISP commands and Error codes - Sync'd with common/include/isp_protocol.h used by seram and serom - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name - -# ISP protocol definition -ISP_COMMAND_START_ISP = 0x00 -ISP_COMMAND_STOP_ISP = 0x01 -ISP_COMMAND_ABORT = 0x02 -ISP_COMMAND_DOWNLOAD_START = 0x03 # SERAM DEPRECTAED -ISP_COMMAND_DOWNLOAD_DATA = 0x04 -ISP_COMMAND_DOWNLOAD_DONE = 0x05 -ISP_COMMAND_EXECUTE = 0x06 # SERAM DEPRECATED -ISP_COMMAND_AUTHENTICATE = 0x07 # SERAM DEPRECATED -ISP_COMMAND_BURN_MRAM = 0x08 # SERAM -ISP_COMMAND_RESET_DEVICE = 0x09 - -ISP_COMMAND_PRINT_DATA = 0x0C -ISP_COMMAND_MRAM_WRITE = 0x0D # SEROM -ISP_COMMAND_SECURE_DEBUG = 0x0E -ISP_COMMAND_ENQUIRY = 0x0F -ISP_COMMAND_GET_BAUD_RATE = 0x10 -ISP_COMMAND_SET_BAUD_RATE = 0x11 -ISP_COMMAND_VERIFY_IMAGE = 0x12 -ISP_COMMAND_GET_TOC_INFO = 0x13 # SERAM DEPRECATED -ISP_COMMAND_GET = 0x14 -ISP_COMMAND_ERASE_MRAM = 0x15 -ISP_COMMAND_SET_MAINTENANCE_FLAG = 0x16 -ISP_COMMAND_OTP_READ = 0x17 -ISP_COMMAND_OTP_WRITE = 0x18 -ISP_COMMAND_MRAM_READ = 0x19 -ISP_COMMAND_SET = 0x1A -ISP_COMMAND_DMPU = 0x1B -ISP_COMMAND_SRAM_WRITE = 0x1C # SEROM -ISP_COMMAND_VERIFY_AND_EXECUTE = 0x1D # SEROM - -ISP_COMMAND_ACK = 0xFE -ISP_COMMAND_NAK = 0xFF -ISP_COMMAND_DATA_RESPONSE = 0xFD - -ISP_MAXIMUM_PACKET_SIZE = 256 -ISP_PACKET_HEADER_LENGTH = 2 -ISP_PACKET_LENGTH_FIELD = 0 -ISP_PACKET_COMMAND_FIELD = 1 -ISP_PACKET_DATA_FIELD = 2 -ISP_PACKET_DATA = 3 -ISP_PACKET_DOWNLOAD_FIELD = 4 - -# ISP Sources -ISP_SOURCE_SEROM = 0x01 -ISP_SOURCE_SERAM = 0x02 - -# ISP Error codes and returns -ISP_SUCCESS = 0x00 -ISP_DATA_SUCCESS = 0x01 -ISP_ERROR = 0xFF -ISP_READ_TIMEOUT = 0xFE -ISP_WRITE_TIMEOUT = 0xFD -ISP_UNKNOWN_COMMAND = 0xFC -ISP_COMMAND_STOP = 0xFB -ISP_CHECKSUM_ERROR = 0xFA -ISP_NOT_SUPPORTED = 0xF9 -ISP_BAD_PACKET_SIZE = 0xF8 -ISP_BAD_DESTINATION_ADDR = 0xF7 -ISP_UNEXPECTED_COMMAND = 0xF6 -ISP_HOST_AUTH_FAILED = 0xF5 -ISP_NOT_ALLOWED = 0xF4 -ISP_BAD_AUTH_TOKEN = 0xF3 -ISP_IMAGE_AUTHENTICATION_FAILED = 0xF2 -ISP_IMAGE_VERIFICATION_FAILED = 0xF1 -ISP_SECURE_DEBUG_FAILED = 0xF0 -ISP_MRAM_WRITE_FAILED = 0xEF -ISP_UNKNOWN_GET_OBJECT = 0xEE -ISP_ERROR_ILLEGAL_ADDRESS = 0xED -ISP_ERROR_MISALIGNED = 0xEC -ISP_MRAM_OFFSET_MISALIGNED = 0xEB -ISP_UNKNOWN_MRAM_ERROR = 0xEA -ISP_MRAM_LENGTH_TOO_LARGE = 0xE9 -ISP_UNKNOWN_SET_OBJECT = 0xE8 -ISP_CODE_VERIFY_FAILURE = 0xE7 # SEROM -ISP_INVALID_CODE_SIZE = 0xE6 # SEROM -ISP_MFG_DATA_MISCOMPARE = 0xE5 # SEROM -ISP_SERAM_JUMP_FAILED = 0xE4 # SEROM -ISP_MRAM_CONTROLLER_ERROR = 0xE3 # SEROM - -# ISP Sub-command -ISP_GET_TOC_INFO = 0x01 -ISP_GET_REVISION = 0x02 -ISP_GET_BAUDRATE = 0x03 -ISP_GET_BANNER = 0x04 -ISP_GET_CPU_STATUS = 0x05 -ISP_GET_MRAM_CONTENTS = 0x06 -ISP_GET_SERAM_METRICS = 0x07 -ISP_GET_LOG_BUFFER_INFO = 0x08 -ISP_GET_LOG_DATA = 0x09 -ISP_GET_SERAM_UPDT_ADDR = 0x0A -#ISP_GET_OTP_READ = 0x0B unused -ISP_GET_TRACE_BUFFER = 0x0C -ISP_GET_SECURE_DEBUG_TOKENS = 0x0D -ISP_GET_POWER_INFO = 0x0E -ISP_GET_PEEK_ADDRESS = 0x0F -ISP_GET_CLOCK_INFO = 0x10 -ISP_GET_SERAM_TRACE_BUFFER = 0x11 -ISP_GET_ECC_KEY = 0x12 -ISP_GET_FIREWALL_CONFIG = 0x13 - -ISP_SET_PRINTING_ENABLE = 0x30 -ISP_SET_PRINTING_DISABLE = 0x31 -ISP_SET_LOGGING_ENABLE = 0x32 -ISP_SET_LOGGING_DISABLE = 0x33 -ISP_SET_POKE_ADDRESS = 0x34 - -ISP_TOC_COMMAND_FIELD = 0x02 -ISP_DATA_START_FIELD = 0x02 -ISP_TOC_INFO_START_MARKER = 0xA5 -ISP_TOC_INFO_END_MARKER = 0xA6 -ISP_DATA_START_MARKER = 0xA7 -ISP_DATA_END_MARKER = 0xA8 - -# Reader thread states -ISP_STATUS_READER_STOP = 0x100 -ISP_STATUS_READER_START = 0x101 -ISP_STATUS_READER_RUNNING = 0x102 -ISP_STATUS_READER_QUIT = 0x103 diff --git a/tools/alif/isp/isp_util.py b/tools/alif/isp/isp_util.py deleted file mode 100755 index b154b8471..000000000 --- a/tools/alif/isp/isp_util.py +++ /dev/null @@ -1,221 +0,0 @@ - -# pylint: disable=unused-argument, invalid-name -""" - isp_util.py - commonly used functions used by ISP - - mainly used to support ISP based MRAM burning utlties. -""" -import os -import sys -import subprocess -import random -from isp_core import * -from utils.toc_common import * -import time - -DATA_CHUNK_SIZE = 240 -EXIT_WITH_ERROR = 1 - -def file_get_size(fileHandle): - """ - file_get_zsize - given a file handle return the size in bytes - """ - fileHandle.seek(0,os.SEEK_END) - sizeinbytes = fileHandle.tell() - - return sizeinbytes - -def progress_bar(fileName, currentSize=0, maxSize=0, enablePrint=True): - """ - progress_bar - print a progress bar - """ - if maxSize <= 0: - print("\n") - return False - - progress = int((currentSize / float(maxSize)) * 100) - - hashes = int(progress / 5) - printBar = (fileName.ljust(32) + "[" + "#" * hashes + " " * (20 - hashes) - + "]") - if enablePrint: - progressVal = "%d%%: %d/%d bytes"%(progress, currentSize, maxSize) - else: - progressVal = " " - - print(printBar + progressVal + "\r", flush=True, end='') - -# if progress >= 100: -# print("\n") - - return True - -def checkArmdbgPath(): - """ - checkArmdbgPath - """ - cmd = 'armdbg -v' - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, universal_newlines=True) - output, errors = p.communicate() - #print(errors.find("'armdbg' is not recognized as an internal")) - if errors.find("'armdbg' is not recognized as an internal") != -1: - print('ERROR: The ARM Debugger is not found!') - print('Be sure you are using ARM DS Command prompt') - print('or add the /bin') - print('directory to your PATH environmental variable') - sys.exit(EXIT_WITH_ERROR) - else: - print('Invoking ARM Debugger: ' + output) - -def send_authentication_command(isp, command, token): - """ - send_authenitication_packet - """ - cmd_packet = [0x03, command] # authenticate execute - cmd_packet = cmd_packet + list(int_to_bytes(token)) - cmd_packet[0] = len(cmd_packet) + 1 - cmd_packet = isp.checkSum(cmd_packet) # add the checksum packet - - isp.writeSerial(bytearray(cmd_packet)) - isp_decode_packet(isp,"TX--> ", cmd_packet) - #isp_wait(isp) - message = isp_readmessage(isp) - isp_decode_packet(isp,"RX<-- ", message) - -certPath = Path("cert/") -imagePath = Path("build/images") - -def authenticate_image(isp, fileName): - """ - authenticate)image - """ - - print("Verify Certificate") - signatureFileName = fileName + '.sign' - print("Signature File: ", signatureFileName) - - try: - f = open(signatureFileName, 'rb') - except IOError as e: - print('[ERROR] {0}'.format(e)) - return 0 - - # generate a random authentication token - token = random.randrange(0xFFFFFFFF) - #print("Auth Token: ", hex(token)) - - send_authentication_command(isp, ISP_COMMAND_VERIFY_IMAGE, token) - - #download certificate - with f: - fileSize = getFilesize(f) - offset = 0 - - while offset < fileSize: - f.seek(offset) - data_line = f.read(DATA_CHUNK_SIZE) - if isp_download_data(isp, data_line) == False: - break - offset = offset + DATA_CHUNK_SIZE - f.close() - - isp_download_done(isp) - return token - -def close_isp_and_exit(isp, msg): - isp.closeSerial() - print('\n') - print(msg) - sys.exit(EXIT_WITH_ERROR) - -def burn_mram_isp(isp, handler, fileName, destAddress, verbose_display, auth_image): - """ - burn_mram_isp - use ISP method to write MRAM - """ - - print("Authenticate Image: ", auth_image) - token = 0x0 - if auth_image: - token = authenticate_image(isp, fileName) - if token == 0: - print('Image authentication failed!') - return False - - print("Download Image") - try: - f = open(fileName, 'rb') - except IOError as e: - print('[ERROR] {0}'.format(e)) - return False - - with f: - fileSize = file_get_size(f) - offset = 0 - data_size = DATA_CHUNK_SIZE - if fileSize <= data_size: # Deal with small ones - data_size = 16 # CHUNK_SIZE - - if isp_burn_mram(isp, destAddress, fileSize, token) == False: - return False - - number_of_blocks = fileSize // data_size - left_over_blocks = fileSize % data_size - - start_time = time.time() - while number_of_blocks != 0: - f.seek(offset) - data_line = f.read(data_size) - - if verbose_display is False: - progress_bar(fileName,offset+data_size,fileSize) - - if isp_download_data(isp, data_line) == False: - break - - offset = offset + data_size - number_of_blocks = number_of_blocks - 1 - - if handler.Handler_exit(): - close_isp_and_exit(isp, "[INFO] CTRL-C detected. User aborted this process") - - if number_of_blocks == 0: - if left_over_blocks != 0: - f.seek(offset) - mram_line = f.read(left_over_blocks) - isp_download_data(isp, mram_line) - - if verbose_display is False: - progress_bar(fileName,offset+left_over_blocks,fileSize) - - print("\r") - delay = 0 - if auth_image: - # add a delay to account for the image verification time - delay = fileSize / 1000000 - print("Verify Image") - - isp_download_done(isp, delay) - end_time = time.time() - print("Done\n {:10.2f} seconds\n".format(end_time-start_time)) - - return True - - -def put_target_in_maintenance_mode(isp, baud_rate, Info=True): - """ - enable target to be maintenance mode - Info parameter toggles the output here - """ - if Info: - print("[INFO] Starting Maintenance Mode entry sequence...") - isp_start(isp) - if Info: - print("--> Set Maintenance Flag") - isp_set_maintenance_flag(isp) - isp_stop(isp) - if Info: - print("--> Reset Target") - isp_reset(isp) - if Info: - print("[INFO] Done. Target is in Maintenance Mode") diff --git a/tools/alif/isp/otp.py b/tools/alif/isp/otp.py deleted file mode 100755 index f683e409d..000000000 --- a/tools/alif/isp/otp.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python3 - -""" - @brief OTP decode and display - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name -from isp_print import isp_print_color - -def display_otp_info(word_offset, response): - """ - display_otp_info - display otp data from Target - """ - otp_value = int.from_bytes(response[2:6],"little") - isp_print_color("blue","0x{:04x} {}".format(word_offset,hex(otp_value))) - print(" ") \ No newline at end of file diff --git a/tools/alif/isp/otp_mfgr_decode.py b/tools/alif/isp/otp_mfgr_decode.py deleted file mode 100755 index a925ed00b..000000000 --- a/tools/alif/isp/otp_mfgr_decode.py +++ /dev/null @@ -1,213 +0,0 @@ -#!/usr/bin/python3 - -""" - @brief OTP data decode - Alif Manufacturing info - - 256 Bits (32 bytes) of total data - * CP1 72 9 - * CP2 72 9 - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name, consider-using-f-string -import struct -from isp_print import isp_print_color - -SRAM0_SIZE_lut = { - 0 : "4.0", - 1 : "2.0" - } - -SRAM1_SIZE_lut = { - 0 : "2.5", - 1 : "0.0" - } - -MRAM_SIZE_lut = { - 0 : "6.0", - 1 : "4.5", - 2 : "3.0", - 3 : "1.5" - } - -class CP_data_t: - """ - OTP manufactoring data - @todo need to add more methods - """ - # pylint: disable=too-many-instance-attributes - def __init__(self): - """ - CP Fuses - 72bits - """ - self.cp_mfgr_id_x_loc = 0 - self.cp_mfgr_id_y_loc = 0 - self.cp_mfgr_id_fab = '' - self.cp_mfgr_id_wfr_id = 0 - self.cp_mfgr_id_lot_id = 0 - self.cp_mfgr_id_lot_id_year = 0 - self.cp_mfgr_id_lot_id_FABID = 0 - self.cp_mfgr_id_lot_id_workweek = 0 - self.cp_mfgr_id_lot_id_serialno = 0 - self.cp_memory_sizes = 0 - self.cp_memory_sizes_SRAM0 = 0 - self.cp_memory_sizes_SRAM1 = 0 - self.cp_memory_sizes_MRAM = 0 - self.cp_test_revision = 0 - self.cp_test_revision_revision = 0 - self.cp_temperature = 0 - self.cp_last_byte = 0 - self.cp_CP1_write_ok = 0 - self.cp_SRAM_repaired = 0 - self.cp_future = 0 - - def otp_manufacture_bank_0_decode(self, message): - """ - otp_manufacture_cp_fuses_decode - parse otp Mfgr data - """ - - if len(message) == 0: - return - - (self.cp_mfgr_id_x_loc,) = struct.unpack("> 8) & 0x0000FF00) | - ((x >> 24) & 0x000000FF)) - -def decode_otp_manufacture(message): - """ - decode_otp_manufacture - decode and display the OTP bits for manufatcuring - """ - Bank0 = CP_data_t() - - Bank0.otp_manufacture_bank_0_decode(message) -# isp_print_color('blue', "CP1\n") - Bank0.display_manufacture_otp_info() - -# CP2_info.display_manufacture_otp_info() - -if __name__ == "__main__": - message = [ 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0, - 0x1, 0x2, 0x3, 0x0, 0x0] - """ - Unit #1: 0x2F002144: 0x5902FF0B - 0x2F002148: 0x00000104 - - Decoded by ATE as: - x-loc: 11 - y-loc: 255 - wafer ID: 2 - lot ID: UASY04001 - """ - real_data_1 = [ - 0x59, 0x02, 0xFF, 0x0B, # OTP Bank 0 - 0x00, 0x00, 0x01, 0x04] # OTP Bank 2 - -# decode_otp_manufacture(real_data_1) # OTP Bank 0 - - """ - Unit #2: 0x2F002144: 0x5902EF10 - 0x2F002148: 0x00000104 - - Decoded by ATE s: - x-loc: 16 - y-loc: 239 - wafer ID: 2 - lot ID: UASY04001 - """ - real_data_2 = [ - 0x59, 0x02, 0xEF, 0x10, # OTP Bank 0 - 0x00, 0x00, 0x01, 0x04] # OTP Bank 2 -# decode_otp_manufacture(real_data_2) # OTP Bank 0 - - """ - Unit #3: 0x2F002144: 0x5902FE01 - 0x2F002148: 0x00000104 - - Decoded by ATE as: - x-loc: 1 - y-loc: 254 - wafer ID: 2 - lot ID: UASY04001 - - """ - real_data_3 = [ - 0x59, 0x02, 0xFE, 0x01, # OTP Bank 0 - 0x00, 0x00, 0x01, 0x04] # OTP Bank 2 -# decode_otp_manufacture(real_data_3) # OTP Bank 0 - - """ - Unit #4: 0x2F002144: 0x5902ED12 - 0x2F002148: 0x00000104 - - Decoded by ATE as: - x-loc: 18 - y-loc: 237 - wafer ID: 2 - lot ID: UASY04001 - """ - real_data_4 = [ - 0x12, 0xED, 0x02, 0x59, - 0x00, 0x00, 0x04, 0x01] # OTP Bank 2 -# 0x59, 0x02, 0xED, 0x12, # OTP Bank 0 -# 0x00, 0x00, 0x01, 0x04] # OTP Bank 2 - - decode_otp_manufacture(real_data_4) # OTP Bank 0 - print("") - - """ - Real data form device - Unit #x: 0x2F002144: 0x59026897 - 0x2F002148: 0x00000104 - As read from ISP - MfgData = 0x10459026897 - ['0x97', '0x68', '0x2', '0x59', - '0x4', '0x1', '0x0', '0x0', - Endianess - """ - real_data_5 = [ - 0x97, 0x68, 0x2, 0x59, - 0x0, 0x0, 0x4, 0x1] - decode_otp_manufacture(real_data_5) # OTP Bank 0 - - print("") diff --git a/tools/alif/isp/power_decode.py b/tools/alif/isp/power_decode.py deleted file mode 100755 index 763ed97f6..000000000 --- a/tools/alif/isp/power_decode.py +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/python3 -""" - @brief Power Info decode and display - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name, consider-using-f-string -import struct -from isp_print import isp_print_color - -# PCSMPSTATE [3:0] -PCSMP_STATE_WARM_RESET = 0x8 -PCSMP_STATE_ON = 0x8 -PCSMP_STATE_DBG_RECOV = 0x8 -PCSMP_STATE_FUNC_RET = 0x7 -PCSMP_STATE_MEM_OFF = 0x6 -PCSMP_STATE_FULL_RET = 0x5 -PCSMP_STATE_LOGIC_RET = 0x4 -PCSMP_STATE_MEM_RET_EMU = 0x3 -PCSMP_STATE_MEM_RET = 0x2 -PCSMP_STATE_OFF_EMU = 0x1 -PCSMP_STATE_OFF = 0x0 - -# DEVPSTATE[3:0]/PPU_PWPR.PWR_POLICY -DEVPSTATE_STATE_DBG_RECOV = 0xA -DEVPSTATE_STATE_WARM_RESET = 0x9 -DEVPSTATE_STATE_ON = 0x8 -DEVPSTATE_STATE_FUNC_RET = 0x7 -DEVPSTATE_STATE_MEM_OFF = 0x6 -DEVPSTATE_STATE_FULL_RET = 0x5 -DEVPSTATE_STATE_LOGIC_RET = 0x4 -DEVPSTATE_STATE_MEM_RET_EMU = 0x3 -DEVPSTATE_STATE_MEM_RET = 0x2 -DEVPSTATE_STATE_OFF_EMU = 0x1 -DEVPSTATE_STATE_OFF = 0x0 - -def ppu_status_to_string(ppu_status): - """ - parse the bit fields of the ppu status and return a printable string - """ - status_string = '' - if ppu_status == DEVPSTATE_STATE_FUNC_RET: - status_string += " FUNC_RET" - if ppu_status == DEVPSTATE_STATE_MEM_OFF: - status_string += " MEM_OFF" - if ppu_status == DEVPSTATE_STATE_FULL_RET: - status_string += " FULL_RET" - if ppu_status == DEVPSTATE_STATE_ON: - status_string += " ON" - if ppu_status == DEVPSTATE_STATE_MEM_RET: - status_string += " MEM_RET" - if ppu_status == DEVPSTATE_STATE_OFF_EMU: - status_string += " ON" # OFF EMU" - if ppu_status == DEVPSTATE_STATE_OFF: - status_string += " OFF" - - return status_string - -def display_cpu_ppu_info(se_curr, se_prev, - a32_0_curr, a32_0_prev, - a32_1_curr, a32_1_prev, - m55_hp_curr, m55_hp_prev, - m55_he_curr, m55_he_prev): - - """ display_cpu_ppu_info - - - show CPU PPU info. - """ - isp_print_color("blue","CPU PPU Status\n") - isp_print_color("blue","+--------+----------+----------+\n") - isp_print_color("blue","| CPU | Current | Previous |\n") - isp_print_color("blue","+--------+----------+----------+\n") - isp_print_color("blue" if se_curr == se_prev else "green", - "| SE |0x%08X|" % (se_curr)); - isp_print_color("blue" ,"0x%08X|\n" % (se_prev)) - - isp_print_color("blue" if a32_0_curr == a32_0_prev else "green", - "| A32_0 |0x%08X|" % (a32_0_curr)); - isp_print_color("blue" ,"0x%08X|\n" % (a32_0_prev)) - - isp_print_color("blue" if a32_1_curr == a32_1_prev else "green", - "| A32_1 |0x%08X|" % (a32_1_curr)); - isp_print_color("blue" ,"0x%08X|\n" % (a32_1_prev)) - - isp_print_color("blue" if m55_hp_curr == m55_hp_prev else "green", - "| M55_HP |0x%08X|" % (m55_hp_curr)); - isp_print_color("blue" ,"0x%08X|\n" % (m55_hp_prev)) - - isp_print_color("blue" if m55_he_curr == m55_hp_prev else "green", - "| M55_HE |0x%08X|" % (m55_he_curr)); - isp_print_color("blue" ,"0x%08X|\n" % (m55_he_prev)) - - isp_print_color("blue","+--------+----------+----------+\n") - -def display_ppu_info(register_string,ppu_register): - """ - display the ppu info - """ - on_state_colour = "blue" - if (ppu_register == DEVPSTATE_STATE_ON or - ppu_register == DEVPSTATE_STATE_OFF_EMU): - on_state_colour = "green" -# on_state_colour = "green" if (ppu_register == DEVPSTATE_STATE_ON ) else "blue" - isp_print_color(on_state_colour,"%20s\t0x%08X\t%s\n" % - (register_string, - ppu_register, - ppu_status_to_string(ppu_register))) - -def power_decode_info(isp, message): - """ - power_decode_info - """ -# (se_curr, se_prev,) = struct.unpack(" {:20}".format(comPorts.device)) - - try: - PortName = input("Enter port name:") - except EOFError: - print(" Operation cancelled by the user!") - print("") - sys.exit(0) - - if PortName == '': - PortName = comPorts.device - - self.serialData.port = PortName - self.portName = PortName - - ErrorCode = False - for PortInfo in AvailablePorts: - if PortInfo.device == self.serialData.port: - ErrorCode = True - break - - if ErrorCode is True: - self.PrintStr("[DBG] Port Name %s" %self.serialData.port) - else: - self.PrintStr("[ERROR] %s is not a valid port name" \ - %self.serialData.port) - - self.setSerialFile(COM_FILE_DEFAULT) - - return True - - def showSerial(self): - """ - showSerial - - dump infomation regarding the COM port - """ - -if __name__ == "__main__": - print("*** Serial port test harness ***") - - isp = serialPort(57600) - isp.discoverSerialPorts() - isp.openSerial() - - isp.closeSerial() diff --git a/tools/alif/isp/serom_errors.py b/tools/alif/isp/serom_errors.py deleted file mode 100755 index 7e9520d86..000000000 --- a/tools/alif/isp/serom_errors.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/python3 - -""" - ISP - - - SEROM Error codes - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name -SEROM_STATUS_SUCCESS = 0x0 - -# Crypto errors -SEROM_BSV_INIT_FAIL = 0x1 -SEROM_BSV_LCS_GET_AND_INIT_FAIL = 0x2 -SEROM_BSV_LCS_GET_FAIL = 0x2 -SEROM_BSV_SEC_MODE_SET_FAIL = 0x3 -SEROM_BSV_PRIV_MODE_SET_FAIL = 0x4 -SEROM_BSV_CORE_CLK_GATING_ENABLE_FAIL = 0x5 - -# MRAM errors -SEROM_MRAM_INITIALIZATION_FAILURE = 0x6 -SEROM_MRAM_INITIALIZATION_TIMEOUT = 0x7 -SEROM_MRAM_WRITE_FAILURE = 0x8 - -# ATOC errors -SEROM_ATOC_EXT_HDR_OFFSET_ZERO = 0x9 -SEROM_ATOC_EXT_HDR_OFFSET_TOO_LARGE = 0xA -SEROM_ATOC_OBJECT_OFFSET_ZERO = 0xB -SEROM_ATOC_OBJECT_OFFSET_MISALIGNED = 0xC -SEROM_ATOC_OBJECT_OFFSET_TOO_LARGE = 0xD -SEROM_ATOC_OBJECT_OFFSET_TOO_SMALL = 0xE -SEROM_ATOC_EXT_HDR_OFFSET_MISALIGNED = 0xF -SEROM_ATOC_HEADER_OFFSET_INVALID = 0x10 -SEROM_ATOC_HEADER_CRC32_ERROR = 0x11 -SEROM_ATOC_HEADER_STRING_INVALID = 0x12 -SEROM_ATOC_NUM_TOC_ENTRIES_INVALID = 0x13 - -# Certificate errors -SEROM_CONTENT_CERTIFICATE_NULL = 0x14 -SEROM_CERTIFICATE_NULL = 0x15 -SEROM_CERTIFICATE_CHAIN_INVALID = 0x16 -SEROM_INVALID_OEM_ROT = 0x17 -SEROM_CERTIFICATE_ERROR_BASE = 0x18 -SEROM_CERTIFICATE_1_ERROR = 0x19 -SEROM_CERTIFICATE_2_ERROR = 0x1A -SEROM_CERTIFICATE_3_ERROR = 0x1B - -# BOOT errors -SEROM_BOOT_CODE_LOAD_ADDR_INVALID = 0x1C -SEROM_BOOT_VERIFY_IN_MEMORY_CASE_INVALID = 0x1D -SEROM_BOOT_ZERO_IMAGE_LENGTH_INVALID = 0x1E -SEROM_BOOT_ENCRYPTED_IMAGE_INVALID = 0x1F -SEROM_BOOT_VERIFY_IN_FLASH_CASE_INVALID = 0x20 -SEROM_BOOT_IMAGE_LENGTH_TOO_LARGE = 0x21 -SEROM_BOOT_RAW_IMAGE_LOADING_NOT_ALLOWED = 0x22 -SEROM_BOOT_SERAM_JUMP_RETURN_ERROR = 0x23 -SEROM_BOOT_FAILED = 0x24 -SEROM_BOOT_JUMP_ADDRESS_NOT_VALID = 0x25 - -# Bank selection errors -SEROM_BOTH_BANKS_INVALID = 0x26 - -SEROM_ATOC_EXT_HDR_OFFSET_TOO_SMALL = 0x27 -SEROM_BOOT_END_OF_MAIN_ERROR = 0x28 -SEROM_INVALID_NULL_PTR = 0x29 -SEROM_INVALID_TOC_OFFSET = 0x30 diff --git a/tools/alif/isp/toc_decode.py b/tools/alif/isp/toc_decode.py deleted file mode 100755 index cea9354b8..000000000 --- a/tools/alif/isp/toc_decode.py +++ /dev/null @@ -1,214 +0,0 @@ -#!/usr/bin/python3 - -""" - @brief Table Of Contents - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name -import struct -from isp_print import isp_print_color - -# CPU Values -TOC_IMAGE_CPU_ID_MASK = 0x0000000F -TOC_IMAGE_CPU_A32_0 = 0 -TOC_IMAGE_CPU_A32_1 = 1 -TOC_IMAGE_CPU_M55_HP = 2 -TOC_IMAGE_CPU_M55_HE = 3 -TOC_IMAGE_CPU_MODEM = 4 -TOC_IMAGE_CPU_GNSS = 5 -TOC_IMAGE_CPU_DSP = 6 -TOC_IMAGE_CPU_RISC_V = 7 -TOC_IMAGE_CPU_SE = 8 -TOC_IMAGE_CPU_LAST = 9 - -# TOC Flags -TOC_IMAGE_COMPRESSED = 0x10 -TOC_IMAGE_LOAD = 0x20 -TOC_IMAGE_BOOT = 0x40 -TOC_IMAGE_ENCRYPT = 0x80 -TOC_IMAGE_DEFERRED = 0x100 - -FLAG_STRING_COMPRESSED = 0 -FLAG_STRING_LOAD_IMAGE = 1 -FLAG_STRING_VERIFY = 2 -FLAG_STRING_CPU_BOOTED = 3 -FLAG_STRING_ENCRYPTED = 4 -FLAG_STRING_DEFERRED = 5 -FLAG_STRING_END = 6 -FLAG_STRING_SIZE = 10 - -# TOC Types -STOC_TOC_HEADER = 0 -ATOC_TOC_HEADER = 1 -MINI_TOC_HEADER = 2 - -TOC_RESPONSE_PACKET_SIZE = 54 - -cpu_name_lut = { - TOC_IMAGE_CPU_A32_0 : "A32_0 ", - TOC_IMAGE_CPU_A32_1 : "A32_1 ", - TOC_IMAGE_CPU_M55_HP : "M55-HP", - TOC_IMAGE_CPU_M55_HE : "M55-HE", - TOC_IMAGE_CPU_MODEM : "Modem ", - TOC_IMAGE_CPU_GNSS : "GNSS ", - TOC_IMAGE_CPU_DSP : "DSP ", - TOC_IMAGE_CPU_RISC_V : "RISC-V" -} - -toctype_lookup = { - STOC_TOC_HEADER : " STOC ", - ATOC_TOC_HEADER : " ATOC ", - MINI_TOC_HEADER : " MTOC " -} - -def debug_output(debug_data): - """ - debug_output - dumps the packet data byte by byte - """ - print("".join('%c ' % i for i in debug_data[3:11])) - -def flags_to_string(flags): - """ - Convert TOC Flags to something you can read - """ - flag_string = list(' ') - - if flags & TOC_IMAGE_COMPRESSED: - flag_string[FLAG_STRING_COMPRESSED] = 'C' - else: - flag_string[FLAG_STRING_COMPRESSED] = 'u' - - if flags & TOC_IMAGE_LOAD: - flag_string[FLAG_STRING_LOAD_IMAGE] = 'L' - - if flags & TOC_IMAGE_DEFERRED: - flag_string[FLAG_STRING_DEFERRED] = 'D' - - return ''.join(str(x) for x in flag_string) - -def digit_count(digits): - """ - given an integer (digits) count the number of digits - return this - """ - counter = 0 - while abs(digits) >= 10**counter: - counter += 1 - - return counter - -def toc_version_to_string(version_id,width=8): - """ - convert the TOC version into a string - """ - major = (version_id >> 24) & 0xFF - minor = (version_id >> 16) & 0xFF - patch = (version_id >> 8) & 0xFF - major_length = digit_count(major) - - version_string = "{:}.{:}.{:}".format(major,minor,patch).rjust(width,' ') - - return version_string.center(width,' ') - -def format_flags(entry_name,flags,width=8): - """ - format the flags - """ - search_words = "SERAM0 SERAM1" - if entry_name.strip() in search_words: - return "-------".center(width, ' ') - return '{:}'.format(flags,width).ljust(width,' ') - -def format_hex(hex_number, width=10): - """ - format a hex_number into a 'width' string - """ - if hex_number == 0x0: - return "----------".center(width, ' ') - return '{0:#0{1}x}'.format(hex_number,width) - -def format_time(time_value, width=8): - """ - format the process_time into a 'width' string - """ - return '{:.2f}'.format(time_value).rjust(width,' ') - -def format_cpu(cpu_value, entry_name='', width=7): - """ - format the cpu into a 'width' string - SERAM0/1 and DEVICE are special cases and - """ - search_words = "SERAM0 SERAM1 DEVICE" - if (entry_name != '' and entry_name.strip() in search_words): - cpu_name = "CM0+" - elif (entry_name != '' and entry_name.strip() == "* SERAM0"): - cpu_name = "CM0+" - elif (entry_name != '' and entry_name.strip() == "* SERAM1"): - cpu_name = "CM0+" - else: - cpu_name = cpu_name_lut.get(cpu_value) - if cpu_name is None: - cpu_name = "Unknown" - - return '{:}'.format(cpu_name).rjust(width,' ') - -def format_name(entry_name,width=10): - """ - format_name - strip off any NULL terminations - """ - return entry_name.decode().rstrip('\x00').rjust(width,' ') - -def toc_decode_toc_info(isp, message): - """ - toc_decode_toc_info - parse a toc header - """ - (address,) = struct.unpack(" 0) and (toctype != MINI_TOC_HEADER): - isp_print_color('blue', "\t+ header " + header_str + '\n') - isp_print_color('blue', "\t+ header_size " + str(header_size) + '\n') - isp_print_color('blue', "\t+ # toc entries " + str(num_toc) + '\n') - isp_print_color('blue', "\t+ entry_size " + str(entry_size) + '\n') - isp_print_color('blue', "\t+ version " + str(hex(version))+ '\n') - -def display_toc_info(message): - """ - display_toc_info - display toc entries sent back from Target - """ - (entry_name,cpu,store_address,object_address,load_address, - boot_address,image_size,version,process_time,flags) = \ - struct.unpack("<8sIIIIIIII7s",bytes(message[0:47])) - - flag_string = flags.decode() - process_time_ms = (0.01 * process_time)/1000 - name_string = format_name(entry_name) - cpu_string = format_cpu(cpu,name_string) - - isp_print_color("blue", - " |%8s|%7s | %10s | 0x%08X | %10s | %10s | %8d |%11s|%6s| %s |\n" % ( - name_string, - cpu_string, - format_hex(store_address), - object_address, - format_hex(load_address), - format_hex(boot_address), - image_size, - toc_version_to_string(version), - format_flags(name_string,flag_string[:5]), - format_time(process_time_ms))) diff --git a/tools/alif/isp/trace_decode.py b/tools/alif/isp/trace_decode.py deleted file mode 100755 index 17bbbd602..000000000 --- a/tools/alif/isp/trace_decode.py +++ /dev/null @@ -1,792 +0,0 @@ -""" - trace buffer decoder (SEROM and SERAM) - - __author__ = "ronyett" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.02.000" - __status__ = "Dev" " -""" -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string - - -TRACE_BASE_ADDRESS = 0 -NUMBER_OF_TRACES = 472 #512 # SERAM Size = 0x200, 512 Words, 2K bytes - -# Trace field encoding data -FLAG_MASK_SHIFT = 0 -SEQ_ID_MASK_SHIFT = 2 -MARKER_MASK_SHIFT = 8 -ADDR_MASK_SHIFT = 16 - -FLAG_MASK = (0x00000003) -SEQ_ID_MASK = (0x000000FC) -MARKER_MASK = (0x0000FF00) -ADDR_MASK = (0xFFFF0000) -VOID_ENTRY = (0xFFFFFFFF) - -TRACE_FLAG_NO_DATA = 0x00 # No data -TRACE_FLAG_BYTE_DATA = 0x01 # Marker is 8 bit data -TRACE_FLAG_WORD_DATA = 0x02 # Next entry is 32-bit data -TRACE_FLAG_TIMESTAMP = 0x03 # Next entry is 32 bit TimeStamp - -TRACE_BUFFER_END_MARKER = 0xeeeeeeee - -# -# SEROM Trace Flags -# -TRACE_BEGIN_RESET = 0x1 -TRACE_SE_FIREWALL = 0x2 -TRACE_HOST_FIREWALL = 0x3 -TRACE_FIREWALL_CTRL_READY = 0x4 -TRACE_FIREWALLS_INITIALIZED = 0x5 -TRACE_LCS_INITIALIZATIONS = 0x6 -TRACE_LCS_CM = 0x7 #lcs=0 -TRACE_LCS_DM = 0x8 #lcs=1 -TRACE_LCS_UNKNOWN_1 = 0x9 #lcs=2 -TRACE_LCS_UNKNOWN_2 = 0xA #lcs=3 -TRACE_LCS_UNKNOWN_3 = 0xB #lcs=4 -TRACE_LCS_SE = 0xC #lcs=5 -TRACE_LCS_UNKNOWN_4 = 0xD #lcs=6 -TRACE_LCS_RMA = 0xE #lcs=7 -TRACE_BEGIN_MAIN = 0xF -TRACE_FIND_STOC = 0x10 -TRACE_LOCATE_CERT_CHAIN = 0x11 -TRACE_RAW_BYPASS_CHECK = 0x12 -TRACE_RAW_BYPASS = 0x13 -TRACE_VERIFY_CERT_CHAIN = 0x14 -TRACE_SRAM_RETAINED = 0x15 -TRACE_SECURE_LCS_BOOT = 0x16 -TRACE_WAKE_UP_BROWNOUT = 0x17 -TRACE_START_CM55_HE = 0x18 -TRACE_CERT_CHAIN_VERIFY_START = 0x19 -TRACE_EACH_CERT_VERIFY = 0x1A -TRACE_CERT_CHAIN_VERIFY_END = 0x1B -TRACE_SERAM_JUMP = 0x1C -TRACE_PROCESS_ERROR = 0x1D -TRACE_CERTIFICATE_ERROR = 0x1E -TRACE_CM55_HE_FORCE_COLD_BOOT = 0x1F - -TRACE_CLEAR_FIRST_BOOT_MRAM_WRITE_FAIL = 0x20 -TRACE_MARK_BANK_NOT_VALID_MRAM_WRITE_FAIL = 0x21 -TRACE_SET_IMAGE_BOOTED_MRAM_WRITE_FAIL = 0x22 -TRACE_UPDATE_ERROR_CODES_MRAM_WRITE_FAIL = 0x23 -TRACE_UPDATE_BOOTFLAGS_CHECKSUM_MRAM_WRITE_FAIL = 0x24 -TRACE_BANK_A_NOT_BOOTABLE = 0x25 -TRACE_BANK_B_NOT_BOOTABLE = 0x26 -TRACE_NEWER_BANK_A = 0x27 -TRACE_NEWER_BANK_B = 0x28 -TRACE_TOC1_SERAM_OFFSET_INVALID = 0x29 -TRACE_TOC2_SERAM_OFFSET_INVALID = 0x2A -TRACE_TOC1_EXTENSION_HEADER_INVALID = 0x2B -TRACE_TOC2_EXTENSION_HEADER_INVALID = 0x2C -TRACE_TOC1_BOOT_FLAGS_CHECKSUM_INVALID = 0x2D -TRACE_TOC2_BOOT_FLAGS_CHECKSUM_INVALID = 0x2E -TRACE_BANK_A_BOOT_FAILED = 0x2F -TRACE_BANK_B_BOOT_FAILED = 0x30 -TRACE_WAKE_UP_RESET = 0x31 -TRACE_LOAD_MSP_ADDRESS = 0x32 -TRACE_LOAD_JUMP_ADDRESS = 0x33 -TRACE_INVALID_TOC_OFFSET = 0x34 -TRACE_CM55_HE_CPU_WAIT_RELEASE = 0x35 -TRACE_PROCESS_ERROR_EXTENDED = 0x36 -TRACE_FAST_BOOT_FIREWALL_PROTECT = 0x37 -TRACE_BEGIN_CGU_CLOCK_CONFIGURATION = 0x38 -TRACE_CGU_CLOCKS_CONFIGURED = 0x39 -TRACE_MRAM_RESET_ERROR_BYPASS = 0x3A -TRACE_MRAM_SET_ERROR_BYPASS = 0x3B -TRACE_BAD_SERAM_JUMP_ADDRESS = 0x3C -TRACE_BOOT_LOADER_JUMP_RETURNED = 0x3D -TRACE_TURN_ON_SYSTEM_POWER = 0x3E -TRACE_SERAM_RETENTION_PATTERN = 0x3F - -# -# SERAM Trace Flags -# -TRACE_FIREWALL_STATIC_CONFIG_BEGIN = 0x40 -TRACE_FIREWALL_STATIC_CONFIG_END = 0x41 -TRACE_PLL_INIT_BEGIN = 0x42 -TRACE_PLL_INIT_END = 0x43 -TRACE_MAINTENANCE_MODE_DETECT_BEGIN = 0x44 -TRACE_MAINTENANCE_MODE_DETECT_END = 0x45 -TRACE_CC_LIB_INIT_BEGIN = 0x46 -TRACE_CC_LIB_INIT_END = 0x47 -TRACE_M55_HE_TCM_INIT_BEGIN = 0x48 -TRACE_M55_HE_TCM_INIT_END = 0x49 -TRACE_ATOC_MISC_BEGIN = 0x4A -TRACE_ATOC_MISC_END = 0x4B -TRACE_STOC_DEVICE_BEGIN = 0x4C -TRACE_STOC_DEVICE_END = 0x4D -TRACE_STOC_PART_NUMBER = 0x4E -TRACE_START_MAIN = 0x4F - -TRACE_STOC_PROCESS_BEGIN = 0x50 -TRACE_ATOC_PROCESS_BEGIN = 0x51 -TRACE_TOC_PROCESS_END = 0x52 -TRACE_TOC_PRINT_BEGIN = 0x53 -TRACE_TOC_PRINT_END = 0x54 -TRACE_BANK_MAINTENANCE_BEGIN = 0x55 -TRACE_BANK_MAINTENANCE_END = 0x56 -TRACE_CPU_RELEASE = 0x57 -TRACE_CPU_BOOT = 0x58 -TRACE_WAKE_UP = 0x59 -TRACE_COLD_BOOT = 0x5A -TRACE_M55_FASTBOOT_SERAM = 0x5B -TRACE_M55_TCM_RETAINED = 0x5C -TRACE_M55_VTOR_SENTINEL = 0x5D -TRACE_STOP_MODE_ENABLE_BEGIN = 0x5E -TRACE_1_MAIN = 0x5F - -TRACE_RTOS_WFI_BEGIN = 0x60 -TRACE_RTOS_WFI_END = 0x61 -TRACE_2_MAIN = 0x62 -TRACE_3_MAIN = 0x63 -TRACE_ENTER_MAINTENANCE_MODE = 0x64 -TRACE_DCU_CONFIG_BEGIN = 0x65 -TRACE_DCU_CONFIG_END = 0x66 -TRACE_RECEIVE_MHU = 0x67 -TRACE_PROCESS_MHU = 0x68 -TRACE_FINISH_MHU = 0x69 -TRACE_SERAM_TO_M55_HP = 0x6A -TRACE_SERAM_TO_M55_HE = 0x6B -TRACE_M55_HP_TO_SERAM = 0x6C -TRACE_M55_HE_TO_SERAM = 0x6D -TRACE_BEGIN_TRIMMING = 0x6E -TRACE_FINISH_TRIMMING = 0x6F - -TRACE_BEGIN_SERAM_BANK_COPY = 0x70 -TRACE_END_SERAM_BANK_COPY = 0x71 -TRACE_M55_FASTBOOT_SERAM_XIP = 0x72 -TRACE_WARM_BOOT = 0x73 -TRACE_A32_0_RELEASED = 0x74 -TRACE_A32_1_RELEASED = 0x75 -TRACE_M55_HP_RELEASED = 0x76 -TRACE_M55_HE_RELEASED = 0x77 -TRACE_MODEM_RELEASED = 0x78 -TRACE_GNSS_RELEASED = 0x79 -TRACE_DSP_RELEASED = 0x7A -TRACE_VBAT_ANA_REG2 = 0x7B -TRACE_VBAT_ANA_REG3 = 0x7C -TRACE_DCDC_REG1 = 0x7D -TRACE_COMP_REG2 = 0x7E -TRACE_NO_TRIM_VALUES_SPECIFIED = 0x7F - -TRACE_SERAM_BOOT_COMPLETE = 0x80 -TRACE_SERAM_BOOT_ERROR = 0x81 -TRACE_SERAM_OS_ERROR = 0x82 -TRACE_VBAT_ANA_REG1 = 0x83 -TRACE_SOC_RESET = 0x84 -TRACE_EWIC_ENABLE = 0x85 -TRACE_EWIC_STATUS = 0x86 -TRACE_SOC_ID = 0x87 -TRACE_OVERRIDE_SOC_ID = 0x88 -TRACE_ACTIVE_SW_VERSION = 0x89 -TRACE_TOGGLE_EXTSYS0_WAKEUP = 0x8A -TRACE_TOGGLE_EXTSYS1_WAKEUP = 0x8B -TRACE_MRAM_WRITE_FAILURE = 0x8C -TRACE_MRAM_CONTROLLER_ERROR = 0x8D -TRACE_SERAM_RESET_HANDLER = 0x8E -TRACE_FAST_BOOT = 0x8B - -TRACE_BANK_A_VALID = 0x90 -TRACE_BANK_B_VALID = 0x91 -TRACE_BANK_A_FIRST_BOOT = 0x92 -TRACE_BANK_B_FIRST_BOOT = 0x93 -TRACE_BANK_A_INVALID = 0x94 -TRACE_BANK_B_INVALID = 0x95 -TRACE_BOOT_BANK_A = 0x96 -TRACE_BOOT_BANK_B = 0x97 -TRACE_BANK_A_BOOTED = 0x98 -TRACE_BANK_B_BOOTED = 0x99 -TRACE_PARTIAL_TRIMMING = 0x9A -TRACE_FULL_TRIMMING = 0x9B -TRACE_TRIM55 = 0x9C -TRACE_TRIM56 = 0x9D -TRACE_TRIM57 = 0x9E -TRACE_TRIM58 = 0x9F - -TRACE_RISC_V_RELEASED = 0xA0 -TRACE_RISC_V_EXTSYS0_RESET = 0xA1 -TRACE_RISC_V_EXTSYS0_SHUTDOWN = 0xA2 -TRACE_RISC_V_EXTSYS0_EXTSYS1_WAKEUP = 0xA3 -TRACE_RISC_V_EXTSYS0_WRITE_WAKEUP_SENTINEL = 0xA4 -TRACE_BISR_OTP_CHECK = 0xA5 -TRACE_BISR_NOT_NEEDED = 0xA6 -TRACE_BISR_ENABLE = 0xA7 -TRACE_BISR_FINISHED = 0xA8 -TRACE_BISR_REPAIR_FAILED = 0xA9 -TRACE_RESUME_FROM_STANDBY = 0xAA -TRACE_BOOT_TIME_US = 0xAB -TRACE_TURN_OFF_SE_POWER = 0xAC -TRACE_TURN_ON_HOST_POWER = 0xAD -TRACE_HARD_FAULT = 0xAE -TRACE_HARD_FAULT_PC = 0xAF - -TRACE_STOP_ENABLE_END = 0xB0 -TRACE_OFF_HANDLER = 0xB1 -TRACE_STOP_VOTES_OK = 0xB2 -TRACE_SE_PPU_INTR = 0xB3 -TRACE_ES0_PPU_INTR = 0xB4 -TRACE_ES1_PPU_INTR = 0xB5 -TRACE_STOP_BEGIN = 0xB6 -TRACE_STOP_0 = 0xB7 -TRACE_STOP_1 = 0xB8 -TRACE_STOP_2 = 0xB9 -TRACE_STOP_3 = 0xBA -TRACE_STOP_4 = 0xBB -TRACE_STOP_5 = 0xBC -TRACE_STOP_6 = 0xBD -TRACE_STOP_7 = 0xBE -TRACE_STOP_8 = 0xBF - -TRACE_STOP_9 = 0xD0 -TRACE_STOP_10 = 0xD1 -TRACE_STOP_11 = 0xD2 -TRACE_STOP_12 = 0xD3 -TRACE_STOP_13 = 0xD4 -TRACE_STOP_14 = 0xD5 -TRACE_STOP_15 = 0xD6 - -TRACE_PINMUX = 0xD7 -TRACE_BOOT_INIT = 0xD8 -TRACE_POWER_INIT = 0xD9 -TRACE_SES_INIT = 0xDA -TRACE_MRAM_CFG = 0xDB -TRACE_MRAM_PWR_EN = 0xDC -TRACE_HARD_FAULT_LR = 0xDD - -# Marker trace translation -marker_lookup = { - TRACE_BEGIN_RESET : 'Begin Reset_Handler', - TRACE_SE_FIREWALL : 'SE Firewall configuration', - TRACE_HOST_FIREWALL : 'HOST Firewall configuration', - TRACE_FIREWALL_CTRL_READY : 'Firewall controller ready', - TRACE_FIREWALLS_INITIALIZED : 'Firewall initialized', - TRACE_LCS_INITIALIZATIONS : 'Begin CC312 initializations', - TRACE_LCS_CM : 'LCS = 0 -> CM', - TRACE_LCS_DM : 'LCS = 1 -> DM', - TRACE_LCS_UNKNOWN_1 : 'LCS = 2 -> UNKNOWN_1', - TRACE_LCS_UNKNOWN_2 : 'LCS = 3 -> UNKNOWN_2', - TRACE_LCS_UNKNOWN_3 : 'LCS = 4 -> UNKNOWN_3', - TRACE_LCS_SE : 'LCS = SE', - TRACE_LCS_UNKNOWN_4 : 'LCS = 6 -> UNKNOWN_4', - TRACE_LCS_RMA : 'LCS = RMA', - TRACE_BEGIN_MAIN : 'Begin Main', - TRACE_FIND_STOC : 'Find STOC in MRAM', - TRACE_LOCATE_CERT_CHAIN : 'Locate certificate chain', - TRACE_RAW_BYPASS_CHECK : 'Raw Bypass check', - TRACE_RAW_BYPASS : 'Raw Bypass method invoked', - TRACE_VERIFY_CERT_CHAIN : 'Verify certificate chain', - TRACE_SRAM_RETAINED : 'SRAM retained', - TRACE_SECURE_LCS_BOOT : 'SECURE LCS Cold Boot', - TRACE_WAKE_UP_BROWNOUT : 'Brownout detected', - TRACE_START_CM55_HE : 'Fast Boot Start CM55_HE', - TRACE_CERT_CHAIN_VERIFY_START : 'Begin certificate chain verification', - TRACE_EACH_CERT_VERIFY : 'Verify each certificate', - TRACE_CERT_CHAIN_VERIFY_END : 'End certificate chain verification', - TRACE_SERAM_JUMP : 'Jump to SERAM', - TRACE_PROCESS_ERROR : 'SEROM Error Detected', - TRACE_CERTIFICATE_ERROR : 'Certificate Processing Error Detected', - TRACE_CM55_HE_FORCE_COLD_BOOT : 'Force CM55-HE cold boot', - TRACE_CLEAR_FIRST_BOOT_MRAM_WRITE_FAIL : 'Clear boot flag MRAM write failed', - TRACE_MARK_BANK_NOT_VALID_MRAM_WRITE_FAIL : 'Mark Bank not valid MRAM write failed', - TRACE_SET_IMAGE_BOOTED_MRAM_WRITE_FAIL : 'Set Image Booted Flag in MRAM failed', - TRACE_UPDATE_ERROR_CODES_MRAM_WRITE_FAIL : 'Update Error Codes in MRAM failed', - TRACE_UPDATE_BOOTFLAGS_CHECKSUM_MRAM_WRITE_FAIL: 'Update Boot Flags Checksum in MRAM failed', - TRACE_BANK_A_NOT_BOOTABLE : 'Bank A not bootable', - TRACE_BANK_B_NOT_BOOTABLE : 'Bank B not bootable', - TRACE_NEWER_BANK_A : 'Bank A is newer', - TRACE_NEWER_BANK_B : 'Bank B is newer', - TRACE_TOC1_SERAM_OFFSET_INVALID : 'TOC1 SERAM Offset invalid', - TRACE_TOC2_SERAM_OFFSET_INVALID : 'TOC2 SERAM Offset invalid', - TRACE_TOC1_EXTENSION_HEADER_INVALID : 'TOC1 Extension Header invalid', - TRACE_TOC2_EXTENSION_HEADER_INVALID : 'TOC2 Extension Header invalid', - TRACE_TOC1_BOOT_FLAGS_CHECKSUM_INVALID : 'TOC1 Boot Flags Checksum invalid', - TRACE_TOC2_BOOT_FLAGS_CHECKSUM_INVALID : 'TOC2 Boot Flags Checksum invalid', - TRACE_BANK_A_BOOT_FAILED : 'BANK A boot failed', - TRACE_BANK_B_BOOT_FAILED : 'BANK B boot failed', - TRACE_WAKE_UP_RESET : 'SOC reset was triggered', - TRACE_LOAD_MSP_ADDRESS : 'Load MSP Address', - TRACE_LOAD_JUMP_ADDRESS : 'Load JUMP Address', - TRACE_INVALID_TOC_OFFSET : 'Invalid Alif TOC offset specified', - TRACE_CM55_HE_CPU_WAIT_RELEASE : 'CM55 HE CPU wait release', - TRACE_PROCESS_ERROR_EXTENDED : 'SEROM Error Detected - extended error', - TRACE_FAST_BOOT_FIREWALL_PROTECT : 'FAST BOOT configure firewall protection', - TRACE_BEGIN_CGU_CLOCK_CONFIGURATION : 'Begin CGU clock configuration', - TRACE_CGU_CLOCKS_CONFIGURED : 'CGU clock configuration complete', - TRACE_MRAM_RESET_ERROR_BYPASS : 'Enable MRAM ECC Error Interrupts', - TRACE_MRAM_SET_ERROR_BYPASS : 'Disable MRAM ECC Error Interrupts', - TRACE_BAD_SERAM_JUMP_ADDRESS : 'Bad SERAM Jump Address', - TRACE_BOOT_LOADER_JUMP_RETURNED : 'Boot Loader Jump Returned', - TRACE_TURN_ON_SYSTEM_POWER : 'Turn On SE System POWER Register', - TRACE_SERAM_RETENTION_PATTERN : 'SERAM retention pattern detected', - TRACE_FIREWALL_STATIC_CONFIG_BEGIN : 'Firewall Static BEGIN', - TRACE_FIREWALL_STATIC_CONFIG_END : 'Firewall Static END ', - TRACE_PLL_INIT_BEGIN : 'PLL BEGIN', - TRACE_PLL_INIT_END : 'PLL END', - TRACE_MAINTENANCE_MODE_DETECT_BEGIN : 'Maintenance Detection BEGIN', - TRACE_MAINTENANCE_MODE_DETECT_END : 'Maintenance Detection END', - TRACE_CC_LIB_INIT_BEGIN : 'CC Lib BEGIN', - TRACE_CC_LIB_INIT_END : 'CC Lib END', - TRACE_M55_HE_TCM_INIT_BEGIN : 'M55 HE TCM Init BEGIN', - TRACE_M55_HE_TCM_INIT_END : 'M55 HE TCM Init END', - TRACE_ATOC_MISC_BEGIN : 'ATOC MISC BEGIN', - TRACE_ATOC_MISC_END : 'ATOC MISC END', - TRACE_STOC_DEVICE_BEGIN : 'STOC DEVICE BEGIN', - TRACE_STOC_DEVICE_END : 'STOC DEVICE END', - TRACE_STOC_PART_NUMBER : 'STOC Part#', - TRACE_START_MAIN : 'main() start', - - TRACE_STOC_PROCESS_BEGIN : 'STOC Process BEGIN', - TRACE_ATOC_PROCESS_BEGIN : 'ATOC Process BEGIN', - TRACE_TOC_PROCESS_END : 'TOC Process END', - TRACE_TOC_PRINT_BEGIN : 'TOC Print BEGIN', - TRACE_TOC_PRINT_END : 'TOC Print END', - TRACE_BANK_MAINTENANCE_BEGIN : 'BANK Maintenance BEGIN', - TRACE_BANK_MAINTENANCE_END : 'BANK Maintenance END', - TRACE_CPU_RELEASE : 'CPU release', - TRACE_CPU_BOOT : 'CPU boot', - TRACE_WAKE_UP : 'Wake up', - TRACE_COLD_BOOT : 'Cold boot', - TRACE_M55_FASTBOOT_SERAM : 'M55 fast boot by SERAM', - TRACE_M55_TCM_RETAINED : 'M55 TCM was retained', - TRACE_M55_VTOR_SENTINEL : 'M55 VTOR SENTINEL detected', - TRACE_STOP_MODE_ENABLE_BEGIN : 'Stop mode enable BEGIN', - TRACE_1_MAIN : 'main() 1', - - TRACE_RTOS_WFI_BEGIN : 'RTOS Wfi BEGIN', - TRACE_RTOS_WFI_END : 'RTOS Wfi END', - TRACE_2_MAIN : 'main() 2', - TRACE_3_MAIN : 'main() 3', - TRACE_ENTER_MAINTENANCE_MODE : 'Enter maintenance mode', - TRACE_DCU_CONFIG_BEGIN : 'Begin DCU configuration', - TRACE_DCU_CONFIG_END : 'Finish DCU configuration', - TRACE_RECEIVE_MHU : 'Receive MHU', - TRACE_PROCESS_MHU : 'Process MHU', - TRACE_FINISH_MHU : 'Finish MHU', - TRACE_SERAM_TO_M55_HP : 'SERAM to M55_HP MHU', - TRACE_SERAM_TO_M55_HE : 'SERAM to M55_HE MHU', - TRACE_M55_HP_TO_SERAM : 'M55_HP to SERAM MHU', - TRACE_M55_HE_TO_SERAM : 'M55_HE to SERAM MHU', - TRACE_BEGIN_TRIMMING : 'Begin installing analog trim values', - TRACE_FINISH_TRIMMING : 'Finish installing analog trim values', - TRACE_BEGIN_SERAM_BANK_COPY : 'SERAM bank copy BEGIN', - TRACE_END_SERAM_BANK_COPY : 'SERAM bank copy END', - TRACE_M55_FASTBOOT_SERAM_XIP : 'M55 XIP fast boot by SERAM', - TRACE_WARM_BOOT : 'Warm boot', - TRACE_A32_0_RELEASED : 'A32_0 released', - TRACE_A32_1_RELEASED : 'A32_1 released', - TRACE_M55_HP_RELEASED : 'M55_HP released', - TRACE_M55_HE_RELEASED : 'M55_HE released', - TRACE_MODEM_RELEASED : 'M55 MODEM released', - TRACE_GNSS_RELEASED : 'M55 GNSS released', - TRACE_DSP_RELEASED : 'DSP released', - TRACE_VBAT_ANA_REG1 : 'Program VBAT_ANA_REG1', - TRACE_VBAT_ANA_REG2 : 'Program VBAT_ANA_REG2', - TRACE_VBAT_ANA_REG3 : 'Program VBAT_ANA_REG3', - TRACE_DCDC_REG1 : 'Program DCDC_REG1', - TRACE_COMP_REG2 : 'Program COMP_REG2', - TRACE_NO_TRIM_VALUES_SPECIFIED : 'No trim values specified', - TRACE_SERAM_BOOT_COMPLETE : 'SERAM boot complete', - TRACE_SERAM_BOOT_ERROR : 'SERAM boot error', - TRACE_SERAM_OS_ERROR : 'SERAM operating system boot error', - TRACE_BANK_A_VALID : 'BANK A is VALID', - TRACE_BANK_B_VALID : 'BANK B is VALID', - TRACE_BANK_A_FIRST_BOOT : 'BANK A is FIRST BOOT', - TRACE_BANK_B_FIRST_BOOT : 'BANK B is FIRST BOOT', - TRACE_BANK_A_INVALID : 'BANK A is INVALID', - TRACE_BANK_B_INVALID : 'BANK B is INVALID', - TRACE_BOOT_BANK_A : 'BOOT BANK A', - TRACE_BOOT_BANK_B : 'BOOT BANK B', - TRACE_BANK_A_BOOTED : 'BANK A BOOTED', - TRACE_BANK_B_BOOTED : 'BANK B BOOTED', - TRACE_FULL_TRIMMING : 'Full trim specified', - TRACE_TRIM55 : 'Trim OTP word 0x55', - TRACE_TRIM56 : 'Trim OTP word 0x56', - TRACE_TRIM57 : 'Trim OTP word 0x57', - TRACE_TRIM58 : 'Trim OTP word 0x58', - TRACE_SOC_RESET : 'SOC Reset Cold Boot', - TRACE_EWIC_ENABLE : 'Configure EWIC Enable', - TRACE_EWIC_STATUS : 'Read EWIC Status', - TRACE_SOC_ID : 'Read SOC_ID', - TRACE_OVERRIDE_SOC_ID : 'Override SOC_ID', - TRACE_ACTIVE_SW_VERSION : 'Certificate Active Software Version', - TRACE_TOGGLE_EXTSYS0_WAKEUP : 'Toggle EXTSYS0 Wakeup', - TRACE_TOGGLE_EXTSYS1_WAKEUP : 'Toggle EXTSYS1 Wakeup', - TRACE_MRAM_WRITE_FAILURE : 'MRAM Write Miscompare Failure', - TRACE_MRAM_CONTROLLER_ERROR : 'MRAM Write Controller Error', - TRACE_SERAM_RESET_HANDLER : 'SERAM reset handler', - TRACE_FAST_BOOT : 'FAST BOOT', - TRACE_RISC_V_RELEASED : 'RISC-V released', - TRACE_RISC_V_EXTSYS0_RESET : 'EXTSYS0 Reset', - TRACE_RISC_V_EXTSYS0_SHUTDOWN : 'EXTSYS0 Shutdown', - TRACE_RISC_V_EXTSYS0_EXTSYS1_WAKEUP : 'EXTSYS1 Wakeup', - TRACE_RISC_V_EXTSYS0_WRITE_WAKEUP_SENTINEL : 'EXTSYS0 Sentinel write', - TRACE_BISR_OTP_CHECK : 'BISR OTP check', - TRACE_BISR_NOT_NEEDED : 'BISR not needed', - TRACE_BISR_ENABLE : 'BISR enable', - TRACE_BISR_FINISHED : 'BISR finished', - TRACE_BISR_REPAIR_FAILED : 'BISR repair failed', - TRACE_RESUME_FROM_STANDBY : 'Resume from STANDBY mode', - TRACE_BOOT_TIME_US : 'Boot time in us', - TRACE_TURN_OFF_SE_POWER : 'Turn off SE POWER register', - TRACE_TURN_ON_HOST_POWER : 'Turn on HOST POWER register', - TRACE_HARD_FAULT : 'HARD FAULT - R0', - TRACE_HARD_FAULT_PC : 'HARD FAULT - PC', - TRACE_BISR_REPAIR_FAILED : 'BISR repair failed', - TRACE_STOP_ENABLE_END : 'Stop mode enable END', - TRACE_OFF_HANDLER : 'OFF mode handler', - TRACE_STOP_VOTES_OK : 'STOP votes OK', - TRACE_SE_PPU_INTR : 'SE PPU interrupt', - TRACE_ES0_PPU_INTR : 'ES0 PPU interrupt', - TRACE_ES1_PPU_INTR : 'ES1 PPU interrupt', - TRACE_STOP_BEGIN : 'STOP mode settings begin', - TRACE_STOP_0 : 'STOP_0', - TRACE_STOP_1 : 'STOP_1', - TRACE_STOP_2 : 'STOP_2', - TRACE_STOP_3 : 'STOP_3', - TRACE_STOP_4 : 'STOP_4', - TRACE_STOP_5 : 'STOP_5', - TRACE_STOP_6 : 'STOP_6', - TRACE_STOP_7 : 'STOP_7', - TRACE_STOP_8 : 'STOP_8', - TRACE_STOP_9 : 'STOP_9', - TRACE_STOP_10 : 'STOP_10', - TRACE_STOP_11 : 'STOP_11', - TRACE_STOP_12 : 'STOP_12', - TRACE_STOP_13 : 'STOP_13', - TRACE_STOP_14 : 'STOP_14', - TRACE_STOP_15 : 'STOP_15', - TRACE_PINMUX : 'PinMux', - TRACE_BOOT_INIT : 'Boot Init', - TRACE_POWER_INIT : 'Power Init', - TRACE_SES_INIT : 'Ses Init', - TRACE_MRAM_CFG : 'MRAM config', - TRACE_MRAM_PWR_EN : 'MRAM power enable', - TRACE_HARD_FAULT_LR : 'HARD FAULT - LR' -} - -service_id_lut = { - 0 : "SERVICE_MAINTENANCE_HEARTBEAT_ID", - 1 : "SERVICE_MAINTENANCE_RTC_ID", - - 100 : "SERVICE_APPLICATION_CLOCK_MANAGEMENT", - 101 : "SERVICE_APPLICATION_PINMUX_ID", - 102 : "SERVICE_APPLICATION_PAD_CONTROL_ID", - 103 : "SERVICE_APPLICATION_FIRMWARE_VERSION_ID", - 104 : 'SERVICE_APPLICATION_UART_WRITE_ID', - 105 : "SERVICE_APPLICATION_OSPI_WRITE_KEY_ID", - 106 : "SERVICE_APPLICATION_DMPU_ID", - - 200 : "SERVICE_SYSTEM_MGMT_GET_TOC_VERSION", - 201 : "SERVICE_SYSTEM_MGMT_GET_TOC_NUMBER", - 202 : "SERVICE_SYSTEM_MGMT_GET_TOC_FLAGS", - 203 : "SERVICE_SYSTEM_MGMT_GET_TOC_VIA_CPU_ID", - 204 : "SERVICE_SYSTEM_MGMT_GET_TOC_VIA_CPU_NAME", - 205 : "SERVICE_SYSTEM_MGMT_GET_TOC_INFO", - 206 : "SERVICE_SYSTEM_MGMT_GET_OTP_INFO", - 207 : "SERVICE_SYSTEM_MGMT_GET_DEVICE_PART_NUMBER", - 208 : "SERVICE_SYSTEM_MGMT_GET_DEVICE_REVISION_DATA", - 209 : "SERVICE_SYSTEM_MGMT_SET_CAPABILITIES_DEBUG", - 210 : "SERVICE_SYSTEM_MGMT_READ_OTP", - 211 : "SERVICE_SYSTEM_MGMT_WRITE_OTP", - - 300 : "SERVICE_POWER_STOP_MODE_REQ_ID", - 301 : "SERVICE_POWER_EWIC_CONFIG_REQ_ID", - 302 : "SERVICE_POWER_VBAT_WAKEUP_CONFIG_REQ_ID", - 303 : "SERVICE_POWER_MEM_RETENTION_CONFIG_REQ_ID", - 304 : "SERVICE_POWER_M55_HE_VTOR_SAVE_REQ_ID", - 305 : "SERVICE_POWER_M55_HP_VTOR_SAVE_REQ_ID", - 306 : "SERVICE_POWER_GLOBAL_STANDBY_REQ_ID", - 307 : "SERVICE_POWER_MEMORY_POWER_REQ_ID", - 308 : "SERVICE_POWER_DCDC_VOLTAGE_REQ_ID", - 309 : "SERVICE_POWER_LDO_VOLTAGE_REQ_ID", - 310 : "SERVICE_POWER_GET_RUN_REQ_ID", - 311 : "SERVICE_POWER_SET_RUN_REQ_ID", - 312 : "SERVICE_POWER_GET_OFF_REQ_ID", - 313 : "SERVICE_POWER_SET_OFF_REQ_ID", - 314 : "SERVICE_POWER_SETTING_CONFIG_REQ_ID", - 315 : "SERVICE_POWER_SETTING_GET_REQ_ID", - - 400 : "SERVICE_CRYPTOCELL_GET_RND", - 401 : "SERVICE_CRYPTOCELL_GET_LCS", - 402 : "SERVICE_CRYPTOCELL_MBEDTLS_AES_INIT", - 403 : "SERVICE_CRYPTOCELL_MBEDTLS_AES_SET_KEY", - 404 : "SERVICE_CRYPTOCELL_MBEDTLS_AES_CRYPT", - 405 : "SERVICE_CRYPTOCELL_MBEDTLS_CCM_GCM_SET_KEY", - 406 : "SERVICE_CRYPTOCELL_MBEDTLS_CCM_GCM_CRYPT", - 407 : "SERVICE_CRYPTOCELL_MBEDTLS_CHACHA20_CRYPT", - 408 : "SERVICE_CRYPTOCELL_MBEDTLS_CHACHAPOLY_CRYPT", - 409 : "SERVICE_CRYPTOCELL_MBEDTLS_POLY1305_CRYPT", - 410 : "SERVICE_CRYPTOCELL_MBEDTLS_SHA_STARTS", - 411 : "SERVICE_CRYPTOCELL_MBEDTLS_SHA_PROCESS", - 412 : "SERVICE_CRYPTOCELL_MBEDTLS_SHA_UPDATE", - 413 : "SERVICE_CRYPTOCELL_MBEDTLS_SHA_FINISH", - 414 : "SERVICE_CRYPTOCELL_MBEDTLS_TRNG_HARDWARE_POLL", - 415 : "SERVICE_CRYPTOCELL_MBEDTLS_CMAC_INIT_SETKEY", - 416 : "SERVICE_CRYPTOCELL_MBEDTLS_CMAC_UPDATE", - 417 : "SERVICE_CRYPTOCELL_MBEDTLS_CMAC_FINISH", - 418 : "SERVICE_CRYPTOCELL_MBEDTLS_CMAC_RESET", - - 500 : "SERVICE_BOOT_PROCESS_TOC_ENTRY", - 501 : "SERVICE_BOOT_CPU", - 502 : "SERVICE_BOOT_RELEASE_CPU", - 503 : "SERVICE_BOOT_RESET_CPU", - 504 : "SERVICE_BOOT_RESET_SOC", - 505 : "SERVICE_BOOT_SET_VTOR", - 506 : "SERVICE_BOOT_SET_ARGS", - - 600 : "SERVICE_UPDATE_STOC", - - 700 : "SERVICE_CLOCK_SELECT_OSC", - 701 : "SERVICE_CLOCK_SELECT_PLL", - 702 : "SERVICE_CLOCK_SET", - 703 : "SERVICE_CLOCK_ES0_SE", - 704 : "SERVICE_CLOCK_ES1_SE", - 705 : "SERVICE_CLOCK_SELECT_A32", - 706 : "SERVICE_CLOCK_SELECT_ACLK", - 707 : "SERVICE_CLOCK_SET_D", - 708 : "SERVICE_PLL_INIT", - 709 : "SERVICE_PLL_DEINIT", - 710 : "SERVICE_PLL_XTAL_START", - 711 : "SERVICE_PLL_XTAL_STOP", - 712 : "SERVICE_PLL_XTAL_IS_STARTED", - 713 : "SERVICE_PLL_CLKPLL_START", - 714 : "SERVICE_PLL_CLKPLL_STOP", - 715 : "SERVICE_PLL_CLKPLL_IS_LOCKED", - 716 : "SERVICE_CLOCK_GET", - - 800 : "SERVICE_EXTSYS0_BOOT_SET_ARGS", - 801 : "SERVICE_EXTSYS0_EXTSYS1_WAKEUP", - 802 : "SERVICE_EXTSYS0_SHUTDOWN" -} - -def readMemory32(address,offset): - """ - return an integer from byte list provided - """ - return int.from_bytes([address[offset+0], - address[offset+1], - address[offset+2], - address[offset+3]],"little") - -def trace_find_marker(marker_value, buffer): - """ - look for the Trace end marker in the trace buffer - @todo should look for the full 32-bits of the marker - """ - marker_found = False - position = 0 - - if marker_value in buffer: - marker_found = True - position = buffer.index(marker_value) - - return marker_found, position - -def trace_find_end_marker(end_marker_value, trace_buffer): - """ - look for the Trace end marker in the trace buffer - @todo should look for the full 32-bits of the marker - """ - marker_found = False - position = 0 - - for each_trace_item in range(0,NUMBER_OF_TRACES+4+4,4): - trace_word = readMemory32(trace_buffer, - each_trace_item) -# print("[{0:08x}] {1:8x}".format(trace_word,end_marker_value)) - if trace_word == end_marker_value : - marker_found = True - position = each_trace_item - #print("End marker 0x%x found at position 0x%x" %(end_marker_value, position)) - break - return marker_found, position - -def trace_buffer_decode(trace_buffer, seram_flag): - """ - trace_buffer_decode - based on the JYTHON code from ARM-DS - - Instead of using actual memory addresses, it is using an array passed - - """ - if (seram_flag): - print("*** SERAM Trace Buffer decode ***") - else: - print("*** SEROM Trace Buffer decode ***") - -# print("[DEBUG] trace_buffer_len %d Marker Pos %d\n" % ( -# len(trace_buffer), -# trace_buffer.index(0xee))) - - # Look for the end of trace marker - marker_found, end_of_trace = trace_find_end_marker(TRACE_BUFFER_END_MARKER, - trace_buffer) - if not marker_found: - print("[ERROR] No end of trace marker was found") - return - - # trace vars structure is at the end of the trace buffer - # header start - trace_vars_address = end_of_trace - 4 - - trace_vars_p = readMemory32(trace_buffer, trace_vars_address) - print("*** Trace Header ***") - print("[0x{0:08x}] 0x{1:08x}".format(trace_vars_address,trace_vars_p)) - - trace_total = (trace_vars_p >> 16) & 0xFF - #print("trace_vars_p >> 16 trace_total = 0x%x" %(trace_total)) - trace_total = min(trace_total, NUMBER_OF_TRACES / 4) - - trace_vars_address += 4 - trace_vars_p = trace_buffer[trace_vars_address] - print("[0x{0:08x}] 0x{1:08x}" .format(trace_vars_address, - readMemory32(trace_buffer,trace_vars_address))) - print("trace_total = %d" %(trace_total)) - print("********************") - - # Decode the trace buffer - print(" Address Seq# LR Trace Marker Marker Data") - - word_offset = 0 - - while trace_total > 0: - #print(" ") - #print("while() start. trace_total = 0x%x" %(trace_total)) - variable_enabled = False - read_address = TRACE_BASE_ADDRESS + word_offset - trace_item = readMemory32(trace_buffer,read_address) - if trace_item == VOID_ENTRY: - print(" XXXXXXXX") - else: - flag = (trace_item & FLAG_MASK) >> FLAG_MASK_SHIFT - seq_id = (trace_item & SEQ_ID_MASK) >> SEQ_ID_MASK_SHIFT - addr = (trace_item & ADDR_MASK) >> ADDR_MASK_SHIFT - marker = (trace_item & MARKER_MASK) >> MARKER_MASK_SHIFT - - #print("word_offset = 0x%x" %(word_offset)) - #print("trace_item = 0x%x" %(trace_item)) - #print("flag = 0x%x" %(flag)) - #print("marker = 0x%x" %(marker)) - #print("read_address = 0x%x" %(read_address)) - - if TRACE_FLAG_WORD_DATA == flag: - #print("TRACE_FLAG_WORD_DATA") - #trace_total = trace_total - 1 #marker + data - - read_address = TRACE_BASE_ADDRESS + word_offset - # second 32-bit word is data we need, advance the word_offset - #word_offset = word_offset + 4 - word_offset = (word_offset + 4) % NUMBER_OF_TRACES - word_data_address = TRACE_BASE_ADDRESS + word_offset - word_data = readMemory32(trace_buffer,word_data_address) - - #print("word_offset = 0x%x" %(word_offset)) - #print("word_data_address = 0x%x" %(word_data_address)) - #print("word_data = 0x%x" %(word_data)) - - if marker in marker_lookup: - marker_string = marker_lookup[marker] - if marker_string is None: - marker_string = "MARKER?" - variable_enabled = False - else: - variable_enabled = True - - #print("marker_string = %s" %(marker_string)) - marker = (trace_item & MARKER_MASK) >> MARKER_MASK -# print("[%08x] %2d %8X %4X %2X" %(read_address, -# seq_id, -# trace_item, -# addr, -# marker)) -# print("variable_enabled = %d" %(variable_enabled)) - if (marker_string.__eq__("Process MHU")): - service_id_string = service_id_lut[word_data] - print("[%08x] %2d 0x%04X %-45s %s" %(read_address, - seq_id, addr, marker_string, service_id_string)) - elif variable_enabled is True: - if marker_string.__eq__("STOC Part#"): - print("PART NUMBER#1") - print("[%08x] %2d 0x%04X %8X 0x%08X %c" %(read_address, - addr, seq_id, 0x10, trace_item, word_data, chr(word_data & 0xFF))) - else: - print("[%08x] %2d 0x%04X %8X 0x%08X" %(read_address, - seq_id, addr, trace_item, word_data)) - else: - if marker_string.__eq__("STOC Part#"): # Decode the STOC Part # - print("[%08x] %2d 0x%04X %-45s 0x%08X %c%c%c%c" %(read_address, - seq_id, addr, marker_string, word_data, - chr(word_data & 0xFF), - chr(word_data >> 8 & 0xFF), - chr(word_data >> 16 & 0xFF), - chr(word_data >> 24 & 0xFF) ) - ) - else: - print("[%08x] %2d 0x%04X %-45s 0x%08X" %(read_address, - seq_id, addr, marker_string, word_data)) - - elif TRACE_FLAG_TIMESTAMP == flag: - #print("TRACE_FLAG_TIMESTAMP") - #trace_total = trace_total - 1 #marker + timestamp - # second 32-bit word is time stamp, advance the word_offset - #word_offset = word_offset + 4 - word_offset = (word_offset + 4) % NUMBER_OF_TRACES - read_address = TRACE_BASE_ADDRESS + word_offset - trace_item_dword = readMemory32(trace_buffer,read_address) - - #print("word_offset = 0x%x" %(word_offset)) - #print("read_address = 0x%x" %(read_address)) - #print("trace_item_dword = 0x%x" %(trace_item_dword)) - - if marker in marker_lookup: - marker_string = marker_lookup[marker] - if marker_string is None: - marker_string = "MARKER?" - variable_enabled = False - else: - variable_enabled = True - print("[%08x] %2d 0x%04X %-45s T:%8d" %( - read_address, - seq_id, - addr, - marker_string, - trace_item_dword)) - - elif TRACE_FLAG_BYTE_DATA == flag: - #print("TRACE_FLAG_BYTE_DATA") - if marker in marker_lookup: - marker_string = marker_lookup[marker] - if marker_string is None: - marker_string = "MARKER?" - variable_enabled = False - else: - variable_enabled = True - - if variable_enabled is True: - print("[%08x] %2d 0x%04X %2X" %(read_address, - seq_id, - addr, - marker)) - else: - print("[%08x] %2d 0x%04X %-45s" %(read_address, - seq_id, - addr, - marker_string)) - - else: - #print("Unknown flag = 0x%x" %(flag)) - print("[%08x] %2d 0x%04X 0x%04X 0x%02X" %(read_address, - seq_id, - trace_item, - addr, - marker)) - - word_offset = (word_offset + 4) % NUMBER_OF_TRACES - - trace_total = trace_total - 1 - -# if word_offset >= (NUMBER_OF_TRACES * 4): - if word_offset >= (NUMBER_OF_TRACES): - break diff --git a/tools/alif/isp/version_decode.py b/tools/alif/isp/version_decode.py deleted file mode 100755 index f2f17c2e5..000000000 --- a/tools/alif/isp/version_decode.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/python3 - -""" - @brief Version data decode - - __author__ onyettr -""" -# pylint: disable=unused-argument, invalid-name -import struct -from isp_print import isp_print_color -from isp_print import isp_print_response -from otp_mfgr_decode import decode_otp_manufacture - -# Wounding bits -OTP_WOUNDING_ALIF_DFT = 1 << 0 -OTP_WOUNDING_RESERVED_0 = 1 << 1 -OTP_WOUNDING_RESERVED_1 = 1 << 2 -OTP_WOUNDING_DISABLE_A32_0 = 1 << 3 -OTP_WOUNDING_DISABLE_A32_1 = 1 << 4 -OTP_WOUNDING_DISABLE_M55_HP = 1 << 5 -OTP_WOUNDING_DISABLE_MODEM = 1 << 6 -OTP_WOUNDING_DISABLE_GNSS = 1 << 7 - -# Wounding bit meanings ENSEMBLE Series -WOUNDING_lut_ensemble = { - 0 : "DFT Disable", - 1 : "Reserved", - 2 : "Reserved", - 3 : "A32_0 Disable", - 4 : "A32_1 Disable", - 5 : "M55_HP Disable", - 6 : "Modem Disable", - 7 : "GNSS Disable" -} - -# Wounding bit meanings for BALLETTO Series -WOUNDING_lut_balletto = { - 0 : "DFT Disable", # Bit 16 - 1 : "JTAG0 Disable", # Bit 17 - 2 : "JTAG1 Disable", # Bit 18 - 3 : "BLE Disable", # Bit 19 - 4 : "Unused Disable", # Bit 20 - 5 : "Unused Disable", # Bit 21 - 6 : "Unused Disable", # Bit 22 - 7 : "Unused Disable", # Bit 23 -} - -# Life Cycle State -LCS_lut = { - 0 : "CM", - 1 : "DM", - 5 : "SE", - 7 : "RMA" -} - -def display_version_info(message): - """ - display_version_info - display version data sent back from Target - """ - -def display_string(field): - """ - display_string - """ - #isp_print_color("blue"," " + str(field) + "\t\t= ") - for ch in field: - l = hex(ch)[2:] - if len(l) == 1: - l = '0' + l - isp_print_color("blue", l) - print("") - -def version_decode(isp, message): - """ - version_decode - parse version data - """ - - if len(message) == 7: - isp_print_response("blue",message) - - if len(message) == 136: - (version,ALIF_PN,) = struct.unpack("> each_bit) & 0x1 == 0x1: - isp_print_color("blue","\n\t") - - # Check the device version as wounding is different - if version in [0xA001]: - isp_print_color("blue",WOUNDING_lut_balletto.get(each_bit)) - else: - isp_print_color("blue",WOUNDING_lut_ensemble.get(each_bit)) - print("") - - DCU = message[78:94] #bytes 78-93 (limit 94) - isp_print_color("blue"," DCU\t\t= ") - isp_print_color("blue",hex(int.from_bytes(DCU,"little"))) - print("") - - MfgData = message[94:126] #bytes 94-125 (limit 126) - MfgDatatInt = int.from_bytes(MfgData,"little") - isp_print_color("blue"," MfgData\t= ") - #isp_print_color("blue",hex(MfgDatatInt)) - display_string(MfgData) - if MfgDatatInt != 0: - decode_otp_manufacture(MfgData) - - #SerialN = (message[127:134]) #bytes 127-133 (limit 134) - #isp_print_color("blue"," SerialN\t= ") - #isp_print_color("blue",hex(int.from_bytes(SerialN,"little"))) - #print("") - - LCS = message[134] - isp_print_color("blue"," LCS\t\t= 0x%x (%s)" % ( - LCS, - LCS_lut.get(LCS)) - ) - print("") diff --git a/tools/alif/maintenance.py b/tools/alif/maintenance.py deleted file mode 100755 index ac431a76c..000000000 --- a/tools/alif/maintenance.py +++ /dev/null @@ -1,798 +0,0 @@ -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string -#pylint: disable=import-error,wrong-import-position,wildcard-import,undefined-variable -""" - Maintenance mode tool - - - Uses synchronous ISP commands - - __author__ = "ronyett" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.06.000" - __status__ = "Dev" " -""" - -import os -import sys -import argparse -sys.path.append("./isp") -from serialport import serialPort # ISP Serial support -from serialport import COM_TIMEOUT_RX_DEFAULT -from isp_protocol import * # ISP protocol constants -from isp_core import * -from isp_util import * -from isp_print import * -import device_probe -#from isp_print import isp_print_color, isp_print_cursor_enable -#from isp_print import isp_print_cursor_disable,isp_print_terminal_reset -from toc_decode import * # ISP TOC support -from power_decode import * # ISP POWER support -from utils.config import * -from utils.user_validations import validateArgList -from recovery import recovery_action, recovery_action_no_reset - - -# Define Version constant for each separate tool -# 0.01.000 Concept+realisation -# 0.02.000 add get TOC -# 0.03.000 add get CPU status -# 0.04.000 add get MRAM contents -# 0.05.000 add get SERAM metrics and terminal mode -# 0.06.000 add ERASE app mram feature -# 0.07.000 add FAST ERASE app mram feature -# 0.07.001 Cursor reset after terminal mode -# 0.08.001 add groups for menu items -# 0.08.002 Cursor reset after Hard Maintenance mode -# 0.08.003 added Ctrl-C in showAndSelectOptions() -# 0.08.004 added python error exit code -# 0.09.000 added menu configurations -# 0.10.000 Integrated recoery mode -# 0.11.000 added get POWER -# 0.12.000 add command line option -# 0.13.000 get baudrate from DBs -# 0.14.000 add get clock data -# 0.15.000 add Fast Erase including NTOC -# 0.16.000 add Recovery MRAM_READ -# 0.17.000 add different menues for SEROM/SERAM stages -TOOL_VERSION = "0.17.000" - -EXIT_WITH_ERROR = 1 -TARGET_RESPONDED = 1 -FAST_ERASE_SIZE = 16 - -def reset_action(isp): - """ - reset_action - reset the device, send ISP request to reset - """ - isp_reset(isp) - -def get_revision_action(isp): - """ - get device revision_action - obtain the device revision info - """ - isp_start(isp) - isp_get_revision(isp) - isp_stop(isp) - -def get_toc_action(isp): - """ - get toc action - obtain the TOC info from target - """ - isp_start(isp) - isp_get_toc_data(isp) - isp_stop(isp) - -def get_power_action(isp): - """ - get power action - obtain the POWER info from target - """ - isp_start(isp) - isp_get_power_data(isp) - isp_stop(isp) - -def get_clock_action(isp): - """ - get clock action - obtain the Clock, XTal, PLL info from target - """ - isp_start(isp) - isp_get_clock_data(isp) - isp_stop(isp) - -def get_banner_action(isp): - """ - get_banner_action - obtain the SERAM banner - """ - isp_start(isp) - isp_get_banner(isp) - isp_stop(isp) - -def get_cpu_status_action(isp): - """ - get cpu status_action - obtain the cpu boot info - """ - isp_start(isp) - isp_get_cpu_status(isp) - isp_stop(isp) - -def get_enquiry_action(isp): - """ - get_enquiry_action - Enquire what is at the end of the cable - """ - isp_start(isp) - isp_enquiry(isp) - isp_stop(isp) - -def get_mram_info_action(isp): - """ - get the real MRAM details - """ - isp_start(isp) - isp_get_mram_contents(isp) - isp_stop(isp) - -def get_seram_info_action(isp): - """ - get_seram_info_action - get seram metrics - """ - isp_start(isp) - isp_get_seram_metrics(isp) - isp_stop(isp) - -def get_mram_read_action(isp): - """ - get MRAMvalue - """ - offset = input('Enter hex word offset: ') - try: - offset_hex = int(offset,16) - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - except: - print("[ERROR] not a valid offset") - return - - isp_start(isp) - isp_read_mram(isp,offset_hex) - isp_stop(isp) - -def get_otp_read(isp): - """ - get OTP value - """ - offset = input('Enter word addr(hex): ') - try: - offset_hex = int(offset,16) - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - except: - print("[ERROR] not a valid hex offset") - return - - isp_start(isp) - isp_read_otp(isp,offset_hex) - isp_stop(isp) - -def get_address_action(isp): - """ - get address value - """ - address = input('Enter addr(hex): ') - try: - address_hex = int(address,16) - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - except: - print("[ERROR] not a valid address") - return - - isp_start(isp) - isp_get_address(isp,address_hex) - isp_stop(isp) - -def set_address_action(isp): - """ - set address value - """ - address = input('Enter addr(hex): ') - try: - address_hex = int(address,16) - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - except: - print("[ERROR] not a valid address") - return - - data = input('Enter data(hex): ') - try: - data_hex = int(data,16) - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - except: - print("[ERROR] not a valid address") - return - - isp_set_address(isp,address_hex,data_hex) - -def get_trace_buffer(isp): - """ - get SEROM trace buffer - """ - isp_start(isp) - isp_get_trace_buffer(isp) - isp_stop(isp) - -def get_seram_trace_buffer(isp): - """ - get SERAM trace buffer - """ - isp_start(isp) - try: - isp_get_seram_trace_buffer(isp) - except: - print('[ERROR] Unable to get SERAM trace when SEROM is in recovery mode') - isp_stop(isp) - -def set_print_enable_action(isp): - """ - set print enable - """ - isp_set_print_enable(isp, True) - -def set_print_disable_action(isp): - """ - set print disable - """ - isp_set_print_enable(isp, False) - -def set_logger_enable_action(isp): - """ - set Logger enable - """ - isp_set_log_enable(isp, True) - -def set_logger_disable_action(isp): - """ - set Logger disable - """ - isp_set_log_enable(isp, False) - -def terminal_mode(isp): - """ - terminal_mode - Enter terminal mode, use [CTRL-C] to exit - """ - ctrlc = CtrlCHandler() # [CTRL-C] handling - - print("[TERMINAL] Ctrl-C to exit") - going = True - - while going: - output_line = isp.readSerial(ISP_MAXIMUM_PACKET_SIZE) - raw_print = bytearray() - for i in range(len(output_line)): - raw_print.append(output_line[i]) - try: - ascii_char = raw_print.decode('ascii') - print(ascii_char,flush=True,end='') - sys.stdout.flush() - except UnicodeDecodeError: - pass - if ctrlc.Handler_exit(): - print("[INFO] CTRL-C") - break - - print("[TERMINAL] Ends") - isp_print_cursor_enable() - isp_print_terminal_reset() - -def application_mram_erase(isp, address, erase_length, reset): - """ - erase_application_mram_action - erase the Application area of MRAM based on the device details - """ - global baud_rate - - erase_length_fmt = "{:,}".format(erase_length) - pattern = 0x00000000 - - print("[INFO] erasing 0x%x %s bytes" %(address,erase_length_fmt)) - - put_target_in_maintenance_mode(isp, baud_rate,False) - - isp_start(isp) - isp_mram_erase(isp,address,erase_length,pattern) - isp_stop(isp) - if reset: - isp_reset(isp) - - -def full_erase_application_mram_action(isp): - """ - full_erase_application_mram_action - Full erase the Application area of MRAM based on the device details - """ - global OEM_BASE_ADDRESS - global OEM_MRAM_SIZE - - address = OEM_BASE_ADDRESS - erase_length = OEM_MRAM_SIZE - application_mram_erase(isp, address, erase_length, True) - print("[INFO] Full Erase done") - -def fast_erase_app_include_start_mram_action(isp): - """ - fast_erase_app_include_start_mram_action - Fast erase the Application area of MRAM (16 bytes) based on the device details - Plus the beginning of MRAM (0x8000-0000) - """ - global ALIF_BASE_ADDRESS - global OEM_BASE_ADDRESS - - # erase APP TOC - address = ALIF_BASE_ADDRESS - FAST_ERASE_SIZE - erase_length = FAST_ERASE_SIZE - # this function can't be called twice as target stops to respond - application_mram_erase(isp, address, erase_length, False) - - # erase start of mram (remove residuals from applications that start at 0x8000-0000) - address = OEM_BASE_ADDRESS - erase_length = FAST_ERASE_SIZE - # this function can't be called twice as target stops to respond - application_mram_erase(isp, address, erase_length, True) - - print("[INFO] Fast Erase done (incl. NTOC)") - -def fast_erase_application_mram_action(isp): - """ - fast_erase_application_mram_action - Fast erase the Application area of MRAM (16 bytes) based on the device details - """ - global ALIF_BASE_ADDRESS - - address = ALIF_BASE_ADDRESS - FAST_ERASE_SIZE - erase_length = FAST_ERASE_SIZE - - application_mram_erase(isp, address, erase_length, True) - print("[INFO] Fast Erase done") - -def process_log_data(log_data): - """ - process_log_data - """ - #print("log_data: ", log_data) - max_index = log_data[0] - head = log_data[1] - index = log_data[2] # start from the tail - data = log_data[3] - ordered_data = [] - while True: - if index == max_index: - index = 0 - if index == head: - break - ordered_data.append(chr(data[index])) - index += 1 - - #print("ordered data: ", ordered_data) - isp_print_color("blue", "........\n\n") - display_str = "" - for ch in ordered_data: - if ch == '\00': - if display_str != "": - severity = display_str[0] - if severity >= '0' and severity <= '9': - display_str = display_str[1:] - isp_print_color("blue", display_str) - display_str = "" - else: - display_str += ch - -def get_log_data_action(isp): - """ - get_log_data_action - """ - isp_start(isp) - log_data = isp_get_log_data(isp) - if log_data != None: - process_log_data(log_data) - isp_stop(isp) - -def maintenance_mode(isp): - """ - maintenance_mode - Enter Manitenance mode - """ - global handler - global baud_rate - - Flicks="|/-\\|/-\\" - Flick = 0 - - isp.setTimeout(0.1) - isp.setBaudRate(baud_rate) - - isp_print_cursor_disable() - - print_count = 0 - se_chars = [b'S', b'E', b'P', b'C', b'T', b'L'] - se_index = 0 - expected_char = b'\0' - while True: - send_data = bytearray(b'ALIF') - isp.writeSerial(send_data) - sys.stdout.flush() - - recv_data = bytearray(isp.readSerial(1)) - - print("Waiting for Target..[RESET Platform] " + Flicks[Flick] + - '\r', flush=True, end="") - sys.stdout.flush() - - # single character version - #if (recv_data == b'\xF0'): - # break - - # looking for the sequence in se_chars - if se_index == 0: - if recv_data == se_chars[0]: - # start of sequence - se_index = 1 - expected_char = se_chars[se_index] - elif recv_data != expected_char: - # unexpected character, reset the sequence - se_index = 0 - expected_char = b'\0' - else: - # received the expected character - if se_index >= (len(se_chars) - 1): - # the entire sequence is received - break - se_index += 1 - expected_char = se_chars[se_index] - - if handler.Handler_exit(): - print("\n[INFO] CTRL-C") - break - - print_count = print_count + 1 - if print_count > 5: # "Fake" delay, time.sleep() will halt - Flick = Flick + 1 - if Flick == 8: - Flick -= 8 - print_count = 0 - - send_data = bytearray(b'ALIF') - isp.writeSerial(send_data) - - sys.stdout.flush() - - # switch back to post pll baud rate - isp.setTimeout(COM_TIMEOUT_RX_DEFAULT) - isp.setBaudRate(baud_rate) - isp_print_cursor_enable() - -def soft_maintenance_mode(isp): - """ - soft_maintenance_mode - enter Soft mode - """ - global baud_rate - - put_target_in_maintenance_mode(isp, baud_rate,False) - -def get_ecc_key(isp): - """ - get_ecc_key from device - """ - isp_start(isp) - isp_get_ecc_key(isp) - isp_stop(isp) - -def get_firewall_config(isp): - """ - get_firewall_config - Pull back Firewall config from target - """ - isp_start(isp) - isp_get_firewall_config(isp) - isp_stop(isp) - -def show_help(supported_commands): - """ - show_help - display all supported commands - """ - print("Supported commands:") - for item in sorted(supported_commands): - print('\t{}'.format(supported_commands[item][0])) - -def maintenance_menu(supported_commands, isp): - """ - maintenance_mode - Show Menu options and get user input - """ - - option = 'x' - while option == 'x': - optList = [] - print('\nAvailable options:\n') - i = 1 - for item in supported_commands: - print("%2s - %s" % (str(i), item)) - i += 1 - optList.append(item) - - try: - option = input('\nSelect an option (Enter to return): ') - except EOFError: - print("[Ctrl-C EOF]") - sys.exit() - except KeyboardInterrupt: - print("[Ctrl-C]") - sys.exit() - - if option == '': - return - - try: - idx = int(option) - except ValueError: - print('Invalid option - Please try again') - option = 'x' - continue - - if idx < 1 or idx > len(optList): - print('Invalid option - Please try again') - option = 'x' - continue - try: - func = globals()[supported_commands[optList[idx-1]]] - except ValueError: - print("oops") - func(isp) - option = 'x' - -def showAndSelectOptions(list): - """ - showAndSelectOptions - """ - option = 'x' - while option == 'x': - print('\nAvailable options:\n') - i = 1 - optList = [] - for opt in list: - print("%2s - %s" % (str(i), opt)) - i += 1 - optList.append(opt) - try: - option = input('\nSelect an option (Enter to exit): ') - except EOFError: - print("[Ctrl-C EOF]") - sys.exit(0) - - if option == '': - sys.exit(0) - try: - idx = int(option) - except ValueError: - print('[ERROR] Invalid option - Please try again') - option = 'x' - continue - - if idx < 1 or idx > len(list): - print('[ERROR] Invalid option - Please try again') - option = 'x' - - return optList[idx-1] - -def read_json_file(file): - """ - read_json_file - """ - f = open(file, 'r') - try: - data = json.load(f) - - except JSONDecodeError as e: - print("[ERROR] in JSON file.") - print(str(e)) - sys.exit(EXIT_WITH_ERROR) - - except ValueError as v: - print("[ERROR] in JSON file:") - print(str(v)) - sys.exit(EXIT_WITH_ERROR) - except: - print("[ERROR] Unknown error loading JSON file") - sys.exit(EXIT_WITH_ERROR) - - f.close() - return data - -def checkRestrictions(menu_item, menu_config): - """ - checkRestrictions - """ - if menu_item in menu_config.keys(): - for item in menu_config[menu_item]: - if globals()[item] in menu_config[menu_item][item]: - return True - return False - -def command_line_mode(isp,cli_option): - """ - command_line_mode - - operate on commands passed in rather than the menus - """ - command_line_lut = { - "sesbanner" : get_banner_action - } - - if cli_option in command_line_lut: - command_line_lut[cli_option](isp) - else: - print("[ERROR] Command %s not recognized" %cli_option) - sys.exit(EXIT_WITH_ERROR) - -def main(): - """ - Maintenance tool - """ - global ALIF_BASE_ADDRESS - global OEM_BASE_ADDRESS - global OEM_MRAM_SIZE - global DEVICE_FEATURE_SET - global DEVICE_FAMILY - global DEVICE_REVISION - global DEVICE_PART_NUMBER - global DEVICE_FEATURE_SET_REVISION - global handler - global baud_rate - - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'FUSION Maintenance Tool') - parser.add_argument("-b", "--baudrate", - help="serial port baud rate", - type=int) - parser.add_argument("-d" , "--discover", action='store_true', - default=False, help="COM port discovery") - parser.add_argument("-opt" ,"--option", - type=str,default="", - help="call option [sesbanner]") - parser.add_argument("-V" , "--version", - help="Display Version Number", - action="store_true") - parser.add_argument("-v" , "--verbose", - help="verbosity mode", - action="store_true") - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - # memory defines for Alif/OEM MRAM Addresses and Sizes - load_global_config() - ALIF_BASE_ADDRESS = utils.config.ALIF_BASE_ADDRESS - OEM_BASE_ADDRESS = utils.config.APP_BASE_ADDRESS - OEM_MRAM_SIZE = utils.config.APP_MRAM_SIZE - DEVICE_FEATURE_SET = utils.config.DEVICE_FEATURE_SET - DEVICE_FAMILY = utils.config.DEVICE_FAMILY - DEVICE_REVISION = utils.config.DEVICE_REVISION - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REV_BAUD_RATE = utils.config.DEVICE_REV_BAUD_RATE - - # create a compound variable to address use cases as Fusion Rev B0 - DEVICE_FEATURE_SET_REVISION = DEVICE_FEATURE_SET + '_' + DEVICE_REVISION - - baud_rate = DEVICE_REV_BAUD_RATE[DEVICE_REVISION] - if args.baudrate is not None: - baud_rate = args.baudrate - - handler = CtrlCHandler() # [CTRL-C] handling - - os.system('') # Help MS-DOS window with ESC sequences - - # Serial dabbling open up port. - isp = serialPort(baud_rate) # Create ISP session - isp.setVerbose(args.verbose) # turn on or off verbose mode for the host - isp.CTRLCHandler = handler # CTRL C Handler for this ISP session - - if args.discover: # discover the COM ports if requested - print('Discover') - isp.discoverSerialPorts() - - errorCode = isp.openSerial() - if errorCode is False: - print("[ERROR] isp openSerial failed for %s" %isp.getPort()) - sys.exit(EXIT_WITH_ERROR) - print("[INFO] %s open Serial port success" %isp.getPort()) - - # Set up the baud rate ((same calls as in recovery.py)) - #if baud_rate != COM_BAUD_RATE_DEFAULT: - # isp.setBaudRate(baud_rate) - print("[INFO] baud rate", isp.getBaudRate()) - - test_target = isp_test_target(baud_rate, isp) - print('[INFO] Connecting to target...', end='') - if test_target == TARGET_RESPONDED: - # be sure device is not in SEROM Recovery Mode - device = device_probe.device_get_attributes(isp) - if device.stage == device_probe.STAGE_SEROM: - print('Device connected in Recovery') - MENU_DB = 'utils/maint-recoveryDB.db' - else: - # target responded and in SERAM stage - print('Device connected') - MENU_DB = 'utils/maintDB.db' - else: - # target did not respond... set full menu - print('Device did not respond') - MENU_DB = 'utils/maintDB.db' - - MENU_CFG = 'utils/menuconfDB.db' - - # Process Maintenance Grouped Menus - menuDB = read_json_file(MENU_DB) - groupsDB = menuDB['groups'] - - # load menu configurations - menuCfgDB = read_json_file(MENU_CFG) - - if args.option: - command_line_mode(isp,args.option) - else: - opt = '*' - while opt != '': - opt = showAndSelectOptions(groupsDB) - - # filter available commands based on silicon, revision, etc. - supported_commands = menuDB[groupsDB[opt]] - menu_options = {} - for item in supported_commands: - if not checkRestrictions(supported_commands[item], menuCfgDB): - menu_options[item] = supported_commands[item] - maintenance_menu(menu_options, isp) - - isp.closeSerial() - - # Reset the Terminal of any ANSI Escape sequence debris - isp_print_cursor_enable() - isp_print_terminal_reset() - -if __name__ == "__main__": - main() diff --git a/tools/alif/tools-config.py b/tools/alif/tools-config.py deleted file mode 100755 index d52912866..000000000 --- a/tools/alif/tools-config.py +++ /dev/null @@ -1,317 +0,0 @@ -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string - -import sys, shutil -import json -from json.decoder import JSONDecodeError -import utils.config -from utils.config import * -from utils.gen_fw_cfg import * - -# Define Version constant for each separate tool -# 0.05.000 - add cmd line options and multiple key directories -# 0.06.000 - add new DEV key for SPARK -# 0.07.000 - fixed SE-2761 (keyEnv is not being updated in Azure) -TOOL_VERSION = "0.07.000" - -EXIT_WITH_ERROR = 1 - -CONFIG_FILE = 'utils/global-cfg.db' -FAMILY_DB = 'utils/familiesDB.db' -FEATURES_DB = 'utils/featuresDB.db' -DEVICE_DB = 'utils/devicesDB.db' -JTAG_ADAPTERS = 'utils/jtag-adapters.db' - -DEVICE_CFG_FILE = "build/config/device-config.json" -JTAG_ADAPTERS_FILE = "build" -KEY_PATH = 'utils/key/' -CERT_PATH = 'cert/' - -# DEV key environments -FUSION_REV_A1 = 'fusion_rev_a1' -FUSION_REV_B0 = 'fusion_rev_b0' -FUSION_REV_B4 = 'fusion_rev_b4' -SPARK_REV_A0 = 'spark_rev_a0' -EAGLE_REV_A0 = 'eagle_rev_a0' -# future: Spark, etc - - -mram_interface = ['jtag', 'isp'] - -def read_json_file(file): - - f = open(file, 'r') - try: - data = json.load(f) - - except JSONDecodeError as e: - print("ERROR in JSON file.") - print(str(e)) - sys.exit(EXIT_WITH_ERROR) - - except ValueError as v: - print("ERROR in JSON file:") - print(str(v)) - sys.exit(EXIT_WITH_ERROR) - - except: - print("ERROR: Unknown error loading JSON file") - sys.exit(EXIT_WITH_ERROR) - - f.close() - return data - -def save_global_config(cfg): - with open(CONFIG_FILE, 'w', encoding='utf-8') as f: - json.dump(cfg, f, ensure_ascii=False, indent=4) - -def showAndSelectOptions(list, default): - option = 'x' - while option == 'x': - print('\nAvailable options:\n') - i = 1 - for item in list: - if item == 'SEP': - print('') - else: - if item == default: - print(str(i) + ' - ' + item + ' (default)') - else: - print(str(i) + ' - ' + item) - i += 1 - while 'SEP' in list: - list.remove('SEP') - - option = input('\nPlease enter the number of your option: ') - if option == '': - return default - try: - idx = int(option) - except ValueError: - print('Invalid option - Please try again') - option = 'x' - continue - - if idx < 1 or idx > len(list): - print('Invalid option - Please try again') - option = 'x' - - return list[int(idx -1)] - -def update_device_config_file(device_part, device_revision): - - if isThisAPP(): # this is logic only for ICV device configuration - return - - load_global_config() - # generate the temp file 'build/fw_cfg.json' - gen_fw_cfg_icv(device_part["family"], device_part["mram_size"], device_part["sram_size"], device_revision, device_part["featureSet"]) - - # open the device config file - with open(DEVICE_CFG_FILE, "r") as device_config_file: - device_config_json = json.load(device_config_file) - - # incorporate fw_cfg.json into the device config file - with open(FW_CFG_FILE, "r") as fw_cfg_file: - fw_json = json.load(fw_cfg_file) - device_config_json["firewall"] = fw_json - # add the wounding information as well - device_config_json["wounding"] = device_part["wounding"] - - # save the updated device config file - with open(DEVICE_CFG_FILE, "w") as device_config_file: - json.dump(device_config_json, device_config_file, indent=4) - -def printMenu(cfg): - print('\n') - print('* * * * * * * * * * * * * * * * * * * * * *') - print('Current configuration') - - print(' - DEVICE Family: ' + devDB[cfg['DEVICE']['Part#']]['family'] + ' - Part#: ' + cfg['DEVICE']['Part#'] + ' - Rev: ' + cfg['DEVICE']['Revision']) - print(' - MRAM BURNER') - print(' Interface: ' + cfg['MRAM-BURNER']['Interface']) - print(' JTAG Adapter: ' + cfg['MRAM-BURNER']['Jtag-adapter']) - print('* * * * * * * * * * * * * * * * * * * * * *') - -def loadParts(family): - parts = [] - for key in devDB: - if devDB[key]['family'] == family: - parts.append(key) - return parts - -def validateRevision(dev_revisions, current_revision): - if current_revision not in dev_revisions: - current_revision = dev_revisions[0] - return current_revision - -def clean_directory_rot(): - # clean key folder - path = KEY_PATH - for file in os.listdir(path): - if file[0:3].lower() == 'oem': - continue - f = path + file - if os.path.isfile(f): - os.remove(f) - - # clean certs folder - path = CERT_PATH - for file in os.listdir(path): - if file[0:3].lower() == 'oem': - continue - f = path + file - if os.path.isfile(f): - os.remove(f) - - -def copy_content_rot(rot_dir): - # this only applies to ICV DEV key release... (local, no Azure) - if isThisPROD(): - return - - # copy key env from the selected RoT - path = KEY_PATH + rot_dir - for file in os.listdir(path): - f = path + '/' + file - if file[0:3].lower() == 'oem': - continue - shutil.copy(f, KEY_PATH) - - # copy certs env from the selected RoT - path = CERT_PATH + rot_dir - for file in os.listdir(path): - f = path + '/' + file - #shutil.copy(f, 'cert/') - shutil.copy(f, CERT_PATH) - -def isThisAPP(): - if os.path.isdir('alif/'): - return True - return False - -def isThisPROD(): - for file in os.listdir(KEY_PATH): - f = KEY_PATH + '/' + file - if os.path.isdir(f): - return False - return True - -def setKeyEnvironment(cfg): - - # do not apply for APP tools - if isThisAPP(): - return - - keyEnvCfg = cfg['DEVICE']['keyEnv'] - feature = devDB[cfg['DEVICE']['Part#']]['featureSet'] - revision = cfg['DEVICE']['Revision'] - # check key env rules - keyEnv = FUSION_REV_B4 # default key env for REV_B4 FUSION - if feature == 'Fusion' and revision == 'A1': # backward compatibility - keyEnv = FUSION_REV_A1 - if feature == 'Fusion' and revision != 'B4': # Rev B4 has a new RoT - keyEnv = FUSION_REV_B0 - if feature == 'Spark' and revision == 'A0': - keyEnv = SPARK_REV_A0 - if feature == 'Eagle' and revision == 'A0': - keyEnv = EAGLE_REV_A0 - # future rules... - - # set the new key env and save it in global-cfg.json - print("Setting a new Key Environment") - clean_directory_rot() - copy_content_rot(keyEnv) - cfg['DEVICE']['keyEnv'] = keyEnv - save_global_config(cfg) - -def processCmdLineOption(args): - # read global cfg - cfg = read_json_file(CONFIG_FILE) - # validate options - if args.part != None: - try: - cfg['DEVICE']['Part#'] = args.part.upper() - except KeyError: - print('Invalid Part#') - sys.exit(EXIT_WITH_ERROR) - - if args.rev != None: - dev_revisions = featDB[devDB[cfg['DEVICE']['Part#']]['featureSet']]['revisions'] - if args.rev.upper() in dev_revisions: - cfg['DEVICE']['Revision'] = args.rev.upper() - else: - print('Invalid Revision') - sys.exit(EXIT_WITH_ERROR) - - save_global_config(cfg) - update_device_config_file(devDB[cfg['DEVICE']['Part#']], cfg['DEVICE']['Revision']) - setKeyEnvironment(cfg) - -def main(): - global devDB - global featDB - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'SETOOLS Selection') - parser.add_argument("-p", "--part", type=str, - help="Part#") - parser.add_argument("-r", "--rev", type=str, - help="Revision") - - # load data from DBs - devDB = read_json_file(DEVICE_DB) - - families = [] - famDB = read_json_file(FAMILY_DB) - for key in famDB: - families.append(key) - - features = [] - featDB = read_json_file(FEATURES_DB) - for key in featDB: - features.append(key) - - dev_revisions = [] - - jtag_adapters = [] - f = open(JTAG_ADAPTERS, 'r') - jtag_adapters = f.read().strip().split('\n') - - args = parser.parse_args() - if args.part != None or args.rev != None: - processCmdLineOption(args) - sys.exit() - - print('SETOOLS OPTIONS CONFIGURATION') - option = '' - while option != 'Exit': - cfg = read_json_file(CONFIG_FILE) - dev_revisions = featDB[devDB[cfg['DEVICE']['Part#']]['featureSet']]['revisions'] - printMenu(cfg) - option = showAndSelectOptions(['Part#', 'Revision', 'Interface', 'JTAG Adapter', 'SEP', 'Exit'], 'Exit') - if option == 'Part#': - selected_family = showAndSelectOptions(families, devDB[cfg['DEVICE']['Part#']]['family']) - parts = loadParts(selected_family) - cfg['DEVICE']['Part#'] = showAndSelectOptions(parts, cfg['DEVICE']['Part#']) - dev_revisions = featDB[devDB[cfg['DEVICE']['Part#']]['featureSet']]['revisions'] - cfg['DEVICE']['Revision'] = validateRevision(dev_revisions, cfg['DEVICE']['Revision']) - update_device_config_file(devDB[cfg['DEVICE']['Part#']], cfg['DEVICE']['Revision']) - - elif option == 'Revision': - cfg['DEVICE']['Revision'] = showAndSelectOptions(dev_revisions, cfg['DEVICE']['Revision']) - update_device_config_file(devDB[cfg['DEVICE']['Part#']], cfg['DEVICE']['Revision']) - - elif option == 'Interface': - cfg['MRAM-BURNER']['Interface'] = showAndSelectOptions(mram_interface, cfg['MRAM-BURNER']['Interface']) - - elif option == 'JTAG Adapter': - cfg['MRAM-BURNER']['Jtag-adapter'] = showAndSelectOptions(jtag_adapters, cfg['MRAM-BURNER']['Jtag-adapter']) - - save_global_config(cfg) - setKeyEnvironment(cfg) - -if __name__ == "__main__": - main() - diff --git a/tools/alif/updateSystemPackage.py b/tools/alif/updateSystemPackage.py deleted file mode 100755 index b311be1b0..000000000 --- a/tools/alif/updateSystemPackage.py +++ /dev/null @@ -1,254 +0,0 @@ -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string -#pylint: disable=import-error,wrong-import-position,wildcard-import,undefined-variable -""" - updateSystemPackage.py - -""" -# TODO: -# check for online updates? Download and apply? - -import os -import sys -import argparse -sys.path.append("./isp") -from serialport import serialPort -from serialport import COM_BAUD_RATE_MAXIMUM -#import ispcommands -from isp_core import * -from isp_util import * -import device_probe -import utils.config -from utils.config import * - -# Define Version constant for each separate tool -# Version Feature -# 0.16.000 Addition of baud rate increase for bulk transfer -# 0.20.000 Removed JTAG access -# 0.21.000 Reset option set as default -# 0.21.001 Suppress maintenance mode output -# 0.21.002 Added python error exit code -# 0.22.000 Added support for multi-packages update (Alif's packages for different Part#/Revs) -# also, removed A0 related-code -# 0.23.000 Added probe to detect the target and abort if Revision mismatches the selection -# 0.24.000 get baudrate from DBs -# 0.25.000 Added Part# and Revision Device's detection and offer to switch as defaults -# 0.26.000 Added support for MAC OS -TOOL_VERSION ="0.26.000" - -EXIT_WITH_ERROR = 1 - -def checkTargetWithSelection(targetDescription, targetRevision): - """ - Check Target Device matches - """ - partIsDifferent = False - if targetDescription != DEVICE_PART_NUMBER: - print('Connected target is not the default Part#') - partIsDifferent = True - - if targetRevision != DEVICE_REVISION: - print('Connected target is not the default Revision') - partIsDifferent = True - - if partIsDifferent: - try: - answer = input('Do you want to set this part as default? (y/n): ') - except EOFError as e: - print('\nUser aborted the process') - sys.exit() - - if answer.lower() == 'y' or answer.lower() == 'yes': - save_global_config(targetDescription, targetRevision) - -def main(): - """ - Start of it all... - """ - global DEVICE_PART_NUMBER - global DEVICE_REVISION - - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - parser = argparse.ArgumentParser(description='Update System Package in MRAM') - parser.add_argument("-d" , "--discover", action='store_true', \ - default=False, help="COM port discovery for ISP") - parser.add_argument("-b", "--baudrate", help="(isp) serial port baud rate", - type=int) - parser.add_argument("-s", "--switch", - help="(isp) dynamic baud rate switch toggle, default=on", - action="store_false") - parser.add_argument("-nr", "--no_reset", default=False, - help="do not reset target before operation", action="store_true") - parser.add_argument("-na", "--no_authentication", action='store_true', - help="run in non-authenticated mode", - default=False) - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - parser.add_argument("-v" , "--verbose", - help="verbosity mode", action="store_true") - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - # retrieve initial params based on user selection (toold-config) - load_global_config() - DEVICE_PART_NUMBER = utils.config.DEVICE_PART_NUMBER - DEVICE_REVISION = utils.config.DEVICE_REVISION - DEVICE_REV_BAUD_RATE = utils.config.DEVICE_REV_BAUD_RATE - HASHES_DB = utils.config.HASHES_DB - - os.system('') # Help MS-DOS window with ESC sequences - - print('Burning: System Package in MRAM') - - print('Selected Device:') - print('Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - - baud_rate = DEVICE_REV_BAUD_RATE[DEVICE_REVISION] - if args.baudrate is not None: - baud_rate = args.baudrate - - dynamic_baud_rate_switch = args.switch - - print('\nConnecting to the target device...') - - dynamic_string = "Enabled" if dynamic_baud_rate_switch else "Disabled" - print("[INFO] baud rate ", baud_rate) - print("[INFO] dynamic baud rate change ", dynamic_string) - - handler = CtrlCHandler() # handle ctrl-c key press - isp = serialPort(baud_rate) # Serial dabbling open up port. - - if args.discover: # discover the COM ports if requested - isp.discoverSerialPorts() - - errorCode = isp.openSerial() - if errorCode is False: - print("[ERROR] isp openSerial failed for %s" %isp.getPort()) - sys.exit(EXIT_WITH_ERROR) - print("[INFO] %s open Serial port success" %isp.getPort()) - - isp.setBaudRate(baud_rate) - isp.setVerbose(args.verbose) - - # probe the device before update - device = device_probe.device_get_attributes(isp) - - # check SERAM is the bootloader stage - print('Bootloader stage: ' + device_probe.STAGE_TEXT[device.stage]) - if device.stage != device_probe.STAGE_SERAM: - print('[ERROR] Please use Recovery option from ROM menu in Maintenance Tool') - sys.exit(EXIT_WITH_ERROR) - - if not args.no_reset: - put_target_in_maintenance_mode(isp, baud_rate, args.verbose) - - print('[INFO] Detected Device:') - partDetected = device.part_number - - # Check for Blank devices - # These should not exist! but initial devices for bring up are always Blank - if bytes(partDetected, 'utf-8') == b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00': - if device.revision == 'A0': # SPARK Device default - partDetected = 'AB1C1F4M51820PH' - elif device.revision == 'EG': # Eagle A0 - partDetected = 'AE722F80F55D5EG' - device.revision = 'A0' - else: # ENSEMBLE Device default - partDetected = 'AE722F80F55D5LS' - print('[WARN] No Part# was detected! Defaulting to ' + partDetected) - - print('Part# ' + partDetected + ' - Rev: ' + device.revision) - - partDescription = getPartDescription(partDetected) - - # load configuration from detected device - load_device_config(partDescription, device.revision) - - # retrieve rest of params from the detected device - DEVICE_PACKAGE = utils.config.DEVICE_PACKAGE - DEVICE_REV_PACKAGE_EXT = utils.config.DEVICE_REV_PACKAGE_EXT - DEVICE_OFFSET = utils.config.DEVICE_OFFSET - MRAM_BASE_ADDRESS = utils.config.MRAM_BASE_ADDRESS - ALIF_BASE_ADDRESS = utils.config.ALIF_BASE_ADDRESS - MRAM_SIZE = utils.config.MRAM_SIZE - - print('- MRAM Base Address: ' + hex(ALIF_BASE_ADDRESS)) - - # check the default Part#/Rev in tools-config and offer to switch - checkTargetWithSelection(partDescription, device.revision) - - env_ext = '' - if device.env.lower() in HASHES_DB: - if HASHES_DB[device.env] == 'DEV': - env_ext = '-dev' - - # for devices in CM LCS, we use the DEV package - if device.env == '00000000000000000000000000000000': - print('[WARN] Device is not provisioned!') - env_ext = '-dev' - - rev_ext = DEVICE_REV_PACKAGE_EXT[device.revision] - - alif_image = 'alif/' + DEVICE_PACKAGE + '-' + rev_ext + env_ext + '.bin' - alif_offset = 'alif/' + DEVICE_OFFSET + '-' + rev_ext + env_ext + '.bin' - - if sys.platform in ["linux","darwin"]: - imageList = alif_image + ' ' + hex(ALIF_BASE_ADDRESS) + \ - ' ' + alif_offset + ' ' + hex(MRAM_BASE_ADDRESS + MRAM_SIZE - 16) - else: - imageList = '../' + alif_image + ' ' + hex(ALIF_BASE_ADDRESS) + \ - ' ../' + alif_offset + ' ' + hex(MRAM_BASE_ADDRESS + MRAM_SIZE - 16) - - # check images exist... - if not os.path.exists(alif_image): - print('Image ' + alif_image + ' does not exist!') - sys.exit(EXIT_WITH_ERROR) - - if not os.path.exists(alif_offset): - print('Image ' + alif_offset + ' does not exist!') - sys.exit(EXIT_WITH_ERROR) - - isp_start(isp) # Start ISP Sequence - - if sys.platform in ["linux","darwin"]: - imageList = imageList.replace('\\','/') - else: - imageList = imageList.replace('/','\\') - - if dynamic_baud_rate_switch: - isp_set_baud_rate(isp,COM_BAUD_RATE_MAXIMUM) # Jack up Baud rate - isp.setBaudRate(COM_BAUD_RATE_MAXIMUM) # Sets the HOST baud rate - - # issue enquiry command to check if SERAM is in Maintenance Mode - mode = isp_get_maintenance_status(isp) - isp_show_maintenance_mode(isp, mode) - - authenticate = True if not args.no_authentication else False - - items = imageList.split(' ') - for e in range(1, len(items),2): - addr = items[e] - address = int(addr,base=16) - fileName = items[e-1] - fileName = fileName.replace('..\\','') - - if burn_mram_isp(isp, handler, fileName, address, - args.verbose, authenticate) == False: - break - - # Restore the default Baud rate - if dynamic_baud_rate_switch: - isp_set_baud_rate(isp,baud_rate) - isp.setBaudRate(baud_rate) - - isp_reset(isp) - - isp.closeSerial() - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/LICENSE b/tools/alif/utils/LICENSE deleted file mode 100755 index 7bfd70c98..000000000 --- a/tools/alif/utils/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (C) Arm Limited, 2020 All rights reserved. - -The example code is provided to You as an aid to learning when working with Arm-based technology, -including but not limited to programming tutorials. Arm hereby grants to you, -subject to the terms and conditions of this Licence, a non-exclusive, non-transferable, non-sub-licensable, free-of-charge licence, -to use and copy the Software solely for the purpose of demonstration and evaluation. - -You accept that the Software has not been tested by Arm therefore the Software is provided “as is”, -without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, -damages or other liability, whether in action or contract, tort or otherwise, arising from, -out of or in connection with the Software or the use of Software. \ No newline at end of file diff --git a/tools/alif/utils/cert_key_util.py b/tools/alif/utils/cert_key_util.py deleted file mode 100755 index 6afab1e89..000000000 --- a/tools/alif/utils/cert_key_util.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -# Key certificate structure is : -# FIELD NAME SIZE (words) -# ---------- ------------ -# Header token 1 -# version number 1 -# size in words (offset to signature) 1 -# Flags 1 -# N Pub key 96 -# Np 5 -# active SW version 1 -# public key HASH 8 -# RSA Signature 96 - -#################################################################### -# Filename - cert_key_util.py -# Description - This file contains the main functionality of the key -# certificate generation. -#################################################################### - -import optparse -import configparser -import sys -import os -file_path = os.getcwd() -sys.path.insert(0, os.path.join(file_path, "utils")) -sys.path.append(os.path.join(sys.path[0], "..", "..")) - -from utils.common import util_logger -from utils.common import global_defines -from utils.common import certificates -from utils.common_cert_lib.keycertificateconfig import KeyCertificateConfig - -# Util's log file -LOG_FILENAME = "sb_key_cert.log" - -# find proj.cfg -if "proj.cfg" in os.listdir(sys.path[0]): - PROJ_CONFIG_PATH = os.path.join(sys.path[0], "proj.cfg") -elif "proj.cfg" in os.listdir(sys.path[-1]): - PROJ_CONFIG_PATH = os.path.join(sys.path[-1], "proj.cfg") -else: - PROJ_CONFIG_PATH = os.path.join(os.getcwd(), "proj.cfg") - - -class ArgumentParser: - def __init__(self): - self.cfg_filename = None - self.log_filename = LOG_FILENAME - self.parser = optparse.OptionParser() - - def parse_arguments(self, args): - (options, args) = self.parser.parse_args(args) - if len(args) > 2 or len(args) < 1: - self.parser.error("incorrect number of positional arguments") - elif len(args) == 2: - self.log_filename = args[1] - self.cfg_filename = args[0] - - -class KeyCertificateGenerator: - def __init__(self, logger, key_cfg, certificate_version): - self.config = key_cfg - self.logger = logger - self.cert_version = certificate_version - self._certificate = None - - def create_certificate(self): - self.logger.info("**** Creating Key certificate ****") - self._certificate = certificates.KeyArmCertificate(self.config, self.cert_version, self.logger) - - self.logger.info("Write the certificate to file") - with open(self.config.cert_pkg, "wb") as bin_output_file: - bin_output_file.write(self._certificate.certificate_data) - - hex_formatted_cert = ["0x%02x" % i for i in list(self._certificate.certificate_data)] - txt_filename = self.config.cert_pkg[:-4] + '_' + global_defines.Cert_FileName + global_defines.Cert_FileExtTxt - with open(txt_filename, "w") as txt_output_file: - txt_output_file.write("char cert_bin_image[] = {\n") - txt_content = "".join([item+',\n' if ind % 4 == 3 else item+',' - for ind, item in enumerate(hex_formatted_cert)]) - txt_output_file.write(txt_content) - txt_output_file.write("}") - - -def main(args): - if not (sys.version_info.major == 3 and sys.version_info.minor >= 5): - print("The script requires Python3.5 or later!") - sys.exit(-1) - # parse arguments - the_argument_parser = ArgumentParser() - the_argument_parser.parse_arguments(args) - # get logging up and running - the_logger = util_logger.UtilLogger(the_argument_parser.log_filename, "Key Certificate Generation") - # Get the project configuration values - project_config = configparser.ConfigParser() - with open(PROJ_CONFIG_PATH, 'r') as project_config_file: - config_string = '[PROJ-CFG]\n' + project_config_file.read() - project_config.read_string(config_string) - cert_version = [project_config.getint("PROJ-CFG", "CERT_VERSION_MAJOR"), - project_config.getint("PROJ-CFG", "CERT_VERSION_MINOR")] - # get util configuration parameters - key_certificate_config = KeyCertificateConfig(the_argument_parser.cfg_filename, the_logger) - # create certificate - cert_creator = KeyCertificateGenerator(the_logger, key_certificate_config, cert_version) - cert_creator.create_certificate() - the_logger.info("**** Certificate file creation has been completed successfully ****") diff --git a/tools/alif/utils/cert_sb_content_util.py b/tools/alif/utils/cert_sb_content_util.py deleted file mode 100755 index 92aa90161..000000000 --- a/tools/alif/utils/cert_sb_content_util.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -# Content certificate structure is : -# FIELD NAME SIZE (words) -# ---------- ------------ -# Header token 1 -# version number 1 -# size in words (offset to signature) 1 -# Flags 1 -# N Pub key 96 -# Np 5 -# active SW version 1 -# NONCE 2 -# signed S/W records(hash + load address + max size + flag) N * (8+3) -# RSA Signature 96 -# none-signed S/W records(storage address + actual size) N * (2) -# - -import optparse -import configparser -import sys -import os - -file_path = os.getcwd() -sys.path.insert(0, os.path.join(file_path, "utils")) -sys.path.append(os.path.join(file_path, "..", "..")) - -from common import util_logger -from common import global_defines -from common import certificates -from utils.common_cert_lib.contentcertificateconfig import ContentCertificateConfig - -from printInfo import * - -# Util's log file -LOG_FILENAME = "sb_content_cert.log" - -# find proj.cfg -if "proj.cfg" in os.listdir(sys.path[0]): - PROJ_CONFIG_PATH = os.path.join(sys.path[0], "proj.cfg") -elif "proj.cfg" in os.listdir(sys.path[-1]): - PROJ_CONFIG_PATH = os.path.join(sys.path[-1], "proj.cfg") -else: - PROJ_CONFIG_PATH = os.path.join(os.getcwd(), "proj.cfg") - - -class ArgumentParser: - def __init__(self): - self.cfg_filename = None - self.log_filename = LOG_FILENAME - self.parser = optparse.OptionParser() - self.parser.add_option("-c") - self.parser.add_option("-l") - - def parse_arguments(self, args): - args = self.parser.parse_args(args) - if len(args) > 2 or len(args) < 1: - self.parser.error("incorrect number of positional arguments") - elif len(args) == 2: - self.log_filename = args[0].l - self.cfg_filename = args[0].c - - -class ContentCertificateGenerator: - def __init__(self, logger, content_cfg, certificate_version): - self.config = content_cfg - self.logger = logger - self.cert_version = certificate_version - self._certificate = None - - def create_certificate(self): - if verboseModeGet(): - self.logger.info("**** Creating Content Certificate ****") - - self._certificate = certificates.ContentArmCertificate(self.config, self.cert_version, self.logger) - serialized_cert_data = self._certificate.certificate_data - - with open(self.config.cert_pkg, "wb") as bin_output_file: - bin_output_file.write(serialized_cert_data) - - hex_formatted_cert = ["0x%02x" % i for i in list(self._certificate.certificate_data)] - txt_filename = self.config.cert_pkg[:-4] + '_' + global_defines.Cert_FileName + global_defines.Cert_FileExtTxt - with open(txt_filename, "w") as txt_output_file: - txt_output_file.write("char cert_bin_image[] = {\n") - txt_content = "".join([item + ',\n' if ind % 4 == 3 else item + ',' - for ind, item in enumerate(hex_formatted_cert)]) - txt_output_file.write(txt_content) - txt_output_file.write("}") - - -def main(args): - if not (sys.version_info.major == 3 and sys.version_info.minor >= 5): - print("The script requires Python3.5 or later!") - sys.exit(-1) - # parse arguments - the_argument_parser = ArgumentParser() - the_argument_parser.parse_arguments(args) - # get logging up and running - the_logger = util_logger.UtilLogger(the_argument_parser.log_filename, "Content Certificate Generation") - # Get the project configuration values - project_config = configparser.ConfigParser() - with open(PROJ_CONFIG_PATH, 'r') as project_config_file: - config_string = '[PROJ-CFG]\n' + project_config_file.read() - project_config.read_string(config_string) - cert_version = [project_config.getint("PROJ-CFG", "CERT_VERSION_MAJOR"), - project_config.getint("PROJ-CFG", "CERT_VERSION_MINOR")] - # get util configuration parameters - content_certificate_config = ContentCertificateConfig(the_argument_parser.cfg_filename, the_logger) - # create certificate - cert_creator = ContentCertificateGenerator(the_logger, content_certificate_config, cert_version) - cert_creator.create_certificate() - if verboseModeGet(): - the_logger.info("**** Certificate file creation has been completed successfully ****") diff --git a/tools/alif/utils/cfg/OEMSBContent_lvs_1.cfg b/tools/alif/utils/cfg/OEMSBContent_lvs_1.cfg deleted file mode 100755 index 9dcae68df..000000000 --- a/tools/alif/utils/cfg/OEMSBContent_lvs_1.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# This configuration file is for the offline secure boot content certificate generation tool -# cert_sb_content_util.py (Content Certificate Generation Tool - CCGT). -# -# The available parameters in this configuration file are the following -# • [KEY-CFG] : Mandatory header. -# The internal non-configurable header. -# • cert-keypair : Mandatory parameter. -# The file holding the RSA keypair for signing this certificate, in PEM format. -# • cert-keypair-pwd : Optional. If omitted the tool prompts for direct input. -# The passphrase file for the keypair file, in .txt format. -# • load-verify-scheme : Mandatory parameter. -# The SW image verification scheme. Supported schemes are: -# - 0 : Load and verify from flash to memory. -# - 1 : Full hash verification in Flash, with no loading to memory. -# - 2 : Verify in memory. -# - 3 : Load from flash. -# Note: Option 3 is not recommended and is not allowed in Secure LCS. -# • crypto-type : Mandatory parameter. -# The cryptographic verification and decryption mode: -# - 0 : Both AES and hash are calculated on the plain image. -# - 1 : AES is calculated on the plain image, and the hash is calculated on the encrypted image. -# Note: We recommend that you use the first mode. -# • aes-ce-id : Mandatory parameter. -# The ID of the key used for encryption, matching the entity that signed the certificate chain: -# - 0 : None. -# - 1 : Kceicv (ICV). -# - 2 : Kce (OEM). -# • aes-enc-key : Optional. Can be omitted if no encryption is needed. -# The text file containing the encryption key for the authenticated SW images: Kce or Kceicv. -# The contents of this file are comma-separated hex Bytes ("0x12,0x34 …") ending with "." -# • images-table : Mandatory parameter. -# The text file containing the list of SW image files to be processed. Each line refers to a single image, -# with the following parameters: <32b mem load addr> <32b flash store addr> <32b image max size> -# -# Notes: -# - If using loading scheme option 1, the memory address is 0xffffffff (nonexisting address). -# - If using loading scheme option 2, the storage address is 0xffffffff (non-existing address). -# - If encryption is used, an output file named _enc.bin is created for each encrypted image. -# • nvcounter-val : Mandatory parameter. -# The NV counter value: -# - 0..64 : The ICV counter. -# - 0..96 : The OEM counter. -# - 0..160 : The full counter, if OEM and ICV are a single entity. -# • cert-pkg : Mandatory parameter. -# The content certificate package in binary format. -[CNT-CFG] -cert-keypair = key/OEMSBContent.pem -cert-keypair-pwd = key/oem_keys_pass.pwd -load-verify-scheme = 1 -crypto-type = 0 -aes-ce-id = 0 -aes-enc-key = key/kce.txt -images-table = ../build/images/images.txt -nvcounter-val = 0 -cert-pkg = ../cert/OEMSBContent.crt diff --git a/tools/alif/utils/cfg/OEMSBContent_lvs_2.cfg b/tools/alif/utils/cfg/OEMSBContent_lvs_2.cfg deleted file mode 100755 index adf3dda38..000000000 --- a/tools/alif/utils/cfg/OEMSBContent_lvs_2.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# This configuration file is for the offline secure boot content certificate generation tool -# cert_sb_content_util.py (Content Certificate Generation Tool - CCGT). -# -# The available parameters in this configuration file are the following -# • [KEY-CFG] : Mandatory header. -# The internal non-configurable header. -# • cert-keypair : Mandatory parameter. -# The file holding the RSA keypair for signing this certificate, in PEM format. -# • cert-keypair-pwd : Optional. If omitted the tool prompts for direct input. -# The passphrase file for the keypair file, in .txt format. -# • load-verify-scheme : Mandatory parameter. -# The SW image verification scheme. Supported schemes are: -# - 0 : Load and verify from flash to memory. -# - 1 : Full hash verification in Flash, with no loading to memory. -# - 2 : Verify in memory. -# - 3 : Load from flash. -# Note: Option 3 is not recommended and is not allowed in Secure LCS. -# • crypto-type : Mandatory parameter. -# The cryptographic verification and decryption mode: -# - 0 : Both AES and hash are calculated on the plain image. -# - 1 : AES is calculated on the plain image, and the hash is calculated on the encrypted image. -# Note: We recommend that you use the first mode. -# • aes-ce-id : Mandatory parameter. -# The ID of the key used for encryption, matching the entity that signed the certificate chain: -# - 0 : None. -# - 1 : Kceicv (ICV). -# - 2 : Kce (OEM). -# • aes-enc-key : Optional. Can be omitted if no encryption is needed. -# The text file containing the encryption key for the authenticated SW images: Kce or Kceicv. -# The contents of this file are comma-separated hex Bytes ("0x12,0x34 …") ending with "." -# • images-table : Mandatory parameter. -# The text file containing the list of SW image files to be processed. Each line refers to a single image, -# with the following parameters: <32b mem load addr> <32b flash store addr> <32b image max size> -# -# Notes: -# - If using loading scheme option 1, the memory address is 0xffffffff (nonexisting address). -# - If using loading scheme option 2, the storage address is 0xffffffff (non-existing address). -# - If encryption is used, an output file named _enc.bin is created for each encrypted image. -# • nvcounter-val : Mandatory parameter. -# The NV counter value: -# - 0..64 : The ICV counter. -# - 0..96 : The OEM counter. -# - 0..160 : The full counter, if OEM and ICV are a single entity. -# • cert-pkg : Mandatory parameter. -# The content certificate package in binary format. -[CNT-CFG] -cert-keypair = key/OEMSBContent.pem -cert-keypair-pwd = key/oem_keys_pass.pwd -load-verify-scheme = 2 -crypto-type = 0 -aes-ce-id = 2 -aes-enc-key = key/kce.txt -images-table = ../build/images/images.txt -nvcounter-val = 0 -cert-pkg = ../cert/OEMSBContent.crt diff --git a/tools/alif/utils/cfg/OEMSBKey1.cfg b/tools/alif/utils/cfg/OEMSBKey1.cfg deleted file mode 100755 index 4f42a2493..000000000 --- a/tools/alif/utils/cfg/OEMSBKey1.cfg +++ /dev/null @@ -1,35 +0,0 @@ -# This configuration file is for the offline key certificate tool cert_key_util.py (Key Certificate Generation Tool - KCGT). -# -# The available parameters in this configuration file are the following -# • [KEY-CFG] : Mandatory header. -# The internal non-configurable header. -# • cert-keypair : Mandatory parameter. -# The file holding the RSA keypair for signing this certificate, in PEM format. -# • cert-keypair-pwd : Optional. If omitted the tool prompts for direct input. -# The passphrase file for the keypair file, in .txt format. -# • hbk-id : Mandatory parameter. The tool is agnostic to the certificate usage, this parameter cannot be omitted. -# The ID of the Hbk field in OTP memory that the public key of this certificate is verified against: -# - 0: 128-bit Hbk0. -# - 1: 128-bit Hbk1. -# - 2: 256-bit Hbk. -# The ROM code uses this field only if this certificate is the first certificate in: -# - A two-level SB certificate chain. -# - A three-level SB certificate chain. -# - A three-level Secure Debug chain. -# • nvcounter-val : Mandatory parameter. -# The NV counter value: -# - 0..64: the ICV counter. -# - 0..96: the OEM counter. -# - 0..160: the full counter, if OEM and ICV are a single entity. -# The passphrase file for the keypair file, in .txt format. -# • next-cert-pubkey : Mandatory parameter. -# The file holding the RSA public key for signing the next certificate in the chain, in PEM format. -# • cert-pkg : Mandatory parameter. -# The key certificate package output file. -[KEY-CFG] -cert-keypair = utils/key/OEMRoT.pem -cert-keypair-pwd = utils/key/oem_keys_pass.pwd -hbk-id = 1 -nvcounter-val = 0 -next-cert-pubkey = utils/key/OEMSBKeyPublic.pem -cert-pkg = cert/OEMSBKey1.crt diff --git a/tools/alif/utils/cfg/OEMSBKey2.cfg b/tools/alif/utils/cfg/OEMSBKey2.cfg deleted file mode 100755 index a39b9267a..000000000 --- a/tools/alif/utils/cfg/OEMSBKey2.cfg +++ /dev/null @@ -1,35 +0,0 @@ -# This configuration file is for the offline key certificate tool cert_key_util.py (Key Certificate Generation Tool - KCGT). -# -# The available parameters in this configuration file are the following -# • [KEY-CFG] : Mandatory header. -# The internal non-configurable header. -# • cert-keypair : Mandatory parameter. -# The file holding the RSA keypair for signing this certificate, in PEM format. -# • cert-keypair-pwd : Optional. If omitted the tool prompts for direct input. -# The passphrase file for the keypair file, in .txt format. -# • hbk-id : Mandatory parameter. The tool is agnostic to the certificate usage, this parameter cannot be omitted. -# The ID of the Hbk field in OTP memory that the public key of this certificate is verified against: -# - 0: 128-bit Hbk0. -# - 1: 128-bit Hbk1. -# - 2: 256-bit Hbk. -# The ROM code uses this field only if this certificate is the first certificate in: -# - A two-level SB certificate chain. -# - A three-level SB certificate chain. -# - A three-level Secure Debug chain. -# • nvcounter-val : Mandatory parameter. -# The NV counter value: -# - 0..64: the ICV counter. -# - 0..96: the OEM counter. -# - 0..160: the full counter, if OEM and ICV are a single entity. -# The passphrase file for the keypair file, in .txt format. -# • next-cert-pubkey : Mandatory parameter. -# The file holding the RSA public key for signing the next certificate in the chain, in PEM format. -# • cert-pkg : Mandatory parameter. -# The key certificate package output file. -[KEY-CFG] -cert-keypair = utils/key/OEMSBKey.pem -cert-keypair-pwd = utils/key/oem_keys_pass.pwd -hbk-id = 1 -nvcounter-val = 0 -next-cert-pubkey = utils/key/OEMSBContentPublic.pem -cert-pkg = cert/OEMSBKey2.crt diff --git a/tools/alif/utils/clocks.py b/tools/alif/utils/clocks.py deleted file mode 100755 index c82dce060..000000000 --- a/tools/alif/utils/clocks.py +++ /dev/null @@ -1,41 +0,0 @@ -""" clocks """ -import json -import struct - - -# pylint: disable=too-few-public-methods -# pylint: disable=too-many-instance-attributes -# pylint: disable=invalid-name -# pylint: disable=attribute-defined-outside-init - -def processChangeSets(changeSets): - print('Processing ChangeSets') - data = bytearray() - for set in changeSets: - print(set) - data += bytes(int(set['address'], 16).to_bytes(4, 'little')) - data += bytes(int(set['mask'], 16).to_bytes(4, 'little')) - data += bytes(int(set['value'], 16).to_bytes(4, 'little')) - - #print(data) - #print(type(data)) - #print(len(data)) - return data - -def json_to_bin(jsn): - """ Convert a JSON object into binary """ - data = bytearray() - for sec in jsn: - if sec == 'change_sets': - data = processChangeSets(jsn[sec]) - - - return data - -def main(): - """ main """ - json_to_bin() - return 0 - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/common/certificates.py b/tools/alif/utils/common/certificates.py deleted file mode 100755 index b25a312e9..000000000 --- a/tools/alif/utils/common/certificates.py +++ /dev/null @@ -1,641 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import os -import abc -import re -import struct -from utils.common import global_defines -from utils.common import flags_global_defines -from utils.common import cryptolayer -from utils.common.exceptions import CertCreationError - -# ******************************************************************* -# Modification to handle local directories vs Azure Storage -# when looking for Key1/key2 certs in gen-toc.py -# ******************************************************************* -def getKeyCertificatePath(): - return "cert/" # local files - -# ******************************************************************* -# Modification to handle DEV vs PROD (Azure) Environments -# when looking for the alif package name (suffix) in gen-toc.py -# (to differentiate the name of packages for PROD vs DEV in APP Tools) -# ******************************************************************* -def getEnvironmentSuffix(): - return '-dev' # DEV environment suffix - -class ArmCertificateHeader(abc.ABC): - @property - @abc.abstractmethod - def magic_number(self): - pass - - @property - @abc.abstractmethod - def cert_version_number(self): - pass - - @property - @abc.abstractmethod - def signed_content_size(self): - pass - - @property - @abc.abstractmethod - def flags(self): - pass - - @abc.abstractmethod - def serialize_to_bytes(self): - pass - - -class KeyArmCertificateHeader(ArmCertificateHeader): - CERT_TOKEN = 0x53426b63 - - def __init__(self, cert_version, hbk_id, logger=None): - self._cert_version = (cert_version[0] << 16) + cert_version[1] - self._hbk_id = hbk_id - self.logger = logger - self._signed_content_size = (global_defines.HEADER_SIZE_IN_WORDS - + global_defines.SW_VERSION_OBJ_SIZE_IN_WORDS - + global_defines.PUBKEY_SIZE_WORDS - + global_defines.NP_SIZE_IN_WORDS - + global_defines.HASH_ALGORITHM_SHA256_SIZE_IN_WORDS) - self._flags = hbk_id - - def magic_number(self): - return self.CERT_TOKEN - - def cert_version_number(self): - return self._cert_version - - def signed_content_size(self): - return self._signed_content_size - - def flags(self): - return self._flags - - def serialize_to_bytes(self): - data = (struct.pack(' global_defines.AES_DECRYPT_KEY_SIZE_IN_BYTES: - self.logger.warning("key size in aes-enc-key file is too big - truncating parameter") - key_data_list = [int(item, 16) for item in str_key_data_bytes] - key_data_list = key_data_list[:global_defines.AES_DECRYPT_KEY_SIZE_IN_BYTES] - - # combine nonce and address into iv (8 bytes nonce + 4 bytes address + 4 bytes of zeros) - aes_iv = self._key_nonce + bytes(item["mem_load_address_byte_list"]) + bytes(4) - # encrypt image - new_image_filename = item["image_filename"][:-4] + global_defines.SW_COMP_FILE_NAME_POSTFIX - hash_of_image, actual_image_size = cryptolayer.Common.encrypt_file_with_aes_ctr(item["image_filename"], - new_image_filename, - key_data_list, - aes_iv, - self._crypto_type, - self.logger) - else: - raise CertCreationError("invalid aes-ce-id for image encryption flag in image of images-table - " - "must have aes-enc-key for images to be encrypted") - else: - # do only hash - with open(item["image_filename"], "rb") as input_file: - plaintext = input_file.read() - actual_image_size = len(plaintext) - hash_of_image = cryptolayer.HashCrypto.calculate_sha256_hash(plaintext) - # image_hash_and_size.append([hash_of_image, actual_image_size]) - self._sw_records.append([hash_of_image, item["mem_load_address"], item["image_max_size"], item["is_aes_code_enc_used"]]) - self._none_signed_info.append([item["flash_store_address"], actual_image_size]) - - @property - def num_images(self): - return self._num_images - - @property - def sw_version(self): - return self._sw_version - - @property - def signer_rsa_public_key(self): - return self._signer_rsa_public_key - - @property - def key_nonce(self): - return self._key_nonce - - def serialize_to_bytes(self): - data = (self._signer_rsa_public_key - + struct.pack('>: ").encode("utf-8") - private_key = rsa.generate_private_key(public_exponent=65537, key_size=3072, backend=default_backend()) - serialized_pem_key = private_key.private_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PrivateFormat.PKCS8, - encryption_algorithm=serialization.BestAvailableEncryption(passphrase) - ) - with open(pem_filename, "wb") as output_file: - output_file.write(serialized_pem_key) - if logger is not None: - logger.info("Private key written to: %s" % pem_filename) - - return private_key - - @staticmethod - def extract_public_rsa_pem_key(private_key, public_pem_filename, logger=None): - public_key = private_key.public_key() - serialized_public_key = public_key.public_bytes(encoding=serialization.Encoding.PEM, - format=serialization.PublicFormat.SubjectPublicKeyInfo) - - with open(public_pem_filename, "wb") as output_file: - output_file.write(serialized_public_key) - if logger is not None: - logger.info("Public key written to: %s" % public_pem_filename) - - @staticmethod - def load_rsa_pem_key(pem_filename, is_key_private, keypair_passphrase_filename=None, logger=None): - """ - Loads RSA private/public key encoded in PEM format - - :param pem_filename: input file in PEM format - :param is_key_private: True for private keys, False for public keys - :param keypair_passphrase_filename: filename containing passphrase for private key, left out in for public keys - :param logger: initialized logging.logger instance - :return: instance of RSAPublicKey/RSAPrivateKey depending on is_key_private - - Raises RsaKeyLoadingError in case of failure. - """ - # opening PEM file - try: - with open(pem_filename) as key_file: - pem_data = key_file.read() - except OSError as e: - if logger is not None: - logger.warning("Could not open RSA key file %s" % pem_filename) - raise RsaKeyLoadingError("Could not open RSA key file: %s" % e) - # loading passphrase for private keys - if is_key_private is True: - if len(keypair_passphrase_filename) > 0: - try: - with open(keypair_passphrase_filename, "r") as pwd_file: - passphrase = pwd_file.read() - passphrase = passphrase.strip().encode("utf-8") - except OSError as e: - if logger is not None: - logger.warning("Could not open keypair passphrase file %s" % keypair_passphrase_filename) - raise RsaKeyLoadingError("Could not open keypair passphrase file: %s" % e) - else: - passphrase = getpass.getpass(prompt="Enter passphrase for RSA private key: ").encode("utf-8") - # loading public/private key - try: - if is_key_private is True: # private key case - key = load_pem_private_key(bytes(pem_data, encoding="utf-8"), passphrase, backend=default_backend()) - # check return value - if isinstance(key, rsa.RSAPrivateKey) is False: - if logger is not None: - logger.warning("Could not parse key as an RSA Private key from file %s" % pem_filename) - raise RsaKeyLoadingError("Could not parse PEM file as an RSAPrivateKey") - else: # public key case - key = load_pem_public_key(bytes(pem_data, encoding="utf-8"), backend=default_backend()) - # check return value - if isinstance(key, rsa.RSAPublicKey) is False: - if logger is not None: - logger.warning("Could not parse key as an RSA Public key from file %s" % pem_filename) - raise RsaKeyLoadingError("Could not parse PEM file as an RSAPublicKey") - except ValueError or cryptography.exceptions.UnsupportedAlgorithm as e: - # look for internal errors - if logger is not None: - logger.warning("Could not read RSA key from file %s" % pem_filename) - raise RsaKeyLoadingError("Could load RSA key: %s" % e) - else: - return key - - @staticmethod - def get_n_from_rsa_pem_private_key(rsa_key): - """ - Get modulus (N) from RSA Private key - - :param rsa_key: instance of rsa.RSAPrivateKey - :return: modulus (N) of the given key object - """ - return rsa_key.public_key().public_numbers().n - - @staticmethod - def get_n_from_rsa_pem_public_key(rsa_key): - """ - Get modulus (N) from RSA Public key - - :param rsa_key: instance of rsa.RSAPublicKey - :return: modulus (N) of the given key object - """ - return rsa_key.public_numbers().n - - @staticmethod - def calculate_np_from_n(n_as_modulus, logger=None): - if not isinstance(n_as_modulus, int): - if logger is not None: - logger.warning("input parameter n_as_modulus expected to be integer") - raise TypeError("input parameter n_as_modulus expected to be integer") - param_np = (2 ** global_defines.SNP) // n_as_modulus - return param_np - - @staticmethod - def concatenate_n_and_np(n_as_modulus, param_np, logger=None): - if not isinstance(n_as_modulus, int): - if logger is not None: - logger.warning("input parameter n_as_modulus expected to be integer") - raise TypeError("input parameter n_as_modulus expected to be integer") - if not isinstance(param_np, int): - if logger is not None: - logger.warning("input parameter param_np expected to be integer") - raise TypeError("input parameter param_np expected to be integer") - n_in_bytes = n_as_modulus.to_bytes(global_defines.SB_CERT_RSA_KEY_SIZE_IN_BYTES, 'big') - np_in_bytes = param_np.to_bytes(global_defines.NP_SIZE_IN_BYTES, 'big') - n_and_np_in_bytes = n_in_bytes + np_in_bytes - return n_and_np_in_bytes - - @staticmethod - def sign_pkcs_v21(prehashed_data_to_sign, rsa_key, logger=None): - signature = rsa_key.sign(prehashed_data_to_sign, - padding.PSS(mgf=padding.MGF1(hashes.SHA256()), - salt_length=global_defines.RSA_SALT_LEN - ), - utils.Prehashed(hashes.SHA256())) - return signature - - @staticmethod - def verify_signature_pkcs_v21(signature, prehashed_message, public_key, logger=None): - """ - Verifies signature on prehashed message. Raises InvalidSignature if it does not match. - """ - public_key.verify(signature, - prehashed_message, - padding.PSS(mgf=padding.MGF1(hashes.SHA256()), - salt_length=global_defines.RSA_SALT_LEN - ), - utils.Prehashed(hashes.SHA256())) - - @staticmethod - def decrypt_oaep(ciphertext, private_key): - decrypted_text = private_key.decrypt( - ciphertext, - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA256()), - algorithm=hashes.SHA256(), - label=None - ) - ) - return decrypted_text - - @staticmethod - def encrypt_oaep(message, public_key): - ciphertext = public_key.encrypt( - message, - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA256()), - algorithm=hashes.SHA256(), - label=None - ) - ) - return ciphertext - - @staticmethod - def load_rsa_public_key_from_n(n_as_modulus): - # todo: check for param type is integer - rsa_params = rsa.RSAPublicNumbers(65537, n_as_modulus) - return rsa_params.public_key(default_backend()) - - -class HashCrypto: - @staticmethod - def calculate_sha256_hash(input_bytes): - hash_function = hashes.Hash(hashes.SHA256(), backend=default_backend()) - hash_function.update(input_bytes) - message_digest = hash_function.finalize() - return message_digest - - @staticmethod - def calculate_md5_hash(input_bytes): - hash_function = hashes.Hash(hashes.MD5(), backend=default_backend()) - hash_function.update(input_bytes) - message_digest = hash_function.finalize() - return message_digest - - -class AesCrypto: - @staticmethod - def encrypt_aes_ctr(message, aes_key, iv): - """ - :param message: message as bytes object - :param aes_key: bytes-like aes key used for encryption - :param iv: bytes-like initialization vector - :return: ciphertext - """ - aes_cipher = Cipher(algorithms.AES(aes_key), modes.CTR(iv), backend=default_backend()) - aes_encryptor = aes_cipher.encryptor() - ciphertext = aes_encryptor.update(message) + aes_encryptor.finalize() - return ciphertext - - @staticmethod - def encrypt_aes_cbc(message, aes_key, aes_iv): - """ - :param message: message as bytes object - :param aes_key: bytes-like aes key used for encryption - :param aes_iv: bytes-like initialization vector - :return: ciphertext - """ - aes_cipher = Cipher(algorithms.AES(aes_key), modes.CBC(aes_iv), backend=default_backend()) - aes_encryptor = aes_cipher.encryptor() - ciphertext = aes_encryptor.update(message) + aes_encryptor.finalize() - return ciphertext - - @staticmethod - def decrypt_aes_cbc(ciphertext, aes_key, aes_iv): - aes_cipher = Cipher(algorithms.AES(aes_key), modes.CBC(aes_iv), backend=default_backend()) - aes_decryptor = aes_cipher.decryptor() - return aes_decryptor.update(ciphertext) + aes_decryptor.finalize() - - @staticmethod - def calc_aes_cmac(message, key): - aes_cmac = cmac.CMAC(algorithms.AES(key), backend=default_backend()) - aes_cmac.update(message) - return aes_cmac.finalize() - - @staticmethod - def encrypt_aes_ccm(key, nonce, associated_data, message): - aes_ccm = aead.AESCCM(key, 16) # tag length = 16 bytes - ciphertext = aes_ccm.encrypt(nonce, message, associated_data) - return ciphertext - - -class Common: - @staticmethod - def get_n_and_np_from_public_key(public_key_filename, logger=None): - key = RsaCrypto.load_rsa_pem_key(public_key_filename, False, logger=logger) - param_n = RsaCrypto.get_n_from_rsa_pem_public_key(key) - param_np = RsaCrypto.calculate_np_from_n(param_n, logger) - n_and_np_bytes = RsaCrypto.concatenate_n_and_np(param_n, param_np, logger) - return n_and_np_bytes - - @staticmethod - def get_hashed_n_and_np_from_public_key(public_key_filename, logger=None): - n_and_np_bytes = Common.get_n_and_np_from_public_key(public_key_filename, logger) - digest = HashCrypto.calculate_sha256_hash(n_and_np_bytes) - return digest - - @staticmethod - def get_n_and_np_from_keypair(keypair_filename, keypair_passphrase_file, logger=None): - key = RsaCrypto.load_rsa_pem_key(keypair_filename, True, keypair_passphrase_file, logger=logger) - param_n = RsaCrypto.get_n_from_rsa_pem_private_key(key) - param_np = RsaCrypto.calculate_np_from_n(param_n, logger) - n_and_np_bytes = RsaCrypto.concatenate_n_and_np(param_n, param_np, logger) - return n_and_np_bytes - - @staticmethod - def rsa_sign(data_to_sign, keypair_filename, keypair_passphrase_file, logger=None): - key = RsaCrypto.load_rsa_pem_key(keypair_filename, True, keypair_passphrase_file, logger=logger) - hashed_data_to_sign = HashCrypto.calculate_sha256_hash(data_to_sign) - signature = RsaCrypto.sign_pkcs_v21(hashed_data_to_sign, key, logger) - RsaCrypto.verify_signature_pkcs_v21(signature, hashed_data_to_sign, key.public_key(), logger) - return signature - - @staticmethod - def rsa_verify_with_pubkey_params(rsa_pubkey_n, signed_data, signature, logger=None): - modulus_in_bytes = rsa_pubkey_n[0:global_defines.PUBKEY_SIZE_BYTES] # chop of np is input contains it - modulus = int.from_bytes(modulus_in_bytes, "big") - public_key = RsaCrypto.load_rsa_public_key_from_n(modulus) - hashed_data_to_sign = HashCrypto.calculate_sha256_hash(signed_data) - RsaCrypto.verify_signature_pkcs_v21(signature, hashed_data_to_sign, public_key, logger) - - @staticmethod - def decrypt_data_with_rsa_keypair(keypair_filename, keypair_passphrase_file, ciphertext, logger=None): - private_key = RsaCrypto.load_rsa_pem_key(keypair_filename, True, keypair_passphrase_file, logger=logger) - message = RsaCrypto.decrypt_oaep(ciphertext, private_key) - return message - - @staticmethod - def encrypt_data_with_rsa_pubkey_params(rsa_pubkey_n_and_np, input_data): - modulus_in_bytes = rsa_pubkey_n_and_np[0:global_defines.PUBKEY_SIZE_BYTES] - modulus = int.from_bytes(modulus_in_bytes, "big") - public_key = RsaCrypto.load_rsa_public_key_from_n(modulus) - ciphertext = RsaCrypto.encrypt_oaep(input_data, public_key) - return ciphertext - - @staticmethod - def encrypt_file_with_aes_ctr(input_filename, output_filename, key_int_array, aes_iv, hash_type, logger=None): - """ - Encrypts image and calculates SHA256 hash on it - :param input_filename: filename of image to be encrypted - :param output_filename: filename of encrypted image - :param key_int_array: bytes of aes key in a list - :param aes_iv: initialization vector - :param hash_type: 0 for hash calculated on plain image, 1 for hash on encrypted image - :param logger: - :return: returns the hash digest and the image size in a tuple - """ - with open(input_filename, "rb") as input_file: - plaintext = input_file.read() - image_actual_size = len(plaintext) - if image_actual_size == 0 or image_actual_size % 4 != 0: - raise ValueError("invalid images size") - ciphertext = AesCrypto.encrypt_aes_ctr(plaintext, bytes(key_int_array), aes_iv) - with open(output_filename, "wb") as output_file: - output_file.write(ciphertext) - if hash_type == 0: - hash_digest = HashCrypto.calculate_sha256_hash(plaintext) - elif hash_type == 1: - hash_digest = HashCrypto.calculate_sha256_hash(ciphertext) - else: - raise ValueError("Invalid input value for hash_type (crypto_type)") - return hash_digest, image_actual_size - - @staticmethod - def derive_aes_key(enc_password_filename, logger=None): - # get passphrase - if len(enc_password_filename) > 0: - try: - with open(enc_password_filename, "r") as pwd_file: - passphrase = pwd_file.read() - passphrase = passphrase.strip().encode("utf-8") - except OSError as e: - if logger is not None: - logger.warning("Could not open passphrase file %s" % enc_password_filename) - raise ValueError("Could not open passphrase file: %s" % e) - else: - passphrase = getpass.getpass(prompt="Enter passphrase for encrypted key: ").encode("utf-8") - - # PBDF1 key and iv derivation with 1 round, no salt, MD5 hash for compatibility reasons: - # "openssl enc -e -nosalt -md md5 -aes-128-cbc -in -out -pass file:" - # and also with EVP_BytesToKey(cipher, dgst, NULL, (uint8_t *) pwdBuff, pwdBuffLen, 1, keyBuff, ivBuff); - # in line 129 of common_crypto_sim.c of original scripts - digest_round_1 = HashCrypto.calculate_md5_hash(passphrase) - aes_key = digest_round_1 - aes_iv = HashCrypto.calculate_md5_hash(digest_round_1 + passphrase) - return aes_key, aes_iv - - @staticmethod - def encrypt_asset_with_aes_cbc(input_filename, output_filename, enc_password_filename, logger=None): - aes_key, aes_iv = Common.derive_aes_key(enc_password_filename, logger) - - # encrypt asset with the derived key - try: - with open(input_filename, "rb") as asset_file: - unencrypted_data = asset_file.read() - except OSError as e: - if logger is not None: - logger.warning("Could not open asset file %s" % input_filename) - raise ValueError("Could not open asset file: %s" % e) - # add pkcs7 padding - pkcs7_padder = sym_padding.PKCS7(128).padder() - padded_unencrypted_data = pkcs7_padder.update(unencrypted_data) - padded_unencrypted_data += pkcs7_padder.finalize() - # encrypt - encrypted_data = AesCrypto.encrypt_aes_cbc(padded_unencrypted_data, aes_key, aes_iv) - - # write encrypted key to output file - with open(output_filename, "wb") as encrypted_outfile: - encrypted_outfile.write(encrypted_data) - - @staticmethod - def decrypt_asset_with_aes_cbc(ciphertext, password_filename, logger=None): - aes_key, aes_iv = Common.derive_aes_key(password_filename, logger) - decrypted_data_padded = AesCrypto.decrypt_aes_cbc(ciphertext, aes_key, aes_iv) - # remove padding - pkcs7_unpadder = sym_padding.PKCS7(128).unpadder() - decrypted_data = pkcs7_unpadder.update(decrypted_data_padded) - decrypted_data += pkcs7_unpadder.finalize() - return decrypted_data diff --git a/tools/alif/utils/common/exceptions.py b/tools/alif/utils/common/exceptions.py deleted file mode 100755 index 3d8491265..000000000 --- a/tools/alif/utils/common/exceptions.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - - -class RsaKeyLoadingError(Exception): - """Raised when the function cannot load an Rsa key from a PEM file""" - pass - - -class ConfigParsingError(Exception): - """Raised when trying to load a misconfigured CFG file""" - pass - - -class CertCreationError(Exception): - """Raised when certificate creation fails""" - pass diff --git a/tools/alif/utils/common/flags_global_defines.py b/tools/alif/utils/common/flags_global_defines.py deleted file mode 100755 index dc5f553c4..000000000 --- a/tools/alif/utils/common/flags_global_defines.py +++ /dev/null @@ -1,40 +0,0 @@ -#################################################################### -# -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - - -# Definition for RSA Np or H usage -# ================================ -# This flag is set to 1 for Np usage in case H should be used set it to 0 -RSA_ALG_USE_Np = 1 - -# This definition is for the secondary HASH of public key calculation. The calculation is done according to the -# calculation of HASH of public key (as saved in the OTP) and is set according to platform type -OTP_HASH_CALC_ON_N_AND_NP = 0 -OTP_HASH_CALC_ON_N = 1 -OTP_HASH_ON_E_AND_N = 2 - -# This definition should be set according to platform and project -SECONDARY_KEY_HASH_CALC = OTP_HASH_CALC_ON_N_AND_NP - -# Definitions for specific projects, should be set to 0 if no additional data is required -SPECIAL_ADDITIONAL_DATA_USED = 1 - -# Content certificate flag word definition -# ========================================= -CODE_ENCRYPTION_SUPPORT_BIT_POS = 4 - -LOAD_VERIFY_SCHEME_BIT_POS = 8 - -CRYPTO_TYPE_BIT_POS = 12 - -# Bit positions of signature offset and number of s/w components -# ================================================================ -NUM_OF_SW_COMPS_BIT_POS = 16 - -SIGNATURE_OFFSET_BIT_POS = 0 - - diff --git a/tools/alif/utils/common/global_defines.py b/tools/alif/utils/common/global_defines.py deleted file mode 100755 index 5d93fac28..000000000 --- a/tools/alif/utils/common/global_defines.py +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -BITS_WITHIN_WORD = 32 - -# Definition of number of bits in a byte. -CC_BITS_IN_BYTE = 8 -# Definition of number of bits in a 32-bits word. -CC_BITS_IN_32BIT_WORD = 32 -# The size of the PKA engine word. -CC_PKA_WORD_SIZE_IN_BITS = 64 -# The maximal supported size of modulus in bits. -C_SRP_MAX_MODULUS_SIZE_IN_BITS = 3072 -# The maximal supported size of modulus in RSA in bits. -CC_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS = 4096 -# The maximal supported size of key-generation in RSA in bits. -CC_RSA_MAX_KEY_GENERATION_HW_SIZE_BITS = 3072 -# The maximal supported size of modulus in RSA in words. -CC_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_WORDS = CC_RSA_MAX_VALID_KEY_SIZE_VALUE_IN_BITS / CC_BITS_IN_32BIT_WORD - -# The size of the RSA public modulus key of the Secure Boot or Secure Debug certificate in bits. -SB_CERT_RSA_KEY_SIZE_IN_BITS = 3072 -# The size of the RSA public modulus key of the Secure Boot or Secure Debug certificate in bytes. -SB_CERT_RSA_KEY_SIZE_IN_BYTES = int(SB_CERT_RSA_KEY_SIZE_IN_BITS / CC_BITS_IN_BYTE) -# The size of the RSA public modulus key of the Secure Boot or Secure Debug certificate in words. -SB_CERT_RSA_KEY_SIZE_IN_WORDS = SB_CERT_RSA_KEY_SIZE_IN_BITS / CC_BITS_IN_32BIT_WORD - -# The maximal count of extra bits in PKA operations. -PKA_EXTRA_BITS = 8 -# The number of memory registers in PKA operations. -PKA_MAX_COUNT_OF_PHYS_MEM_REGS = 32 - -# Global defines from common_rsa_keypair -RSA_PRIVATE_KEY_SIZE = SB_CERT_RSA_KEY_SIZE_IN_BITS -NP_SIZE_IN_BYTES = 20 -NEW_PKA_WORD_SIZE_BITS = CC_PKA_WORD_SIZE_IN_BITS -NEW_PAK_ADDITIONAL_BITS = 8 -SNP = SB_CERT_RSA_KEY_SIZE_IN_BITS + NEW_PKA_WORD_SIZE_BITS + NEW_PAK_ADDITIONAL_BITS - 1 - -HASH_SHA256_DIGEST_SIZE_IN_BYTES = 32 - -# Definitions for sw version legal values - -######################################### -SW_REVOCATION_MAX_NUM_OF_BITS_HBK0 = 64 -SW_REVOCATION_MAX_NUM_OF_BITS_HBK1 = 96 -SW_REVOCATION_MAX_NUM_OF_BITS_HBK2 = 160 - -RSA_SALT_LEN = 32 - -BYTES_WITHIN_WORD = 4 -PUBKEY_SIZE_BYTES = 384 #256 aligned with SB_CERT_RSA_KEY_SIZE_IN_BITS defined in cc_pka_hw_plat_defs.h -PUBKEY_SIZE_WORDS = (PUBKEY_SIZE_BYTES//BYTES_WITHIN_WORD) -NP_SIZE_IN_WORDS = (NP_SIZE_IN_BYTES//BYTES_WITHIN_WORD) -SHA_256_HASH_SIZE_IN_BYTES = 32 -RSA_SIGNATURE_SIZE_BYTES = 384 #256 aligned with SB_CERT_RSA_KEY_SIZE_IN_BITS defined in cc_pka_hw_plat_defs.h - -CC_MNG_CHIP_MANUFACTURE_LCS = 0x0 -CC_MNG_DEVICE_MANUFACTURE_LCS = 0x1 -CC_MNG_SECURE_LCS = 0x5 -CC_MNG_RMA_LCS = 0x7 - -# E value, in a string mode. for the HASh calculation -E_VALUE_REVERSED = "00010001" -# Memory unload flag -MEM_ADDRESS_UNLOAD_FLAG = 0xFFFFFFFF - -RSA_SIGNATURE_SIZE_IN_BYTES = 384 -RSA_SIGNATURE_SIZE_IN_DOUBLE_BYTES = 768 -RSA_SIGNATURE_SIZE_IN_WORDS = 96 -# HASH size in SHA256 in bytes -HASH_ALGORITHM_SHA256_SIZE_IN_WORDS = (SHA_256_HASH_SIZE_IN_BYTES//BYTES_WITHIN_WORD) - -# H size -RSA_H_SIZE_IN_BYTES = RSA_SIGNATURE_SIZE_IN_BYTES -RSA_H_SIZE_IN_WORDS = (RSA_SIGNATURE_SIZE_IN_BYTES//BYTES_WITHIN_WORD) - -# Size of SW versions -SW_VERSION_OBJ_SIZE_IN_WORDS = 1 - -# header size in bytes -HEADER_SIZE_IN_WORDS = 4 -HEADER_SIZE_IN_BYTES = (HEADER_SIZE_IN_WORDS * BYTES_WITHIN_WORD) -#size number of bytes in address -NUM_OF_BYTES_IN_ADDRESS = 4 - -SOC_ID_SIZE_IN_BYTES = 32 - -#enabler certificate flag offset -HBK_ID_FLAG_BIT_OFFSET = 0 -LCS_ID_FLAG_BIT_OFFSET = 4 -RMA_CERT_FLAG_BIT_OFFSET = 8 - - -# HASH output representation -HASH_BINARY_REPRESENTATION = 1 -HASH_HEX_REPRESENTATION = 2 - - -# certificate output file prefix -Cert_FileName = "Cert" -# certificate output file suffix -Cert_FileExtBin = ".bin" -Cert_FileExtTxt = ".txt" - -# definitions for code encryption -AES_IV_SIZE_IN_BYTES = 16 -AES_DECRYPT_KEY_SIZE_IN_BYTES = 16 -SW_COMP_FILE_NAME_POSTFIX = "_enc.bin" - -NONCE_SIZE_IN_WORDS = 2 -MAX_NUM_OF_IMAGES = 16 - -SW_REC_ADDR32_SIGNED_DATA_SIZE_IN_WORDS = 3 - -USE_AES_CE_ID_NONE = 0 -USE_AES_CE_ID_KCEICV = 1 -USE_AES_CE_ID_KCE = 2 - -LOAD_AND_VERIFY_IMAGE = 0 -VERIFY_IMAGE_IN_FLASH = 1 -VERIFY_IMAGE_IN_MEM = 2 -LOADING_ONLY_IMAGE = 3 diff --git a/tools/alif/utils/common/util_logger.py b/tools/alif/utils/common/util_logger.py deleted file mode 100755 index 5d07f5ede..000000000 --- a/tools/alif/utils/common/util_logger.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import sys -import logging - -#from utils.printInfo import * - -class UtilLogger: - def __init__(self, log_filename, utility_name): - self.log_filename = log_filename - self.root_logger = logging.getLogger() - self.log_formatter = logging.Formatter("%(asctime)s - %(message)s") - self.log_file_handler = logging.FileHandler(self.log_filename) - self.log_file_handler.setFormatter(self.log_formatter) - # Added if condition to avoid duplicate meessages or instances - if not self.root_logger.handlers: - log_console_handler = logging.StreamHandler(sys.stdout) - log_console_handler.setFormatter(self.log_formatter) - self.root_logger.addHandler(log_console_handler) - - self.root_logger.addHandler(self.log_file_handler) - self.root_logger.setLevel(logging.INFO) - #if verboseModeGet(): - self.root_logger.info(utility_name + " Utility started (Logging to " + self.log_filename + ")") - - def info(self, message): - self.root_logger.info(message) - - def warning(self, message): - self.root_logger.warning(message) - - def error(self, message): - self.root_logger.error(message) - - def critical(self, message): - self.root_logger.critical(message) diff --git a/tools/alif/utils/common_cert_lib/contentcertificateconfig.py b/tools/alif/utils/common_cert_lib/contentcertificateconfig.py deleted file mode 100755 index 8c724ac04..000000000 --- a/tools/alif/utils/common_cert_lib/contentcertificateconfig.py +++ /dev/null @@ -1,234 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import configparser - -from utils.common.util_logger import UtilLogger -from utils.common.exceptions import ConfigParsingError -from utils.common import global_defines - -from printInfo import * - -class ContentCertificateConfig: - CFG_SECTION_NAME = "CNT-CFG" - - def __init__(self, config_filename, app_logger=None): - """ - Parses the CNT-CFG content certificate cfg file. - Raises ConfigParsingError when cfg has been written incorrectly. - Raises TypeError or ValueError when a cfg value is incorrect on its own. - - :param str config_filename: name of cfg file to parse - :param UtilLogger app_logger: instance of the application logger - """ - self._config_filename = config_filename - self._logger = app_logger - self._parser = configparser.ConfigParser() - - self._cert_keypair = None - self._cert_keypair_pwd = None - self._load_verify_scheme = None - self._crypto_type = None - self._aes_ce_id = None - self._aes_enc_key = None - self._images_table = None - self._nvcounter_val = None - self._cert_pkg = None - self._parse_config() - - @property - def section_name(self): - return self.CFG_SECTION_NAME - - @property - def cert_keypair(self): - return self._cert_keypair - - @cert_keypair.setter - def cert_keypair(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair must be a string") - elif value == "": - raise ValueError("Config parameter cert-keypair cannot be an empty string!") - else: - self._cert_keypair = value - - @property - def cert_keypair_pwd(self): - return self._cert_keypair_pwd - - @cert_keypair_pwd.setter - def cert_keypair_pwd(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair-pwd must be a string") - else: - self._cert_keypair_pwd = value - - @property - def load_verify_scheme(self): - return self._load_verify_scheme - - @load_verify_scheme.setter - def load_verify_scheme(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter load_verify_scheme must be an integer") - elif value not in [0, 1, 2, 3]: - raise ValueError("invalid input value for config parameter load_verify_scheme") - else: - self._load_verify_scheme = value - - @property - def crypto_type(self): - return self._crypto_type - - @crypto_type.setter - def crypto_type(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter crypto_type must be an integer") - elif value not in [0, 1]: - raise ValueError("invalid input value for config parameter crypto_type") - else: - self._crypto_type = value - - @property - def aes_ce_id(self): - return self._aes_ce_id - - @aes_ce_id.setter - def aes_ce_id(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter aes_ce_id must be an integer") - elif value not in [0, 1, 2]: - raise ValueError("invalid input value for config parameter aes_ce_id") - else: - self._aes_ce_id = value - - @property - def aes_enc_key(self): - return self._aes_enc_key - - @aes_enc_key.setter - def aes_enc_key(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter aes_enc_key must be a string") - else: - self._aes_enc_key = value - - @property - def images_table(self): - return self._images_table - - @images_table.setter - def images_table(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter images_table must be a string") - elif value == "": - raise ValueError("Config parameter images_table cannot be an empty string!") - else: - self._images_table = value - - @property - def nvcounter_val(self): - return self._nvcounter_val - - @nvcounter_val.setter - def nvcounter_val(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter nvcounter_val must be an integer") - elif value not in range(global_defines.SW_REVOCATION_MAX_NUM_OF_BITS_HBK2 + 1): - raise ValueError("invalid input value for config parameter nvcounter_val") - else: - self._nvcounter_val = value - - @property - def cert_pkg(self): - return self._cert_pkg - - @cert_pkg.setter - def cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert_pkg must be a string") - elif value == "": - raise ValueError("Config parameter cert_pkg cannot be an empty string!") - else: - self._cert_pkg = value - - def _parse_config(self): - if self._logger is not None: - if verboseModeGet(): - self._logger.info("Parsing config file: " + self._config_filename) - self._parser.read(self._config_filename, encoding='cp1250') - - if not self._parser.has_section(self.section_name): - if self._logger is not None: - self._logger.error("section [" + self.section_name + "] wasn't found in cfg file") - raise ConfigParsingError - - if not self._parser.has_option(self.section_name, 'cert-keypair'): - if self._logger is not None: - self._logger.error("parameter cert-keypair not found in cfg file") - raise ConfigParsingError - else: - self.cert_keypair = self._parser.get(self.section_name, 'cert-keypair') - - if self._parser.has_option(self.section_name, 'cert-keypair-pwd'): # used for testing - self.cert_keypair_pwd = self._parser.get(self.section_name, 'cert-keypair-pwd') - else: - self.cert_keypair_pwd = '' - - if not self._parser.has_option(self.section_name, 'load-verify-scheme'): - if self._logger is not None: - self._logger.error("parameter load-verify-scheme not found in cfg file") - raise ConfigParsingError - else: - self.load_verify_scheme = self._parser.getint(self.section_name, 'load-verify-scheme') - - if not self._parser.has_option(self.section_name, 'crypto-type'): - if self._logger is not None: - self._logger.error("parameter crypto-type not found in cfg file") - raise ConfigParsingError - else: - self.crypto_type = self._parser.getint(self.section_name, 'crypto-type') - - if not self._parser.has_option(self.section_name, 'aes-ce-id'): - if self._logger is not None: - self._logger.error("parameter aes-ce-id not found in cfg file") - raise ConfigParsingError - else: - self.aes_ce_id = self._parser.getint(self.section_name, 'aes-ce-id') - - if self._parser.has_option(self.section_name, 'aes-enc-key'): - self.aes_enc_key = self._parser.get(self.section_name, 'aes-enc-key') - else: - self.aes_enc_key = "" - - if not self._parser.has_option(self.section_name, 'images-table'): - if self._logger is not None: - self._logger.error("parameter images-table not found in cfg file") - raise ConfigParsingError - else: - self.images_table = self._parser.get(self.section_name, 'images-table') - - if not self._parser.has_option(self.section_name, 'nvcounter-val'): - if self._logger is not None: - self._logger.error("parameter nvcounter-val not found in cfg file") - raise ConfigParsingError - else: - self.nvcounter_val = self._parser.getint(self.section_name, 'nvcounter-val') - - if not self._parser.has_option(self.section_name, 'cert-pkg'): - if self._logger is not None: - self._logger.error("parameter cert_pkg not found in cfg file") - raise ConfigParsingError - else: - self.cert_pkg = self._parser.get(self.section_name, 'cert-pkg') - - # SB does not support encrypted images in case of "loading only" and "verify only in flash" modes - if self.aes_ce_id != global_defines.USE_AES_CE_ID_NONE and ( - self.load_verify_scheme == global_defines.VERIFY_IMAGE_IN_FLASH or - self.load_verify_scheme == global_defines.LOADING_ONLY_IMAGE): - if self._logger is not None: - self._logger.error("invalid parameter combination for aes-ce-id and load-verify-scheme") - raise ConfigParsingError diff --git a/tools/alif/utils/common_cert_lib/developercertificateconfig.py b/tools/alif/utils/common_cert_lib/developercertificateconfig.py deleted file mode 100755 index 06c353eba..000000000 --- a/tools/alif/utils/common_cert_lib/developercertificateconfig.py +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import configparser - -from common.util_logger import UtilLogger -from common.exceptions import ConfigParsingError - - -class DeveloperDebugCertificateConfig: - CFG_SECTION_NAME = "DEVELOPER-DBG-CFG" - - def __init__(self, config_filename, app_logger=None): - """ - Parses the DEVELOPER-DBG-CFG developer debug certificate cfg file. - Raises ConfigParsingError when cfg has been written incorrectly. - Raises TypeError or ValueError when a cfg value is incorrect on its own. - - :param str config_filename: name of cfg file to parse - :param UtilLogger app_logger: instance of the application logger - """ - self._config_filename = config_filename - self._logger = app_logger - self._parser = configparser.ConfigParser() - - self._cert_keypair = None - self._cert_keypair_pwd = None - self._soc_id = None - self._debug_masks = [0, 0, 0, 0] - self._enabler_cert_pkg = None - self._cert_pkg = None - self._parse_config() - - @property - def section_name(self): - return self.CFG_SECTION_NAME - - @property - def cert_keypair(self): - return self._cert_keypair - - @cert_keypair.setter - def cert_keypair(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair must be a string") - elif value == "": - raise ValueError("Config parameter cert-keypair cannot be an empty string!") - else: - self._cert_keypair = value - - @property - def cert_keypair_pwd(self): - return self._cert_keypair_pwd - - @cert_keypair_pwd.setter - def cert_keypair_pwd(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair-pwd must be a string") - else: - self._cert_keypair_pwd = value - - @property - def soc_id(self): - return self._soc_id - - @soc_id.setter - def soc_id(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter soc_id must be a string") - else: - self._soc_id = value - - @property - def debug_masks(self): - return self._debug_masks - - @debug_masks.setter - def debug_masks(self, value): - if isinstance(value, list) is False: - raise TypeError("Config parameter debug_masks must be a list") - elif len(value) != 4 or isinstance(value[0], int) is False or isinstance(value[1], int) is False or \ - isinstance(value[2], int) is False or isinstance(value[3], int) is False: - raise TypeError("Config parameter debug_masks must be a list of 4 integers") - else: - for item in value: - if not 0 <= item <= 0xFFFFFFFF: - raise ValueError("invalid input value for config parameter debug_masks") - self._debug_masks = value - - @property - def enabler_cert_pkg(self): - return self._enabler_cert_pkg - - @enabler_cert_pkg.setter - def enabler_cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter enabler_cert_pkg must be a string") - elif value == "": - raise ValueError("Config parameter enabler_cert_pkg cannot be an empty string!") - else: - self._enabler_cert_pkg = value - - @property - def cert_pkg(self): - return self._cert_pkg - - @cert_pkg.setter - def cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert_pkg must be a string") - elif value == "": - raise ValueError("Config parameter cert_pkg cannot be an empty string!") - else: - self._cert_pkg = value - - def _parse_config(self): - if self._logger is not None: - self._logger.info("Parsing config file: " + self._config_filename) - self._parser.read(self._config_filename, encoding='cp1250') - self._logger.info("Parsed items:\n" + str(self._parser.items(self.CFG_SECTION_NAME))) - with open(self._config_filename, "r") as config_file: - raw_data = config_file.read() - self._logger.info("Raw content of config file:\n" + raw_data) - - if not self._parser.has_section(self.section_name): - if self._logger is not None: - self._logger.warning("section [" + self.section_name + "] wasn't found in cfg file") - raise ConfigParsingError - - if not self._parser.has_option(self.section_name, 'cert-keypair'): - if self._logger is not None: - self._logger.error("parameter cert-keypair not found in cfg file") - raise ConfigParsingError - else: - self.cert_keypair = self._parser.get(self.section_name, 'cert-keypair') - - if self._parser.has_option(self.section_name, 'cert-keypair-pwd'): # used for testing - self.cert_keypair_pwd = self._parser.get(self.section_name, 'cert-keypair-pwd') - else: - self.cert_keypair_pwd = '' - - if not self._parser.has_option(self.section_name, 'soc-id'): - if self._logger is not None: - self._logger.error("parameter soc-id not found in cfg file") - raise ConfigParsingError - else: - self.soc_id = self._parser.get(self.section_name, 'soc-id') - - if (self._parser.has_option(self.section_name, 'debug-mask[0-31]') - and self._parser.has_option(self.section_name, 'debug-mask[32-63]') - and self._parser.has_option(self.section_name, 'debug-mask[64-95]') - and self._parser.has_option(self.section_name, 'debug-mask[96-127]')): - debug_masks = [int(self._parser.get(self.section_name, 'debug-mask[0-31]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[32-63]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[64-95]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[96-127]'), 16)] - self.debug_masks = debug_masks - - if not self._parser.has_option(self.section_name, 'enabler-cert-pkg'): - if self._logger is not None: - self._logger.error("parameter enabler_cert_pkg not found in cfg file") - raise ConfigParsingError - else: - self.enabler_cert_pkg = self._parser.get(self.section_name, 'enabler-cert-pkg') - - if not self._parser.has_option(self.section_name, 'cert-pkg'): - if self._logger is not None: - self._logger.error("parameter cert_pkg not found in cfg file") - raise ConfigParsingError - else: - self.cert_pkg = self._parser.get(self.section_name, 'cert-pkg') diff --git a/tools/alif/utils/common_cert_lib/enablercertificateconfig.py b/tools/alif/utils/common_cert_lib/enablercertificateconfig.py deleted file mode 100755 index afb09536e..000000000 --- a/tools/alif/utils/common_cert_lib/enablercertificateconfig.py +++ /dev/null @@ -1,282 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import configparser - -from common.util_logger import UtilLogger -from common.exceptions import ConfigParsingError - - -class EnablerDebugCertificateConfig: - CFG_SECTION_NAME = "ENABLER-DBG-CFG" - - def __init__(self, config_filename, app_logger=None): - """ - Parses the ENABLER-DBG-CFG enabler debug certificate cfg file. - Raises ConfigParsingError when cfg has been written incorrectly. - Raises TypeError or ValueError when a cfg value is incorrect on its own. - - :param str config_filename: name of cfg file to parse - :param UtilLogger app_logger: instance of the application logger - """ - self._config_filename = config_filename - self._logger = app_logger - self._parser = configparser.ConfigParser() - - self._cert_keypair = None - self._cert_keypair_pwd = None - self._lcs = None - self._rma_mode = None - self._debug_masks = [0, 0, 0, 0] - self._debug_locks = [0, 0, 0, 0] - self._hbk_id = None - self._key_cert_pkg = None - self._next_cert_pubkey = None - self._cert_pkg = None - self._parse_config() - - @property - def section_name(self): - return self.CFG_SECTION_NAME - - @property - def cert_keypair(self): - return self._cert_keypair - - @cert_keypair.setter - def cert_keypair(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair must be a string") - elif value == "": - raise ValueError("Config parameter cert-keypair cannot be an empty string!") - else: - self._cert_keypair = value - - @property - def cert_keypair_pwd(self): - return self._cert_keypair_pwd - - @cert_keypair_pwd.setter - def cert_keypair_pwd(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair-pwd must be a string") - else: - self._cert_keypair_pwd = value - - @property - def lcs(self): - return self._lcs - - @lcs.setter - def lcs(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter lcs must be an integer") - elif value not in [0, 1, 5, 7]: - raise ValueError("invalid input value for config parameter lcs") - else: - self._lcs = value - - @property - def rma_mode(self): - return self._rma_mode - - @rma_mode.setter - def rma_mode(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter rma_mode must be an integer") - elif value not in [0, 1]: - raise ValueError("invalid input value for config parameter rma_mode") - else: - self._rma_mode = value - - @property - def debug_masks(self): - return self._debug_masks - - @debug_masks.setter - def debug_masks(self, value): - if isinstance(value, list) is False: - raise TypeError("Config parameter debug_masks must be a list") - elif len(value) != 4 or isinstance(value[0], int) is False or isinstance(value[1], int) is False or \ - isinstance(value[2], int) is False or isinstance(value[3], int) is False: - raise TypeError("Config parameter debug_masks must be a list of 4 integers") - else: - for item in value: - if not 0 <= item <= 0xFFFFFFFF: - raise ValueError("invalid input value for config parameter debug_masks") - self._debug_masks = value - - @property - def debug_locks(self): - return self._debug_locks - - @debug_locks.setter - def debug_locks(self, value): - if isinstance(value, list) is False: - raise TypeError("Config parameter debug_locks must be a list") - elif len(value) != 4 or isinstance(value[0], int) is False or isinstance(value[1], int) is False or \ - isinstance(value[2], int) is False or isinstance(value[3], int) is False: - raise TypeError("Config parameter debug_locks must be a list of 4 integers") - else: - for item in value: - if not 0 <= item <= 0xFFFFFFFF: - raise ValueError("invalid input value for config parameter debug_locks") - self._debug_locks = value - - @property - def hbk_id(self): - return self._hbk_id - - @hbk_id.setter - def hbk_id(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter hbk_id must be an integer") - elif value not in [0, 1, 2, 0xF]: - raise ValueError("invalid input value for config parameter hbk_id") - else: - self._hbk_id = value - - @property - def key_cert_pkg(self): - return self._key_cert_pkg - - @key_cert_pkg.setter - def key_cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter key_cert_pkg must be a string") - else: - self._key_cert_pkg = value - - @property - def next_cert_pubkey(self): - return self._next_cert_pubkey - - @next_cert_pubkey.setter - def next_cert_pubkey(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter next_cert_pubkey must be a string") - elif value == "": - raise ValueError("Config parameter next_cert_pubkey cannot be an empty string!") - else: - self._next_cert_pubkey = value - - @property - def cert_pkg(self): - return self._cert_pkg - - @cert_pkg.setter - def cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert_pkg must be a string") - elif value == "": - raise ValueError("Config parameter cert_pkg cannot be an empty string!") - else: - self._cert_pkg = value - - def _parse_config(self): - if self._logger is not None: - self._logger.info("Parsing config file: " + self._config_filename) - self._parser.read(self._config_filename, encoding='cp1250') - self._logger.info("Parsed items:\n" + str(self._parser.items(self.CFG_SECTION_NAME))) - with open(self._config_filename, "r") as config_file: - raw_data = config_file.read() - self._logger.info("Raw content of config file:\n" + raw_data) - - if not self._parser.has_section(self.section_name): - if self._logger is not None: - self._logger.error("section " + self.section_name + " wasn't found in cfg file") - raise ConfigParsingError - - is_debug_exist = 0 - if (self._parser.has_option(self.section_name, 'debug-mask[0-31]') - and self._parser.has_option(self.section_name, 'debug-mask[32-63]') - and self._parser.has_option(self.section_name, 'debug-mask[64-95]') - and self._parser.has_option(self.section_name, 'debug-mask[96-127]') - and self._parser.has_option(self.section_name, 'debug-lock[0-31]') - and self._parser.has_option(self.section_name, 'debug-lock[32-63]') - and self._parser.has_option(self.section_name, 'debug-lock[64-95]') - and self._parser.has_option(self.section_name, 'debug-lock[96-127]')): - debug_masks = [int(self._parser.get(self.section_name, 'debug-mask[0-31]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[32-63]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[64-95]'), 16), - int(self._parser.get(self.section_name, 'debug-mask[96-127]'), 16)] - self.debug_masks = debug_masks - - debug_locks = [int(self._parser.get(self.section_name, 'debug-lock[0-31]'), 16), - int(self._parser.get(self.section_name, 'debug-lock[32-63]'), 16), - int(self._parser.get(self.section_name, 'debug-lock[64-95]'), 16), - int(self._parser.get(self.section_name, 'debug-lock[96-127]'), 16)] - self.debug_locks = debug_locks - is_debug_exist = 1 - - if self._parser.has_option(self.section_name, 'rma-mode'): - self.rma_mode = self._parser.getint(self.section_name, 'rma-mode') - else: - self.rma_mode = 0 - - is_hbk_exist = self._parser.has_option(self.section_name, 'hbk-id') - if is_hbk_exist: - self.hbk_id = self._parser.getint(self.section_name, 'hbk-id') - else: - self.hbk_id = 0xF # dummy value (from original) - certificate always need a value - - is_key_pkg_exist = 0 - if self._parser.has_option(self.section_name, 'key-cert-pkg'): - self.key_cert_pkg = self._parser.get(self.section_name, 'key-cert-pkg') - is_key_pkg_exist = 1 - - if self.rma_mode == 1 and is_debug_exist == 1: - if self._logger is not None: - self._logger.error("Both RMA and debug mode are defined") - raise ConfigParsingError - if self.rma_mode == 0 and is_debug_exist == 0: - if self._logger is not None: - self._logger.error("Neither RMA nor Debug mode is defined") - raise ConfigParsingError - if is_key_pkg_exist == 0 and not is_hbk_exist: - if self._logger is not None: - self._logger.error("Neither hbk-id nor key-cert-pkg is defined") - raise ConfigParsingError - if is_key_pkg_exist == 1 and is_hbk_exist: - if self._logger is not None: - self._logger.error("Both hbk-id and key-cert-pkg is defined") - raise ConfigParsingError - if not is_hbk_exist and self.rma_mode == 1: - if self._logger is not None: - self._logger.error("hbk-id must exist if RMA mode is defined") - raise ConfigParsingError - - if not self._parser.has_option(self.section_name, 'cert-keypair'): - if self._logger is not None: - self._logger.error("cert-keypair not found") - raise ConfigParsingError - else: - self.cert_keypair = self._parser.get(self.section_name, 'cert-keypair') - - if self._parser.has_option(self.section_name, 'cert-keypair-pwd'): # used for testing - self.cert_keypair_pwd = self._parser.get(self.section_name, 'cert-keypair-pwd') - else: - self.cert_keypair_pwd = '' - - if not self._parser.has_option(self.section_name, 'lcs'): - if self._logger is not None: - self._logger.error("no lcs parameter found") - raise ConfigParsingError - else: - self.lcs = self._parser.getint(self.section_name, 'lcs') - - if not self._parser.has_option(self.section_name, 'next-cert-pubkey'): - if self._logger is not None: - self._logger.error("no next-cert-pubkey parameter found") - raise ConfigParsingError - else: - self.next_cert_pubkey = self._parser.get(self.section_name, 'next-cert-pubkey') - - if not self._parser.has_option(self.section_name, 'cert-pkg'): - if self._logger is not None: - self._logger.error("no cert-pkg parameter found") - raise ConfigParsingError - else: - self.cert_pkg = self._parser.get(self.section_name, 'cert-pkg') diff --git a/tools/alif/utils/common_cert_lib/keycertificateconfig.py b/tools/alif/utils/common_cert_lib/keycertificateconfig.py deleted file mode 100755 index b1cc8e607..000000000 --- a/tools/alif/utils/common_cert_lib/keycertificateconfig.py +++ /dev/null @@ -1,180 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import configparser - -from utils.common.util_logger import UtilLogger -from utils.common.exceptions import ConfigParsingError -from utils.common import global_defines - - -class KeyCertificateConfig: - CFG_SECTION_NAME = "KEY-CFG" - - def __init__(self, config_filename, app_logger=None): - """ - Parses the KEY-CFG key certificate cfg file. - Raises ConfigParsingError when cfg has been written incorrectly. - Raises TypeError or ValueError when a cfg value is incorrect on its own. - - :param str config_filename: name of cfg file to parse - :param UtilLogger app_logger: instance of the application logger - """ - self._config_filename = config_filename - self._logger = app_logger - self._parser = configparser.ConfigParser() - - self._cert_keypair = None - self._cert_keypair_pwd = None - self._hbk_id = None - self._nvcounter_val = None - self._next_cert_pubkey = None - self._cert_pkg = None - self._parse_config() - - @property - def section_name(self): - return self.CFG_SECTION_NAME - - @property - def cert_keypair(self): - return self._cert_keypair - - @cert_keypair.setter - def cert_keypair(self, value): - if value == "": - raise ValueError("Config parameter cert-keypair cannot be an empty string!") - elif isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair must be a string") - else: - self._cert_keypair = value - - @property - def cert_keypair_pwd(self): - return self._cert_keypair_pwd - - @cert_keypair_pwd.setter - def cert_keypair_pwd(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert-keypair-pwd must be a string") - else: - self._cert_keypair_pwd = value - - @property - def hbk_id(self): - return self._hbk_id - - @hbk_id.setter - def hbk_id(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter hbk_id must be an integer") - elif value not in [0, 1, 2]: - raise ValueError("invalid input value for config parameter hbk_id") - else: - self._hbk_id = value - - @property - def nvcounter_val(self): - return self._nvcounter_val - - @nvcounter_val.setter - def nvcounter_val(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter nvcounter_val must be an integer") - elif value not in range(global_defines.SW_REVOCATION_MAX_NUM_OF_BITS_HBK2 + 1): - raise ValueError("invalid input value for config parameter nvcounter_val") - else: - self._nvcounter_val = value - - @property - def next_cert_pubkey(self): - return self._next_cert_pubkey - - @next_cert_pubkey.setter - def next_cert_pubkey(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter next_cert_pubkey must be a string") - elif value == "": - raise ValueError("Config parameter next_cert_pubkey cannot be an empty string!") - else: - self._next_cert_pubkey = value - - @property - def cert_pkg(self): - return self._cert_pkg - - @cert_pkg.setter - def cert_pkg(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter cert_pkg must be a string") - elif value == "": - raise ValueError("Config parameter cert_pkg cannot be an empty string!") - else: - self._cert_pkg = value - - def _parse_config(self): - if self._logger is not None: - self._logger.info("Parsing config file: " + self._config_filename) - self._parser.read(self._config_filename, encoding='cp1250') - self._logger.info("Parsed items:\n" + str(self._parser.items(self.CFG_SECTION_NAME))) - with open(self._config_filename, "r") as config_file: - raw_data = config_file.read() - self._logger.info("Raw content of config file:\n" + raw_data) - - if not self._parser.has_section(self.section_name): - if self._logger is not None: - self._logger.error("section [" + self.section_name + "] wasn't found in cfg file") - raise ConfigParsingError - - if not self._parser.has_option(self.section_name, 'cert-keypair'): - if self._logger is not None: - self._logger.error("cert-keypair not found") - raise ConfigParsingError - else: - self.cert_keypair = self._parser.get(self.section_name, 'cert-keypair') - - if self._parser.has_option(self.section_name, 'cert-keypair-pwd'): - self.cert_keypair_pwd = self._parser.get(self.section_name, 'cert-keypair-pwd') - else: - self.cert_keypair_pwd = '' - - if not self._parser.has_option(self.section_name, 'hbk-id'): - if self._logger is not None: - self._logger.error("hbk-id not found") - raise ConfigParsingError - else: - self.hbk_id = self._parser.getint(self.section_name, 'hbk-id') - - if not self._parser.has_option(self.section_name, 'nvcounter-val'): - if self._logger is not None: - self._logger.error("nvcounter-val not found") - raise ConfigParsingError - else: - self.nvcounter_val = self._parser.getint(self.section_name, 'nvcounter-val') - # verify nvcounter_val according to HBK - if self.hbk_id == 0: - max_value_nvcounter = global_defines.SW_REVOCATION_MAX_NUM_OF_BITS_HBK0 - elif self.hbk_id == 1: - max_value_nvcounter = global_defines.SW_REVOCATION_MAX_NUM_OF_BITS_HBK1 - else: - max_value_nvcounter = global_defines.SW_REVOCATION_MAX_NUM_OF_BITS_HBK2 - if self.nvcounter_val > max_value_nvcounter: - if self._logger is not None: - self._logger.error("Invalid nvcounter-val based on given hbk-id") - raise ConfigParsingError - - if not self._parser.has_option(self.section_name, 'next-cert-pubkey'): - if self._logger is not None: - self._logger.error("no next-cert-pubkey parameter found") - raise ConfigParsingError - else: - self.next_cert_pubkey = self._parser.get(self.section_name, 'next-cert-pubkey') - - if not self._parser.has_option(self.section_name, 'cert-pkg'): - if self._logger is not None: - self._logger.error("no cert-pkg parameter found") - raise ConfigParsingError - else: - self.cert_pkg = self._parser.get(self.section_name, 'cert-pkg') diff --git a/tools/alif/utils/common_cert_lib/x509certificateconfig.py b/tools/alif/utils/common_cert_lib/x509certificateconfig.py deleted file mode 100755 index e65b06596..000000000 --- a/tools/alif/utils/common_cert_lib/x509certificateconfig.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import configparser -import sys -import os - -from common.util_logger import UtilLogger - - -class X509CertificateConfig: - - def __init__(self, config_filename, config_section_name, app_logger=None): - """ - Parses the X509 part of a certificate config file. - Raises ConfigParsingError when cfg has been written incorrectly. - Raises TypeError or ValueError when a cfg value is incorrect on its own. - - :param str config_filename: name of cfg file to parse - :param str config_section_name: name of the section holding the values of the cfg file - :param UtilLogger app_logger: instance of the application logger - """ - self._config_filename = config_filename - self._section_name = config_section_name - self._logger = app_logger - self._parser = configparser.ConfigParser() - - self._issuer_name = "" - self._subject_name = "" - self._not_before = 0 - self._not_after = 0 - self._serial_num = 0 - self._parse_config() - - @property - def issuer_name(self): - return self._issuer_name - - @issuer_name.setter - def issuer_name(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter issuer-name must be a string") - else: - self._issuer_name = value - - @property - def subject_name(self): - return self._subject_name - - @subject_name.setter - def subject_name(self, value): - if isinstance(value, str) is False: - raise TypeError("Config parameter subject-name must be a string") - else: - self._subject_name = value - - @property - def not_before(self): - return self._not_before - - @not_before.setter - def not_before(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter not-before must be an integer") - else: - self._not_before = value - - @property - def not_after(self): - return self._not_after - - @not_after.setter - def not_after(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter not-after must be an integer") - else: - self._not_after = value - - @property - def serial_num(self): - return self._serial_num - - @serial_num.setter - def serial_num(self, value): - if isinstance(value, int) is False: - raise TypeError("Config parameter serial-num must be an integer") - else: - self._serial_num = value - - def _parse_config(self): - self._parser.read(self._config_filename, encoding='cp1250') - - if self._parser.has_option(self._section_name, 'issuer-name'): - self.issuer_name = self._parser.get(self._section_name, 'issuer-name') - - if self._parser.has_option(self._section_name, 'subject-name'): - self.subject_name = self._parser.get(self._section_name, 'subject-name') - - if self._parser.has_option(self._section_name, 'not-before'): - self.not_before = self._parser.getint(self._section_name, 'not-before') - - if self._parser.has_option(self._section_name, 'not-after'): - self.not_after = self._parser.getint(self._section_name, 'not-after') - - if self._parser.has_option(self._section_name, 'serial-num'): - self.serial_num = self._parser.getint(self._section_name, 'serial-num') diff --git a/tools/alif/utils/config.py b/tools/alif/utils/config.py deleted file mode 100755 index a7f48ccd5..000000000 --- a/tools/alif/utils/config.py +++ /dev/null @@ -1,204 +0,0 @@ -import sys -import json -from json.decoder import JSONDecodeError - -# Define Version constant for each separate tool -# 0.06.000 added package and offset params -TOOL_VERSION = "0.07.000" - -# DB files -CONFIG_FILE = 'utils/global-cfg.db' -DEVICE_DB_FILE = 'utils/devicesDB.db' -FEATURES_DB_FILE = 'utils/featuresDB.db' -HASHES_DB_FILE = 'utils/hashesDB.db' - - -EXIT_WITH_ERROR = 1 - -# Device Part# and Revision -DEVICE_PART_NUMBER = '' -DEVICE_REVISION = '' -DEVICE_FAMILY = '' -DEVICE_FEATURE_SET = '' -DEVICE_PACKAGE = '' -DEVICE_REV_PACKAGE_EXT = '' -DEVICE_REV_BAUD_RATE = '' -DEVICE_OFFSET = '' - -# Hashes -HASHES_DB = [] - -# MRAM Access Interface -MRAM_BURN_INTERFACE = '' - -# JTAG Adapter -JTAG_ADAPTER = '' - -# memory defines for Alif/OEM MRAM Addresses -MRAM_BASE_ADDRESS = 0x00 -ALIF_BASE_ADDRESS = 0x00 -APP_BASE_ADDRESS = 0x00 -# memory defines for Alif/OEM MRAM Sizes -MRAM_SIZE = 0x00 -ALIF_MRAM_SIZE = 0x00 -APP_MRAM_SIZE = 0x00 - -# Hardcoded values -APP_OFFSET = 0x00 - -# parameters by architecture -SERAM_BANKS = 0 - -# ALIF TOC POINTER SIZE (pointers to) -ALIF_TOC_POINTER_SIZE = 16 - -def read_global_config(file): - -# print("Opening file %s" % file); - f = open(file, 'r') - try: - cfg = json.load(f) - - except JSONDecodeError as e: - print("ERROR in JSON file.") - print(str(e)) - sys.exit(EXIT_WITH_ERROR) - - except ValueError as v: - print("ERROR in JSON file:") - print(str(v)) - sys.exit(EXIT_WITH_ERROR) - - except: - print("ERROR: Unknown error loading JSON file") - sys.exit(EXIT_WITH_ERROR) - - f.close() - return cfg - -def save_global_config(devDescription, devRevision): - with open(CONFIG_FILE, 'r', encoding='utf-8') as f: - cfg = json.load(f) - - with open(CONFIG_FILE, 'w', encoding='utf-8') as f: - cfg['DEVICE']['Part#'] = devDescription - cfg['DEVICE']['Revision'] = devRevision - json.dump(cfg, f, ensure_ascii=False, indent=4) - - -def checkAttribute(cfg, attribute): - try: - test = cfg[attribute] - - except KeyError as e: - print('Parameter ' + str(e) + ' is not configured') - sys.exit(EXIT_WITH_ERROR) - - except: - print('General error checking attribute ' + attribute) - sys.exit(EXIT_WITH_ERROR) - -def getPartDescription(devPartNumber): - # read devices DB - db = read_global_config(DEVICE_DB_FILE) - partDescription = '' - for desc in db: - if devPartNumber in desc: - partDescription = desc - break - - if partDescription == '': - print("We couldn't find the " + devPartNumber + " in the available parts") - sys.exit(EXIT_WITH_ERROR) - - return partDescription - -def load_device_config(devDescription, devRevision): - global DEVICE_PART_NUMBER - global DEVICE_REVISION - global DEVICE_FAMILY - global DEVICE_FEATURE_SET - global DEVICE_PACKAGE - global DEVICE_REV_PACKAGE_EXT - global DEVICE_REV_BAUD_RATE - global DEVICE_OFFSET - global MRAM_BASE_ADDRESS - global ALIF_BASE_ADDRESS - global APP_BASE_ADDRESS - global MRAM_SIZE - global ALIF_MRAM_SIZE - global APP_MRAM_SIZE - global SERAM_BANKS - - # assign Part#/Rev according detection - DEVICE_PART_NUMBER = devDescription - DEVICE_REVISION = devRevision - - # read devices DB - db = read_global_config(DEVICE_DB_FILE) - - # read architectures DB - features = read_global_config(FEATURES_DB_FILE) - - DEVICE_FAMILY = db[devDescription]['family'] - DEVICE_FEATURE_SET = db[devDescription]['featureSet'] - DEVICE_PACKAGE = db[devDescription]['package'] - - MRAM_BASE_ADDRESS = int(features[db[devDescription]['featureSet']]['mram_base'],16) - REVISIONS = features[db[devDescription]['featureSet']]['revisions'] - DEVICE_REV_PACKAGE_EXT = features[db[devDescription]['featureSet']]['rev_package_ext'] - DEVICE_REV_BAUD_RATE = features[db[devDescription]['featureSet']]['rev_baud_rate'] - DEVICE_OFFSET = db[devDescription]['offset'] - - # validate configuration - if devRevision not in REVISIONS: - print('Revision is invalid!') - sys.exit(EXIT_WITH_ERROR) - - - # set MRAM Size (same for all revisions) - MRAM_SIZE = int(features[db[devDescription]['featureSet']]['mram_total'], 16) - SERAM_BANKS = features[db[devDescription]['featureSet']]['seram_banks'] - - # relative addresses (offsets) - alif_offset = int(db[devDescription]['alif_offset'], 16) - app_size = int(db[devDescription]['app_size'], 16) - APP_OFFSET - - # calculate - ALIF_BASE_ADDRESS = MRAM_BASE_ADDRESS + alif_offset - APP_BASE_ADDRESS = MRAM_BASE_ADDRESS + APP_OFFSET - ALIF_MRAM_SIZE = MRAM_SIZE - alif_offset - ALIF_TOC_POINTER_SIZE - APP_MRAM_SIZE = app_size - - -def load_global_config(): - global DEVICE_PART_NUMBER - global DEVICE_REVISION - global MRAM_BURN_INTERFACE - global JTAG_ADAPTER - global HASHES_DB - - cfg = read_global_config(CONFIG_FILE) - - # validate configuration parameters - # check parameter is configured... - checkAttribute(cfg['DEVICE'], 'Revision') - - # read hashes DB - hashes = read_global_config(HASHES_DB_FILE) - - DEVICE_PART_NUMBER = cfg['DEVICE']['Part#'] - DEVICE_REVISION = cfg['DEVICE']['Revision'] - - # load rest of config params - load_device_config(DEVICE_PART_NUMBER, DEVICE_REVISION) - - # retrieve DEV Environments - HASHES_DB = hashes - - # set MRAM BURNER Access Interface - MRAM_BURN_INTERFACE = cfg['MRAM-BURNER']['Interface'] - - # set JTAG Adapter - JTAG_ADAPTER = cfg['MRAM-BURNER']['Jtag-adapter'] - diff --git a/tools/alif/utils/device_config.py b/tools/alif/utils/device_config.py deleted file mode 100755 index 9c6578030..000000000 --- a/tools/alif/utils/device_config.py +++ /dev/null @@ -1,293 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -import struct -from utils.config import read_global_config -import utils.firewall -from utils.firewall import firewall_json_to_bin -import utils.pinmux -from printInfo import * - -EXIT_WITH_ERROR = 1 - -DEVICE_CONFIG_PIN_MUX = 0x01 -DEVICE_CONFIG_PIN_PROTECTION = 0x02 -DEVICE_CONFIG_EVENT_ROUTING = 0x03 -DEVICE_CONFIG_INTERRUPT_MAP = 0x04 -DEVICE_CONFIG_FIREWALL = 0x05 -DEVICE_CONFIG_WOUNDING = 0x06 -DEVICE_CONFIG_CLOCKS = 0x07 -DEVICE_CONFIG_REGISTER_SETTINGS = 0x08 -DEVICE_CONFIG_MISCELLANEOUS = 0x09 -DEVICE_CONFIG_METADATA = 0x0A -DEVICE_CONFIG_END_OF_LIST = 0xFE - -HEADER_SIZE_MASK = 0x00FFFFFF - -VALID_SECTIONS = [ - "metadata", - "firewall", - "clocks", - "pinmux", - "wounding", - "register_settings", - "miscellaneous" -] - -misc_settings_headers = { - 'LFXO_CAP_CTRL' : '0x00000001', # <16 bits setting type> <16 bits setting size in words> - 'LFXO_GM_CTRL' : '0x00010001', - 'HFXO_CAP_CTRL' : '0x00020001', - 'HFXO_PFET_GM_CTRL' : '0x00030001', - 'HFXO_NFET_GM_CTRL' : '0x00040001', - 'SE_BOOT_INFO' : '0x00050001' -# 'ISP_MAINTENANCE_SUPPORT' : '0x00060001', -# 'FW_RUNTIME_CFG' : '0x00070001', -# 'PINMUX_RUNTIME_CFG' : '0x00080001', -# 'CLOCK_RUNTIME_CFG' : '0x00090001' -} - -metadata_settings_headers = { - 'HFXO_PRESENT' : '0x00000001', # <16 bits setting type> <16 bits setting size in words> - 'HFXO_FREQUENCY_CFG' : '0x00010001', - 'LFXO_PRESENT' : '0x00020001', - 'LFXO_FREQUENCY' : '0x00030001' -} - -# HFXO frequency config data format: -# 3 bits 0 (unsused) -# 1 bit 'divider enable' flag -# 1 bit 0 (unused) -# 7 bits PLL multiplier integer (N) part -# 20 bits PLL multiplier fractional (f) part -# -hfxo_frequency_cfg = { - 38400000 : '0x17D00000', - 32000000 : '0x04B00000', - 25000000 : '0x06000000', - 24000000 : '0x06400000', -} - -hfxo_frequency_cfg_spark = { - 38400000 : '0x11900000', -} - -lfxo_frequency = { - 32768 : 32768, - 32000 : 32000 -} - - -def validateSections(sections, file): - for sec in sections: - if sec not in VALID_SECTIONS: - # Don't terminate the script, just print than an unsupported section was found - print('[WARN] Unsupported section "' + sec + '" found in file ' + file) - #sys.exit(EXIT_WITH_ERROR) - -def createBinary(file): - - try: - f = open(file, 'wb') - except: - print(sys.exc_info()[0]) - print('[ERROR] creating Device Configuration binary') - sys.exit(EXIT_WITH_ERROR) - - return f - -def closeBinary(f): - f.close() - -def writeBinary(f, data): - f.write(data) - -def processMetadata(configuration): - - data = bytearray() - for sec in configuration: - if sec != "external_clock_sources": - continue - - for setting in configuration[sec]: - if "id" not in setting: - continue - - if setting["id"] == "OSC_HFXO": - if "enabled" in setting: - enabled = 0x1 if setting["enabled"] else 0x0 - - header = metadata_settings_headers.get('HFXO_PRESENT') - data += bytes(int(header, 16).to_bytes(4, 'little')) - data += bytes(enabled.to_bytes(4, 'little')) - - if "frequency" in setting: - if utils.config.DEVICE_FEATURE_SET == 'Spark': - frequency_cfg = hfxo_frequency_cfg_spark.get(setting['frequency']) - else: - frequency_cfg = hfxo_frequency_cfg.get(setting['frequency']) - if frequency_cfg is None: - print("[ERROR] Unsupported HFXO frequency:", setting['frequency']) - sys.exit(EXIT_WITH_ERROR) - - header = metadata_settings_headers.get('HFXO_FREQUENCY_CFG') - data += bytes(int(header, 16).to_bytes(4, 'little')) - printInfo("HFXO frequency config:", frequency_cfg) - data += bytes(int(frequency_cfg, 16).to_bytes(4, 'little')) - - if setting["id"] == "OSC_LFXO": - if "enabled" in setting: - enabled = 0x1 if setting["enabled"] else 0x0 - - header = metadata_settings_headers.get('LFXO_PRESENT') - data += bytes(int(header, 16).to_bytes(4, 'little')) - data += bytes(enabled.to_bytes(4, 'little')) - - if "frequency" in setting: - frequency = lfxo_frequency.get(setting['frequency']) - if frequency is None: - print("[ERROR] Unsupported LFXO frequency:", setting['frequency']) - sys.exit(EXIT_WITH_ERROR) - - header = metadata_settings_headers.get('LFXO_FREQUENCY') - data += bytes(int(header, 16).to_bytes(4, 'little')) - printInfo("LFXO frequency:", frequency) - # LFXO frequency table is decimal - data += bytes(frequency.to_bytes(4, 'little')) - - printInfo("XTAL data:", data) - return data - -def processChangeSets(changeSets): - printInfo('Processing ChangeSets') - data = bytearray() - for changeSet in changeSets: - data += bytes(int(changeSet['address'], 16).to_bytes(4, 'little')) - data += bytes(int(changeSet['mask'], 16).to_bytes(4, 'little')) - data += bytes(int(changeSet['value'], 16).to_bytes(4, 'little')) - - return data - -def processRegisterSettings(configuration): - printInfo("Process Register_Settings") - data = bytearray() - for sec in configuration: - if sec == 'change_sets': - data = processChangeSets(configuration[sec]) - printInfo("register_settings: ", data) - return data - -def processClocks(configuration): - printInfo("Process Clocks") - data = bytearray() - for sec in configuration: - if sec == 'change_sets': - data = processChangeSets(configuration[sec]) - # TODO: process other clock settings - printInfo("clocks: ", data) - return data - -def processPinMux(configuration): - printInfo("Process PinMux") - data = utils.pinmux.json_to_bin(configuration) - return bytearray(data) - -def processFirewall(configuration, is_icv): - printInfo("Process Firewall") - utils.firewall.OUTPUT_FILE = 'build/images/fw_temp.bin' - firewall_json_to_bin(configuration, is_icv) - -def processWounding(configuration): - printInfo("Process Wounding") - - printInfo("Wounding Data: ", configuration) - - num = int(configuration, 0) - data = num.to_bytes(4,byteorder='little') - - return bytearray(data) - -def processMiscellaneous(configuration): - printInfo("Process Miscellaneous") - - data = bytearray() - for sec in configuration: - if ('id' not in sec) or ('value' not in sec): - continue - if not sec['id'] in misc_settings_headers: - printInfo("[WARN] SE not supported: ", sec['id']) - continue - header = misc_settings_headers.get(sec['id']) - data += bytes(int(header, 16).to_bytes(4, 'little')) - data += bytes(int(sec['value']).to_bytes(4, 'little')) - - return data - -def gen_device_config(file, is_icv): - - cfg = read_global_config('build/config/' + file) - validateSections(cfg, file) #request from SE-1938 - binFile = file[:-5] + '.bin' - f = createBinary('build/images/' + binFile) - for sec in cfg: - printInfo("Create area for: " + sec) - - if sec == "metadata": - obj = processMetadata(cfg[sec]) - header = (DEVICE_CONFIG_METADATA<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - if sec == "wounding": - obj = processWounding(cfg[sec]) - header = (DEVICE_CONFIG_WOUNDING<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - if sec == "pinmux": - obj = processPinMux(cfg[sec]) - header = (DEVICE_CONFIG_PIN_MUX<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - if sec == "clocks": - obj = processClocks(cfg[sec]) - header = (DEVICE_CONFIG_CLOCKS<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - if sec == "register_settings": - obj = processClocks(cfg[sec]) - header = (DEVICE_CONFIG_REGISTER_SETTINGS<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - if sec == "firewall": - processFirewall(cfg[sec], is_icv) - - # checking the Alif TOC Package size - try: - fsize = os.path.getsize(utils.firewall.OUTPUT_FILE) - printInfo("Firewall binary size: " + str(fsize) + " bytes") - except: - print(sys.exc_info()[0]) - print("[ERROR] Veryfing Firewall binary size") - sys.exit(EXIT_WITH_ERROR) - - header = (DEVICE_CONFIG_FIREWALL<<24) | (fsize & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - - # reading the file to include it in Device Config. binary - with open(utils.firewall.OUTPUT_FILE, 'rb') as bin_file: - writeBinary(f, bin_file.read()) - - if sec == "miscellaneous": - obj = processMiscellaneous(cfg[sec]) - header = (DEVICE_CONFIG_MISCELLANEOUS<<24) | (len(obj) & HEADER_SIZE_MASK) - writeBinary(f, struct.pack("I", header)) - writeBinary(f, obj) - - tail = DEVICE_CONFIG_END_OF_LIST<<24 - writeBinary(f, struct.pack("I", tail)) - closeBinary(f) diff --git a/tools/alif/utils/devicesDB.db b/tools/alif/utils/devicesDB.db deleted file mode 100755 index b2c727230..000000000 --- a/tools/alif/utils/devicesDB.db +++ /dev/null @@ -1,310 +0,0 @@ -{ - "E7 (AE722F80F55D5LS) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00C0FFFB", - "package" : "SP-AE722F80F55D5LS", - "offset" : "offset-58" - }, - "E7 (AE722F80F55D5AS) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00C0FFFB", - "package" : "SP-AE722F80F55D5AS", - "offset" : "offset-58" - }, - "E5 (AE512F80F55D5LS) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00D07FFB", - "package" : "SP-AE512F80F55D5LS", - "offset" : "offset-58" - }, - "E5 (AE512F80F5582AS) - 5.5 MRAM / 8.25 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "8.25", - "wounding" : "0x00D07FFB", - "package" : "SP-AE512F80F5582AS", - "offset" : "offset-58" - }, - "E5 (AE512F80F55D5AS) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00D07FFB", - "package" : "SP-AE512F80F55D5AS", - "offset" : "offset-58" - }, - "E5 (AE512F80F5582LS) - 5.5 MRAM / 8.25 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "8.25", - "wounding" : "0x00D07FFB", - "package" : "SP-AE512F80F5582LS", - "offset" : "offset-58" - }, - "E3 (AE302F80F55D5LE) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00D83FFB", - "package" : "SP-AE302F80F55D5LE", - "offset" : "offset-58" - }, - "E3 (AE302F80F5582LE) - 5.5 MRAM / 8.25 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "8.25", - "wounding" : "0x00D83FFB", - "package" : "SP-AE302F80F5582LE", - "offset" : "offset-58" - }, - "E3 (AE302F80F55D5AE) - 5.5 MRAM / 13.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "13.5", - "wounding" : "0x00D83FFB", - "package" : "SP-AE302F80F55D5AE", - "offset" : "offset-58" - }, - "E3 (AE302F80F5582AE) - 5.5 MRAM / 8.25 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x580000", - "app_size" : "0x580000", - "mram_size" : "5.5", - "sram_size" : "8.25", - "wounding" : "0x00D83FFB", - "package" : "SP-AE302F80F5582AE", - "offset" : "offset-58" - }, - "E3 (AE302F80C1557LE) - 1.5 MRAM / 5.75 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x180000", - "app_size" : "0x180000", - "mram_size" : "1.5", - "sram_size" : "5.75", - "wounding" : "0x00D83FEB", - "package" : "SP-AE302F80C1557LE", - "offset" : "offset-18" - }, - "E3 (AE302F40C1537LE) - 1.5 MRAM / 3.75 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x180000", - "app_size" : "0x180000", - "mram_size" : "1.5", - "sram_size" : "3.75", - "wounding" : "0x00D83FEA", - "package" : "SP-AE302F40C1537LE", - "offset" : "offset-18" - }, - "E1 (AE101F4071542LH) - 1.5 MRAM / 4.5 SRAM":{ - "featureSet" : "Fusion", - "family" : "Ensemble", - "alif_offset" : "0x180000", - "app_size" : "0x180000", - "mram_size" : "1.5", - "sram_size" : "4.5", - "wounding" : "0x00F82B72", - "package" : "SP-AE101F4071542LH", - "offset" : "offset-18" - }, - "E1C (AE1C1F4051920PH) - 1.86 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x1DD000", - "app_size" : "0x1DD000", - "mram_size" : "1.86", - "sram_size" : "2.0", - "wounding" : "0x00F80B12", - "package" : "SP-AE1C1F4051920PH", - "offset" : "offset-1D" - }, - "E1C (AE1C1F4051920HH) - 1.86 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x1DD000", - "app_size" : "0x1DD000", - "mram_size" : "1.86", - "sram_size" : "2.0", - "wounding" : "0x00F80B12", - "package" : "SP-AE1C1F4051920HH", - "offset" : "offset-1D" - }, - "E1C (AE1C1F40319205H) - 1.86 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x1DD000", - "app_size" : "0x1DD000", - "mram_size" : "1.86", - "sram_size" : "2.0", - "wounding" : "0x00F80212", - "package" : "SP-AE1C1F40319205H", - "offset" : "offset-1D" - }, - "E1C (AE1C1F1041010PH) - 1.0 MRAM / 1.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x100000", - "app_size" : "0x100000", - "mram_size" : "1.0", - "sram_size" : "1.0", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F1041010PH", - "offset" : "offset-10" - }, - "E1C (AE1C1F1041010HH) - 1.0 MRAM / 1.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x100000", - "app_size" : "0x100000", - "mram_size" : "1.0", - "sram_size" : "1.0", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F1041010HH", - "offset" : "offset-10" - }, - "E1C (AE1C1F10410105H) - 1.0 MRAM / 1.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x100000", - "app_size" : "0x100000", - "mram_size" : "1.0", - "sram_size" : "1.0", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F10410105H", - "offset" : "offset-10" - }, - "E1C (AE1C1F1040505PH) - 0.5 MRAM / 0.5 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x080000", - "app_size" : "0x080000", - "mram_size" : "0.5", - "sram_size" : "0.5", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F1040505PH", - "offset" : "offset-08" - }, - "E1C (AE1C1F1040505HH) - 0.5 MRAM / 0.5 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x080000", - "app_size" : "0x080000", - "mram_size" : "0.5", - "sram_size" : "0.5", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F1040505HH", - "offset" : "offset-08" - }, - "E1C (AE1C1F10405055H) - 0.5 MRAM / 0.5 SRAM":{ - "featureSet" : "Spark", - "family" : "Ensemble", - "alif_offset" : "0x080000", - "app_size" : "0x080000", - "mram_size" : "0.5", - "sram_size" : "0.5", - "wounding" : "0x00F80000", - "package" : "SP-AE1C1F10405055H", - "offset" : "offset-08" - }, -"B1 (AB1C1F4M51820PH) - 1.8 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x1CD000", - "app_size" : "0x1CD000", - "mram_size" : "1.8", - "sram_size" : "2.0", - "wounding" : "0x00F00B12", - "package" : "SP-AB1C1F4M51820PH", - "offset" : "offset-1C" - }, - "B1 (AB1C1F4M51820HH) - 1.8 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x1CD000", - "app_size" : "0x1CD000", - "mram_size" : "1.8", - "sram_size" : "2.0", - "wounding" : "0x00F00B12", - "package" : "SP-AB1C1F4M51820HH", - "offset" : "offset-1C" - }, - "B1 (AB1C1F1M41820PH) - 1.8 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x1CD000", - "app_size" : "0x1CD000", - "mram_size" : "1.8", - "sram_size" : "2.0", - "wounding" : "0x00F00000", - "package" : "SP-AB1C1F1M41820PH", - "offset" : "offset-1C" - }, -"B1 (AB1C1F1M41820HH) - 1.8 MRAM / 2.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x1CD000", - "app_size" : "0x1CD000", - "mram_size" : "1.8", - "sram_size" : "2.0", - "wounding" : "0x00F00000", - "package" : "SP-AB1C1F1M41820HH", - "offset" : "offset-1C" - }, -"B1 (AB1C1F1M41010PH) - 1.0 MRAM / 1.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x100000", - "app_size" : "0x100000", - "mram_size" : "1.0", - "sram_size" : "1.0", - "wounding" : "0x00F00000", - "package" : "SP-AB1C1F1M41010PH", - "offset" : "offset-10" - }, -"B1 (AB1C1F1M41010HH) - 1.0 MRAM / 1.0 SRAM":{ - "featureSet" : "Spark", - "family" : "Balletto", - "alif_offset" : "0x100000", - "app_size" : "0x100000", - "mram_size" : "1.0", - "sram_size" : "1.0", - "wounding" : "0x00F00000", - "package" : "SP-AB1C1F1M41010HH", - "offset" : "offset-10" - } -} diff --git a/tools/alif/utils/discover.py b/tools/alif/utils/discover.py deleted file mode 100755 index 6dbaf9d7b..000000000 --- a/tools/alif/utils/discover.py +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys -import shutil -import subprocess -import utils.config -from utils.config import * - -CONF_FILE = 'bin/ARMDS_dbg.cfg' -Manufacturer = "" -Platform = "" -Connection = "" - -def getJlinkSN(): - """ - JLINK get the serial number - """ - cmd = "pylink emulator -l usb" -# DEBUG -# print("CMD=",cmd) -# which_pylink = shutil.which("pylink") -# print("SHUTIL says ", which_pylink) - - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,universal_newlines=True,shell=True) - output, errors = p.communicate() - - if errors > '': - print('Errors') - print(errors) - - idx = output.find('Serial Number:') - - if idx == -1: - return -1 - - sn = output[idx+15:].splitlines() - return sn[0] - -def discover_Manufacturer(extensionDB): - """ - ARM ULINK discovery - """ - global Manufacturer - - print("\nDiscovering Manufacturer...") - - cmd = 'armdbg --cdb-root-ignore-default --cdb-root "' + extensionDB + '" --cdb-entry "?"' - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True,shell=True) - output, errors = p.communicate() - options = errors.splitlines() - - selection = 0 - while selection == 0: - print('\nAvailable options:') - i = 0 - for line in options: - if i == 0: - i += 1 - continue - print(str(i) + ". " + line) - i += 1 - - selection = int(input("\nPlease select an option: ")) - if int(selection) > len(options)-1: - print('Please select a valid option!') - selection = 0 - - Manufacturer = options[selection] - print('Manufacturer: ' + Manufacturer) - - -def discover_Platform(extensionDB): - global Manufacturer - global Platform - - print("\nDiscovering Platform for " + Manufacturer + "...") - - cmd = 'armdbg --cdb-root-ignore-default --cdb-root "' + extensionDB + '" --cdb-entry "' + Manufacturer + '::?"' - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True,shell=True) - output, errors = p.communicate() - options = errors.splitlines() - - selection = 0 - while selection == 0: - print('\nAvailable options:') - i = 0 - for line in options: - if i == 0: - i += 1 - continue - print(str(i) + ". " + line) - i += 1 - - selection = int(input("\nPlease select an option: ")) - if int(selection) > len(options)-1: - print('Please select a valid option!') - selection = 0 - - Platform = options[selection] - print('Platform: ' + Platform) - - -def discover_Connection(extensionDB, jtag_adapter): - global Manufacturer - global Platform - global Connection - - print("\nDiscovering Connection for " + Manufacturer + "::" + Platform + "...") - - cmd = 'armdbg --cdb-root "' + extensionDB + '" --cdb-entry "' + Manufacturer + '::' + Platform + '::Bare Metal Debug::Bare Metal Debug::Cortex-M0+::' + jtag_adapter + '" --cdb-entry-param "Connection=?" --browse ' - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True,shell=True) - output, errors = p.communicate() - options = output.splitlines() - - selection = 0 - while selection == 0: - print('\nAvailable options:') - i = 0 - for line in options: - if i == 0: - i += 1 - continue - print(str(i) + ". " + line.strip()) - i += 1 - - selection = int(input("\nPlease select an option: ")) - if int(selection) > len(options)-1: - print('Please select a valid option!') - selection = 0 - - Connection = options[selection].strip() - print('Connection: ' + Connection) - -def discoverParameters(): - print("Please be sure the board is powered-on and ULINK Pro is connected!") - input("Press any key to continue...") - extensionDB = '%USERPROFILE%\\Development Studio Workspace\\ExtensionDB' - if sys.platform == "linux": - extensionDB = '$HOME/developmentstudio-workspace/ExtensionDB' - - # get JTAG Adatper from Global Configuration - load_global_config() - JTAG_ADAPTER = utils.config.JTAG_ADAPTER - - print('Writing MRAM with parameters:') - print('Device Part# ' + DEVICE_PART_NUMBER + ' - Rev: ' + DEVICE_REVISION) - print('- MRAM Base Address: ' + hex(ALIF_BASE_ADDRESS)) - - - discover_Manufacturer(extensionDB) - discover_Platform(extensionDB) - discover_Connection(extensionDB, JTAG_ADAPTER) - -def saveConfiguration(): - try: - f = open(CONF_FILE, "w") - f.write(Manufacturer + ',' + Platform + ',' + Connection) - f.close() - - except: - print("There was an error creating the configuration file!") - return - -def getValues(): - - if not os.path.exists(CONF_FILE): - print("Configuration file doesn't exist. We will run the discovery process...") - discoverParameters() - saveConfiguration() - - try: - f = open(CONF_FILE, 'r') - Manufacturer, Platform, Connection = f.readline().split(',') - - except FileNotFoundError: - print("The configuration file could not be created!") - return - except: - print('There was an error reading the configuration file!') - return - - return Manufacturer, Platform, Connection - -def main(): - if sys.version_info.major == 2: - print("You need Python 3 for this application!") - return 0 - - Manuf, Plat, Conn = getValues() - print('Configuration values:') - print(Manuf) - print(Plat) - print(Conn) - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/familiesDB.db b/tools/alif/utils/familiesDB.db deleted file mode 100755 index 30325d4ce..000000000 --- a/tools/alif/utils/familiesDB.db +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Ensemble":{ - - }, - "Balletto":{ - - } -} diff --git a/tools/alif/utils/featuresDB.db b/tools/alif/utils/featuresDB.db deleted file mode 100755 index 17125008d..000000000 --- a/tools/alif/utils/featuresDB.db +++ /dev/null @@ -1,18 +0,0 @@ -{ - "Fusion":{ - "mram_total" : "0x600000", - "mram_base" : "0x80000000", - "revisions": ["B4","B3","B2"], - "rev_package_ext": {"B2":"rev-b2","B3":"rev-b3","B4":"rev-b4"}, - "rev_baud_rate": {"B2":55000,"B3":55000,"B4":55000}, - "seram_banks" : 2 - }, - "Spark":{ - "mram_total" : "0x200000", - "mram_base" : "0x80000000", - "revisions": ["A0","A5"], - "rev_package_ext": {"A0":"rev-a0","A5":"rev-a5"}, - "rev_baud_rate": {"A0":56500,"A5":18000}, - "seram_banks" : 2 - } -} diff --git a/tools/alif/utils/firewall.py b/tools/alif/utils/firewall.py deleted file mode 100755 index 8af70bfbf..000000000 --- a/tools/alif/utils/firewall.py +++ /dev/null @@ -1,267 +0,0 @@ -""" firewall """ -import json -import ctypes - -# pylint: disable=too-few-public-methods -# pylint: disable=too-many-instance-attributes -# pylint: disable=invalid-name -# pylint: disable=attribute-defined-outside-init - -INPUT_FILE = 'fw_cfg_cm.json' -OUTPUT_FILE = 'fw_cfg.bin' - -c_uint32 = ctypes.c_uint32 - -class firewall_controller(ctypes.LittleEndianStructure): - """ firewall_controller """ - _fields_ = [ - ("err", c_uint32, 1), - ("raz", c_uint32, 1), - ("sr_pwr", c_uint32, 1), - ("valid", c_uint32, 1) - ] - - def init_from_cfg(self, cfg): - """ Initialize from JSON configuration """ - if cfg['valid']: - self.valid = 1 - self.err = cfg['err'] - self.raz = cfg['raz'] - self.sr_pwr = cfg['sr_pwr'] - -class firewall_component(ctypes.LittleEndianStructure): - """ firewall_component """ - _fields_ = [ - ("num_rgn_entries", c_uint32, 8), - - ("lock", c_uint32, 2), - ("err", c_uint32, 1), - ("raz", c_uint32, 1), - ("flt_cfg", c_uint32, 2), - ("fe_pwr", c_uint32, 2), - - ("me_ctrl", c_uint32, 3), - ("int_msk", c_uint32, 5), - - ("enable", c_uint32, 1), - ("valid", c_uint32, 1), - ] - - def init_from_cfg(self, cfg, num_rgns): - """ Initialize from JSON configuration """ - self.num_rgn_entries = num_rgns - self.lock = 0 - self.err = cfg['err'] if 'err' in cfg else 1 - self.raz = cfg['raz'] if 'raz' in cfg else 0 - self.flt_cfg = int(cfg['flt_cfg'], 0) if 'flt_cfg' in cfg else 0x2 - self.fe_pwr = cfg['fe_pwr'] if 'fe_pwr' in cfg else 0 - self.me_ctrl = int(cfg['me_ctrl'], 0) if 'me_ctrl' in cfg else 0x0 - self.int_msk = int(cfg['int_msk'], 0) if 'int_msk' in cfg else 0x0 - self.enable = 1 - self.valid = 1 - -class fw_rgn_cmn(ctypes.LittleEndianStructure): - """ fw_rgn_cmn """ - _fields_ = [ - ("rgn_indx", c_uint32, 8), - ("en", c_uint32, 1), - ("lock", c_uint32, 1), - ] - -class fw_rgn_mpe(ctypes.LittleEndianStructure): - """ fw_rgn_mpe """ - _fields_ = [ - ("mid", c_uint32, 8), - ("acc", c_uint32, 12), - ("any_mst", c_uint32, 1), - ("reserved", c_uint32, 3), - ("enable", c_uint32, 1), - ("valid", c_uint32, 1), - ] - - def init_from_cfg(self, cfg): - """ Initialize from JSON configuration """ - self.valid = 1 - self.reserved = 0 - self.enable = 1 - self.mid = cfg['master_id'] - self.acc = int(cfg['permissions'], 0) - self.any_mst = cfg['any_master'] - -class fw_rgn_pe2(ctypes.LittleEndianStructure): - """ fw_rgn_pe2 """ - _fields_ = [ - ("size", c_uint32, 7), - ("mul_n_po2", c_uint32, 1), - ("addr_trans_en", c_uint32, 1), - ("ma_trans_en", c_uint32, 1), - ("reserved", c_uint32, 6), - ("trans_flags", c_uint32, 16), - ] - -class firewall_region(ctypes.LittleEndianStructure): - """ firewall_region """ - _fields_ = [ - ("cmn", fw_rgn_cmn), - ("mpe0", fw_rgn_mpe), - ("mpe1", fw_rgn_mpe), - ("mpe2", fw_rgn_mpe), - ("mpe3", fw_rgn_mpe), - ("base_addr", c_uint32), - ("out_uppr_addr", c_uint32), - ("pe2", fw_rgn_pe2), - ] - - def init_from_cfg(self, cfg, rgn_idx): - """ Initialize from JSON configuration """ - self.cmn.rgn_indx = rgn_idx - self.cmn.en = 1 - self.cmn.lock = 0 - - self.mpe0.valid = 0 - self.mpe1.valid = 0 - self.mpe2.valid = 0 - self.mpe3.valid = 0 - for j_mpe in cfg['mpe_list']: - if j_mpe['mpe_id'] == 0: - self.mpe0.init_from_cfg(j_mpe) - elif j_mpe['mpe_id'] == 1: - self.mpe1.init_from_cfg(j_mpe) - elif j_mpe['mpe_id'] == 2: - self.mpe2.init_from_cfg(j_mpe) - elif j_mpe['mpe_id'] == 3: - self.mpe3.init_from_cfg(j_mpe) - - self.base_addr = int(cfg['start_address'], 0) - - self.out_uppr_addr = int(cfg['end_address'], 0) if 'end_address' in cfg else 0xFFFFFFFF - self.pe2.size = int(cfg['size'], 0) if 'size' in cfg else 0x0 - self.pe2.mul_n_po2 = cfg['mul_n_po2'] if 'mul_n_po2' in cfg else 0 - self.pe2.addr_trans_en = cfg['addr_trans_en'] if 'addr_trans_en' in cfg else 0 - self.pe2.ma_trans_en = cfg['ma_trans_en'] if 'ma_trans_en' in cfg else 0 - self.pe2.trans_flags = int(cfg['translation_flags'], 0) if 'translation_flags' in cfg else 0x4 - -class protected_area(ctypes.LittleEndianStructure): - """ protected_area """ - _fields_ = [ - ("component_id", c_uint32), - ("base_addr", c_uint32), - ("upper_addr", c_uint32) - ] - - def init_from_cfg(self, cfg): - """ Initialize from JSON configuration """ - self.component_id = cfg['component_id'] - self.base_addr = int(cfg['start_address'], 0) - self.upper_addr = int(cfg['end_address'], 0) - - -FW_COMP_NUM = 15 -FW_PROT_AREA_NUM = 16 - -def process_components(cfg): - """ process_components """ - - # order the FC sections by the component_id - ordered_cfg = [None for i in range(FW_COMP_NUM)] - for j_comp in cfg: - comp_id = int(j_comp['component_id']) - if comp_id < 0 or comp_id >= FW_COMP_NUM: - continue - ordered_cfg[comp_id] = j_comp - - components = [firewall_component() for i in range(FW_COMP_NUM)] - configured_regions = [] - - for j_comp in ordered_cfg: - if j_comp == None: - continue - - rgn_count = 0 - for j_rgn in j_comp['configured_regions']: - rgn_idx = int(j_rgn['region_index']) - if rgn_idx < 0 or rgn_idx > 255: - continue - - rgn = firewall_region() - rgn.init_from_cfg(j_rgn, rgn_idx) - - rgn_count += 1 - configured_regions.append(rgn) - - comp_id = int(j_comp['component_id']) - comp = components[comp_id] - comp.init_from_cfg(j_comp, rgn_count) - - return components, configured_regions - -def firewall_json_to_bin(jsn, is_icv): - """ Convert a JSON file into binary """ - #with open(INPUT_FILE, "r") as json_file: - # jsn = json.load(json_file) - - # read the firewall components and configured regions - components, configured_regions = process_components(jsn['firewall_components']) - - # read the firewall controller - controller = firewall_controller() - if 'firewall_controller' in jsn: - controller.init_from_cfg(jsn['firewall_controller']) - - # read the protected areas - protected_areas = [] - if is_icv and 'protected_areas' in jsn: - protected_areas = [protected_area() for i in range(FW_PROT_AREA_NUM)] - curr_area = 0 - for j_prot in jsn['protected_areas']: - prot_area = protected_areas[curr_area] - prot_area.init_from_cfg(j_prot) - - curr_area += 1 - if curr_area >= FW_PROT_AREA_NUM: - break - # end for loop over the protected areas - - with open(OUTPUT_FILE, 'wb') as bin_file: - for comp in components: - bin_file.write(comp) - bin_file.write(controller) - if is_icv: - for prot_area in protected_areas: - bin_file.write(prot_area) - for rgn in configured_regions: - bin_file.write(rgn) - -def bin_to_struct(): - """ Convert a binary file into Python structures """ - components = [firewall_component() for i in range(FW_COMP_NUM)] - configured_regions = [] - ctrl = firewall_controller() - protected_areas = [protected_area() for i in range(FW_PROT_AREA_NUM)] - - with open(OUTPUT_FILE, 'rb') as bin_file: - for comp in components: - # read the components section - bin_file.readinto(comp) - # create region entries for each configured region in this component - for _ in range(comp.num_rgn_entries): - configured_regions.append(firewall_region()) - - # read the controller section - bin_file.readinto(ctrl) - - # read the protected areas section - for prot_area in protected_areas: - bin_file.readinto(prot_area) - - # read the configured regions section - for rgn in configured_regions: - bin_file.readinto(rgn) - -def main(): - """ main """ - json_to_bin() - return 0 - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/gen_fw_cfg.py b/tools/alif/utils/gen_fw_cfg.py deleted file mode 100755 index 46b1b8ea1..000000000 --- a/tools/alif/utils/gen_fw_cfg.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python3 -""" - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.1.0" - __status__ = "Dev" -""" -# pylint: disable=unused-argument, invalid-name, bare-except - -import sys -import argparse -import json -import os -import utils.toc_common - -TOOL_VERSION ="0.1.001" # Define Version constant for each separate tool - -EXIT_WITH_ERROR = 1 - -FW_CFG_FILE = "build/fw_cfg.json" - -def mram_size_to_address(mram_size): - mram_size_int = 0 - if mram_size == '1.8': # @todo this should be improved - mram_size_int = int("0x001CD000", 16) - elif mram_size == '1.86': - mram_size_int = int("0x001DD000", 16) - else: - mram_size_int = int(float(mram_size) * 1024 * 1024) - mram_base_int = int("0x80000000", 16) - stoc_start = mram_base_int + mram_size_int - atoc_end = stoc_start - 1 - atoc_end_str = "0x" + hex(atoc_end).lstrip("0x").upper() - stoc_start_str = "0x" + hex(stoc_start).lstrip("0x").upper() - return atoc_end_str, stoc_start_str - -def handle_sram(sram_size, firewall_components, protected_areas): - - if "13.5" == sram_size: # no SRAM wounding - #print("**** no SRAM wounding") - return - - # load the definitions for REV_B - with open('firewall/sram_rev_b.json', "r") as json_file: - sram_json = json.load(json_file) - - # Wound the Modem TCMs - FC #12 - firewall_components.append(sram_json["firewall_components"][0]) - protected_areas.append(sram_json["protected_areas"][0]) - - if "8.25" == sram_size: # no other wounding - #print("**** 8.25MB wounding") - return - - if "5.75" == sram_size: # E3 with 5.75MB SRAM - # Wound SRAM1 - FC #4 - XNVM - firewall_components.append(sram_json["firewall_components"][1]) - protected_areas.append(sram_json["protected_areas"][1]) - #print("**** 5.75MB wounding") - return - - if "4.5" == sram_size: # E1 - # Wound SRAM1 - FC #4 - XNVM - firewall_components.append(sram_json["firewall_components"][1]) - protected_areas.append(sram_json["protected_areas"][1]) - - # Wound M55-HP TCMs - 0x50000000-0x57FFFFFF - firewall_components.append(sram_json["firewall_components"][4]) - protected_areas.append(sram_json["protected_areas"][4]) - #print("**** 4.5MB wounding") - return - - if "3.75" == sram_size: #E3 with 3.75MB SRAM: - # Wound SRAM0 - FC #5 - CVM - firewall_components.append(sram_json["firewall_components"][3]) - protected_areas.append(sram_json["protected_areas"][3]) - - # Wound SRAM1 to 2MB - firewall_components.append(sram_json["firewall_components"][2]) - protected_areas.append(sram_json["protected_areas"][2]) - #print("**** 3.75MB wounding") - return - - # Invalid sram_size - wound SRAM0, SRAM1, and the M55-HP TCMs - firewall_components.append(sram_json["firewall_components"][1]) - protected_areas.append(sram_json["protected_areas"][1]) - firewall_components.append(sram_json["firewall_components"][3]) - protected_areas.append(sram_json["protected_areas"][3]) - firewall_components.append(sram_json["firewall_components"][4]) - protected_areas.append(sram_json["protected_areas"][4]) - print("**** Invalid SRAM size!") - -def write_json(json_content): - out_file = FW_CFG_FILE - if (os.path.exists(out_file)): - os.remove(out_file) - - with open(out_file, 'w') as f: - json.dump(json_content, f, indent=2) - -def gen_fw_cfg_icv(family, mram_size, sram_size, device_revision, featureSet): - - atoc_end_address, stoc_start_address = mram_size_to_address(mram_size) - print(family) - if family == "Ensemble" and featureSet == "Spark": - # Ensemble E1C - with open('firewall/fw_cfg_spark.json', "r") as json_file: - spark_json = json.load(json_file) - spark_json["firewall_components"][1]["configured_regions"][0]["end_address"] = atoc_end_address - spark_json["protected_areas"][2]["start_address"] = stoc_start_address - - # Delete the sections for the BLE protected areas - spark_json["firewall_components"].pop(0) - spark_json["protected_areas"].pop(0) - spark_json["protected_areas"].pop(0) - write_json(spark_json) - return; - - if family == "Balletto": - # Balletto B1 - with open('firewall/fw_cfg_spark.json', "r") as json_file: - spark_json = json.load(json_file) - spark_json["firewall_components"][1]["configured_regions"][0]["end_address"] = atoc_end_address - spark_json["protected_areas"][2]["start_address"] = stoc_start_address - write_json(spark_json) - return - - # MRAM - # The following code is tightly coupled with the structure of the file mram.json. - # Should we define the data structures in Python code instead of reading them from a JSON file? - with open('firewall/mram.json', "r") as json_file: - mram_json = json.load(json_file) - - if family != "Predator": - # Delete the OSPI mirrorred region at 0x20000000 - mram_json["firewall_components"][0]["configured_regions"].pop(2) - - mram_json["firewall_components"][0]["configured_regions"][0]["end_address"] = atoc_end_address - mram_json["protected_areas"][0]["start_address"] = stoc_start_address - - # generate Slave FC configuration - firewall_components = mram_json['firewall_components'] - protected_areas = mram_json['protected_areas'] - - # SRAM - handle_sram(sram_size, firewall_components, protected_areas) - - out_json = {} - out_json['firewall_components'] = firewall_components - out_json['protected_areas'] = protected_areas - - write_json(out_json) - -def update_fw_cfg_oem(file): - filename = 'build/config/' + file - with open(filename, "r") as json_file: - json_text = json.load(json_file) - with open(filename, "w") as json_file: - json.dump(json_text, json_file, indent=2) - - # TODO: update/generate the Master FC sections - #print("json_text: ", json_text) - #json.dump("", json_file, indent=2) - - -def main(): - """ - """ - if sys.version_info.major == 2: - print("[ERROR] You need Python 3 for this application!") - sys.exit(EXIT_WITH_ERROR) - - # Deal with Command Line - parser = argparse.ArgumentParser(description= - 'Generate STOC device configuration') - parser.add_argument("-m", "--mram", type=str, default="5.5", help='MRAM size in MB, default 5.5') - parser.add_argument("-s", "--sram", type=str, default="13.5", help="SRAM size in MB, default 13.5") - parser.add_argument("-V" , "--version", - help="Display Version Number", action="store_true") - args = parser.parse_args() - if args.version: - print(TOOL_VERSION) - sys.exit() - - mram_size = args.mram.rstrip('0').rstrip('.') - sram_size = args.sram.rstrip('0').rstrip('.') - - gen_fw_cfg_icv("", mram_size, sram_size, "") - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/global-cfg.db b/tools/alif/utils/global-cfg.db deleted file mode 100755 index 6ac442f7d..000000000 --- a/tools/alif/utils/global-cfg.db +++ /dev/null @@ -1,10 +0,0 @@ -{ - "DEVICE": { - "Revision": "B4", - "Part#": "E3 (AE302F80F55D5AE) - 5.5 MRAM / 13.5 SRAM" - }, - "MRAM-BURNER": { - "Interface": "isp", - "Jtag-adapter": "J-Link" - } -} \ No newline at end of file diff --git a/tools/alif/utils/hashesDB.db b/tools/alif/utils/hashesDB.db deleted file mode 100755 index 6244afc7a..000000000 --- a/tools/alif/utils/hashesDB.db +++ /dev/null @@ -1,6 +0,0 @@ -{ - "c879a64b28100754b462589ae1f34d3b":"DEV", - "7715fe1a57f193ef2a856f052aa24779":"DEV", - "af9771e6f171ee6de39106bd812babf0":"DEV", - "f049442ecc7900a838d34c31d71e62e6":"DEV" -} \ No newline at end of file diff --git a/tools/alif/utils/hbk_gen_util.py b/tools/alif/utils/hbk_gen_util.py deleted file mode 100755 index bee3250d3..000000000 --- a/tools/alif/utils/hbk_gen_util.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -#################################################################### -# Filename - hbk_gen_util.py -# Description - This file is responsible for creation of public key -# HASH and its corresponding number of Zeroes -# as it should be saved in the OTP/NVM -#################################################################### - -import optparse -import sys -import os -from utils.common import util_logger -from utils.common import cryptolayer - -# Prim key hash file name -PRIM_KEY_HASH_FILE_NAME = "prim_key_hash.txt" -ZEROS_NUM_FILES_NAME = "zero_bits_in_hash.txt" -# Util's log file -LOG_FILENAME = "gen_hbk_log.log" - -OUTPUT_SIZE_SHA_256 = 32 -OUTPUT_SIZE_SHA_256_TRUNC = int(OUTPUT_SIZE_SHA_256/2) -BITS_WITHIN_WORD = 32 -BYTES_WITHIN_WORD = 4 - - -def create_word_list(byte_array, byte_array_word_count, endianness): - """ - Creates a hexadecimal (32 bits) word list out of a byte array representation of an input number - :param byte_array: input number represented as a list of the bytes it consists of - :param byte_array_word_count: number of (32 bit) words in input array - :param endianness: output byte order -> little endian 'L' or big endian 'B' - :return: 32 bit word list - """ - word_list = [] - if not isinstance(byte_array, list) or not isinstance(byte_array_word_count, int): - raise TypeError("input parameter byte_array or byte_array_word_count has wrong type") - if endianness != 'L' and endianness != 'B': - raise ValueError("input parameter endianness has wrong value") - else: - for i in range(byte_array_word_count): - if endianness == 'L': - current_word = byte_array[i * 4] - current_word = current_word + (byte_array[i * 4 + 1] << 8) - current_word = current_word + (byte_array[i * 4 + 2] << 16) - current_word = current_word + (byte_array[i * 4 + 3] << 24) - else: - current_word = byte_array[i * 4 + 3] - current_word = current_word + (byte_array[i * 4 + 2] << 8) - current_word = current_word + (byte_array[i * 4 + 1] << 16) - current_word = current_word + (byte_array[i * 4] << 24) - word_list.append(current_word) - return word_list - - -def count_zero_bits_in_bytes(bytes_input, bit_size): - """ - Calculate the number of zero bits in a number given in a bytes representation. - - :param bytes_input: (bytes) input number - :param bit_size: size of bytes_input in bits - :return: (int) number of zero bits - - Returns TypeError if parameter bytes_input is not "bytes" - Return TypeError if parameter bit_size is not int - """ - # converting to str in binary representation - byteorder/endianness is irrelevant for this function - binary_input = format(int.from_bytes(bytes_input, byteorder="big"), 'b').zfill(bit_size) - return binary_input.count("0") - - -class ArgumentParser: - def __init__(self): - self.key_filename = None - self.output_endianness = None - self.hash_format = None - self.result_hash_filename = None - self.result_zeros_filename = None - self.log_filename = None - self.parser = optparse.OptionParser() - self.parser.add_option("-k", "--key", dest="key_filename", - help="!Mandatory! The name of the PEM file holding the RSA public key") - self.parser.add_option("-e", "--endian", dest="output_endianness", default="L", - metavar="END", - help="Sets the output endianness: END=B for Big Endian or END=L for Little Endian [" - "default: %default]") - self.parser.add_option("-f", "--format", dest="hash_format", default="SHA256", - metavar="HASHMODE", - help="Sets the hash format: HASHMODE=SHA256 for full SHA-256 hash (Hbk) or " - "HASHMODE=SHA256_TRUNC for truncated SHA-256 hash (Hbk0 or Hbk1) [default: " - "%default]") - self.parser.add_option("-o", "--out-hash", dest="result_hash_filename", default=PRIM_KEY_HASH_FILE_NAME, - metavar="FILE", - help="Writes hash result to FILE [default: %default]") - self.parser.add_option("-z", "--out-zeros", dest="result_zeros_filename", default=ZEROS_NUM_FILES_NAME, - metavar="FILE", - help="Writes number of zero bits in the hash result to FILE [default: %default]") - self.parser.add_option("-l", "--log", dest="log_filename", default=LOG_FILENAME, - metavar="FILE", - help="Writes event log to FILE [default: %default]") - - def parse_arguments(self, args): - (options, args) = self.parser.parse_args(args) - if len(args) > 0: - self.parser.error("incorrect number of positional arguments, use option -h for help") - - self.key_filename = options.key_filename - if self.key_filename is None: - self.parser.error("Option -k must be given, use option -h for help") - - self.output_endianness = options.output_endianness - if self.output_endianness is not None and self.output_endianness != "B" and self.output_endianness != "L": - self.parser.error("Illegal argument for output endianness (option -e)") - - self.hash_format = options.hash_format - if self.hash_format is not None and self.hash_format != "SHA256" and self.hash_format != "SHA256_TRUNC": - self.parser.error("Illegal argument for hash format (option -f)") - - self.result_hash_filename = options.result_hash_filename - self.result_zeros_filename = options.result_zeros_filename - self.log_filename = options.log_filename - - -class HbkGenerator: - def __init__(self, argument_parser, logger): - self.argument_parser = argument_parser - self.logger = logger - self.hash_digest = None - self.hash_word_list = None - self.zero_bits = None - - # decide hash output size - if self.argument_parser.hash_format == "SHA256": - self.outputSize = OUTPUT_SIZE_SHA_256 - else: - self.outputSize = OUTPUT_SIZE_SHA_256_TRUNC - self.output_word_count = self.outputSize // BYTES_WITHIN_WORD - self.output_bit_count = self.output_word_count * BITS_WITHIN_WORD - - def generate_hbk(self): - self.logger.info("Step 1: Calculating hash") - self.hash_digest = cryptolayer.Common.get_hashed_n_and_np_from_public_key(self.argument_parser.key_filename, - self.logger) - self.hash_digest = self.hash_digest[:self.outputSize] - self.hash_word_list = create_word_list(list(self.hash_digest), self.output_word_count, - self.argument_parser.output_endianness) - self.logger.info("Step 2: Calculate num of zero bits over the hash") - self.zero_bits = count_zero_bits_in_bytes(self.hash_digest, self.output_bit_count) - - def write_output_files(self): - hex_list = [format(item, "#08x") for item in self.hash_word_list] - hash_output_string = ", ".join(hex_list) - with open(self.argument_parser.result_hash_filename, 'w') as hash_output_file: - hash_output_file.write(hash_output_string) - #with open(self.argument_parser.result_zeros_filename, 'w') as zeros_output_file: - # zeros_output_file.write(hex(self.zero_bits)) - - -def main(args): - if not (sys.version_info.major == 3 and sys.version_info.minor >= 5): - print("The script requires Python3.5 or later!") - sys.exit(-1) - # parse arguments - the_argument_parser = ArgumentParser() - the_argument_parser.parse_arguments(args) - # get logging up and running - the_logger = util_logger.UtilLogger(the_argument_parser.log_filename, "HBK Generator") - # perform main task - generator = HbkGenerator(the_argument_parser, the_logger) - generator.generate_hbk() - generator.write_output_files() - the_logger.info("Script completed successfully") diff --git a/tools/alif/utils/jtag-adapters.db b/tools/alif/utils/jtag-adapters.db deleted file mode 100755 index 97d7edcbf..000000000 --- a/tools/alif/utils/jtag-adapters.db +++ /dev/null @@ -1,2 +0,0 @@ -J-Link - diff --git a/tools/alif/utils/key/OEMRoT.pem b/tools/alif/utils/key/OEMRoT.pem deleted file mode 100755 index 802f1ce4a..000000000 --- a/tools/alif/utils/key/OEMRoT.pem +++ /dev/null @@ -1,42 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIHbTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIwzEe5UOoVsYCAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBB5WgZjHz4EBbUisNB0c5gqBIIH -EKUWBTX0eZYKjYt5kwqHzt16B2jU45ELi3RiMl4Fv7nQwcvkGJWs+j+Ph9RY/1zh -No6ZWmgzjVPFgSozvsU7GHX4zANXxgShUXln598NCkqq2h7FigVV2CcibezX6TxN -Y6YqFVu8LRqzKk/7biThz7l5zXyRC8OXzPTV2PR9puOAjsw9gdgzhJlz883dxgO8 -9ZumvhyzACtkCzkG7hGQcsoJXgFReGFjqaTB01k6V7g/06qKoJu69nw9AXaJ18ho -v12gDYSwpHk+dex4URTuEMi6Mw31FouJoQLY5PJmh8PvWbz7pJ2kPrrwD6SaKqhW -TO9DYmnXdm7oovdu+2QOJLwWjORaK/11HXI2smWOLpZ8Jl5LNigeu/DXCWFk5PQO -p1vuAQYHeQDuSQTWkvJSNZ0WJ2EcgJjd/uRn2QjtNywOhhbnSlCSAVWOFfNzAL4Y -Rci3UQllRuzozQ1X/gZKgLfPFv1FqUtz21fvhDmFH2tBaOgqHgW/NhMBpFGEqo6s -b0/Ab6QvZ1BnjQcRve8yalnEIjcInv+KJsRoYvaG6sww0XjT3/sA47EHBH7o3sjM -5+YFqB1+dpgaTi+VFvnRgYWSNf0YDb2xUX53WrZSMCie5dZX21RlJLC8A02csKlD -dhYOaVr/zjO99jWMyb6/T+vxsko0hvhtjgezm7Q+vHHWyMYsoPKyOGmht6ppZqUb -TIxz0cWMQsFaIiOo53FguqacIRpxOInHUC//1syPxB5RbW+fuklJsZplGA60W2L7 -/MzuSWyFUypuTAbpzDqqDtg/2fxD56/Qzi4bhLa9OLBz70flQZAk5UN/+Ob8JUel -BYrToW7H5K7Prj6S3A6LPs98D0aRGmu3SC5tbQKzCsvnBZvZllSVQZp0h5+4SIQS -ZIv3wDsSGDaKndXgspsp3h1VswVRggHV5O6jps0+BvWPIZEsKU4JxQd9fr4ekRrb -j6ZlxGiMGDQES1fTpoV78usK91LMyFKHRSRl+QjD6ewdhnZtUN+lccEP9wv908fR -Or/iRqoAfvmn4ezUTPVH2h13tIEVs/Kh3IMoqlhntwJd4uCZbdr525T+CRtywutm -ac/P8t1dmSwuNxXe+kcJp62S/wRAT1jgyRRlfPn1GFsFex92bg9DgQimKmNCadfX -Jms0bXLuAb1XZcEXBOglzmwvut5TKMEKcEwdW5gJ7yNih1fJ0p0FOD/pXcDnnncC -pGqltRuIo087CJElk2XCuubiihGPKSSdFCId07K24t/IM1ZI9S/NCJiqAXR+qKaQ -384AoTSnuBiRKKWgqD+jTrEMqaKEFcU/s5HuU6d/9ujkAEaf1MkxyjyRt3dsowB9 -sPLEFd9eQoHVnGAg3i/xfkLiwhH+Ok67L41Wcna70A42g8O5HZJCRh3wdL2Gnqso -is9LqXSZzwEQcmDIw44C73SW4C7XvJJs7BGj3xb33+pL4bZnmsgTgKzyN8toaFY4 -uPqjMryX9S2Mi3NH/k+OJ9j3fVK/dad6eJYNQAm/YnP75C1gKexksk0cA6ZF5trs -RuSBB9JmgMFdaa/3ZblFL0REW1BQANkN7D9tOXV9+YReaxfDZ10DXwK0Zapgp4vo -n1E+IgAg8E2+8tXzyeGXDuvoegWkIDEyvmLXc9JH+iyEazue07A8JlCXZxZ0Rms4 -spYEKg+pim3rhrpO33F+4f/2iz1W9TQGIxO/1ZCZcVKAFiuhqSApA66F2FI4QXFw -FKlelbbULrbZBPj/pmTLj7GMSdxhiycmDHiXEbdqCjLdhG1W0cWMc2o2mBjtlc1W -Zj/ujMlz4IXQvY/qo4tdXtjmSEQul4u4Ekr3/NobiKe5Hv40MK1V6vKiA5Ib+vyR -7ZnRGi8rV9RSR2ko8K1TY8W0zFMFXiPGmmW5j/hT+58/6YUk5AsFI0QcHxqtIYyp -6LjqsgNpzGkuu+DWoJ/bEgPCYagEWZ4u/RM9Fqg5+NAn6ZDEeiZdHgpjOOVyfyvT -u6Va9cXRPkSH0PSX/RHyZRBk2FcHweTu3dvJ8BInKxsR6uSeN/0sE/ZLowGdeQ8M -bxcmZoqCETbWUZ3/Kg4dc+kM8rD3/Ap1sZlfOe16sHrVxMg01Z5D65yLpCL8lO3k -5k9l8jnA9QzQXow241X4b2c+jzQ2rQkQ+Lut626iq65WhtK6MJboOGVDNbZh6LJB -jR/ybeN1Qb1N18kdXK9LP8+6GiFhEogVBNtqlr6td87YXe9cnV6OOhjyL5kpX453 -reHk5nChOdEgzhgzrwOV9O9IzyCFdh+Un2eIG3YUWSmvyz1nhFgIC3OH0mKoxUxB -OzLcUDb+aWJFN6FJYl4/u+RfVuK8ji4pcdIvL4ysbUlH4oXRqIpVAeEXV3KR+WrX -9MqF1nfn3n+FZYpUFajeVPuuf8logIKYP/UZTqMJSzmk ------END ENCRYPTED PRIVATE KEY----- diff --git a/tools/alif/utils/key/OEMRoTPublic.pem b/tools/alif/utils/key/OEMRoTPublic.pem deleted file mode 100755 index 9e9955b21..000000000 --- a/tools/alif/utils/key/OEMRoTPublic.pem +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAyhcTU6X4XO+guLUUoUzF -LnTPm0Wd2HBoX+D8AHAE5dcggCp8s18TfRBlzM3hMEWgPylB9Wc8lNPGihgGeG3j -PyrCDAlkJzSzW+Q/Um7kP7OradtZQlsi4OMzSoluv7asemCJ9aL5JWUKyfy8vleW -Kx4ihnkKgfrfodfB0xnKtffV+QorpRZldNjq4itItPbs7+AykKWyb8+Jr8Q+Angg -3olgoitIZfQ+1cMFI/9tv442jGInpLl//JAz8aZiZAb4PLWUX2B/C96u1A0rXuDg -uBGQyLoM55by0YQve7A45wwf2NMQ5N9h0OygaQ9AReJV1sy8I3RQqiw2YZCV7eQB -l3u+2mS2alqnImT7Wd+pLk5URlDlTxy/ktAS37K91UJtyPt/gBDnyxbLNW3y3H8T -RFTLtgPbLswlePdeaG9IxliSCBweodW56ug2+SYQqMU/r6XeDDKK/dtbAz8SFdAH -UXGfFyycO8Fj6XcIsMAnaPdi2yzxsMKzQp4QXVois5m3AgMBAAE= ------END PUBLIC KEY----- diff --git a/tools/alif/utils/key/OEMSBContent.pem b/tools/alif/utils/key/OEMSBContent.pem deleted file mode 100755 index 6ee9c649e..000000000 --- a/tools/alif/utils/key/OEMSBContent.pem +++ /dev/null @@ -1,42 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIHbTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIGbczFX0cty4CAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBBlskH16EZh6ZjBPJdkKE2CBIIH -ENBB2r0djbJYsncwmGCluBhlJ/FC7CEmcq54z4FadSvJE1bF5OQo8vsRWJC5fZHx -Q+/+kpNKBZT+8en3NQO+7DIvixoWHR/L2D7e0QYMbvQfJ17QVLE+wcqyDpk+D/hK -HRSvaHv3wTp9sc88jphH5DzXyrHmOHVHaZHzYQC3/mHRgliEM2ghxPsLwDAfbK1c -P9SZA0eiH7z9vttL6HSji+gx9UvxNIXWy+NiFhiycDFtLlulrtWmc73m3I5MgCMO -6OGvUpG7in3qDnTA2YbC5KZVjGZlmixPbrtsFPm0blWwms6/upczEej+NLXgGaDG -7Jgwsg9TjAZiQHRJ4qbXMiGnfsw6LMlIs9wS1jqW8D/tKIxR6cJ4KyGUFIBQXCox -krJZoNRE9DaiGNaQEFoTsbqAGSjn4qYj7hUuDI73Ep8wFeqaigxP/JxL6X+FKbng -v+68FPYTfe0x3RuNgTNEjETVKuZwtjjJMRZaFzm6OWwV92IvjBSkhMBwq6nHKzZG -7CiCDtZjLdO+ny0AStHrvHyXC60IfPTCJuW4z/0uJjP7+jGRX0FxdBhc3PgBNW/4 -B4vZ6nbP/Z6+06F1Z1Crl22pVuMDCqdA0Z0CHtYJXF266HFXU5oVE9J+w2hKNgMe -U2lsG/EYbIx4suSokdtUTYWQeLdnGx8TwA6m1CKnAZ+pIr6Vw+tFeOa20oAlq0ac -4R+mS6MIS8DeFKrSpxWSsGaIBKuduDIZDTTJMJZuQLUAkVCKnPqltw56/VLmZmcV -r4BfWfGqPNTdBoZh+LwhoPc3uPY7BMy8kdEHfxzwGFY3Ngdskq7goQ/V8HXErxjI -xvYxGNwFAYCy6Yg/PBtLXeJyrko1Ww9kZ9Dc7IlDa6NExkm99ct+b5zlvXqnT0Z/ -kpqHmqfQgBXlOXS9Iaf/PSvvtTrF2biMyFDWkLUy60cwzNoCAR1oNn9EylQ0d16y -9kFnIauVmGjSyWizZOONq3CgHpvGr9gKjegnqsHkFizemz/sPJzNaAlnKfN47Y9u -ZBIVzQLmnDaQo04BwwCNlJo9+thYRR8Jz6YVuDRUNvite2L2urHAnat1/5S6X6od -37eP87l9OpHl0hG76LtSDioBELR+pqiNDZMc20slmivqYyPCLFjVkbqGDoeYNhiA -9T3SsF2S+kdXBNpyV2AzSWZKE9KwJvc63iiRVAGe11fABpkJvS0DbwtpZeHcAHCd -6TlL0nbnr3f5zQBLyHAGypJ8nwBcVjwq8GaiIRQgmsgXBY25wyz8xCpNBE3DEPFv -3SQqUTmFOgiBYHLyaIAvScI9moDrmm3nLtel7JiTyhyNjgTPz6TbKGGNo8umilKD -R7oq+nkyF7/Zx2ddge50IHyx4q0MK79VLOAzr1xR9nLW6HA8XEdq0+JezwSEnFxT -87cATY7omYN1/WN6xPjTVfM4sdsEWTUTBYfwtBSNhmXyPjIdCfgseqx3EszuwKpG -2/b31eKVI+IFoYvs6rZR+z7MAzWMQRtmtO0hAbzn05GVv/U6yUbyd77Iqq29YZKS -cBlNXZVz51d08PPD1XstHQd5BEXJEjxVhYx4fREBc+oBBoOGBA52de+ciOJRcg0d -2/MB5TNsGNA3vIcGjPucIJpNNpFd3fNSCm9oCKV07jaW2ACcLZ1Fxe8cdueXCkxi -6anZ/7S6TCW3rBJY8yOTt/xQRAJfAbeWqKM9RxkWYh54RCGTZRjmNGkYvSBexOch -0iIcl5W5lSLcRJqaquuenl0bYRzSP+d/qWb2mk9Xe2i+WLe5Lomefn+Dld06944g -bNhe1k6/geU6dWCITbzlMuWnEO+LrkQF1pu1YW5FqXhEGF7j+tiIL7byL3tEkkbg -7d5Z/0C/r+hJZZEB3PzOnwU2kcrS4iahKATbb75jHE1qsrJqgqZ6e4hc6OWNx0gG -DzEEss5OU3hb/B3jXq7wwzHXdZ1Acrg1S1U267yheSumuHjVrIGZLmCUx1adfzhj -15eWuefpZDj0SM7XrTxNAqt4ITo8S8ONab76R93yU1Vu6256QpGlmMGRKIhO+Oq3 -GB4ox/erSl3VjqarA8OZuXEjek2wt5yqdoviTTHpeu5NAlLXeAF3oYxX5vCTT0BQ -3+r5SLtzPsoMTZO1/+tXFTRsts+sSn3C4VUHQlVMBiCnxCWDlcsFEhCeFlWv51lt -tKZfJzCC760OdfgFu3YBkEwRaE2WuigYcHt0A2mMU22D2GPjUCQb4oZYLRZHypS5 -WCstrv2Nv262Ri2TA2f6DtG6fIc06gqlaDTRkA00APTxj7HFPA31sg8MrGSaoF6g -Og30R2Fky+ABP534RNXy0aWYoqSSG4TKh0aEI+joH/VMUTD2V3+hec91bc6gfnnf -EoexVDODgVSETm7CP3aCiSuoBv6GRbudS3xor5n1qRVZ ------END ENCRYPTED PRIVATE KEY----- diff --git a/tools/alif/utils/key/OEMSBContentPublic.pem b/tools/alif/utils/key/OEMSBContentPublic.pem deleted file mode 100755 index fd6b11c70..000000000 --- a/tools/alif/utils/key/OEMSBContentPublic.pem +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA4IMCIc+X8Anx9Rc5oVHK -H1kjOmRUtbNLEdEaOEcCjEhtXtO49JzVxxwVnB/D7ACWU3LHNlhyh9p4ln5Mzovb -bMRptcJ0rEWIv3cs2D2MDdfsxcfNYR5E9FeepES9ImMMIRu5hhquFsTeTm8yAwzQ -0LuxJ3uq/Vxesbq05k4QXyvGfBWu8+w1q/vIeRrWme+4ppjnq61r++wFW83CPluF -K5hhMyrOSU5KE9pZ0eWJP8z9XvAwdE97gd0agwjqRuBy68gto6mD04Pm6R3d8OGI -KO3XAE4l+u3hKXbCHbWa8ZhbLWOwt5jb44MzvivKT9d+brPtiG1PCAEkqoTJM/Q+ -dorKHIl4Jcu+86+cGgcotzhTL9fv1+7Gi/9QiMdSAoL1xoJd3hRLb2wWZbkBNVA+ -RNjYXhTe7p84RVoP6BWgpv1duT39Gko3RnU4fq6CM9vYUxgCCss4VMwJHOukYqrW -ZY0Rnohv0n9q4WlcZP+/vSRoMucmeaV0cW+JEUyotgyzAgMBAAE= ------END PUBLIC KEY----- diff --git a/tools/alif/utils/key/OEMSBKey.pem b/tools/alif/utils/key/OEMSBKey.pem deleted file mode 100755 index 89ba675ec..000000000 --- a/tools/alif/utils/key/OEMSBKey.pem +++ /dev/null @@ -1,42 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIHbTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIth9PNLaEdl4CAggA -MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBDa49PQbSc6r+xLeI2oQzvIBIIH -ELT56F2p+CjBXZrM7rWh0+R/2hxZv2lVPqc8L2n71RAw2QyMVBh9HHJ9LRQMrQOB -3JDn7ePh8NiA5kMRKh3FBs6hcOCcbkbVfSeYJmtCPoDNK4QPfvAt5BKpSKoslYj4 -mPPlewpzDs8Xh9I6kroq7ueD/VpiG/aCmPvSZc1CWKCVpse85/n/V3x1p1/S4506 -rHaxw3H8fmQABQ1QgqCFotOjGnO9pMbYEbHkwPMBov82uoW31RnFP99ulTd8rwuo -fW7e2iaSqe7cf5gReUCQvL5T74k/q9x2m9agnI1x4sUpPlctEPcREhet2hBAr1vv -McWXwQ0h9hYbCBveQ31PEhkWLlrbhVZzfjGlujrSC8sKsGv9YacB5R6vsBqEer3j -YTXNxfFwwqKyu7+gK5hy9s7oh0uaz0K1x7M/en9NDsouS3/W3xrkzG12Xwha+QcG -C1X23VedsmMwsPP8lAfJljZ6LlPJouzplbjniKdgpEXplQspfkoOGdDQeadH5eyd -xMyCD4JPnsLmCgWigxGLeYTPfQM3XxNjv3hqwE8gp+eO1m0rJvSixgR7u2uF4HOc -WkaIeCrnH4j8dUa9eZI+J8s4G4QRupw/dqaXeiDvpzPGDA1nGfJQFhAQk1964IL0 -LRUzmvR6lQBEnwwVowvtHN0ll6i8hhNH5eG8auP3XL1hEUUfjoE/MsCRJLCahnlH -SJ/h1o2eW2FESHIRTX+poNZjY3maDkn7p2h7lD7fa37A3g/TIG67fAb0vPKQuWI8 -bGXLhz+9jP4Mx6y2A3JrDIMcAiYIJnHzCR8SnXKqUXYVwUzYiF3fz62knLNi48Iz -J+svT7WLuY6utpGYs9qdueSBj/cQX4q0K3nPY5rllhWKH31W+PTjc35X0vt1zVSi -uxQpzrDJZ38zohFomUkDsRteQdXC7BUjkyGU9myKRQLhtUE32hI4B8gNWiz4p4+X -XPzpPbM9PxcC+wZyCRMrfAprgkRoCi0mOv5dCBeNCV8Cy8iEKZsX45GZ0MJXTlQ2 -1LfKtZSwIc/O4p4Y0zfO5gPUPela6WshKjFiDwNVO+d0MK2RxCxC9JNkuvU6ezxj -8hXDcMLmGman2XgogwcvtELDDtaGRhM5+RFCU6iWfwdvQZIC3owitTW6AAqoOG28 -LNU9AJ1asPH4XyU0rYdLwLquu+MaWCscT1ZterGAM6QKTKFB3dup4V7QK8e4hTQE -xl+WmVjyHnx4h4+Qk46wBfPzl2tyQV+tKFp6SECkrlooQvOsMVCKF4De0/7zhwzk -0UtmQYvp4grfm4dMYFw7S5VRHRJDyvjYMs+l57TlGKPBLNsmFtuHdlB99tPY6+Rg -C2T1CHPTcUEGQrYYbzhej7dz0nPbJGcjg2b7Dpx4dcK9TyLKQaghweV8J5XsFDwh -uRS274Prr9L0Oeq2ay59ZVzoQpmeJr8ZVp00VfMfn94IMVTc4Ng434hKkFDTMrWZ -+Dgaf31/o8UW5MD2EkXjY0b9L8JFzVDpAN4QpwfTXsnZSezFDs/1Z73gKeVwv3x0 -6URoOM9A/QFT5Vf6VRjqHpdBjDNG0U2O51YiwCPJZSNnqyPF4g4lgYknbWhOhMYg -3tqMq3O/R8nDqW2HQzT2498thGWygndXMV2fiQY4z8MqaemmR2txYLgPhqypilc8 -PPOoy81pDQ3bYMLDjLHlFD3YgyeztE4j1Gp02F88f7fGCGmx4HLLeF12ED6gKHYU -Vaz/f2h+PwkvsdgEoJ+lcYi7AupoIdXWqGctthqIfgbIll9nbznGnL0VhW1DlDZg -D9DAKduw/jT6m7Wvb8JGfgXvUOnq4JDUr39gVdPj5km2KgKqI9clhx7uW7Bl8VhG -B8wwoNvNG3E1MCwDL99bwkj3WMnA0/U7Bz9YH8W/WoX8B+c2rlxJkDA6BNOvvSYL -KvJq27Ld4CWgsPP4cNoSrCkg21q+/9MWNDwXAubUUtTgv1Js18FBPhqe3aqvcHaU -V1rN0ZJYHFH96n7DnRzQbh6abmEyApiGDmRV33J1CowlVmR9y80CJOB3J8EpbnAx -rCWPgch3LujG34jQAemNDcSYTRcvR2G2EbI1GNVmrbCVRL3BwaHEdfEYzFcLS7YD -LrmUMZpKYdmzyifHt9Y3JVDjlHIXwrUgIK2jjrSMzNLt6ArSNyMnJvdu4DEVNoVE -u2HfF2AplGQMmXf1Up+/mePOgXOT8LX+n2qRS9K37PC37CKEPpOOnTa/71+zl/op -O3viB0CijaJQBe39PvDx/ZxDicbXVpCoa++LJkAV8LFSdkc8qSH9uZZUsR9o4XOl -BWh+41TiTHp8c3Zc5gdRURbe2INhmoPHWpcl30vriCWOmmK63AoSqvirHEPEEu3w -6ong+3q7csBRxXorza2sT7F9ckKtFEAeTedNH8KV0Awu ------END ENCRYPTED PRIVATE KEY----- diff --git a/tools/alif/utils/key/OEMSBKeyPublic.pem b/tools/alif/utils/key/OEMSBKeyPublic.pem deleted file mode 100755 index 84cc8b1d7..000000000 --- a/tools/alif/utils/key/OEMSBKeyPublic.pem +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA1F/dTkBwYPY4psalLLBP -SVbHhuOsRJGN/DFRt/0qtZIheb3JA1BhMllR40EHFZbW53p/n4/+8jYNMeqrkACE -I3FImXbd39yiaeCFH0E2nCElabVR/+MysAnogzEfVy32z+Dmd1m83b28MogJ988P -XZOkxck2PLTEbphkuEj0tYoh2mgCy7Xply5ELD+Lw/usLKtf2M+IYqbiaY98OIM6 -Kr9/HtRZhqutiBwrhSYtSZTZzC0Bl0mzUKCxAQLlJYmbT0L1fjf+V28iXgQx1pYv -LqFQwEiF6eS5DL2Lt5H6hC2xJmP9MaA6YLL3AEMT7dy9+zoDjk/J74g33kLnqTp2 -Pr8XfHfKnxSdbfCvX9wll8KDDnWVCq9U3Ol/UKCYaFnnsjrXCgqVnQ6ScN1R9314 -XnWBZ+y3VfnWi51CTE0lu7E4k0mGT6k7wmpSvnBXwbuFeM+O7en2QgHMAeNWE638 -0V+Lkwt8s6A2jhGX0GAh9iYZgOvfS7DBGXXJ/JhXa8yDAgMBAAE= ------END PUBLIC KEY----- diff --git a/tools/alif/utils/key/hbk1.bin b/tools/alif/utils/key/hbk1.bin deleted file mode 100755 index 17174266f..000000000 Binary files a/tools/alif/utils/key/hbk1.bin and /dev/null differ diff --git a/tools/alif/utils/key/hbk1_hash.txt b/tools/alif/utils/key/hbk1_hash.txt deleted file mode 100755 index aa120fe9e..000000000 --- a/tools/alif/utils/key/hbk1_hash.txt +++ /dev/null @@ -1 +0,0 @@ -0xbb63be74, 0xff65c3fb, 0xd49dd5bc, 0x4eb944fc \ No newline at end of file diff --git a/tools/alif/utils/key/kce.txt b/tools/alif/utils/key/kce.txt deleted file mode 100755 index 7f9b5c158..000000000 --- a/tools/alif/utils/key/kce.txt +++ /dev/null @@ -1 +0,0 @@ -0x3a,0x9e,0xde,0x51,0xa0,0xfd,0x2f,0xe7,0x55,0x9a,0x32,0xb2,0xb1,0x76,0x57,0x32 \ No newline at end of file diff --git a/tools/alif/utils/key/oem_enc_asset.bin b/tools/alif/utils/key/oem_enc_asset.bin deleted file mode 100755 index ab8afee21..000000000 Binary files a/tools/alif/utils/key/oem_enc_asset.bin and /dev/null differ diff --git a/tools/alif/utils/key/oem_keys_pass.pwd b/tools/alif/utils/key/oem_keys_pass.pwd deleted file mode 100755 index b7b595908..000000000 --- a/tools/alif/utils/key/oem_keys_pass.pwd +++ /dev/null @@ -1 +0,0 @@ -sdi78%7jj2HAR5mP0ajhbbsd56$@#sdhbcks \ No newline at end of file diff --git a/tools/alif/utils/key/oem_prov_asset.bin b/tools/alif/utils/key/oem_prov_asset.bin deleted file mode 100755 index c6866db73..000000000 Binary files a/tools/alif/utils/key/oem_prov_asset.bin and /dev/null differ diff --git a/tools/alif/utils/lzf-lnx b/tools/alif/utils/lzf-lnx deleted file mode 100755 index 213c15b91..000000000 Binary files a/tools/alif/utils/lzf-lnx and /dev/null differ diff --git a/tools/alif/utils/maint-recoveryDB.db b/tools/alif/utils/maint-recoveryDB.db deleted file mode 100755 index 4b398e3d9..000000000 --- a/tools/alif/utils/maint-recoveryDB.db +++ /dev/null @@ -1,20 +0,0 @@ -{ - "groups" : { - "ROM" : "rom", - "Device Information" : "info", - "Utilities" : "utils" - }, - "info" : { - "Device enquiry" : "get_enquiry_action", - "Get revision info" : "get_revision_action", - "Get SEROM trace data": "get_trace_buffer" - }, - "utils" : { - "Terminal mode" : "terminal_mode" - }, - "rom" : { - "Recovery" : "recovery_action", - "Recovery (No Reset)" : "recovery_action_no_reset" - } -} - diff --git a/tools/alif/utils/maintDB.db b/tools/alif/utils/maintDB.db deleted file mode 100755 index 1a03f9d15..000000000 --- a/tools/alif/utils/maintDB.db +++ /dev/null @@ -1,46 +0,0 @@ -{ - "groups" : { - "Device Control" : "control", - "Device Information" : "info", - "MRAM" : "mram", - "Utilities" : "utils", - "Setting capabilities" : "setting" - }, - "control" : { - "Hard maintenance mode" : "maintenance_mode", - "Soft maintenance mode" : "soft_maintenance_mode", - "Device reset" : "reset_action" - }, - "info" : { - "Get TOC info" : "get_toc_action", - "Get SES Banner" : "get_banner_action", - "Get CPU boot info" : "get_cpu_status_action", - "Device enquiry" : "get_enquiry_action", - "Get revision info" : "get_revision_action", - "Get OTP data" : "get_otp_read", - "Get MRAM data" : "get_mram_read_action", - "Get log data" : "get_log_data_action", - "Get SEROM trace data": "get_trace_buffer", - "Get SERAM trace data": "get_seram_trace_buffer", - "Get power data": "get_power_action", - "Get clock data": "get_clock_action" - }, - "mram" : { - "Erase Application Mram" : "full_erase_application_mram_action", - "Fast Erase Application Mram" : "fast_erase_application_mram_action", - "Fast Erase App. Mram (include NTOC)" : "fast_erase_app_include_start_mram_action", - "Get MRAM info" : "get_mram_info_action" - }, - "utils" : { - "Terminal mode" : "terminal_mode", - "Get SERAM metrics" : "get_seram_info_action", - "Get ECC key" : "get_ecc_key", - "Get Firewall configuration" : "get_firewall_config" - }, - "setting" : { - "Enable LOGGING" : "set_logger_enable_action", - "Disable LOGGING" : "set_logger_disable_action", - "Enable PRINTING" : "set_print_enable_action", - "Disable PRINTING" : "set_print_disable_action" - } -} diff --git a/tools/alif/utils/menuconfDB.db b/tools/alif/utils/menuconfDB.db deleted file mode 100755 index dde6e658a..000000000 --- a/tools/alif/utils/menuconfDB.db +++ /dev/null @@ -1,13 +0,0 @@ -{ - "get_mram_read_action" : { - "DEVICE_FEATURE_SET_REVISION": [ - "Fusion_A0" - ] - }, - "get_power_action" : { - "DEVICE_FEATURE_SET_REVISION": [ - "Fusion_A1" - ] - } - -} diff --git a/tools/alif/utils/pinmux.py b/tools/alif/utils/pinmux.py deleted file mode 100755 index f4f4aea71..000000000 --- a/tools/alif/utils/pinmux.py +++ /dev/null @@ -1,75 +0,0 @@ -""" pinmuxing """ -import json -import ctypes -import struct - -# pylint: disable=too-few-public-methods -# pylint: disable=too-many-instance-attributes -# pylint: disable=invalid-name -# pylint: disable=attribute-defined-outside-init - -c_uint32 = ctypes.c_uint32 -c_uint8 = ctypes.c_uint8 - -class pad_configuration_bits(ctypes.LittleEndianStructure): - """ fw_rgn_mpe """ - _fields_ = [ - ("port", c_uint32, 8), - ("pin", c_uint32, 8), - ("mux_mode", c_uint32, 7), - ("pad_control_valid", c_uint32, 1), - ("pad_control", c_uint32, 8) - ] - - def init_from_cfg(self, cfg): - """ Initialize from JSON configuration """ - self.port = cfg['port'] - self.pin = cfg['pin'] - self.mux_mode = cfg['mux_mode'] - self.pad_control_valid = 1 - self.pad_control = int(cfg['pad_config'], 0) - -class pad_configuration_bytes(ctypes.LittleEndianStructure): - """ fw_rgn_mpe """ - _fields_ = [ - ("b1", c_uint8), - ("b2", c_uint8), - ("b3", c_uint8), - ("b4", c_uint8) - ] - -class pad_configuration(ctypes.Union): - _fields_ = [ - ("bits", pad_configuration_bits), - ("bytes", pad_configuration_bytes) - ] - - def init_from_cfg(self, cfg): - """ Initialize from JSON configuration """ - self.bits.port = cfg['port'] - self.bits.pin = cfg['pin'] - self.bits.mux_mode = cfg['mux_mode'] - self.bits.pad_control_valid = 1 - self.bits.pad_control = int(cfg['pad_config'], 0) - -def json_to_bin(jsn): - """ Convert a JSON object into binary """ - data = [] - pads = jsn - for pad in pads: - pad_cfg = pad_configuration() - pad_cfg.init_from_cfg(pad) - data.append(pad_cfg.bytes.b1) - data.append(pad_cfg.bytes.b2) - data.append(pad_cfg.bytes.b3) - data.append(pad_cfg.bytes.b4) - - return data - -def main(): - """ main """ - json_to_bin() - return 0 - -if __name__ == "__main__": - main() diff --git a/tools/alif/utils/printInfo.py b/tools/alif/utils/printInfo.py deleted file mode 100755 index dcd0f91e3..000000000 --- a/tools/alif/utils/printInfo.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -#pylint: disable=invalid-name,superfluous-parens,anomalous-unicode-escape-in-string - -""" - __author__ = "" - __copyright__ =Copyright 2021, ALIF Semiconductor" -""" - -verboseMode = False - -def verboseModeSet(flag): - global verboseMode - verboseMode = flag - -def verboseModeGet(): - return verboseMode - -def printInfo(*args): - if verboseMode: - msj = '' - for item in args: - if type(item).__name__ == 'str': - msj += item - else: - msj += str(item) - msj += ' ' - print('[INFO] ' + msj) - \ No newline at end of file diff --git a/tools/alif/utils/proj.cfg b/tools/alif/utils/proj.cfg deleted file mode 100755 index 151644444..000000000 --- a/tools/alif/utils/proj.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# certificate version -CERT_VERSION_MAJOR = 1 -CERT_VERSION_MINOR = 0 - - - diff --git a/tools/alif/utils/rsa_keygen.py b/tools/alif/utils/rsa_keygen.py deleted file mode 100755 index 0fbb3d0e6..000000000 --- a/tools/alif/utils/rsa_keygen.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2001-2020, Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause OR Arm’s non-OSI source license -# - -import optparse -import sys -from utils.common import util_logger -from utils.common import cryptolayer - -# Util's log file -LOG_FILENAME = "key_gen_log.log" - - -class ArgumentParser: - def __init__(self): - self.private_key_filename = None - self.private_key_pwd_filename = None - self.public_key_filename = None - self.log_filename = None - #self.parser = optparse.OptionParser(usage="usage: %prog [options]", - # description="%prog generates a PEM encoded RSA private key and writes it " - # "to the file specified by parameter . " - # "Optionally it can also generate the corresponding public key " - # "to the file specified by option -k.") - # Removed above line of code and added below line ---------------------- Swathi - self.parser = optparse.OptionParser() - self.parser.add_option("-p", "--pass_file", dest="private_key_pwd_filename", - help="Filename containing the passphrase for creating the private key, " - "in plaintext format. For security considerations, this parameter can be omitted, " - "in which case this utility will prompt for direct input.") - self.parser.add_option("-k", "--pubkey", dest="public_key_filename", - help="If given, the public key will be also extracted into the PEM file specified " - "by this parameter") - self.parser.add_option("-l", "--log", dest="log_filename", default=LOG_FILENAME, - metavar="FILE", - help="Writes event log to FILE [default: %default]") - - def parse_arguments(self, args): - (options, args) = self.parser.parse_args(args) - if len(args) != 1: - self.parser.error("incorrect number of positional arguments, use option -h for help") - self.private_key_filename = args[0] - self.private_key_pwd_filename = options.private_key_pwd_filename - self.public_key_filename = options.public_key_filename - self.log_filename = options.log_filename - - -class KeyGenerator: - def __init__(self, argument_parser, logger): - self.argument_parser = argument_parser - self.logger = logger - - def generate_key(self): - key = cryptolayer.RsaCrypto.generate_rsa_pem_key(self.argument_parser.private_key_filename, - self.argument_parser.private_key_pwd_filename, - self.logger) - if self.argument_parser.public_key_filename is not None: - cryptolayer.RsaCrypto.extract_public_rsa_pem_key(key, self.argument_parser.public_key_filename, self.logger) - - -def main(args): - if not (sys.version_info.major == 3 and sys.version_info.minor >= 5): - print("The script requires Python3.5 or later!") - sys.exit(-1) - # parse arguments - the_argument_parser = ArgumentParser() - the_argument_parser.parse_arguments(args) - # get logging up and running - the_logger = util_logger.UtilLogger(the_argument_parser.log_filename, "RSA Key Generator") - # perform main task - generator = KeyGenerator(the_argument_parser, the_logger) - generator.generate_key() - the_logger.info("Script completed successfully") diff --git a/tools/alif/utils/sign_image_util.py b/tools/alif/utils/sign_image_util.py deleted file mode 100755 index cd40629b0..000000000 --- a/tools/alif/utils/sign_image_util.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python3 -""" - Perform Image signing - - __author__ = "" - __copyright__ = "ALIF Seminconductor" - __version__ = "0.1.0" - __status__ = "Dev" -""" -# pylint: disable=unused-argument, invalid-name, bare-except -from pathlib import Path -from utils.toc_common import * -from utils.common.certificates import getKeyCertificatePath - -# 0.3.000 - added support for Azure Storage (Public Keys and Certs) -# 0.4.000 - split image signature functionality -# 0.5.000 - remove folders restriction -TOOL_VERSION ="0.5.000" # Define Version constant for each separate tool - -#EXIT_WITH_ERROR = 1 - -certPath = Path("cert/") -imagePath = Path("build/images") - -# A simplified copy of createContentCerts (in toc_common.py) with some modified paths -def create_content_certs(sec, prefix, config_file): - """ - create a content certificate for an image - """ - print('Creating Signature...') - try: - file = open(imagePath / "images.txt", "w") - except: - print(sys.exc_info()[0]) - print("ERROR creating template file for Content Certificates") - sys.exit(EXIT_WITH_ERROR) - - configFile = prefix + config_file - - fsize = sec['size'] - encrypt = '0' - - binfile = sec['binary'] - binfile = "../" + binfile - print("Binary File: ", binfile) - file.write(binfile + \ - " " + str(sec['loadAddress']) + \ - " " + str(sec['mramAddress']) + \ - " " + str(fsize) + \ - " " + encrypt) - file.close() - - os.chdir(os.getcwd() + '/utils/') - cert_sb_content_util.main(["-c", 'cfg/'+configFile, "-l", '../build/logs/SBContent.log']) - os.chdir(os.getcwd() + '/../') - - # check if file exists (and remove it) before renaming it - #certFile = "SB" + sec['binary'] + ".crt" - certFile = sec['binary'] + ".crt" - if os.path.exists(certFile): - os.remove(certFile) - - fileName = prefix + "SBContent.crt" - os.rename(certPath / fileName, certFile) - # save cert. name in images list - sec['cert'] = certFile - - # remove ICVSBContent_Cert.txt file (not used) - textFile = prefix + "SBContent_Cert.txt" - if os.path.exists(certPath / textFile): - os.remove(certPath / textFile) - # remove images.txt (not used) - textFile = "images.txt" - if os.path.exists(imagePath / textFile): - os.remove(imagePath / textFile) - -def is_seram_address(address): - # TODO: the end address should be configurable (for SPARK it is 0x30020000) - if address >= 0x30000000 and address < 0x30040000: - return True - else: - return False - -def sign_image(fileName, destAddress, loadAddress, signature_type): - key1_cert = "" - key2_cert = "" - - if signature_type == "ICV": - #key1_cert = "cert/ICVSBKey1.crt" - key1_cert = getKeyCertificatePath() + '/ICVSBKey1.crt' - #key2_cert = "cert/ICVSBKey2.crt" - key2_cert = getKeyCertificatePath() + '/ICVSBKey2.crt' - elif signature_type == "OEM": - key1_cert = "cert/OEMSBKey1.crt" - key2_cert = "cert/OEMSBKey2.crt" - else: - print("Auth Host can only be 'ICV' or 'OEM'") - sys.exit(EXIT_WITH_ERROR) - - sec = {} - sec['disabled'] = False - sec['binary'] = fileName - fsize, padlen = getImageSize(sec['binary']) - sec['size'] = fsize - sec['padlen'] = padlen - if is_seram_address(destAddress): - sec['mramAddress'] = hex(destAddress) - else: - sec['mramAddress'] = globalToLocalAddress(hex(destAddress)) - sec['identifier'] = 'image' - sec['flags'] = {} - - if loadAddress == 0xFFFFFFFF: - # Signing content that is downloaded to 'destAddress' before verification. - # The address is specified in the sec['mramAddress'] field. - sec['loadAddress'] = hex(loadAddress) - #load-verify-scheme = 1 - config_file = 'SBContent_lvs_1.cfg' - elif is_seram_address(loadAddress): - # signing SERAM images for packaging them as single-image STOC updates - # SERAM images require 'load-verify-scheme = 0' - sec['loadAddress'] = hex(loadAddress) - #load-verify-scheme = 0 - config_file = 'SBContent_lvs_0.cfg' - else: - # this section is not used currently - sec['loadAddress'] = globalToLocalAddress(hex(loadAddress)) - #load-verify-scheme = 0 - config_file = 'SBContent_lvs_0.cfg' - create_content_certs(sec, signature_type.upper(), config_file) - - content_cert = sec["cert"] - print("Content Certificate File: ", content_cert) - - sigfile = fileName + ".sign" - print("Signature File: ", sigfile) - with open(sigfile, "wb") as outf: - with open(key1_cert, 'rb') as inf: - outf.write(inf.read()) - with open(key2_cert, 'rb') as inf: - outf.write(inf.read()) - with open(content_cert, 'rb') as inf: - outf.write(inf.read()) - # add the 12-byte padding required for content certificate chains - outf.write(('\0' * 12).encode('utf8')) - - if os.path.exists(content_cert): - os.remove(content_cert) - - return sigfile diff --git a/tools/alif/utils/toc_common.py b/tools/alif/utils/toc_common.py deleted file mode 100755 index 71a8580ac..000000000 --- a/tools/alif/utils/toc_common.py +++ /dev/null @@ -1,626 +0,0 @@ -import sys -import os -import glob -from pathlib import Path -import json -from json.decoder import JSONDecodeError -from utils import cert_sb_content_util -import utils.toc_common -from printInfo import * - -EXIT_WITH_ERROR = 1 - -certPath = Path("cert/") -imagePath = Path("build/images/") - - -# we need to pad 12 bytes to put the image into a 16-byte aligned address -CERT_CHAIN_SIZE = (840 * 2) + 868 + 12 # 2560 bytes (0xA00) -# we pad out to have 16-byte aligned sizes = 880 total size -CONT_CERT_SIZE = 868 + 12 -# we need to pad 12 bytes to put the image into a 16-byte aligned address -CERT_CHAIN_SIZE = (840 * 2) + 868 + 12 - -def getImageSize(file): - """ - find the image size - """ - - try: - fsize = os.path.getsize(file) - - except FileNotFoundError: - print("ERROR: The file " + file + " was not found in build/ directory!") - print("Please check the file and try again") - sys.exit(EXIT_WITH_ERROR) - - except: - print(sys.exc_info()[0]) - print("ERROR: getting the image size for file " + file) - sys.exit(EXIT_WITH_ERROR) - - #print("OS file size: " + str(fsize)) - - padlen = 0 - - if fsize % 16: - # If we have to pad out - newsize = fsize + (16 - (fsize % 16)) - #print("Size should be " + str(newsize)) - padlen = (16 - (fsize % 16)) - - return fsize, padlen - - -def validateHexAddress(address, param, image): - """ - check address - """ - if (address[0:2].lower() != '0x'): - print(param + ' for image ' + image + ' should in in hex!') - sys.exit(EXIT_WITH_ERROR) - - try: - val = int(address, 0) - - except ValueError: - print('Invalid address in ' + param + ' for image ' + image) - sys.exit(EXIT_WITH_ERROR) - - - - -def globalToLocalAddress(globalAddress): - """ - convert addresses - """ - # Global to Local Addresses Convertion is based on this table - #Rgn​ SE Address Region (CM0+)​ RegSize​ Global add Region​ Coverage​ - # EXAMPLE FOR REV_A0 DEVICES - #1​ 0x6000_0000 - 0x8000_0000​ 512MB​ 0x0000_0000 - 0x2000_0000​ Boot register, CVM, XNVM, Host Peripherals, Power, Firewall, MHU​ - #2​ 0x8000_0000 - 0x8200_0000​ 32MB 0x4800_0000 - 0x4A00_0000​ EXPMST0 Shared Peripherals​ - #3​ 0x8800_0000 - 0x8900_0000​ 16MB​ 0x5000_0000 - 0x5100_0000​ EXTSYS0 HP-CM55 TCM​ - #4​ 0x9000_0000 - 0x9800_0000​ 128MB​ 0x6000_0000 - 0x6800_0000​ EXTSYS1 TCMs​ - #5​ 0x9800_0000 - 0x9C00_0000​ 64MB​ 0x7000_0000 - 0x7400_0000​ Low Power Peripherals (VBAT at 0x7000 and LPAON at 0x7100)​ - #6​ 0xA000_0000 - 0xA800_0000​ 128MB 0x8000_0000 - 0x8800-0000​ OCVM​ - #7​ 0xC000_0000 – 0xE000_0000​ 512MB​ 0xD000_0000 – 0xF000_0000​ OctalSPI0 and OctalSPI1​ - # - #The upper region addresses are exclusive for the purpose of readability - #(e.g. instead of 0x7FFF_FFFF the upper address is listed as 0x8000_0000)​ - - # Steps for the conversion" - # 1. Check if provided global address is in one of the above regions - # 2. if in region, apply the corresponding Delta to convert to a Local address - # 3. If NOT in region, we exit with error and terminate the program - - #Rgn Delta - #1 + 0x6000-0000 - #2 + 0x3800-0000 - #3 + 0x3800-0000 - #4 + 0x3000-0000 - #5 + 0x2800-0000 - #6 + 0x2000-0000 - #7 - 0x1000-0000 - - - # Global addresses definition for REV_Ax devices - regions_Ax = [ - ['0x00000000','0x20000000'], - ['0x48000000','0x4A000000'], - ['0x50000000','0x51000000'], - ['0x60000000','0x68000000'], - ['0x70000000','0x74000000'], - ['0x80000000','0x88000000'], - ['0xD0000000','0xF0000000'] - ] - - deltas_Ax = [ - ['+','0x60000000'], - ['+','0x38000000'], - ['+','0x38000000'], - ['+','0x30000000'], - ['+','0x28000000'], - ['+','0x20000000'], - ['-','0x10000000'] - ] - - # Global addresses definition for REV_B0 devices - regions_B0 = [ - ['0x02000000','0x02400000'], # SRAM0_BASE - ['0x08000000','0x08280000'], # SRAM1_BASE - ['0x50000000','0x50040000'], # M55_HP_ITCM_BASE - ['0x50800000','0x50900000'], # M55_HP_DTCM_BASE - ['0x58000000','0x58040000'], # M55_HE_ITCM_BASE - ['0x58800000','0x58840000'], # M55_HE_DTCM_BASE - ['0x62000000','0x62100000'], # MODEM_ITCM_BASE - ['0x62100000','0x62200000'], # MODEM_DTCM_BASE - ['0x63000000','0x63080000'], # DSP_ITCM_BASE - ['0x63100000','0x63300000'], # DSP_DTCM_BASE - ['0x60000000','0x60040000'], # GNSS_ITCM_BASE - ['0x60040000','0x600C0000'], # GNSS_DTCM_BASE - ['0x80000000','0x80600000'] # MRAM_BASE - ] - - deltas_B0 = [ - ['+','0x60000000'], - ['+','0x60000000'], - ['+','0x44000000'], - ['+','0x44000000'], - ['+','0x40000000'], - ['+','0x40000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x10000000'] - ] - - # Global addresses definition for Spark devices - regions_Spark = [ - ['0x00000000','0x20000000'], - ['0x40000000','0x50000000'], - ['0x50000000','0x501E0000'], - ['0x58000000','0x5C000000'], - ['0x60000000','0x64000000'], - ['0x80000000','0x84000000'], - ['0xA0000000','0xE0000000'] - ] - - deltas_Spark = [ - ['+','0x60000000'], - ['+','0x40000000'], - ['+','0x44000000'], - ['+','0x40000000'], - ['+','0x3C000000'], - ['+','0x10000000'], - ['+','0x00000000'] - ] - - # Global addresses definition for REV_B0 devices - regions_Eagle = [ - ['0x02000000','0x02400000'], # SRAM0_BASE - ['0x08000000','0x08280000'], # SRAM1_BASE - ['0x50000000','0x50040000'], # M55_HP_ITCM_BASE - ['0x50800000','0x50900000'], # M55_HP_DTCM_BASE - ['0x58000000','0x58040000'], # M55_HE_ITCM_BASE - ['0x58800000','0x58840000'], # M55_HE_DTCM_BASE - ['0x62000000','0x62100000'], # MODEM_ITCM_BASE - ['0x62100000','0x62200000'], # MODEM_DTCM_BASE - ['0x63000000','0x63080000'], # DSP_ITCM_BASE - ['0x63100000','0x63300000'], # DSP_DTCM_BASE - ['0x60000000','0x60040000'], # GNSS_ITCM_BASE - ['0x60040000','0x600C0000'], # GNSS_DTCM_BASE - ['0x80000000','0x80600000'] # MRAM_BASE - ] - - deltas_Eagle = [ - ['+','0x60000000'], - ['+','0x60000000'], - ['+','0x44000000'], - ['+','0x44000000'], - ['+','0x40000000'], - ['+','0x40000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x3C000000'], - ['+','0x10000000'] - ] - - # create a list of valid global regions - #print(utils.config.DEVICE_REVISION) - if utils.config.DEVICE_FEATURE_SET == 'Fusion': - if utils.config.DEVICE_REVISION == 'A1': - regions = regions_Ax - deltas = deltas_Ax - else: - regions = regions_B0 - deltas = deltas_B0 - - elif utils.config.DEVICE_FEATURE_SET == 'Spark': - regions = regions_Spark - deltas = deltas_Spark - elif utils.config.DEVICE_FEATURE_SET == 'Eagle': - regions = regions_Eagle - deltas = deltas_Eagle - else: - print('ERROR: Invalid Device type!') - sys.exit(EXIT_WITH_ERROR) - - - #print(globalAddress) - localAddress = int(globalAddress, 16) - notFound = True - idx = 0 - for address in regions: - LOWER = int(address[0], 16) - UPPER = int(address[1], 16) - if localAddress >= LOWER and localAddress < UPPER: - #print('Address inside boundaries - region ' + str(idx)) - notFound = False - break - idx += 1 - - if notFound: - print('ERROR: Invalid Global Address. Please check!') - sys.exit(EXIT_WITH_ERROR) - - delta = int(deltas[idx][1], 16) - if deltas[idx][0] == '+': - localAddress += delta - elif deltas[idx][0] == '-': - localAddress -= delta - else: - print('ERROR in determining the right operation in global address conversion!') - sys.exit(EXIT_WITH_ERROR) - - #print(hex(localAddress)) - return hex(localAddress) - -def initCfgOptions(keys): - """ - CFG options - """ - options = {} - - for i in keys: - options[i] = 'none' - - return options - -def dict_raise_on_duplicates(ordered_pairs): - """ - Reject duplicate keys. - """ - d = {} - for k, v in ordered_pairs: - if k in d: - raise ValueError("Duplicate key: %r" % (k,)) - else: - d[k] = v - return d - -def read_json_file(file, attributes, flags, cpus): - """ - read the json file - """ - global numImages - - try: - f = open(file, 'r') - - except FileNotFoundError: - print('ERROR: file ' + file + ' does not exist!') - sys.exit(EXIT_WITH_ERROR) - - except: - print('ERROR opening configuration file') - sys.exit(EXIT_WITH_ERROR) - - - try: - cfg = json.load(f, object_pairs_hook=dict_raise_on_duplicates) - - except JSONDecodeError as e: - print("ERROR in JSON file.") - print(str(e)) - sys.exit(EXIT_WITH_ERROR) - - except ValueError as v: - print("ERROR in JSON file:") - print(str(v)) - sys.exit(EXIT_WITH_ERROR) - - except: - print("ERROR: Unknown error loading JSON file") - sys.exit(EXIT_WITH_ERROR) - - f.close() - - images = [] - for image in cfg: - #print('IMAGE:') - #print(image, cfg[image]) - if len(image) == 0: - print("ERROR: image description can't be empty!","Please correct it in configuration file") - sys.exit(EXIT_WITH_ERROR) - - # ensure the image descriptor is 8 characters (complete with '\0' otherwise) - n = 8 - len(image) - imgDesc = image.ljust(n + len(image), '\0') - imgOptions = initCfgOptions(attributes) - userOptions = cfg[image] - imgOptions['identifier'] = imgDesc[:8] - #print('Analyze options') - for opt in userOptions: - #print(opt, userOptions[opt]) - if imgOptions.get(opt) is None: - print('ERROR: Invalid key: "' + opt + \ - '" in configuration file, image: ' + image) - sys.exit(EXIT_WITH_ERROR) - else: - if isinstance(userOptions[opt], list): - for s in userOptions[opt]: - if s.upper() not in flags: - print('ERROR: flag "' + s + '" in image ' - + image + ' is not supported') - sys.exit(EXIT_WITH_ERROR) - - imgOptions[opt] = [s.upper() for s in userOptions[opt]] - else: - if opt in ['loadAddress','mramAddress']: - validateHexAddress(userOptions[opt], opt, image) - if opt == 'loadAddress': - if userOptions[opt][0:3] == '0x8': - print('ERROR: An MRAM address can not be used in loadAddress attribute') - sys.exit(EXIT_WITH_ERROR) - - if opt == 'cpu_id': - if userOptions[opt] not in cpus: - print('ERROR: cpu_id "' + userOptions[opt] + '" in image ' + image + ' is not supported') - sys.exit(EXIT_WITH_ERROR) - - imgOptions[opt] = userOptions[opt] - - images.append(imgOptions) - - return images - -def compressImage(file): - """ - compression - """ - print('Compressing image: ' + file) - if sys.platform == "linux": - os.system('chmod +x ./utils/lzf-lnx') - os.system('./utils/lzf-lnx -cfb 4096 ' + file) - else: - os.system('utils\\lzf.exe -cfb 4096 ' + file) - -def addContentCertificate(file, binary): - """ - addContentCertificate - """ - certFile = "SB" + binary + ".crt" - certFile = certPath / certFile - #print("Copying Cont.Cert: " + str(certFile)) - file.write(getBlob(certFile)) - # pad 12 bytes to put the image in a 16-byte aligned address - file.write(b'\x00' * 12) - - -def createContentCerts(fwsections, prefix): - """ - create content certificates - """ - print('Creating Content Certificates...') - for sec in fwsections: - - if sec['disabled'] is True: - continue - - #print(sec) - #print(imagePath) - - try: - file = open(imagePath / "images.txt", "w") - except: - print(sys.exc_info()[0]) - print("[ERROR] creating template file for Content Certificates") - sys.exit(EXIT_WITH_ERROR) - - - # create the ContentCertificate - # - # swLoadVerifyScheme values in Content Certificates: - # - # SERAMX : 0 - load and verify - # XIP (verify in flash) : 1 - (Encryption Not Allowed) - # IMAGE : 2 - verify in memory (LOAD flag set) (Encryption is allowed and optional) - # - - encrypt = '0' - # Content Certificate for SERAM needs to have Local Addresses - sec['mramAddress'] = globalToLocalAddress(sec['mramAddress']) - if sec['identifier'].upper()[:5] == 'SERAM': - configFile = prefix + 'SBContent_lvs_0.cfg' - mem_load_address = sec['loadAddress'] - # Encryption allowed if load-verify-scheme = 0 - if 'ENCRYPT' in sec['flags']: - encrypt = '1' - - else: - if 'LOAD' in sec['flags']: - # use - # load-verify-scheme = 2 - # aes-ce-id = 2 - configFile = prefix + 'SBContent_lvs_2.cfg' - mem_load_address = globalToLocalAddress(sec['loadAddress']) - # Encryption ONLY allowed if load-verify-scheme = 2 (LOAD flag set) - if 'ENCRYPT' in sec['flags']: - encrypt = '1' - else: - # use - # load-verify-scheme = 1 - # aes-ce-id = 0 (no encryption allowed if verify in flash) - configFile = prefix + 'SBContent_lvs_1.cfg' - mem_load_address = '0xFFFFFFFF' - - fsize = sec['size'] - if 'COMPRESS' in sec['flags']: - fsize = sec['uncompressedSize'] - - printInfo('Content Certificate1:') - #print("../build/" + sec['binary'] + " " + str(mem_load_address) + " " + \ - # str(sec['mramAddress']) + " " + str(fsize) + " " + encrypt) - file.write("../build/images/" + sec['binary'] + \ - " " + str(mem_load_address) + \ - " " + str(sec['mramAddress']) + \ - " " + str(fsize) + \ - " " + encrypt) - file.close() - - os.chdir(os.getcwd() + '/utils/') - cert_sb_content_util.main(["-c", 'cfg/'+configFile, "-l", '../build/logs/SBContent.log']) - os.chdir(os.getcwd() + '/../') - - # check if file exists (and remove it) before renaming it - #certFile = "SB" + sec['binary'] + ".crt" - certFile = "SB" + sec['binary'] + "_" + str(sec['mramAddress']) + ".crt" - printInfo(certFile) - if (os.path.exists(certPath / certFile)): - os.remove(certPath / certFile) - - fileName = prefix + "SBContent.crt" - os.rename(certPath / fileName, certPath / certFile) - # save cert. name in images list - sec['cert'] = certFile - - # remove ICVSBContent_Cert.txt file (not used) - textFile = prefix + "SBContent_Cert.txt" - if (os.path.exists(certPath / textFile)): - os.remove(certPath / textFile) - - # remove images.txt - temporal template file (not used) - textFile = "images.txt" - if (os.path.exists(imagePath / textFile)): - os.remove(imagePath / textFile) - - -def getObjectType(objType, switcher): - """ - get object type - """ - return switcher.get(objType.strip(), 4) - -def getCPUID(objCPU, switcher): - """ - fet CPU ID - """ - - return switcher.get(objCPU, 0xF) - - -def getObjectFlags(objFlags): - """ - getObjectFlags - """ - flagInt = 0 - for f in objFlags: - if f == 'COMPRESS': - flagInt += 0x10 - elif f == 'LOAD': - flagInt += 0x20 - elif f == 'BOOT': - flagInt += 0x40 - elif f == 'ENCRYPT': - flagInt += 0x80 - elif f == 'DEFERRED': - flagInt += 0x100 - - return flagInt - -def getObjectVersion(objVersion): - """ - """ - if objVersion == 'none': - return 0 - - ver = objVersion.split('.') - res = 0 - idx = 3 - for n in ver: - if idx < 1: - break - res += (int(n) * (256 ** idx)) - idx -= 1 - return res - -def getBlob(file): - """ - get the Blob - """ - f = open(file, 'rb') # TODO: This needs to check for open fail - blob = f.read() - f.close() - return blob - -def scanFiles(fileList, action): - """ - scanFiles - """ - filesProcesed = 0 - for i in range(len(fileList)): - files = glob.glob(fileList[i]) - for file in files: - if action == 'list': - if i == 0: - print('\nThe following files will be deleted:\n') - print('\t' + file) - elif action == 'delete': - os.remove(file) - filesProcesed += 1 - - return filesProcesed - -def cleanBuild(fileList): - """ - cleanBuild - """ - - files = scanFiles(fileList, 'list') - - if files == 0: - print('\nThere were no files to delete') - sys.exit() - - print('\nPress Y to confirm, or any other key to exit') - confirmResponse = input('> ') - if confirmResponse.upper() == 'Y' or confirmResponse.upper() == 'YES': - print('Deleting files...') - scanFiles(fileList, 'delete') - print('\nThe build workspace was cleaned!', '(' + str(files) + ' files were deleted)') - else: - print('The operation was aborted!') - -def validateOptions(fwsections): - # validate options in fwsections - exit if errors - for sec in fwsections: - if 'COMPRESS' in sec['flags']: - # enforce compression is not allowed encryption is used - if 'ENCRYPT' in sec['flags']: - print('[ERROR] Compression is not allowed for encrypted images!') - print('[ERROR] Please correct the configuration: ' - + str(sec['flags']) - + ' in image ' - + sec['identifier']) - sys.exit(EXIT_WITH_ERROR) - - # enforce compression is not allowed for XIP use case - if 'LOAD' not in sec['flags'] and sec['cpu_id'] != 'none': - print('[ERROR] Compression is not allowed for XIP images!') - print('[ERROR] Please correct the configuration: ' - + str(sec['flags']) - + ' in image ' - + sec['identifier']) - sys.exit(EXIT_WITH_ERROR) - - # if LOAD flag is used, loadAddress should be valid - if 'LOAD' in sec['flags']: - if sec['loadAddress'] == 'none': - print('[ERROR] if LOAD flag is used, a loadAddress must be specified!') - print('[ERROR] Please correct the configuration in image ' - + sec['identifier']) - sys.exit(EXIT_WITH_ERROR) - - # if BOOT flag is used, CPU_ID should be valid - if 'BOOT' in sec['flags']: - if sec['cpu_id'] == 'none': - print('[ERROR] if BOOT flag is used, a cpu_id must be specified!') - print('[ERROR] Please correct the configuration in image ' - + sec['identifier']) - sys.exit(EXIT_WITH_ERROR) diff --git a/tools/alif/utils/user_validations.py b/tools/alif/utils/user_validations.py deleted file mode 100755 index 8ffc3c5a6..000000000 --- a/tools/alif/utils/user_validations.py +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env python3 -import os -import sys - -EXIT_WITH_ERROR = 1 - -def validateNumber(number, alignment): - #validate a number (to be used as an Address, Size or Pattern) - # 1. check number is valid (positive integer <= 32bits) - # 2. if address is in decimal, check for negative values - # 3. check for 16-byte alignment if requested - if number[:2].lower() == '0x': - base = 16 - else: - base = 10 - - try: - val = int(number,base) - if val < 0: - raise Exception - - except: - print('Error in parameter ' + number + ' - Please check') - sys.exit(EXIT_WITH_ERROR) - - if alignment == True: - if val%16: - print('Error: parameter ' + number + ' must be multiple of 16') - print('Please correct and retry') - sys.exit(EXIT_WITH_ERROR) - - if len(hex(val)) > 10: - print("Error: parameter " + number + " can't be larger than a 32-bit value") - print('Please correct and retry') - sys.exit(EXIT_WITH_ERROR) - - return val - -def validateItems(items, pad): - # we get a list of dictionaries - for item in items: - for key in item: - if key == 'file': - # validate file - # get file size to check existance - try: - # mram_burner runs in bin/ folder so all references would - # have '../' to land into tools root directory and describe the path from there... - # GUI will solve all these limitations. - fPath = item[key][3:] - fSize = os.path.getsize(fPath) - if (fSize % 16) != 0: - print("File size = %d" % fSize) - print('!!!WARNING: the SIZE of ' + fPath + ' is NOT multiple of 16 bytes as required by MRAM') - if pad: - padlen = (16 - (fSize % 16)) - print('Since the -p option was invoked, the binary will be padded with ' + str(padlen) + ' bytes') - with open(fPath, 'ab') as f: - f.write(('\0' * padlen).encode('utf8')) - - else: - print('Please correct the image or use the -p option to pad the binary') - os._exit(1) - - except: - print(sys.exc_info()[0]) - print("Error: there is a problem with the image " + item[key]) - print('Please check it exists and retry') - sys.exit(EXIT_WITH_ERROR) - - elif key == 'address': - # validate address is valid - validateNumber(item[key], False) - - elif key == 'addressX16': - # validate address is valid and 16-byte aligned - validateNumber(item[key], True) - - elif key == 'sizeX16': - #validate size - validateNumber(item[key], True) - - elif key == 'pattern': - # validate pattern - validateNumber(item[key], False) - - -def convertToHex(item): - # item could be a file (returned as it is) or a number - # if decimal number, it will be converted to hex and returned - # if hexadecimal number, it will be returned as it is - if item[:2].lower() != '0x': - try: - return hex(int(item, 10)) - - except: - return item - - return item - - -def validateArgList(action, argList, pad=False): - items = [] - if action == 'Burning: ': - # we should have a pair of parameters (file and MRAM_Address) - pairList = argList.split(' ') - if len(pairList)%2: - print('Error in parameters: check the help using -h option') - sys.exit(EXIT_WITH_ERROR) - - tmp = {} - for i in range(0, len(pairList), 2): - tmp["file"] = pairList[i] - tmp["address"] = pairList[i+1] - items.append(tmp.copy()) - - elif action == 'Erasing: ': - # we should have a pair of parameters (file and MRAM_Address) - params = argList.split(' ') - if len(params)<3 or len(params)>4: - print('Error in parameters: check the help using -h option') - sys.exit(EXIT_WITH_ERROR) - - tmp = {} - tmp["addressX16"] = params[1] - tmp["sizeX16"] = params[2] - if len(params)==4: - tmp["pattern"] = params[3] - - items.append(tmp) - - else: - # we can't validate arguments as we don't recognize the action - print('Unknown option in argument validation: ' + action) - sys.exit(EXIT_WITH_ERROR) - - # validate the list of items to validate - validateItems(items, pad) - - newArgList = '' - for item in argList.split(' '): - newArgList += convertToHex(item) + ' ' - - return newArgList -