This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: dynamic HAL_PLATFORM_* values
On Sun, Apr 11, 2004 at 10:44:02PM -0500, Andy Dyer wrote:
> We have boards with varying versions of FPGA code in them for
> various reasons (debug builds, not updated, programming mistake,
> etc).
>
> In the FPGA are registers I can read to get the version
> numbers. During hal_platform_init() (or maybe earlier)
> I want to read those registers, format the data into a
> fixed length string in .data and somewhere #define
> HAL_PLATFORM_EXTRAS to be a pointer to that string, so
> that redboot will print my string out on boot and the string
> will reflect the values in the FPGA registers at runtime.
> Everything I saw from grepping my tree statically defines
> HAL_PLATFORM_* in a cdl file.
>
> where I was running into trouble was in figuring out what the
> "right" way to do this is. The #define doesn't seem to "belong"
> in any of my exisiting platform hal include files (hal_diag, plf_cache,
> plf_intr, plf_io, and plf_stub), so I wanted to make a new header
> file, figure out how to get it into the install/include heirarchy,
> and get it #included into the build headers so when redboot links it
> can find my pointer.
Things like this normally go into plf_io.h. Just add a prototype for
something like char *cyg_hal_fgpa_version(void), and edit the
define_proc in the hal cdl to something like
puts $::cdl_header "#define HAL_PLATFORM_EXTRA cyg_hal_fpga_version()"
Im note sure is redboot/src/main.c pulls in plf_io.h. If not you will
also need
puts $::cdl_header "#include <cyg/hal/plf_io.h>"
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss