target/xtensa: avoid IHI for writes to non-executable memory
[openocd.git] / doc / manual / primer / tcl.txt
index c10c36473a9c6e83c3a3958d7b749a8dcbe87694..eba2f552d002e57a6f4a9133c6d1660a4913eedc 100644 (file)
@@ -115,7 +115,7 @@ Exception: The arrays.
 
        set x "2 * 6"
        set foo([expr $x])  "twelve"
-       
+
 **************************************************
 ***************************************************
 === TCL TOUR ===
@@ -125,7 +125,7 @@ There is some tricky things going on.
 ===============
 
 First, there is a "for" loop - at level 0
-{level 0 means: out side of a proc/function}
+{level 0 means: outside of a procedure/function}
 
 This means it is evaluated when the file is parsed.
 
@@ -133,7 +133,7 @@ This means it is evaluated when the file is parsed.
 In TCL, "FOR" is a funny thing, it is not what you think it is.
 
 Syntactically - FOR is a just a command, it is not language
-construct like for(;;) in C... 
+construct like for(;;) in C...
 
 The "for" command takes 4 parameters.
    (1) The "initial command" to execute.
@@ -151,9 +151,9 @@ The FOR command:
 5)  Goto Step 2.
 
 As show, each of these items are in {curly-braces}.  This means they
-are passed as they are - KEY-POINT: un evaluated to the FOR
+are passed as they are - KEY-POINT: unevaluated to the FOR
 command. Think of it like escaping the backticks in Bash so that the
-"under-lying" command can evaluate the contents. In this case, the FOR
+"underlying" command can evaluate the contents. In this case, the FOR
 COMMAND.
 
 == END: SIDEBAR: About The FOR command ==
@@ -167,19 +167,19 @@ Format is like "sprintf". Because of the [brackets], it becomes what
 you think.  But here's how:
 
 First - the line is parsed - for {braces}.  In this case, there are
-none.  The, the parser looks for [brackets] and finds them.  The,
+none.  Then, the parser looks for [brackets] and finds them.  The
 parser then evaluates the contents of the [brackets], and replaces
-them. It is alot this bash statement.
+them. It is similar to this bash statement.
 
        EXPORT vn=`date`
 
 LINE 2 & 3
-       set $vn [expr (1024 * $x)]
+       set $vn [expr {1024 * $x}]
        global $vn
 
 In line 1, we dynamically created a variable name.  Here, we are
 assigning it a value. Lastly Line 3 we force the variable to be
-global, not "local" the the "for command body"
+global, not "local" within the "for command body"
 
 ===============
 The PROCS
@@ -194,7 +194,7 @@ The (1) NAME of the function, a (2) LIST of parameters, and a (3) BODY
 Again, this is at "level 0" so it is a global function.  (Yes, TCL
 supports local functions, you put them inside of a function}
 
-You'll see in some cases, I nest [brackets] alot and in others I'm
+You'll see in some cases, I nest [brackets] a lot and in others I'm
 lazy or wanted it to be more clear... it is a matter of choice.
 ===============
 
@@ -215,7 +215,7 @@ All memory regions must have 2 things:
  (2)  NAME( array )
       And the array must have some specific names:
           ( <idx>, THING )
-           Where: THING is one of: 
+           Where: THING is one of:
                   CHIPSELECT
                   BASE
                   LEN
@@ -224,7 +224,7 @@ All memory regions must have 2 things:
                   RWX - the access ability.
                   WIDTH - the accessible width.
 
-        ie: Some regions of memory are not 'word' 
+        i.e.: Some regions of memory are not 'word'
        accessible.
 
 The function "address_info" - given an address should
@@ -237,14 +237,14 @@ tell you about the address.
 MAJOR FUNCTION:
 ==
 
-proc memread32 { ADDR } 
-proc memread16 { ADDR } 
-proc memread8 { ADDR } 
+proc memread32 { ADDR }
+proc memread16 { ADDR }
+proc memread8 { ADDR }
 
 All read memory - and return the contents.
 
 [ FIXME: 7/5/2008 - I need to create "memwrite" functions]
-                
+
 **************************************************
 ***************************************************
 === TCL TOUR ===
@@ -265,13 +265,13 @@ In a makefile or shell script you may have seen this:
      FOO_linux = "Penguins rule"
      FOO_winXP = "Broken Glass"
      FOO_mac   = "I like cat names"
-     
+
      # Pick one
      BUILD  = linux
      #BUILD = winXP
      #BUILD = mac
      FOO = ${FOO_${BUILD}}
-                               
+
 The "double [set] square bracket" thing is the TCL way, nothing more.
 
 ----
@@ -287,10 +287,10 @@ Notice this IF COMMAND - (not statement) is like this:
           error [format string...]
        }
 
-The "IF" command expects either 2 params, or 4 params.
+The "IF" command expects either 2 or 4 parameters.
 
  === Sidebar: About "commands" ===
-  
+
      Take a look at the internals of "jim.c"
      Look for the function: Jim_IfCoreCommand()
      And all those other "CoreCommands"
@@ -298,10 +298,10 @@ The "IF" command expects either 2 params, or 4 params.
      You'll notice - they all have "argc" and "argv"
 
      Yea, the entire thing is done that way.
-     
+
      IF is a command. SO is "FOR" and "WHILE" and "DO" and the
      others. That is why I keep using the phase it is a "command"
-     
+
  === END: Sidebar: About "commands" ===
 
 Parameter 1 to the IF command is expected to be an expression.
@@ -315,9 +315,9 @@ CATCH - is an error catcher.
 You give CATCH 1 or 2 parameters.
     The first 1st parameter is the "code to execute"
     The 2nd (optional) is where to put the error message.
-    
+
     CATCH returns 0 on success, 1 for failure.
-    The "![catch command]" is self explaintory.
+    The "![catch command]" is self explanatory.
 
 
 The 3rd parameter to IF must be exactly "else" or "elseif" [I lied
@@ -325,7 +325,7 @@ above, the IF command can take many parameters they just have to
 be joined by exactly the words "else" or "elseif".
 
 The 4th parameter contains:
-    
+
     "error [format STRING....]"
 
 This lets me modify the previous lower level error by tacking more
@@ -341,12 +341,12 @@ exists.  {the function: "proc_exists" does this}
 
 And - if it does - I call the function.
 
-In "C" it is alot like using: 'sprintf()' to construct a function name
+In "C" it is a lot like using: 'sprintf()' to construct a function name
 string, then using "dlopen()" and "dlsym()" to look it up - and get a
 function pointer - and calling the function pointer.
 
 In this case - I execute a dynamic command. You can do some cool
-tricks with interpretors. 
+tricks with interpretors.
 
 ----------
 
@@ -380,7 +380,7 @@ Some assumptions:
 
 The "CHIP" file has defined some variables in a proper form.
 
-ie:   AT91C_BASE_US0 - for usart0, 
+i.e.: AT91C_BASE_US0 - for usart0,
       AT91C_BASE_US1 - for usart1
       ... And so on ...
 
@@ -394,7 +394,7 @@ looks like this:
 In this case, I'm trying to figure out what USARTs exist.
 
 Step 1 - is to determine if the NAME has been defined.
-ie: Does AT91C_BASE_USx - where X is some number exist?
+i.e.: Does AT91C_BASE_USx - where X is some number exist?
 
 The "info exists VARNAME" tells you if the variable exists.  Then -
 inside the IF statement... There is another loop. This loop is the
@@ -419,9 +419,9 @@ with the generated list of commands for the entire USART.
 With that little bit of code - I now have a bunch of functions like:
 
    show_US0, show_US1, show_US2, .... etc ...
-   
+
    And show_US0_MR, show_US0_IMR ... etc...
-  
+
 And - I have this for every USART... without having to create tons of
 boiler plate yucky code.
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)