FILE_CONFIG Section
The FILE_CONFIG section allows configuration variables to be defined for a device file. Configuration variables are constants that need to be configured by the user for the device file to work. The section lists these variables and their types.
Syntax
FILE_CONFIG VALUES type name [ DESCRIPTION "description"; ] [ HELP "help"; ] [ CONDITION "condition"; ] [ VALUES value := "description"; ... END; ] [ DEFAULT default; ] END; ... END; DEFAULTS DEFAULT_SET [ PART_NUMBERS partnumber "description"; ... END; ] [ DEFAULT_VALUES variable default; ... END; ] END; END; END;
VALUES Section
Types
The variable type is one of following:
- INT
- An unsigned INT value.
- STRING
- A STRING.
- BOOLEAN
- A boolean value that can be either set to TRUE or FALSE. The XJEase variable created will be an INT that is set to 1 for TRUE and 0 for FALSE.
- FILENAME
- A filename. The XJEase variable created will be a STRING. XJDeveloper will display a file browse dialog when setting a filename value.
- ENUM
- A value that can be set to one of a set of predefined values. The values can either be INTs or STRINGs, but they must all be the same type. See enumerated values below for more information.
Name
The variable name defines the name of the constant that will be created in XJEase for this variable.
Description
The optional description is the string that is displayed to the user when they are configuring the device file.
Help
An optional help string can be specified to give more details about the variable. This is also visible to the user when configuring the device file.
Condition
Sometimes a value only needs to be configured if another value has been set. The condition is a string that specifies another integer variable that must be set to a non-zero value for this variable to be enabled.
Enumerated values
An enumerated value has a predefined set of valid values and is defined by an additional VALUES
section within the variable definition. The variable can be either string or integer based, and all values must be of this type. The values are defined by a value of the appropriate type and then a string description, which is what is displayed to the user when selecting a value.
Default
In cases where there is a sensible default value for a variable, this can be specified. Users will be given the option to use default values when configuring the device file.
DEFAULTS Section
Each set of defaults contains a list of part numbers which the defaults are for, and a list of default values.
Part Numbers
Each part number which uses the set of defaults is listed, along with an optional description string, which will be displayed to the user when they are given the option to use the set of defaults.
Default Values
A list of default values is given. Any number of variable defaults can be specified - they do not all need to be set.
Example
DEVICE NAME := "device" ... FILE_CONFIG VALUES BOOLEAN DEBUG DESCRIPTION "Switch extra debugging output on"; END; BOOLEAN PROGRAM_FLASH DESCRIPTION "Program a file to the flash"; END; // These next values are only enabled if PROGRAM_FLASH is non-zero INT PROGRAM_FLASH_ADDRESS DESCRIPTION "The address to program in flash"; HELP "This must be set if PROGRAM_FLASH is set to true"; CONDITION "PROGRAM_FLASH"; END; FILENAME PROGRAM_FLASH_FILE DESCRIPTION "The file to program in flash"; HELP "This must be set if PROGRAM_FLASH is set to true"; CONDITION "PROGRAM_FLASH"; END; // This value is a string enumerated type ENUM PROGRAM_FLASH_FORMAT DESCRIPTION "The type of file"; HELP "This must be set if PROGRAM_FLASH is set to true"; CONDITION "PROGRAM_FLASH"; VALUES "hex" := "Hex file format"; "bin" := "Bin file format"; END; END; // This value is an integer enumerated type ENUM PROGRAM_FLASH_ID DESCRIPTION "The expected flash id"; CONDITION "PROGRAM_FLASH"; VALUES 0x1234 := "Some manufacturer"; 0x6721 := "Some other manufacturer"; 0b1011100101010001 := "Manufacturer in binary"; 34567 := "Manufacturer in decimal"; END; END; END; DEFAULTS DEFAULT_SET PART_NUMBERS AB123DEF "Some part"; AB1234GH "Some other part"; CD567IJ; END; DEFAULT_VALUES DEBUG 1; PROGRAM_FLASH 1; END; END; END; END; END;
XJTAG v4.1.100