This is the mail archive of the
ecos-devel@sources.redhat.com
mailing list for the eCos project.
Re: Mode conditional CDL
On Thu, 2003-10-23 at 16:40, Bart Veer wrote:
> >>>>> "Gary" == Gary Thomas <gary@mlbassoc.com> writes:
>
> Gary> I've found another thing I'd like to do with CDL that is
> Gary> cumbersome. We have the RedBoot "model" string
> Gary> HAL_PLATFORM_BOARD. When there is a package which supports
> Gary> more than one board type, I'd like to have this reflect the
> Gary> model chosen. Sadly, I've not figured out how to do this in
> Gary> the define_proc at the top of the package. I ended up adding
> Gary> something like this:
>
> Index: hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl
> ===================================================================
> RCS file: /misc/cvsfiles/ecos/packages/hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl,v
> retrieving revision 1.2
> diff -u -5 -p -r1.2 hal_powerpc_rattler.cdl
> --- hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl 28 Aug 2003 15:55:54 -0000 1.2
> +++ hal/powerpc/rattler/current/cdl/hal_powerpc_rattler.cdl 22 Oct 2003 21:00:22 -0000
> @@ -138,10 +138,14 @@ cdl_package CYGPKG_HAL_POWERPC_RATTLER {
> flavor bool
> default_value 0
> description "
> The Rattler comes in two variants - one with PCI
> and another without."
> + define_proc {
> + puts $::cdl_header "#undef HAL_PLATFORM_BOARD"
> + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Rattler-PCI\""
> + }
> }
>
> Gary> I also couldn't put C style #ifdefs to handle this because
> Gary> the CDL option which it depends on is not defined (has not
> Gary> yet been emitted in the platform.h file) until later on.
>
> Gary> If there's a better way to handle this, I'd be happy to hear
> Gary> about it. I'd also like to figure a way to do things like
> Gary> define a string which is the board clock speed, etc. Ideas?
>
> This was supposed to be handled by CDL scripting, i.e. something like:
>
> define_proc {
> if { [cdl_get CYGHWR_HAL_POWERPC_RATTLER_PCI] } {
> ...
> } else {
> ...
> }
> }
>
> For now another way of doing this is to use a calculated option, e.g.:
>
> cdl_option CYGDAT_HAL_POWERPC_RATTLER_PLATFORM_BOARD {
> ..
> flavor data
> calculated { CYGHWR_HAL_POWERPC_RATTLER_PCI ? "boardA" : "boardB" }
> }
>
> But your approach is probably preferable for simple cases. It involves
> less code and avoids adding a dummy option.
>
I wanted to avoid the addition of another option just for this case.
Is there a schedule (hah!) for adding scripting to the CDL engine?
[I'm pretty sure I know the answer, but I have to ask :-)]
Thanks
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates