Hi all, is there an expert for CDL/TCL language?
I have problems with creating macro name dynamically with TCL language. I have to implement an ADC driver. I want to create the list of channels. Because the large number of channels (10 internal channel with ACT value, MIN value and MAX value and 15 external channels) I want to create the channel list more convenient. The following code (some excerpt of my CDL script) works already good, but it is not matching my requirements completely: #--------------------------------------------------------------------------- ---------------------------------------- set SensorList { temp vccint vccaux vpvn vrefp vrefn vccbram vccpint vccpaux vcc0ddr } foreach Sensor $SensorList { cdl_component CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_$Sensor { parent CYGNUM_DEVS_ADC_ARM_XC7Z_ONCHIP_SENSORS display "on-chip $Sensor" flavor none description "XADC on-chip $Sensor sensor measurement" cdl_option CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_NAME_ONCHIP_ACT_$Sensor { display "Device name" flavor data default_value [format {"\"/dev/xadc_act_%s\""} $Sensor ] description " This option controls the name that an eCos application should use to access this device via cyg_io_lookup(), open(), or similar calls." } . . . #--------------------------------------------------------------------------- ----------------------------------------- The $Sensor symbol is replaced in the code for each loop correctly. But it works only, when $Sensor is separated by blanks or if it is at end of string. It is NOT working, when I place it inside the MACRO Name: e.g. CYGDAT_DEVS_ADC_ARM_XC7Z_CHANNEL_ONCHIP_$Sensor _ACT_NAME I have tried different syntax approaches...e..g "$$", $ at beginning and end of symbol, put into "[...]", but no success! Is this possible anyhow? And what is the correct syntax? Further I want to use string functions "string toupper" and "string tolower". In Macro Names I want to convert to upper, in device name I want to convert to lower (which would match the naming conventions). But this is not working too. I tried e.g [string tolower ($Sensor)] or [expr string tolower($Sensor)] and a lot of other variants. But I always get syntax errors. Any ideas, what is wrong? Thanks Richard ITR GmbH web: http://www.itrgmbh.com email: i...@itrgmbh.com -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss