Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Correct use of AppendToMBSStringOptionValue or SetMBSStringOptionValue in templates

Hi everyone,

I am trying to create a templateengine plugin for use with the cross gcc plugin from CDT, where the goal is to allow the creation of a STM32 F4xx (Cortex-M4) project, allow the user to select the used system or peripheral drivers (from the stdperiph library), create include and source folders and copy the correct files into the correct location, and at the end add some toolchain options/settings.

So far I have successfully added the user choice of drivers through the template file and the conditional copy of the header/source file based on the user's choice (I must admit, for a boolean type property the checkbox on the right of the property label looks a bit weird to me... but that's just personal taste I guess).

The problems start when I try to use AppendToMBSStringOptionValue, it did not work at all. Basically I have a headers folder, the user can give it whatever name they want. The folder is created with a process org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder. Under this folder two org.eclipse.cdt.core.CreateFolder processes create $(headers)/cmsis and $(headers)/stdperiph, where then process org.eclipse.cdt.core.AddFiles placess the selected files.

What I would like to do, is to add the subfolders under $(headers) to the toolchains C compiler include paths. I got the cdt master sources from git and saw that the crossgcc plugin does not define its own extension option for that, so my take is that it inherits the managedbuilder.gnu.ui options. Here's how this part of my template file looks like:

<process type="org.eclipse.cdt.managedbuilder.core.AppendToMBSStringOptionValue">
        <simple name="projectName" value="$(projectName)"/>
        <complex-array name="resourcePaths">
<simple name="id" value="gnu.c.compiler.option.include.paths" />
                <simple name="value" value="$(headers)/cmsis" />
                <simple name="path" value="" />

I tried to find on the net examples of how to use this process (or SetMBSStringOptionValue), but the only thing I found was the test cases within CDT, which did not help much. Well, this example above did not work - after the project was created all the files were in the correct place, but when I looked at the toolchain settings in the project properties, I did not find the cmsis includes folder added to the -I compiler paths; the only thing there was the the top include folder added through the CreateIncludeFolder process (and the standard compiler paths, of course). So either the id I used is wrong, or I don't understand how to use this facility.

I would also need to add preprocessor defines to the cross gcc compiler, i.e. if a user selected driver ABC in the new project, then the driver's sources are copied, but also some define in the manner of USE_DRIVER_ABC should be added to the gcc preprocessor settings (preferably for all project configurations)...

Could anyone shed some light on the problem? Even if it is to point me to some other plugin project which extends CDT - I have no idea where to look any more.

Thanks a lot,


Back to the top