フリースタンディングでのテンプレート

以前JSPを使ったテンプレートだったけど、フリースタンディングの場合のテンプレートを紹介。

   <extension
         point="jp.pizzafactory.crosschains.codeTemplate">
      <template name="LED shift (RAM)"
            projectTypeId="cdt.managedbuild.target.gnu.arm.elf.exe">
         <file path="examples/led_shift_ram/boot.S"/>
         <file path="examples/led_shift_ram/led_shift.c"/>
         <file path="examples/led_shift_ram/sam7s128_ram.x"/>
         <file path="examples/common/.gdb_ram.ini"/>
      </template>
   </extension>

とか記述するとフリースタンディングでテンプレートが書けます。

さらにビルド設定の情報(リンカスクリプトの設定とか)もテンプレートに追加したいといろいろ調べたのですがやはり思ったような内容が得られずに、後ろの席の方に聞いて解決への道しるべ*1を示してもらいました。
でこんな感じで書いてみました。

   <extension
         point="jp.pizzafactory.crosschains.managedConfigElementProvider">
      <projectType projectTypeId="cdt.managedbuild.target.gnu.arm.elf.exe"/>
      <configuration name="Debug-Freestanding-AT91SAM7S"
	       artifactExtension="out"
	       cleanCommand="rm -rf"
		   errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
	       parent="pizza.managedbuild.config.gnu.arm.elf.exe.debug"
	       id="pizza.managedbuild.config.gnu.arm.elf.exe.debug">
	       <toolChain
	         id="pizza.freestanding.armv4.at91sam7s.toolchain.gnu.arm.elf.exe.debug"
	         superClass="pizza.managedbuild.toolchain.gnu.arm.elf.exe.debug">
		      <tool
	            command="arm-elf-gcc"
	            id="pizza.freestanding.armv4.at91sam7s.tool.gnu.c.linker.arm.elf.exe.debug"
	            superClass="pizza.managedbuild.tool.gnu.c.linker.arm.elf.exe.debug">
				<option id="pizza.freestanding.armv4.at91sam7s.gnu.c.link.option.nostdlibs" superClass="gnu.c.link.option.nostdlibs" value="true" valueType="boolean"/>
				<option id="pizza.freestanding.armv4.at91sam7s.gnu.c.link.option.other" superClass="gnu.c.link.option.other" valueType="stringList">
					<listOptionValue builtIn="false" value="../sam7s128_ram.x."/>
				</option>
		      </tool>
		   </toolChain>
	   </configuration>
   </extension>

*2
これを追加するとプロジェクトタイプの構成が増えてしまうことになるが特に問題はないでしょう。
オプション設定をもっと増やしたい場合は、org.eclipse.cdt.managedbuilder.gnu.uiのplugin.xmlを参照すること。

*1:カーネルのターゲット依存部のplugin.xmlに同じようなことが書いてあるよ」

*2:listOptionValue builtInはfalseにしないと現れません。