armtrace32lauterbach

How to extract required bit fields from 32 bit variable in Trace32


I want to extract bit fields 4 to 7 from READ_DATA variable. Below cmm script I tried, but not working. can some one help with working cmm script to extract bit fields in variable and to check a particular bit in variable is set or not.

&READ_DATA=Data.Long(A:0x12345678)
&MY_DATA=&READ_DATA & 0xF0 ; Bitwise AND not working

Solution

  • Expressions in TRACE32 scripts and commands may not contain spaces, because spaces are the argument separators for commands.

    Thus, this should work:

    &READ_DATA=Data.Long(A:0x12345678)
    &MY_DATA=&READ_DATA&0xF0 ; Bitwise AND should work that way
    

    Or in a single line:

    &MY_DATA=Data.Long(A:0x12345678)&0xF0