[ECOS] CDL help: cdl_option set by package?

Bart Veer bartv@ecoscentric.com
Tue Jun 29 18:01:00 GMT 2004


>>>>> "Heiko" == Heiko Panther <heiko.panther@web.de> writes:

    Heiko> I'm looking for a way to define a cdl_option in the
    Heiko> architecture hal, and have it set either by a platform hal
    Heiko> or by the user (in case the platform does not set it). I
    Heiko> don't see an easy way to do that. I've been thinking about
    Heiko> how to solve it with cdl_interface, but that gets kind of
    Heiko> complex. Can anyone help?

There are a couple of ways of approaching this. If the platform
requires a specific value, just use a "requires" property in the
platform HAL cdl.

   cdl_package CYGPKG_HAL_<platform> {
       ....
       requires { CYGDAT_HAL_<arch>_ANSWER == 42 }
       ...
   }

In configurations where the platform HAL does not contain such a
requirement the architecture HAL's default_value will apply, and the
user can override this. If the platform does contain the requirement
then the user will not be able to override this.

Alternatively, if you want the platform HAL to supply a replacement
default_value but the user is still allowed to change it, use
something like:

  cdl_option CYGDAT_HAL_<arch>_ANSWER {
      flavor data
      default_value { is_loaded(CYGDAT_HAL_<arch>_ANSWER_DEFAULT) ? \
                      CYGDAT_HAL_<arch>_ANSWER_DEFAULT : 11 }
      ...
  }

and in the platform HAL have a dummy option:

  cdl_option CYGDAT_HAL_<arch>_ANSWER_DEFAULT {
      flavor data
      calculated  42
      ...
  }

So if some other package defined CYGDAT_HAL_<arch>_ANSWER_DEFAULT then
that setting will be used, otherwise the architectural default
applies. Either way the user can override the setting.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list