11.1.2.2 Adding Board and Project Specific Properties
Sometimes a new project-level property needs to be added to support the feature set of a given board. For example, one might like to describe external memories, ranges, timings, etc., and use them during debug launch for proper setup.
Such properties can be declared in a function called onShowProps
which needs to
be placed inside autoload.py. They are edited using the tool
properties tab of the Project Properties dialog box.
The properties are persisted within the project file, making them available for future debug sessions.
def onShowProps(t):
ide.addTextProperty(t,"x.ddram.timing" , "*|programoptions|programoptions.eraseb4program","DDRAM frequency","Enter DDRAM frequency", "1200000")
ide.addEnumProperty(t, "x.memory.type", "*|programoptions|programoptions.eraseb4program","External memory", "Select external memory", "ddram2",
"ddram2|DDRAM 2|ddram 2 memory\n"
"ddram3|DDRAM 3|ddram 3 memory\n"
"qspi|QSPI mem|QSPI memory")
The properties are persisted in the settings
object:
timing = settings.getNumeric("x.ddram.timing", 120000)
extMem = settings.getString("x.memory.type","ddram2") # default to ddram2 if project never configured