0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-20 06:58:39 +03:00

Initial commit

This commit is contained in:
OneOfEleven
2023-09-09 08:03:56 +01:00
parent 92305117f1
commit 54441e27d9
3388 changed files with 582553 additions and 0 deletions

View File

@ -0,0 +1,237 @@
/*
* ARM Limited (ARM) is supplying this software for use with Cortex-M
* processor based microcontroller, but can be equally used for other
* suitable processor architectures. This file can be freely distributed.
* Modifications to this file shall be clearly marked.
*
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* @file ARM_Example.h
* @brief CMSIS HeaderFile
* @version 1.2
* @date 20. July 2018
* @note Generated by SVDConv V3.3.21 on Friday, 20.07.2018 15:12:22
* from File 'ARM_Example.svd',
* last modified on Friday, 20.07.2018 13:11:38
*/
/** @addtogroup ARM Ltd.
* @{
*/
/** @addtogroup ARM_Example
* @{
*/
#ifndef ARM_EXAMPLE_H
#define ARM_EXAMPLE_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup Configuration_of_CMSIS
* @{
*/
/* =========================================================================================================================== */
/* ================ Interrupt Number Definition ================ */
/* =========================================================================================================================== */
typedef enum {
/* ======================================= ARM Cortex-M3 Specific Interrupt Numbers ======================================== */
Reset_IRQn = -15, /*!< -15 Reset Vector, invoked on Power up and warm reset */
NonMaskableInt_IRQn = -14, /*!< -14 Non maskable Interrupt, cannot be stopped or preempted */
HardFault_IRQn = -13, /*!< -13 Hard Fault, all classes of Fault */
MemoryManagement_IRQn = -12, /*!< -12 Memory Management, MPU mismatch, including Access Violation
and No Match */
BusFault_IRQn = -11, /*!< -11 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory
related Fault */
UsageFault_IRQn = -10, /*!< -10 Usage Fault, i.e. Undef Instruction, Illegal State Transition */
SVCall_IRQn = -5, /*!< -5 System Service Call via SVC instruction */
DebugMonitor_IRQn = -4, /*!< -4 Debug Monitor */
PendSV_IRQn = -2, /*!< -2 Pendable request for system service */
SysTick_IRQn = -1, /*!< -1 System Tick Timer */
/* ======================================== ARM_Example Specific Interrupt Numbers ========================================= */
TIMER0_IRQn = 0, /*!< 0 Timer 0 interrupt */
TIMER1_IRQn = 4, /*!< 4 Timer 2 interrupt */
TIMER2_IRQn = 6 /*!< 6 Timer 2 interrupt */
} IRQn_Type;
/* =========================================================================================================================== */
/* ================ Processor and Core Peripheral Section ================ */
/* =========================================================================================================================== */
/* =========================== Configuration of the ARM Cortex-M3 Processor and Core Peripherals =========================== */
#define __CM3_REV 0x0100U /*!< CM3 Core Revision */
#define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */
#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
#define __MPU_PRESENT 1 /*!< MPU present or not */
#define __FPU_PRESENT 0 /*!< FPU present or not */
/** @} */ /* End of group Configuration_of_CMSIS */
#include "core_cm3.h" /*!< ARM Cortex-M3 processor and core peripherals */
#include "system_ARM_Example.h" /*!< ARM_Example System */
#ifndef __IM /*!< Fallback for older CMSIS versions */
#define __IM __I
#endif
#ifndef __OM /*!< Fallback for older CMSIS versions */
#define __OM __O
#endif
#ifndef __IOM /*!< Fallback for older CMSIS versions */
#define __IOM __IO
#endif
/* ======================================== Start of section using anonymous unions ======================================== */
#if defined (__CC_ARM)
#pragma push
#pragma anon_unions
#elif defined (__ICCARM__)
#pragma language=extended
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc11-extensions"
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wnested-anon-types"
#elif defined (__GNUC__)
/* anonymous unions are enabled by default */
#elif defined (__TMS470__)
/* anonymous unions are enabled by default */
#elif defined (__TASKING__)
#pragma warning 586
#elif defined (__CSMC__)
/* anonymous unions are enabled by default */
#else
#warning Not supported compiler type
#endif
/* =========================================================================================================================== */
/* ================ Device Specific Peripheral Section ================ */
/* =========================================================================================================================== */
/** @addtogroup Device_Peripheral_peripherals
* @{
*/
/* =========================================================================================================================== */
/* ================ TIMER0 ================ */
/* =========================================================================================================================== */
/**
* @brief 32 Timer / Counter, counting up or down from different sources (TIMER0)
*/
typedef struct { /*!< (@ 0x40010000) TIMER0 Structure */
__IOM uint32_t CR; /*!< (@ 0x00000000) Control Register */
__IOM uint16_t SR; /*!< (@ 0x00000004) Status Register */
__IM uint16_t RESERVED;
__IM uint32_t RESERVED1[2];
__IOM uint16_t INT; /*!< (@ 0x00000010) Interrupt Register */
__IM uint16_t RESERVED2;
__IM uint32_t RESERVED3[3];
__IOM uint32_t COUNT; /*!< (@ 0x00000020) The Counter Register reflects the actual Value
of the Timer/Counter */
__IOM uint32_t MATCH; /*!< (@ 0x00000024) The Match Register stores the compare Value for
the MATCH condition */
union {
__IM uint32_t PRESCALE_RD; /*!< (@ 0x00000028) The Prescale Register stores the Value for the
prescaler. The cont event gets divided by
this value */
__OM uint32_t PRESCALE_WR; /*!< (@ 0x00000028) The Prescale Register stores the Value for the
prescaler. The cont event gets divided by
this value */
};
__IM uint32_t RESERVED4[9];
__IOM uint32_t RELOAD[4]; /*!< (@ 0x00000050) The Reload Register stores the Value the COUNT
Register gets reloaded on a when a condition
was met. */
} TIMER0_Type; /*!< Size = 96 (0x60) */
/** @} */ /* End of group Device_Peripheral_peripherals */
/* =========================================================================================================================== */
/* ================ Device Specific Peripheral Address Map ================ */
/* =========================================================================================================================== */
/** @addtogroup Device_Peripheral_peripheralAddr
* @{
*/
#define TIMER0_BASE 0x40010000UL
#define TIMER1_BASE 0x40010100UL
#define TIMER2_BASE 0x40010200UL
/** @} */ /* End of group Device_Peripheral_peripheralAddr */
/* =========================================================================================================================== */
/* ================ Peripheral declaration ================ */
/* =========================================================================================================================== */
/** @addtogroup Device_Peripheral_declaration
* @{
*/
#define TIMER0 ((TIMER0_Type*) TIMER0_BASE)
#define TIMER1 ((TIMER0_Type*) TIMER1_BASE)
#define TIMER2 ((TIMER0_Type*) TIMER2_BASE)
/** @} */ /* End of group Device_Peripheral_declaration */
/* ========================================= End of section using anonymous unions ========================================= */
#if defined (__CC_ARM)
#pragma pop
#elif defined (__ICCARM__)
/* leave anonymous unions enabled */
#elif (__ARMCC_VERSION >= 6010050)
#pragma clang diagnostic pop
#elif defined (__GNUC__)
/* anonymous unions are enabled by default */
#elif defined (__TMS470__)
/* anonymous unions are enabled by default */
#elif defined (__TASKING__)
#pragma warning restore
#elif defined (__CSMC__)
/* anonymous unions are enabled by default */
#endif
#ifdef __cplusplus
}
#endif
#endif /* ARM_EXAMPLE_H */
/** @} */ /* End of group ARM_Example */
/** @} */ /* End of group ARM Ltd. */

View File

@ -0,0 +1,788 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File naming: <part/series name>.svd -->
<!--
Copyright (C) 2012-2014 ARM Limited. All rights reserved.
Purpose: System Viewer Description (SVD) Example (Schema Version 1.1)
This is a description of a none-existent and incomplete device
for demonstration purposes only.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
<vendor>ARM Ltd.</vendor> <!-- device vendor name -->
<vendorID>ARM</vendorID> <!-- device vendor short name -->
<name>ARM_Example</name> <!-- name of part-->
<series>ARMCM3</series> <!-- device series the device belongs to -->
<version>1.2</version> <!-- version of this description, adding CMSIS-SVD 1.1 tags -->
<description>ARM 32-bit Cortex-M3 Microcontroller based device, CPU clock up to 80MHz, etc. </description>
<licenseText> <!-- this license text will appear in header file. \n force line breaks -->
ARM Limited (ARM) is supplying this software for use with Cortex-M\n
processor based microcontroller, but can be equally used for other\n
suitable processor architectures. This file can be freely distributed.\n
Modifications to this file shall be clearly marked.\n
\n
THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED\n
OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\n
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\n
ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\n
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
</licenseText>
<cpu> <!-- details about the cpu embedded in the device -->
<name>CM3</name>
<revision>r1p0</revision>
<endian>little</endian>
<mpuPresent>true</mpuPresent>
<fpuPresent>false</fpuPresent>
<nvicPrioBits>3</nvicPrioBits>
<vendorSystickConfig>false</vendorSystickConfig>
</cpu>
<addressUnitBits>8</addressUnitBits> <!-- byte addressable memory -->
<width>32</width> <!-- bus width is 32 bits -->
<!-- default settings implicitly inherited by subsequent sections -->
<size>32</size> <!-- this is the default size (number of bits) of all peripherals
and register that do not define "size" themselves -->
<access>read-write</access> <!-- default access permission for all subsequent registers -->
<resetValue>0x00000000</resetValue> <!-- by default all bits of the registers are initialized to 0 on reset -->
<resetMask>0xFFFFFFFF</resetMask> <!-- by default all 32Bits of the registers are used -->
<peripherals>
<!-- Timer 0 -->
<peripheral>
<name>TIMER0</name>
<version>1.0</version>
<description>32 Timer / Counter, counting up or down from different sources</description>
<groupName>TIMER</groupName>
<baseAddress>0x40010000</baseAddress>
<size>32</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x100</size>
<usage>registers</usage>
</addressBlock>
<interrupt>
<name>TIMER0</name>
<description>Timer 0 interrupt</description>
<value>0</value>
</interrupt>
<registers>
<!-- CR: Control Register -->
<register>
<name>CR</name>
<description>Control Register</description>
<addressOffset>0x00</addressOffset>
<size>32</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0x1337F7F</resetMask>
<fields>
<!-- EN: Enable -->
<field>
<name>EN</name>
<description>Enable</description>
<bitRange>[0:0]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Disable</name>
<description>Timer is disabled and does not operate</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Enable</name>
<description>Timer is enabled and can operate</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- RST: Reset -->
<field>
<name>RST</name>
<description>Reset Timer</description>
<bitRange>[1:1]</bitRange>
<access>write-only</access>
<enumeratedValues>
<enumeratedValue>
<name>No_Action</name>
<description>Write as ZERO if necessary</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Reset_Timer</name>
<description>Reset the Timer</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- CNT: Counting Direction -->
<field>
<name>CNT</name>
<description>Counting direction</description>
<bitRange>[3:2]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Count_UP</name>
<description>Timer Counts UO and wraps, if no STOP condition is set</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Count_DOWN</name>
<description>Timer Counts DOWN and wraps, if no STOP condition is set</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>Toggle</name>
<description>Timer Counts up to MAX, then DOWN to ZERO, if no STOP condition is set</description>
<value>2</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- MODE: Operation Mode -->
<field>
<name>MODE</name>
<description>Operation Mode</description>
<bitRange>[6:4]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Continous</name>
<description>Timer runs continously</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Single_ZERO_MAX</name>
<description>Timer counts to 0x00 or 0xFFFFFFFF (depending on CNT) and stops</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>Single_MATCH</name>
<description>Timer counts to the Value of MATCH Register and stops</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>Reload_ZERO_MAX</name>
<description>Timer counts to 0x00 or 0xFFFFFFFF (depending on CNT), loads the RELOAD Value and continues</description>
<value>3</value>
</enumeratedValue>
<enumeratedValue>
<name>Reload_MATCH</name>
<description>Timer counts to the Value of MATCH Register, loads the RELOAD Value and continues</description>
<value>4</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- PSC: Use Prescaler -->
<field>
<name>PSC</name>
<description>Use Prescaler</description>
<bitRange>[7:7]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Disabled</name>
<description>Prescaler is not used</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Enabled</name>
<description>Prescaler is used as divider</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- CNTSRC: Timer / Counter Soruce Divider -->
<field>
<name>CNTSRC</name>
<description>Timer / Counter Source Divider</description>
<bitRange>[11:8]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>CAP_SRC</name>
<description>Capture Source is used directly</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div2</name>
<description>Capture Source is divided by 2</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div4</name>
<description>Capture Source is divided by 4</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div8</name>
<description>Capture Source is divided by 8</description>
<value>3</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div16</name>
<description>Capture Source is divided by 16</description>
<value>4</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div32</name>
<description>Capture Source is divided by 32</description>
<value>5</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div64</name>
<description>Capture Source is divided by 64</description>
<value>6</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div128</name>
<description>Capture Source is divided by 128</description>
<value>7</value>
</enumeratedValue>
<enumeratedValue>
<name>CAP_SRC_div256</name>
<description>Capture Source is divided by 256</description>
<value>8</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- CAPSRC: Timer / COunter Capture Source -->
<field>
<name>CAPSRC</name>
<description>Timer / Counter Capture Source</description>
<bitRange>[15:12]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>CClk</name>
<description>Core Clock</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_0</name>
<description>GPIO A, PIN 0</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_1</name>
<description>GPIO A, PIN 1</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_2</name>
<description>GPIO A, PIN 2</description>
<value>3</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_3</name>
<description>GPIO A, PIN 3</description>
<value>4</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_4</name>
<description>GPIO A, PIN 4</description>
<value>5</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_5</name>
<description>GPIO A, PIN 5</description>
<value>6</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_6</name>
<description>GPIO A, PIN 6</description>
<value>7</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOA_7</name>
<description>GPIO A, PIN 7</description>
<value>8</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOB_0</name>
<description>GPIO B, PIN 0</description>
<value>9</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOB_1</name>
<description>GPIO B, PIN 1</description>
<value>10</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOB_2</name>
<description>GPIO B, PIN 2</description>
<value>11</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOB_3</name>
<description>GPIO B, PIN 3</description>
<value>12</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOC_0</name>
<description>GPIO C, PIN 0</description>
<value>13</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOC_5</name>
<description>GPIO C, PIN 1</description>
<value>14</value>
</enumeratedValue>
<enumeratedValue>
<name>GPIOC_6</name>
<description>GPIO C, PIN 2</description>
<value>15</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- CAPEDGE: Capture Edge -->
<field>
<name>CAPEDGE</name>
<description>Capture Edge, select which Edge should result in a counter increment or decrement</description>
<bitRange>[17:16]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>RISING</name>
<description>Only rising edges result in a counter increment or decrement</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>FALLING</name>
<description>Only falling edges result in a counter increment or decrement</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>BOTH</name>
<description>Rising and falling edges result in a counter increment or decrement</description>
<value>2</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- TRGEXT: Triggers an other Peripheral -->
<field>
<name>TRGEXT</name>
<description>Triggers an other Peripheral</description>
<bitRange>[21:20]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>NONE</name>
<description>No Trigger is emitted</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>DMA1</name>
<description>DMA Controller 1 is triggered, dependant on MODE</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>DMA2</name>
<description>DMA Controller 2 is triggered, dependant on MODE</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>UART</name>
<description>UART is triggered, dependant on MODE</description>
<value>3</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- Reload: Selects Reload Register n -->
<field>
<name>RELOAD</name>
<description>Select RELOAD Register n to reload Timer on condition</description>
<bitRange>[25:24]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>RELOAD0</name>
<description>Selects Reload Register number 0</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD1</name>
<description>Selects Reload Register number 1</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD2</name>
<description>Selects Reload Register number 2</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD3</name>
<description>Selects Reload Register number 3</description>
<value>3</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- IDR: Inc or dec Reload Register Selection -->
<field>
<name>IDR</name>
<description>Selects, if Reload Register number is incremented, decremented or not modified</description>
<bitRange>[27:26]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>KEEP</name>
<description>Reload Register number does not change automatically</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>INCREMENT</name>
<description>Reload Register number is incremented on each match</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>DECREMENT</name>
<description>Reload Register number is decremented on each match</description>
<value>2</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- START: Starts / Stops the Timer/Counter -->
<field>
<name>S</name>
<description>Starts and Stops the Timer / Counter</description>
<bitRange>[31:31]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>STOP</name>
<description>Timer / Counter is stopped</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>START</name>
<description>Timer / Counter is started</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
</fields>
</register>
<!-- SR: Status Register -->
<register>
<name>SR</name>
<description>Status Register</description>
<addressOffset>0x04</addressOffset>
<size>16</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xD701</resetMask>
<fields>
<!-- RUN: Shows if Timer is running -->
<field>
<name>RUN</name>
<description>Shows if Timer is running or not</description>
<bitRange>[0:0]</bitRange>
<access>read-only</access>
<enumeratedValues>
<enumeratedValue>
<name>Stopped</name>
<description>Timer is not running</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Running</name>
<description>Timer is running</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- MATCH: Shows if a Match was hit -->
<field>
<name>MATCH</name>
<description>Shows if the MATCH was hit</description>
<bitRange>[8:8]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>No_Match</name>
<description>The MATCH condition was not hit</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Match_Hit</name>
<description>The MATCH condition was hit</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- UN: Shows if an underflow occured -->
<field>
<name>UN</name>
<description>Shows if an underflow occured. This flag is sticky</description>
<bitRange>[9:9]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>No_Underflow</name>
<description>No underflow occured since last clear</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Underflow</name>
<description>A minimum of one underflow occured since last clear</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- OV: Shows if an overflow occured -->
<field>
<name>OV</name>
<description>Shows if an overflow occured. This flag is sticky</description>
<bitRange>[10:10]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>No_Overflow</name>
<description>No overflow occured since last clear</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Overflow_occured</name>
<description>A minimum of one overflow occured since last clear</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- RST: Shows if Timer is in RESET state -->
<field>
<name>RST</name>
<description>Shows if Timer is in RESET state</description>
<bitRange>[12:12]</bitRange>
<access>read-only</access>
<enumeratedValues>
<enumeratedValue>
<name>Ready</name>
<description>Timer is not in RESET state and can operate</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>In_Reset</name>
<description>Timer is in RESET state and can not operate</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- RELOAD: Shows the currently active Reload Register -->
<field>
<name>RELOAD</name>
<description>Shows the currently active RELOAD Register</description>
<bitRange>[15:14]</bitRange>
<access>read-only</access>
<enumeratedValues>
<enumeratedValue>
<name>RELOAD0</name>
<description>Reload Register number 0 is active</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD1</name>
<description>Reload Register number 1 is active</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD2</name>
<description>Reload Register number 2 is active</description>
<value>2</value>
</enumeratedValue>
<enumeratedValue>
<name>RELOAD3</name>
<description>Reload Register number 3 is active</description>
<value>3</value>
</enumeratedValue>
</enumeratedValues>
</field>
</fields>
</register>
<!-- INT: Interrupt Register -->
<register>
<name>INT</name>
<description>Interrupt Register</description>
<addressOffset>0x10</addressOffset>
<size>16</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0x0771</resetMask>
<fields>
<!-- EN: Interrupt Enable -->
<field>
<name>EN</name>
<description>Interrupt Enable</description>
<bitRange>[0:0]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Disabled</name>
<description>Timer does not generate Interrupts</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Enable</name>
<description>Timer triggers the TIMERn Interrupt</description>
<value>1</value>
</enumeratedValue>
</enumeratedValues>
</field>
<!-- MODE: Interrupt Mode -->
<field>
<name>MODE</name>
<description>Interrupt Mode, selects on which condition the Timer should generate an Interrupt</description>
<bitRange>[6:4]</bitRange>
<access>read-write</access>
<enumeratedValues>
<enumeratedValue>
<name>Match</name>
<description>Timer generates an Interrupt when the MATCH condition is hit</description>
<value>0</value>
</enumeratedValue>
<enumeratedValue>
<name>Underflow</name>
<description>Timer generates an Interrupt when it underflows</description>
<value>1</value>
</enumeratedValue>
<enumeratedValue>
<name>Overflow</name>
<description>Timer generates an Interrupt when it overflows</description>
<value>2</value>
</enumeratedValue>
</enumeratedValues>
</field>
</fields>
</register>
<!-- COUNT: Counter Register -->
<register>
<name>COUNT</name>
<description>The Counter Register reflects the actual Value of the Timer/Counter</description>
<addressOffset>0x20</addressOffset>
<size>32</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
</register>
<!-- MATCH: Match Register -->
<register>
<name>MATCH</name>
<description>The Match Register stores the compare Value for the MATCH condition</description>
<addressOffset>0x24</addressOffset>
<size>32</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
</register>
<!-- PRESCALE: Prescale Read Register -->
<register>
<name>PRESCALE_RD</name>
<description>The Prescale Register stores the Value for the prescaler. The cont event gets divided by this value</description>
<addressOffset>0x28</addressOffset>
<size>32</size>
<access>read-only</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
</register>
<!-- PRESCALE: Prescale Write Register -->
<register>
<name>PRESCALE_WR</name>
<description>The Prescale Register stores the Value for the prescaler. The cont event gets divided by this value</description>
<addressOffset>0x28</addressOffset>
<size>32</size>
<access>write-only</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
</register>
<!-- RELOAD: Array of Reload Register with 4 elements-->
<register>
<dim>4</dim>
<dimIncrement>4</dimIncrement>
<name>RELOAD[%s]</name>
<description>The Reload Register stores the Value the COUNT Register gets reloaded on a when a condition was met.</description>
<addressOffset>0x50</addressOffset>
<size>32</size>
<access>read-write</access>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
</register>
</registers>
</peripheral>
<!-- Timer 1 -->
<peripheral derivedFrom="TIMER0">
<name>TIMER1</name>
<baseAddress>0x40010100</baseAddress>
<interrupt>
<name>TIMER1</name>
<description>Timer 1 interrupt</description>
<value>4</value>
</interrupt>
</peripheral>
<!-- Timer 2 -->
<peripheral derivedFrom="TIMER0">
<name>TIMER2</name>
<baseAddress>0x40010200</baseAddress>
<interrupt>
<name>TIMER2</name>
<description>Timer 2 interrupt</description>
<value>6</value>
</interrupt>
</peripheral>
</peripherals>
</device>

View File

@ -0,0 +1,668 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013-2022 ARM Limited. All rights reserved.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the License); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
$Date: 21. April 2022
$Revision: 1.3.9
Version 1.3.9:
- add CM85 as enumerated value for cpuNameType.
Version 1.3.8:
- add SMC1 as enumerated value for cpuNameType.
Version 1.3.7:
- add CM55 as enumerated value for cpuNameType.
Version 1.3.6:
- add ARMV81MML as enumeration value for cpuNameType.
Version 1.3.5:
- add CM35P as enumeration value for cpuNameType.
Version 1.3.4:
- add dspPresent element to cpuType as SIMD instructions became optional for new processors.
Version 1.3.3:
- update file header to Apache 2.0 License
- add dimableIdentifierType, as a copy of previous identifierType adding "%s",
- update identifierType to only allow names without %s included.
- remove enumerationNameType.
- add headerEnumName to enumerationType and to dimArrayIndexType for peripheral arrays
overwriting hierarchically generated names
- add dimName to dimElementGroup. Only valid in <cluster> context, ignored otherwise.
Version 1.3.2:
adding dimIndexArray to peripheral-, cluster- and register-array to describe
enumeration of array indices.
Version 1.3.1:
fixed peripheral name element type to identifierType to support %s for peripheral arrays
added optional protection element to addressBlockType and added p=privileged
Version 1.3:
added dim to peripherals to describe an array of peripherals.
added nesting of clusters to support hierarchical register structures.
added protection element as part of the registerPropertiesGroup indicating
special permissions are required for accessing a register.
CPU Section extended with description of the Secure Attribution Unit.
Version 1.2:
Cortex-M7 support items have been added as optional tags for the device header file generation:
fpuDP, icachePresent, dcachePresent, itcmPresent, dtcmPresent
Version 1.1:
For backward compatibility all additional tags have been made optional.
Extensions may be mandatory for successful device header file generation
Other changes are related to some restructuring of the schema.
Note that the memory section has been removed since this would limit the
reuse of descriptions for a series of devices.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" version="1.3">
<!-- stringType requires a none empty string of a least one character length -->
<xs:simpleType name="stringType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="descriptionStringType">
<xs:restriction base="xs:string">
<xs:pattern value="[\p{IsBasicLatin}\p{IsLatin-1Supplement}]*" />
</xs:restriction>
</xs:simpleType>
<!-- cpuType specifies a selection of Cortex-M and Secure-Cores. This list will get extended as new processors are released -->
<xs:simpleType name="cpuNameType">
<xs:restriction base="xs:token">
<xs:enumeration value="CM0"/>
<xs:enumeration value="CM0PLUS"/>
<xs:enumeration value="CM0+"/>
<xs:enumeration value="CM1"/>
<xs:enumeration value="CM3"/>
<xs:enumeration value="CM4"/>
<xs:enumeration value="CM7"/>
<xs:enumeration value="CM23"/>
<xs:enumeration value="CM33"/>
<xs:enumeration value="CM35P"/>
<xs:enumeration value="CM55"/>
<xs:enumeration value="CM85"/>
<xs:enumeration value="SC000"/>
<xs:enumeration value="SC300"/>
<xs:enumeration value="ARMV8MML"/>
<xs:enumeration value="ARMV8MBL"/>
<xs:enumeration value="ARMV81MML"/>
<xs:enumeration value="CA5"/>
<xs:enumeration value="CA7"/>
<xs:enumeration value="CA8"/>
<xs:enumeration value="CA9"/>
<xs:enumeration value="CA15"/>
<xs:enumeration value="CA17"/>
<xs:enumeration value="CA53"/>
<xs:enumeration value="CA57"/>
<xs:enumeration value="CA72"/>
<xs:enumeration value="SMC1"/>
<xs:enumeration value="other"/>
</xs:restriction>
</xs:simpleType>
<!-- revisionType specifies the CPU revision format as defined by ARM (rNpM) -->
<xs:simpleType name="revisionType">
<xs:restriction base="xs:string">
<xs:pattern value="r[0-9]*p[0-9]*"/>
</xs:restriction>
</xs:simpleType>
<!-- EndianType pre-defines the tokens for specifying the endianess of the device -->
<xs:simpleType name="endianType">
<xs:restriction base="xs:token">
<xs:enumeration value="little"/>
<xs:enumeration value="big"/>
<xs:enumeration value="selectable"/>
<xs:enumeration value="other"/>
</xs:restriction>
</xs:simpleType>
<!-- dataType pre-defines the tokens in line with CMSIS data type definitions -->
<xs:simpleType name="dataTypeType">
<xs:restriction base="xs:token">
<xs:enumeration value="uint8_t"/>
<xs:enumeration value="uint16_t"/>
<xs:enumeration value="uint32_t"/>
<xs:enumeration value="uint64_t"/>
<xs:enumeration value="int8_t"/>
<xs:enumeration value="int16_t"/>
<xs:enumeration value="int32_t"/>
<xs:enumeration value="int64_t"/>
<xs:enumeration value="uint8_t *"/>
<xs:enumeration value="uint16_t *"/>
<xs:enumeration value="uint32_t *"/>
<xs:enumeration value="uint64_t *"/>
<xs:enumeration value="int8_t *"/>
<xs:enumeration value="int16_t *"/>
<xs:enumeration value="int32_t *"/>
<xs:enumeration value="int64_t *"/>
</xs:restriction>
</xs:simpleType>
<!-- dimableIdentifierType specifies the subset and sequence of characters used for specifying identifiers that may contain %s from dim. -->
<!-- this is particularly important as these are used in ANSI C Structures during the device header file generation -->
<xs:simpleType name="dimableIdentifierType">
<xs:restriction base="xs:string">
<xs:pattern value="((%s)|(%s)[_A-Za-z]{1}[_A-Za-z0-9]*)|([_A-Za-z]{1}[_A-Za-z0-9]*(\[%s\])?)|([_A-Za-z]{1}[_A-Za-z0-9]*(%s)?[_A-Za-z0-9]*)"/>
</xs:restriction>
</xs:simpleType>
<!-- identifierType specifies the subset and sequence of characters used for specifying identifiers that must not contain %s from dim. -->
<!-- this is particularly important as these are used in ANSI C Structures during the device header file generation -->
<xs:simpleType name="identifierType">
<xs:restriction base="xs:string">
<xs:pattern value="[_A-Za-z0-9]*"/>
</xs:restriction>
</xs:simpleType>
<!-- V1.3: Protection Access Attribute Strings -->
<xs:simpleType name="protectionStringType">
<xs:restriction base="xs:string">
<!-- s = Secure -->
<!-- n = Non-secure -->
<!-- p = Privileged -->
<xs:pattern value="[snp]"/>
</xs:restriction>
</xs:simpleType>
<!-- V1.3: SAU Access Type -->
<xs:simpleType name="sauAccessType">
<xs:restriction base="xs:string">
<!-- c = non-secure Callable / Secure -->
<!-- n = Non-secure -->
<xs:pattern value="[cn]"/>
</xs:restriction>
</xs:simpleType>
<!-- dimIndexType specifies the subset and sequence of characters used for specifying the sequence of indices in register arrays -->
<xs:simpleType name="dimIndexType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]+\-[0-9]+|[A-Z]-[A-Z]|[_0-9a-zA-Z]+(,\s*[_0-9a-zA-Z]+)+"/>
</xs:restriction>
</xs:simpleType>
<!-- scaledNonNegativeInteger specifies the format in which numbers are represented in hexadecimal or decimal format -->
<xs:simpleType name="scaledNonNegativeInteger">
<xs:restriction base="xs:string">
<xs:pattern value="[+]?(0x|0X|#)?[0-9a-fA-F]+[kmgtKMGT]?"/>
</xs:restriction>
</xs:simpleType>
<!-- enumeratedValueDataType specifies the number formats for the values in enumeratedValues -->
<xs:simpleType name="enumeratedValueDataType">
<xs:restriction base="xs:string">
<xs:pattern value="[+]?(((0x|0X)[0-9a-fA-F]+)|([0-9]+)|((#|0b)[01xX]+))"/>
</xs:restriction>
</xs:simpleType>
<!-- accessType specfies the pre-defined tokens for the available accesses -->
<xs:simpleType name="accessType">
<xs:restriction base="xs:token">
<xs:enumeration value="read-only"/>
<xs:enumeration value="write-only"/>
<xs:enumeration value="read-write"/>
<xs:enumeration value="writeOnce"/>
<xs:enumeration value="read-writeOnce"/>
</xs:restriction>
</xs:simpleType>
<!-- modifiedWriteValuesType specifies the pre-defined tokens for the write side effects -->
<xs:simpleType name="modifiedWriteValuesType">
<xs:restriction base="xs:token">
<xs:enumeration value="oneToClear"/>
<xs:enumeration value="oneToSet"/>
<xs:enumeration value="oneToToggle"/>
<xs:enumeration value="zeroToClear"/>
<xs:enumeration value="zeroToSet"/>
<xs:enumeration value="zeroToToggle"/>
<xs:enumeration value="clear"/>
<xs:enumeration value="set"/>
<xs:enumeration value="modify"/>
</xs:restriction>
</xs:simpleType>
<!-- readAction type specifies the pre-defined tokens for read side effects -->
<xs:simpleType name="readActionType">
<xs:restriction base="xs:token">
<xs:enumeration value="clear"/>
<xs:enumeration value="set"/>
<xs:enumeration value="modify"/>
<xs:enumeration value="modifyExternal"/>
</xs:restriction>
</xs:simpleType>
<!-- enumUsageType specifies the pre-defined tokens for selecting what access types an enumeratedValues set is associated with -->
<xs:simpleType name="enumUsageType">
<xs:restriction base="xs:token">
<xs:enumeration value="read"/>
<xs:enumeration value="write"/>
<xs:enumeration value="read-write"/>
</xs:restriction>
</xs:simpleType>
<!-- bitRangeType specifies the bit numbers to be restricted values from 0 - 69 -->
<xs:simpleType name="bitRangeType">
<xs:restriction base="xs:token">
<xs:pattern value="\[([0-4])?[0-9]:([0-4])?[0-9]\]"/>
</xs:restriction>
</xs:simpleType>
<!-- writeContraintType specifies how to describe the restriction of the allowed values that can be written to a resource -->
<xs:complexType name="writeConstraintType">
<xs:choice>
<xs:element name="writeAsRead" type="xs:boolean"/>
<xs:element name="useEnumeratedValues" type="xs:boolean"/>
<xs:element name="range">
<xs:complexType>
<xs:sequence>
<xs:element name="minimum" type="scaledNonNegativeInteger"/>
<xs:element name="maximum" type="scaledNonNegativeInteger"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<!-- addressBlockType specifies the elements to describe an address block -->
<xs:complexType name="addressBlockType">
<xs:sequence>
<xs:element name="offset" type="scaledNonNegativeInteger"/>
<xs:element name="size" type="scaledNonNegativeInteger"/>
<xs:element name="usage">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="registers"/>
<xs:enumeration value="buffer"/>
<xs:enumeration value="reserved"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<!-- Version 1.3.2: optional access protection for an address block s=secure n=non-secure p=privileged -->
<xs:element name="protection" type="protectionStringType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!-- interruptType specifies how to describe an interrupt associated with a peripheral -->
<xs:complexType name="interruptType">
<xs:sequence>
<xs:element name="name" type="stringType"/>
<xs:element name="description" type="xs:string" minOccurs="0"/>
<xs:element name="value" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
<!-- register properties group specifies register size, access permission and reset value
this is used in multiple locations. Settings are inherited downstream. -->
<xs:group name="registerPropertiesGroup">
<xs:sequence>
<xs:element name="size" type="scaledNonNegativeInteger" minOccurs="0"/>
<xs:element name="access" type="accessType" minOccurs="0"/>
<!-- V 1.3: extended register access protection -->
<xs:element name="protection" type="protectionStringType" minOccurs="0"/>
<xs:element name="resetValue" type="scaledNonNegativeInteger" minOccurs="0"/>
<xs:element name="resetMask" type="scaledNonNegativeInteger" minOccurs="0"/>
</xs:sequence>
</xs:group>
<!-- bitRangeLsbMsbStyle specifies the bit position of a field within a register
by specifying the least significant and the most significant bit position -->
<xs:group name="bitRangeLsbMsbStyle">
<xs:sequence>
<xs:element name="lsb" type="scaledNonNegativeInteger"/>
<xs:element name="msb" type="scaledNonNegativeInteger"/>
</xs:sequence>
</xs:group>
<!-- bitRangeOffsetWidthStyle specifies the bit position of a field within a register
by specifying the least significant bit position and the bitWidth of the field -->
<xs:group name="bitRangeOffsetWidthStyle">
<xs:sequence>
<xs:element name="bitOffset" type="scaledNonNegativeInteger"/>
<xs:element name="bitWidth" type="scaledNonNegativeInteger" minOccurs="0"/>
</xs:sequence>
</xs:group>
<!-- dimElementGroup specifies the number of array elements (dim), the address offset
between to consecutive array elements and an a comma seperated list of strings
being used for identifying each element in the array -->
<xs:group name="dimElementGroup">
<xs:sequence>
<xs:element name="dim" type="scaledNonNegativeInteger"/>
<xs:element name="dimIncrement" type="scaledNonNegativeInteger"/>
<xs:element name="dimIndex" type="dimIndexType" minOccurs="0"/>
<xs:element name="dimName" type="identifierType" minOccurs="0"/>
<xs:element name="dimArrayIndex" type="dimArrayIndexType" minOccurs="0"/>
</xs:sequence>
</xs:group>
<xs:complexType name="cpuType">
<xs:sequence>
<!-- V1.1: ARM processor name: Cortex-Mx / SCxxx -->
<xs:element name="name" type="cpuNameType"/>
<!-- V1.1: ARM defined revision of the cpu -->
<xs:element name="revision" type="revisionType"/>
<!-- V1.1: Endian specifies the endianess of the processor/device -->
<xs:element name="endian" type="endianType"/>
<!-- V1.1: mpuPresent specifies whether or not a memory protection unit is physically present -->
<xs:element name="mpuPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.1: fpuPresent specifies whether or not a floating point hardware unit is physically present -->
<xs:element name="fpuPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.2: fpuDP specifies a double precision floating point hardware unit is physically present-->
<xs:element name="fpuDP" type="xs:boolean" minOccurs="0"/>
<!-- V1.3: dspPresent specifies whether the optional SIMD instructions are supported by processor -->
<xs:element name="dspPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.2: icachePresent specifies that an instruction cache is physically present-->
<xs:element name="icachePresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.2: dcachePresent specifies that a data cache is physically present-->
<xs:element name="dcachePresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.2: itcmPresent specifies that an instruction tightly coupled memory is physically present-->
<xs:element name="itcmPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.2: dtcmPresent specifies that an data tightly coupled memory is physically present-->
<xs:element name="dtcmPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.1: vtorPresent is used for Cortex-M0+ based devices only. It indicates whether the Vector -->
<!-- Table Offset Register is implemented in the device or not -->
<xs:element name="vtorPresent" type="xs:boolean" minOccurs="0"/>
<!-- V1.1: nvicPrioBits specifies the number of bits used by the Nested Vectored Interrupt Controller -->
<!-- for defining the priority level = # priority levels -->
<xs:element name="nvicPrioBits" type="scaledNonNegativeInteger"/>
<!-- V1.1: vendorSystickConfig is set true if a custom system timer is implemented in the device -->
<!-- instead of the ARM specified SysTickTimer -->
<xs:element name="vendorSystickConfig" type="xs:boolean"/>
<!-- V1.3: reports the total number of interrupts implemented by the device (optional) -->
<xs:element name="deviceNumInterrupts" type="scaledNonNegativeInteger" minOccurs="0"/>
<!-- V1.3: sauRegions specifies the available number of address regions -->
<!-- if not specified a value of zero is assumed -->
<xs:element name="sauNumRegions" type="scaledNonNegativeInteger" minOccurs="0"/>
<!-- V1.3: SAU Regions Configuration (if fully or partially predefined) -->
<xs:element name="sauRegionsConfig" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="region" minOccurs="0" maxOccurs="unbounded">
<!-- addressBlockType specifies the elements to describe an address block -->
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="base" type="scaledNonNegativeInteger"/>
<xs:element name="limit" type="scaledNonNegativeInteger"/>
<xs:element name="access" type="sauAccessType"/>
</xs:sequence>
<xs:attribute name="enabled" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="name" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="enabled" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="protectionWhenDisabled" type="protectionStringType" use="optional" default="s"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="enumeratedValueType">
<xs:sequence>
<!-- name is a ANSI C indentifier representing the value (C Enumeration) -->
<xs:element name="name" type="identifierType"/>
<!-- description contains the details about the semantics/behavior specified by this value -->
<xs:element name="description" type="stringType" minOccurs="0"/>
<xs:choice>
<xs:element name="value" type="enumeratedValueDataType"/>
<!-- isDefault specifies the name and description for all values that are not
specifically described individually -->
<xs:element name="isDefault" type="xs:boolean"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="enumerationType">
<xs:sequence>
<!-- name specfies a reference to this enumeratedValues section for reuse purposes
this name does not appear in the System Viewer nor the Header File. -->
<xs:element name="name" type="identifierType" minOccurs="0"/>
<!-- overrides the hierarchical enumeration type in the device header file. User is responsible for uniqueness across description -->
<xs:element name="headerEnumName" type="identifierType" minOccurs="0"/>
<!-- usage specifies whether this enumeration is to be used for read or write or
(read and write) accesses -->
<xs:element name="usage" type="enumUsageType" minOccurs="0"/>
<!-- enumeratedValue derivedFrom=<identifierType> -->
<xs:element name="enumeratedValue" type="enumeratedValueType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="derivedFrom" type="identifierType" use="optional"/>
</xs:complexType>
<xs:complexType name="dimArrayIndexType">
<xs:sequence>
<xs:element name="headerEnumName" type="identifierType" minOccurs="0"/>
<xs:element name="enumeratedValue" type="enumeratedValueType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="fieldType">
<xs:sequence>
<xs:group ref="dimElementGroup" minOccurs="0"/>
<!-- name specifies a field's name. The System Viewer and the device header file will
use the name of the field as identifier -->
<xs:element name="name" type="dimableIdentifierType"/>
<!-- description contains reference manual level information about the function and
options of a field -->
<xs:element name="description" type="stringType" minOccurs="0"/>
<!-- alternative specifications of the bit position of the field within the register -->
<xs:choice minOccurs="1" maxOccurs="1">
<!-- bit field described by lsb followed by msb tag -->
<xs:group ref="bitRangeLsbMsbStyle"/>
<!-- bit field described by bit offset relative to Bit0 + bit width of field -->
<xs:group ref="bitRangeOffsetWidthStyle"/>
<!-- bit field described by [<msb>:<lsb>] -->
<xs:element name="bitRange" type="bitRangeType"/>
</xs:choice>
<!-- access describes the predefined permissions for the field. -->
<xs:element name="access" type="accessType" minOccurs="0"/>
<!-- predefined description of write side effects -->
<xs:element name="modifiedWriteValues" type="modifiedWriteValuesType" minOccurs="0"/>
<!-- writeContstraint specifies the subrange of allowed values -->
<xs:element name="writeConstraint" type="writeConstraintType" minOccurs="0"/>
<!-- readAction specifies the read side effects. -->
<xs:element name="readAction" type="readActionType" minOccurs="0"/>
<!-- enumeratedValues derivedFrom=<identifierType> -->
<xs:element name="enumeratedValues" type="enumerationType" minOccurs="0" maxOccurs="2">
</xs:element>
</xs:sequence>
<xs:attribute name="derivedFrom" type="dimableIdentifierType" use="optional"/>
</xs:complexType>
<xs:complexType name="fieldsType">
<xs:sequence>
<!-- field derivedFrom=<identifierType> -->
<xs:element name="field" type="fieldType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="registerType">
<xs:sequence>
<xs:group ref="dimElementGroup" minOccurs="0"/>
<!-- name specifies the name of the register. The register name is used by System Viewer and
device header file generator to represent a register -->
<xs:element name="name" type="dimableIdentifierType"/>
<!-- display name specifies a register name without the restritions of an ANSIS C identifier.
The use of this tag is discouraged because it does not allow consistency between
the System View and the device header file. -->
<xs:element name="displayName" type="stringType" minOccurs="0"/>
<!-- description contains a reference manual level description about the register and it's purpose -->
<xs:element name="description" type="stringType" minOccurs="0"/>
<xs:choice>
<!-- alternateGroup specifies the identifier of the subgroup a register belongs to.
This is useful if a register has a different description per mode but a single name -->
<xs:element name="alternateGroup" type="identifierType" minOccurs="0"/>
<!-- V1.1: alternateRegister specifies an alternate register description for an address that is
already fully described. In this case the register name must be unique within the peripheral -->
<xs:element name="alternateRegister" type="dimableIdentifierType" minOccurs="0"/>
</xs:choice>
<!-- addressOffset describes the address of the register relative to the baseOffset of the peripheral -->
<xs:element name="addressOffset" type="scaledNonNegativeInteger"/>
<!-- registerPropertiesGroup elements specify the default values for register size, access permission and
reset value. These default values are inherited to all fields contained in this register -->
<xs:group ref="registerPropertiesGroup" minOccurs="0"/>
<!-- V1.1: dataType specifies a CMSIS compliant native dataType for a register (i.e. signed, unsigned, pointer) -->
<xs:element name="dataType" type="dataTypeType" minOccurs="0"/>
<!-- modifiedWriteValues specifies the write side effects -->
<xs:element name="modifiedWriteValues" type="modifiedWriteValuesType" minOccurs="0"/>
<!-- writeConstraint specifies the subset of allowed write values -->
<xs:element name="writeConstraint" type="writeConstraintType" minOccurs="0"/>
<!-- readAcction specifies the read side effects -->
<xs:element name="readAction" type="readActionType" minOccurs="0"/>
<!-- fields section contains all fields that belong to this register -->
<xs:element name="fields" type="fieldsType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="derivedFrom" type="dimableIdentifierType" use="optional"/>
</xs:complexType>
<!-- V1.1: A cluster is a set of registers that are composed into a C data structure in the device header file -->
<xs:complexType name="clusterType">
<xs:sequence>
<xs:group ref="dimElementGroup" minOccurs="0"/>
<xs:element name="name" type="dimableIdentifierType"/>
<xs:element name="description" type="xs:string"/>
<!-- V1.1: alternateCluster specifies an alternative description for a cluster address range that is
already fully described. In this case the cluster name must be unique within the peripheral -->
<xs:element name="alternateCluster" type="dimableIdentifierType" minOccurs="0"/>
<!-- V1.1: headerStructName specifies the name for the cluster structure typedef
used in the device header generation instead of the cluster name -->
<xs:element name="headerStructName" type="identifierType" minOccurs="0"/>
<xs:element name="addressOffset" type="scaledNonNegativeInteger"/>
<!-- registerPropertiesGroup elements specify the default values for register size, access permission and
reset value. These default values are inherited to all registers contained in this peripheral -->
<xs:group ref="registerPropertiesGroup" minOccurs="0"/>
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="register" type="registerType" minOccurs="0" maxOccurs="unbounded"/>
<!-- 1.3: nesting of cluster is supported -->
<xs:element name="cluster" type="clusterType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:sequence>
<xs:attribute name="derivedFrom" type="dimableIdentifierType" use="optional"/>
</xs:complexType>
<!-- the registers section can have an arbitrary list of cluster and register sections -->
<xs:complexType name="registersType">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="cluster" type="clusterType"/>
<xs:element name="register" type="registerType"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="peripheralType">
<xs:sequence>
<!-- 1.3: specify uni-dimensional array of peripheral - requires name="<name>[%s]" -->
<xs:group ref="dimElementGroup" minOccurs="0"/>
<!-- name specifies the name of a peripheral. This name is used for the System View and device header file -->
<xs:element name="name" type="dimableIdentifierType"/>
<!-- version specifies the version of the peripheral descriptions -->
<xs:element name="version" type="stringType" minOccurs="0"/>
<!-- description provides a high level functional description of the peripheral -->
<xs:element name="description" type="stringType" minOccurs="0"/>
<!-- V1.1: alternatePeripheral specifies an alternative description for an address range that is
already fully by a peripheral described. In this case the peripheral name must be unique within the device description -->
<xs:element name="alternatePeripheral" type="dimableIdentifierType" minOccurs="0"/>
<!-- groupName assigns this peripheral to a group of peripherals. This is only used bye the System View -->
<xs:element name="groupName" type="xs:Name" minOccurs="0"/>
<!-- prependToName specifies a prefix that is placed in front of each register name of this peripheral.
The device header file will show the registers in a C-Struct of the peripheral without the prefix. -->
<xs:element name="prependToName" type="identifierType" minOccurs="0"/>
<!-- appendToName is a postfix that is appended to each register name of this peripheral. The device header
file will sho the registers in a C-Struct of the peripheral without the postfix -->
<xs:element name="appendToName" type="identifierType" minOccurs="0"/>
<!-- V1.1: headerStructName specifies the name for the peripheral structure typedef
used in the device header generation instead of the peripheral name -->
<xs:element name="headerStructName" type="dimableIdentifierType" minOccurs="0"/>
<!-- disableCondition contains a logical expression based on constants and register or bit-field values
if the condition is evaluated to true, the peripheral display will be disabled -->
<xs:element name="disableCondition" type="stringType" minOccurs="0"/>
<!-- baseAddress specifies the absolute base address of a peripheral. For derived peripherals it is mandatory
to specify a baseAddress. -->
<xs:element name="baseAddress" type="scaledNonNegativeInteger"/>
<!-- registerPropertiesGroup elements specify the default values for register size, access permission and
reset value. These default values are inherited to all registers contained in this peripheral -->
<xs:group ref="registerPropertiesGroup" minOccurs="0"/>
<!-- addressBlock specifies one or more address ranges that are assigned exclusively to this peripheral.
derived peripherals may have no addressBlock, however none-derived peripherals are required to specify
at least one address block -->
<xs:element name="addressBlock" type="addressBlockType" minOccurs="0" maxOccurs="unbounded"/>
<!-- interrupt specifies can specify one or more interrtupts by name, description and value -->
<xs:element name="interrupt" type="interruptType" minOccurs="0" maxOccurs="unbounded"/>
<!-- registers section contains all registers owned by the peripheral. In case a peripheral gets derived it does
not have its own registers section, hence this section is optional. A unique peripheral without a
registers section is not allowed -->
<xs:element name="registers" type="registersType" minOccurs="0" maxOccurs="1">
</xs:element>
</xs:sequence>
<xs:attribute name="derivedFrom" type="dimableIdentifierType" use="optional"/>
</xs:complexType>
<!-- ==================================================== -->
<!-- The top level element of a description is the device -->
<!-- ==================================================== -->
<xs:element name="device" nillable="true">
<xs:complexType>
<xs:sequence>
<!-- V1.1: Vendor Name -->
<xs:element name="vendor" type="stringType" minOccurs="0"/>
<!-- V1.1: Vendor ID - a short name for referring to the vendor (e.g. Texas Instruments = TI) -->
<xs:element name="vendorID" type="identifierType" minOccurs="0"/>
<!-- name specifies the device name being described -->
<xs:element name="name" type="identifierType"/>
<!-- V1.1: series specifies the device series or family name -->
<xs:element name="series" type="stringType" minOccurs="0"/>
<!-- version specifies the version of the device description -->
<xs:element name="version" type="stringType"/>
<!-- description is a string describing the device features (e.g. memory size, peripherals, etc.) -->
<xs:element name="description" type="stringType"/>
<!-- V1.1: licenseText specifies the file header section to be included in any derived file -->
<xs:element name="licenseText" type="stringType" minOccurs="0"/>
<!-- V1.1: cpu specifies the details of the processor included in the device -->
<xs:element name="cpu" type="cpuType" minOccurs="0"/>
<!-- V1.1: the tag specifies the filename without extension of the CMSIS System Device include file.
This tag is used by the header file generator for customizing the include statement referencing the
CMSIS system file within the CMSIS device header file. By default the filename is "system_<device.name>"
In cases a device series shares a single system header file, the name of the series shall be used
instead of the individual device name. -->
<xs:element name="headerSystemFilename" type="identifierType" minOccurs="0"/>
<!-- V1.1: headerDefinitionPrefix specifies the string being prepended to all names of types defined in
generated device header file -->
<xs:element name="headerDefinitionsPrefix" type="identifierType" minOccurs="0"/>
<!-- addressUnitBits specifies the size of the minimal addressable unit in bits -->
<xs:element name="addressUnitBits" type="scaledNonNegativeInteger"/>
<!-- width specifies the number of bits for the maximum single transfer size allowed by the bus interface.
This sets the maximum size of a single register that can be defined for an address space -->
<xs:element name="width" type="scaledNonNegativeInteger"/>
<!-- registerPropertiesGroup elements specify the default values for register size, access permission and
reset value -->
<xs:group ref="registerPropertiesGroup" minOccurs="0"/>
<!-- peripherals is containing all peripherals -->
<xs:element name="peripherals">
<xs:complexType>
<xs:sequence>
<xs:element name="peripheral" type="peripheralType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Vendor Extensions: this section captures custom extensions. This section will be ignored by default -->
<xs:element name="vendorExtensions" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded">
</xs:any>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="schemaVersion" type="xs:decimal" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
<!-- END OF FILE -->

View File

@ -0,0 +1,116 @@
#!/bin/bash
function usage {
echo "$(basename $0) <file>"
echo ""
echo "Arguments:"
echo " -h|--help Show this usage text."
echo " -v|--verbose Print verbose output."
echo " -d|--debug Print debug output."
echo " -b|--base <sha> Git commit SHA of merge base."
echo " <file> The file to check the header."
echo ""
}
function echo-verbose {
if [[ $VERBOSE != 0 ]]; then
echo $1
fi
}
function echo-debug {
if [[ $DEBUG != 0 ]]; then
echo $1
fi
}
set -o pipefail
VERBOSE=0
DEBUG=0
BASE_REV=""
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
'-h'|'--help')
usage
exit 1
;;
'-v'|'--verbose')
VERBOSE=1
;;
'-d'|'--debug')
DEBUG=1
;;
'-b'|'--base')
shift
if git rev-parse $1 2>/dev/null >/dev/null; then
BASE_REV=$(git rev-parse $1)
else
echo "Unknown revision: $1" >&2
fi
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
;;
esac
shift # past argument
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ -z "$1" ]] || [[ ! -f $1 ]]; then
echo -e "No file given!\n"
usage
exit 1
fi
FILE=$1
RESULT=0
echo "Checking $1"
echo-debug "grep -E '@date\s+([0-9]{2}\. \w+ [0-9]{4})' ${FILE} | sed -E 's/^.*@date\s+([0-9]{2}\. \w+ [0-9]{4}).*/\1/'"
FILE_DATE=$(grep -E '@date\s+([0-9]{2}\. \w+ [0-9]{4})' ${FILE} | sed -E 's/^.*@date\s+([0-9]{2}\. \w+ [0-9]{4}).*/\1/')
echo-verbose "File date: $FILE_DATE"
if [[ ! -z $FILE_DATE ]]; then
echo-debug "git log -1 --pretty="format:%ad" --date="format:%d. %B %Y" ${FILE}"
HEAD_DATE=$(git log -1 --pretty="format:%ad" --date="format:%d. %B %Y" ${FILE})
echo-verbose "Head date: $HEAD_DATE"
if [[ $HEAD_DATE != $FILE_DATE ]]; then
echo-debug "grep -En "@date.*${FILE_DATE}" ${FILE} | cut -f1 -d:"
FILE_DATE_LINE=$(grep -En "@date.*${FILE_DATE}" ${FILE} | cut -f1 -d:)
echo "${FILE}:${FILE_DATE_LINE}:Please update file date to '$HEAD_DATE'." >&2
RESULT=1
fi
fi
echo-debug "grep -E '@version\s+V?([0-9]+\.[0-9]+(\.[0-9]+)?)' ${FILE} | sed -E 's/^.*@version\s+V?([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/'"
FILE_VERSION=$(grep -E '@version\s+V?([0-9]+\.[0-9]+(\.[0-9]+)?)' ${FILE} | sed -E 's/^.*@version\s+V?([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/')
echo-verbose "File version: $FILE_VERSION"
if [[ ! -z $FILE_VERSION ]]; then
echo-debug "grep -En \"@version.*${FILE_VERSION}\" ${FILE} | cut -f1 -d:"
FILE_VERSION_LINE=$(grep -En "@version.*${FILE_VERSION}" ${FILE} | cut -f1 -d:)
echo-verbose "File version line: $FILE_VERSION_LINE"
echo-debug "git log -1 --pretty=\"format:%H\" -- ${FILE}"
HEAD_REV=$(git log -1 --pretty="format:%H" -- ${FILE})
echo-verbose "Head revision : $HEAD_REV"
if [[ -z "$BASE_REV" ]] || [[ $HEAD_REV =~ ^$BASE_REV ]]; then
echo-debug "git log -1 --pretty=\"format:%P\" -- ${FILE}"
BASE_REV=$(git log -1 --pretty="format:%P" -- ${FILE})
fi
echo-verbose "Base revision : $BASE_REV"
echo-debug "git blame ${BASE_REV}..${HEAD_REV} -l -L ${FILE_VERSION_LINE},${FILE_VERSION_LINE} ${FILE}"
BLAME=$(git blame ${BASE_REV}..${HEAD_REV} -l -L ${FILE_VERSION_LINE},${FILE_VERSION_LINE} ${FILE})
echo-debug "git rev-parse $(sed -E 's/^[\^]?([[:alnum:]]+).*/\1/' <<<$BLAME)"
BLAME_REV=$(git rev-parse $(sed -E 's/^[\^]?([[:alnum:]]+).*/\1/' <<<$BLAME))
echo-verbose "Blame revision: $BLAME_REV"
if [[ $BASE_REV == $BLAME_REV ]]; then
echo "${FILE}:${FILE_VERSION_LINE}:Please increment file version." >&2
RESULT=1
fi
fi
exit $RESULT

View File

@ -0,0 +1,25 @@
#!/bin/bash
linkchecker -F csv --check-extern $1
OFS=$IFS
IFS=$'\n'
for line in $(grep -E '^[^#]' linkchecker-out.csv | tail -n +2); do
link=$(echo $line | cut -d';' -f 1)
file=$(echo $line | cut -d';' -f 2)
msg=$(echo $line | cut -d';' -f 4)
src=$(echo $file | sed -E 's/file:\/\/(.*)\/Documentation\/(\w+)\/.*/\1\/DoxyGen\/\2/')
if [ -d $src ]; then
origin=$(grep -Ern "href=['\"]${link}['\"]" $src/src/)
for o in $origin; do
ofile=$(echo $o | cut -d':' -f 1)
oline=$(echo $o | cut -d':' -f 2)
echo "${ofile}:${oline};${link};${msg}" >&2
done
fi
done
IFS=$OFS
exit 0

View File

@ -0,0 +1,63 @@
#!/bin/bash
PACKCHK_VERSION=1.3.95
SVDCONV_VERSION=3.3.42
REPO_URL=https://github.com/Open-CMSIS-Pack/devtools
DOWNLOAD_URL=${REPO_URL}/releases/download/
DIRNAME=$(dirname $0)
set -o pipefail
function usage {
echo "$(basename $0) [-h|--help] [-f|--force]"
echo ""
echo "Arguments:"
echo " -h|--help Print this usage message and exit."
echo " -f|--force Force (re)download."
echo ""
echo "Environment:"
echo " curl"
echo " sha256sum"
echo ""
}
function fetch {
mkdir -p ${DIRNAME}/$2
pushd ${DIRNAME}/$2 >/dev/null
curl -O -L $1
unzip -o $(basename $1)
rm $(basename $1)
popd >/dev/null
}
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
'-h'|'--help')
usage
exit 1
;;
'-f'|'--force')
FORCE=1
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
;;
esac
shift # past argument
done
set -- "${POSITIONAL[@]}" # restore positional parameters
fetch "${DOWNLOAD_URL}/tools%2Fpackchk%2F${PACKCHK_VERSION}/packchk-${PACKCHK_VERSION}-darwin64.zip" Darwin64
fetch "${DOWNLOAD_URL}/tools%2Fpackchk%2F${PACKCHK_VERSION}/packchk-${PACKCHK_VERSION}-linux64.zip" Linux64
fetch "${DOWNLOAD_URL}/tools%2Fpackchk%2F${PACKCHK_VERSION}/packchk-${PACKCHK_VERSION}-windows64.zip" Win32
fetch "${DOWNLOAD_URL}/tools%2Fsvdconv%2F${SVDCONV_VERSION}/svdconv-${SVDCONV_VERSION}-darwin64.zip" Darwin64
fetch "${DOWNLOAD_URL}/tools%2Fsvdconv%2F${SVDCONV_VERSION}/svdconv-${SVDCONV_VERSION}-linux64.zip" Linux64
fetch "${DOWNLOAD_URL}/tools%2Fsvdconv%2F${SVDCONV_VERSION}/svdconv-${SVDCONV_VERSION}-windows64.zip" Win32
exit 0

