Author: mcayland Date: Sat Jul 27 13:21:59 2013 New Revision: 1192 URL: http://tracker.coreboot.org/trac/openbios/changeset/1192
Log: config: add new fcode tag and support for building Fcode into dictionaries
Here we introduce a new <fcode> tag which will tokenise the specified source file into Fcode using the toke utility. Similarly add a new type attribute to the dictionary <object> tag which when set to "fcode" will add the fcode binary as a dependency for the specified target dictionary.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Added: trunk/openbios-devel/config/xml/fcode.xsl Modified: trunk/openbios-devel/Makefile.target trunk/openbios-devel/config/xml/dictionary.xsl trunk/openbios-devel/config/xml/makefile.xsl trunk/openbios-devel/config/xml/rules.xml
Modified: trunk/openbios-devel/Makefile.target ============================================================================== --- trunk/openbios-devel/Makefile.target Sat Jul 27 13:21:56 2013 (r1191) +++ trunk/openbios-devel/Makefile.target Sat Jul 27 13:21:59 2013 (r1192) @@ -35,6 +35,9 @@ INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include AS_FLAGS+= -g
+# FCode tokeniser +TOKE := toke + quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
VPATH_SUFFIXES = %.c %.h %.S %.fs
Modified: trunk/openbios-devel/config/xml/dictionary.xsl ============================================================================== --- trunk/openbios-devel/config/xml/dictionary.xsl Sat Jul 27 13:21:56 2013 (r1191) +++ trunk/openbios-devel/config/xml/dictionary.xsl Sat Jul 27 13:21:59 2013 (r1192) @@ -53,16 +53,23 @@ </xsl:variable>
<xsl:if test="$conditions=0"> - <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY:=$(</xsl:text> - <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY) </xsl:text>
- <xsl:value-of select="$path"/> - <xsl:value-of select="@source"/> - xsl:text </xsl:text> + <xsl:variable name="source"><xsl:value-of select="@source" /></xsl:variable> + + <!-- Handle just Forth source, not FCode --> + <xsl:if test="not(@target = 'fcode')"> + <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY:=$(</xsl:text> + <xsl:value-of select="$dictname"/>xsl:text-DICTIONARY) </xsl:text> + + <xsl:value-of select="$path"/> + <xsl:value-of select="$source"/> + xsl:text </xsl:text> + </xsl:if> + </xsl:if> </xsl:for-each>
- xsl:text </xsl:text> + xsl:text </xsl:text>
<!-- Create targets for all dictionaries --> <xsl:for-each select="//dictionary"> @@ -92,6 +99,27 @@ <xsl:if test="$init!=''"> xsl:text $(ODIR)/</xsl:text><xsl:value-of select="$init"/>xsl:text.dict</xsl:text> </xsl:if> + + <!-- Check for Fcode dependency --> + <xsl:for-each select="object[@target = 'fcode']"> + + <xsl:variable name="conditions"> + xsl:text0</xsl:text> + <xsl:for-each select="(ancestor-or-self::*)[@condition!='']"> + <xsl:call-template name="resolve-condition"> + <xsl:with-param select="@condition" name="expression"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <xsl:if test="$conditions = 0"> + + xsl:text $(ODIR)/</xsl:text> + <xsl:value-of select="@source"/> + + </xsl:if> + </xsl:for-each> + xsl:text </xsl:text> <!-- rule --> xsl:text	$(call quiet-command,$(ODIR)/forthstrap</xsl:text>
Added: trunk/openbios-devel/config/xml/fcode.xsl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/openbios-devel/config/xml/fcode.xsl Sat Jul 27 13:21:59 2013 (r1192) @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="ISO-8859-15" ?> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <xsl:template match="/" mode="fcode"> + + xsl:text # # fcode rules # </xsl:text> + + <!-- Create linker targets for FCode roms --> + <xsl:for-each select="//fcode"> + <xsl:variable name="outer-conditions"> + xsl:text0</xsl:text> + <xsl:for-each select="(ancestor-or-self::*)[@condition!='']"> + <xsl:call-template name="resolve-condition"> + <xsl:with-param select="@condition" name="expression"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <xsl:if test="$outer-conditions = 0"> + <xsl:if test="(ancestor-or-self::*)"> + + <xsl:variable name="path"> + <xsl:for-each select="ancestor::build"> + <xsl:call-template name="get-dirname"> + <xsl:with-param select="@base" name="path"/> + </xsl:call-template> + </xsl:for-each> + </xsl:variable> + + <!-- Fcode name --> + xsl:text$(ODIR)/</xsl:text> + <xsl:value-of select="@name"/> + xsl:text:</xsl:text> + + xsl:text $(SRCDIR)/</xsl:text> + <xsl:value-of select="$path"/> + <xsl:value-of select="@source"/> + + <!-- FIXME this requires strict spaces in rules.xml --> + <xsl:value-of select="document('rules.xml',.)//rule[@target='host'][@entity='fcode']"/> + xsl:text </xsl:text> + </xsl:if> + </xsl:if> + </xsl:for-each> + + </xsl:template> +</xsl:stylesheet>
Modified: trunk/openbios-devel/config/xml/makefile.xsl ============================================================================== --- trunk/openbios-devel/config/xml/makefile.xsl Sat Jul 27 13:21:56 2013 (r1191) +++ trunk/openbios-devel/config/xml/makefile.xsl Sat Jul 27 13:21:59 2013 (r1192) @@ -5,10 +5,12 @@ <xsl:include href="util.xsl"/> <xsl:include href="dictionary.xsl"/> <xsl:include href="object.xsl"/> + <xsl:include href="fcode.xsl"/>
<xsl:template match="/"> <xsl:value-of select="document('rules.xml',.)/rules/pre"/> <xsl:apply-templates select="." mode="dictionaries"/> + <xsl:apply-templates select="." mode="fcode"/> <xsl:apply-templates select="." mode="objects"/> </xsl:template>
Modified: trunk/openbios-devel/config/xml/rules.xml ============================================================================== --- trunk/openbios-devel/config/xml/rules.xml Sat Jul 27 13:21:56 2013 (r1191) +++ trunk/openbios-devel/config/xml/rules.xml Sat Jul 27 13:21:59 2013 (r1192) @@ -13,6 +13,9 @@ <rule target="host" entity="library"> $(call quiet--command,$(AR) cru $@ $^; $(RANLIB) $@," HOSTAR $(TARGET_DIR)$@") </rule> +<rule target="host" entity="fcode"> + $(call quiet-command,$(TOKE) -o $@ $^," TOKE $(TARGET_DIR)$@") +</rule>
<!-- target/cross compiler build rules --> <rule target="target" entity="executable">