CMSIS-Pack  Version 1.2
Delivery Mechanism for Software Packs
 All Pages
ExpressionType

Expressions are used in various places to describe one of the following:

  • A value as assigned by the <assign> element.
  • A condition to use in the <waitfor> element.
  • The address of a <datawrite> element.
  • The value of a <datawrite> element.

An expression may consist of the following:

  • Constant numbers in decimal and hexadecimal representation (prefix 0x).
  • Arithmetic operators such as +, -, *, /, and %.
  • Bit-arithmetic operators such as &, |, ~, ^, >>, and <<.
  • Comparison-operators such as ==, !=, <, >, <=, and >=.
  • Logic operators such as !, &&, ||, and ==.
  • Conditional expression operations like:
    (x < y) ? a : b
  • Precedence of sub-expressions is indicated by brackets ((, )). C-like precedence applies if brackets are omitted.
  • References to <assign> element values by the name attribute.
  • Built-in read functions as shown in the following table:
Function Description
read8(addr, ap, dp)
Read an 8-bit value from target memory at address addr. Use access port ap and the debug port with the identifier dp. ap and dp are optional. If unspecified, dp and ap default to the values as defined for the surrounding section.
read16(addr, ap, dp)
Read a 16-bit value from target memory at address addr. Use access port ap and the debug port with the identifier dp. ap and dp are optional. If unspecified, dp and ap default to the values as defined for the surrounding section.
read32(addr, ap, dp)
Read a 32-bit value from target memory at address addr. Use access port ap and the debug port with the identifier dp. ap and dp are optional. If unspecified, dp and ap default to the values as defined for the surrounding section.
read64(addr, ap, dp)
Read a 64-bit value from target memory at address addr. Use access port ap and the debug port with the identifier dp. ap and dp are optional. If unspecified, dp and ap default to the values as defined for the surrounding section.
readAp(addr, ap, dp)
Read a 32-bit value from an access port register at address addr. The access port to read from is ap. The debug port to use has the identifier dp. ap and dp are optional. If unspecified, dp and ap default to the values as defined for the surrounding section.
readDp(addr, dp)
Read a 32-bit value from a debug port register at address addr. dp specifies the debug port to read from and is optional. If unspecified, dp defaults to the value as defined for the surrounding section.
Note
  • All values used in expressions resolve to 64-bit unsigned integer values.
  • All logic-operations and comparisons resolve to the value 1 if true, to 0 otherwise.
  • Results of all read-functions are casted to 64-bit unsigned integer values.
  • XML prohibits the use of the characters &, <, and >. Use the corresponding XML entity names instead: &amp;, &lt;, and &gt;.