View File

@ -0,0 +1,359 @@
#!/bin/bash
# Version: 1.5
# Date: 2022-04-06
# This bash script generates a CMSIS Software Pack:
#
# Pre-requisites:
# - bash shell (for Windows: install git for Windows)
# - git in path (for Windows: install git for Windows)
# - 7z in path (zip archiving utility)
# e.g. Ubuntu: sudo apt-get install p7zip-full p7zip-rar)
# - xmllint in path (XML schema validation; available only for Linux)
#
# Preparation steps:
# - Generate documentation, see CMSIS/DoxyGen/gen_doc.sh
# - Populate utilities, see
# - CMSIS/Utilities/fetch_devtools.sh
# - Populate pre-built libraries, see
# - CMSIS/RTOS/RTX/LIB/fetch_libs.sh
# - CMSIS/RTOS2/RTX/Library/fetch_libs.sh
#
############### EDIT BELOW ###############
# Extend Path environment variable locally
#
set -o pipefail
function usage {
echo "$(basename $0) [-h|--help] [<pdsc>]"
echo ""
echo "Arguments:"
echo " -h|--help Print this usage message and exit."
echo " --ignore_errors Ignore errors detected during pack generation."
echo " --version <VER> Force pack version to <VER>."
echo " pdsc The pack description to generate the pack for."
echo ""
echo "Environment:"
echo " 7z"
if [ $(uname -s) = "Linux" ]; then
echo " xmllint"
fi
echo ""
}
function pack_version()
{
local version=$(grep -Pzo "(?s)<releases>\s+<release version=\"([^\"]+)\"" "$1" | tr -d '\0' | tail -n 1 | sed -r -e 's/.*version="([^"]+)"/\1/g')
echo "PDSC version: '$version'" >&2
echo $version
}
function git_describe()
{
if git rev-parse --git-dir 2>&1 >/dev/null; then
local gitversion=$(git describe --tags --match $1* --abbrev=9 2>/dev/null || echo "$1-dirty-0-g$(git describe --tags --match $1* --always --abbrev=9 2>/dev/null)")
local version=$(echo $gitversion | sed -r -e 's/-([0-9]+)-(g[0-9a-f]{9})/\1+\2/')
if [[ $version != $1 ]] && [[ $version == $gitversion ]]; then
version+=0
fi
echo "Git version: '$version'" >&2
echo $version
else
echo "No Git repository: '$1-nogit'" >&2
echo "$1-nogit"
fi
}
function patch_pdsc()
{
if [[ "$2" != "$3" ]]; then
echo "Updating latest release tag with version '$3'"
sed -r -i -e "s/<release version=\"$2\"/<release version=\"$3\"/" $1
fi
}
IGNORE_ERRORS=0
VERSION=
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
'-h'|'--help')
usage
exit 1
;;
'--ignore-errors')
IGNORE_ERRORS=1
shift # past argument
;;
'--version')
shift # past argument
VERSION=$1
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
OS=$(uname -s)
case $OS in
'Linux')
CMSIS_TOOLSDIR="./CMSIS/Utilities/Linux64"
;;
'WindowsNT'|MINGW*|CYGWIN*)
CMSIS_TOOLSDIR="./CMSIS/Utilities/Win32"
;;
'Darwin')
CMSIS_TOOLSDIR="./CMSIS/Utilities/Darwin64"
;;
*)
echo "Error: unrecognized OS $OS"
exit 1
;;
esac
PATH_TO_ADD="$CMSIS_TOOLSDIR"
[[ ":$PATH:" != *":${PATH_TO_ADD}:"* ]] && PATH="${PATH}:${PATH_TO_ADD}"
echo $PATH_TO_ADD appended to PATH
echo " "
# Pack warehouse directory - destination
PACK_WAREHOUSE=./output
# Temporary pack build directory
PACK_BUILD=./build
# Specify directory names to be added to pack base directory
PACK_DIRS="
Device
CMSIS/Core/Include
CMSIS/Core/Template
CMSIS/Core_A
CMSIS/DAP
CMSIS/Driver
CMSIS/RTOS
CMSIS/RTOS2
CMSIS/Utilities/Win32
CMSIS/Utilities/Linux64
CMSIS/Utilities/Darwin64
CMSIS/Documentation
"
# Specify file names to be added to pack base directory
PACK_BASE_FILES="
LICENSE.txt
CMSIS/Utilities/ARM_Example.*
CMSIS/Utilities/*.xsd
"
# Specify file names to be deleted from pack build directory
PACK_DELETE_FILES="
CMSIS/RTOS/CMSIS_RTOS_Tutorial.pdf
CMSIS/RTOS/RTX/LIB/fetch_libs.sh
CMSIS/RTOS/RTX/LIB/*.zip
CMSIS/RTOS2/RTX/Library/fetch_libs.sh
CMSIS/RTOS2/RTX/Library/*.zip
CMSIS/RTOS2/RTX/Library/build.py
"
# Specify patches to be applied
PACK_PATCH_FILES=""
############ DO NOT EDIT BELOW ###########
echo Starting CMSIS-Pack Generation: `date`
# Zip utility check
ZIP=7z
type -a "${ZIP}"
errorlevel=$?
if [ $errorlevel -gt 0 ]
then
echo "Error: No 7zip Utility found"
echo "Action: Add 7zip to your path"
echo " "
exit 1
fi
# Pack checking utility check
PACKCHK=packchk
type -a ${PACKCHK}
errorlevel=$?
if [ $errorlevel != 0 ]; then
echo "Error: No packchk Utility found"
echo "Action: Add packchk to your path"
echo "Hint: Included in CMSIS Pack:"
echo "$CMSIS_PACK_ROOT/ARM/CMSIS/<version>/CMSIS/Utilities/<os>/"
echo " "
if [[ $IGNORE_ERRORS == 0 ]]; then
exit 1
fi
fi
echo " "
# Locate Package Description file
# check whether there is more than one pdsc file
NUM_PDSCS=$(ls -1 *.pdsc | wc -l)
PACK_DESCRIPTION_FILE=$(ls *.pdsc)
if [[ -n $1 && -f $1 ]]; then
PACK_DESCRIPTION_FILE=$1
elif [ ${NUM_PDSCS} -lt 1 ]; then
echo "Error: No *.pdsc file found in current directory"
echo " "
exit 1
elif [ ${NUM_PDSCS} -gt 1 ]; then
echo "Error: Only one PDSC file allowed in directory structure:"
echo "Found:"
echo "$PACK_DESCRIPTION_FILE"
echo "Action: Provide PDSC file explicitly!"
echo " "
usage
exit 1
fi
SAVEIFS=$IFS
IFS=.
set ${PACK_DESCRIPTION_FILE}
# Pack Vendor
PACK_VENDOR=$1
# Pack Name
PACK_NAME=$2
echo "Generating Pack: for $PACK_VENDOR.$PACK_NAME"
echo " "
IFS=$SAVEIFS
#if $PACK_BUILD directory does not exist, create it.
if [ ! -d "$PACK_BUILD" ]; then
mkdir -p "$PACK_BUILD"
fi
# Copy files into build base directory: $PACK_BUILD
# pdsc file is mandatory in base directory:
cp -f "./${PACK_VENDOR}.${PACK_NAME}.pdsc" "${PACK_BUILD}"
# Add directories
echo Adding directories to pack:
echo "${PACK_DIRS}"
echo " "
for d in ${PACK_DIRS}; do
cp -r --parents "$d" "${PACK_BUILD}"
done
# Add files
echo Adding files to pack:
echo "${PACK_BASE_FILES}"
echo " "
if [ ! -x ${PACK_BASE_FILES+x} ]; then
for f in ${PACK_BASE_FILES}; do
cp -f --parents "$f" $PACK_BUILD/
done
fi
# Delete files
echo Deleting files from pack:
echo "${PACK_DELETE_FILES}"
echo " "
if [ ! -x ${PACK_DELETE_FILES+x} ]; then
for f in ${PACK_DELETE_FILES}; do
find $PACK_BUILD/$(dirname "$f") -name $(basename "$f") -delete
done
fi
# Apply patches
echo Applying patches to pack:
echo "${PACK_PATCH_FILES}"
echo " "
if [ ! -x ${PACK_PATCH_FILES+x} ]; then
CWD=$(pwd)
pushd $PACK_BUILD > /dev/null
for f in ${PACK_PATCH_FILES}; do
patch -p0 -t -i "${CWD}/${f}"
done
popd > /dev/null
fi
# Create checksum file
echo Creating checksum file:
pushd $PACK_BUILD > /dev/null
find . -type f -exec sha1sum {} + > ../${PACK_VENDOR}.${PACK_NAME}.sha1
mv ../${PACK_VENDOR}.${PACK_NAME}.sha1 .
popd > /dev/null
# Run Schema Check (for Linux only):
# sudo apt-get install libxml2-utils
if [ $(uname -s) = "Linux" ]; then
echo "Running schema check for ${PACK_VENDOR}.${PACK_NAME}.pdsc"
curl https://raw.githubusercontent.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/main/schema/PACK.xsd -o CMSIS/Utilities/PACK.xsd
xmllint --noout --schema "$(realpath -m ./CMSIS/Utilities/PACK.xsd)" "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc"
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: Schema check of $PACK_VENDOR.$PACK_NAME.pdsc against PACK.xsd failed"
echo " "
if [[ $IGNORE_ERRORS == 0 ]]; then
exit 1
fi
fi
else
echo "Use MDK PackInstaller to run schema validation for $PACK_VENDOR.$PACK_NAME.pdsc"
fi
# Patch pack version
echo "Checking PDCS version against Git..."
pdsc_version=$(pack_version "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc")
if [ -z $VERSION ]; then
VERSION=$(git_describe ${pdsc_version})
fi
patch_pdsc "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc" ${pdsc_version} ${VERSION}
# Run Pack Check and generate PackName file with version
"${PACKCHK}" "${PACK_BUILD}/${PACK_VENDOR}.${PACK_NAME}.pdsc" \
-n ${PACK_BUILD}/PackName.txt \
-x M353 -x M364 -x M335 -x M336
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: pack check failed"
echo "Check preparation steps if missing files are reported!"
echo " "
if [[ $IGNORE_ERRORS == 0 ]]; then
exit 1
fi
fi
PACKNAME=$(cat ${PACK_BUILD}/PackName.txt)
rm -rf ${PACK_BUILD}/PackName.txt
# Archiving
# $ZIP a $PACKNAME
echo "creating pack file $PACKNAME"
#if $PACK_WAREHOUSE directory does not exist create it
if [ ! -d "$PACK_WAREHOUSE" ]; then
mkdir -p "$PACK_WAREHOUSE"
fi
pushd "$PACK_WAREHOUSE" > /dev/null
PACK_WAREHOUSE=$(pwd)
popd > /dev/null
pushd "$PACK_BUILD" > /dev/null
PACK_BUILD=$(pwd)
"$ZIP" a "$PACK_WAREHOUSE/$PACKNAME" -tzip
popd > /dev/null
errorlevel=$?
if [ $errorlevel -ne 0 ]; then
echo "build aborted: archiving failed"
exit 1
fi
echo "build of pack succeeded"
# Clean up
echo "cleaning up ..."
rm -rf "$PACK_BUILD"
echo " "
echo Completed CMSIS-Pack Generation: $(date)