Hi

We've tried to break out several generic parts of our openOCD scripts into 
different script files.
We then encounter some issues to access global variables.

Example

File main.cfg:
--------------

set FLASH_CONFIG_SIZE 1

# include generic script file for board
source [find board/testboard.cfg]

# call generic function
str_configure_flash



File board/testboard.cfg:
------------------

proc str_configure_flash { } {
        global FLASH_CONFIG_SIZE 
        ...etc... do stuff with $FLASH_CONFIG_SIZE
}


Then openOCD gives error back that "FLASH_CONFIG_SIZE" is not in global 
scope.
It seems like main script file is not running in global scope?
Because if I change variable declaration in "main.cfg" to explicit set 
global namespace, it works!?

set ::FLASH_CONFIG_SIZE 16384

Is this working as intended? Should main script file work in "global" 
scope?
Sorry I'm very new in TCL-scripting, maybe I got it all wrong, just trying 
to understand :)

Thanks and regards
/Fredrik
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to