ΣSigmaStudio Ask AI Русский Log in

How to use preprocessors in script for VDSP++5.0?

Processors & DSP laurenloves Feb 4, 2017 00:00 2 replies Original on forum ↗
Subscribe
laurenloves Question
Feb 4, 2017 00:00

I am new to embedded programming. I see there is a way to set pre-processors using the project option, but I have an issue. I have two different builds that use alot of the same code but have slight differences. I am using pre-processors to separate out the code? If I use the project files option, that means I would need to create two projects for every project that uses the pre-processors right? To make things easier I rather have the preprocessor set at the build script to make the separations. How can I do this for VDSP? I am using c code.

build

preprocessor

vdsp5.0

ADIApproved Reply
Mar 3, 2017 00:00

Hi,

You can use VisualDSP++ Automation API "AddSwitch" which adds a switch to the project-wide tool command line when building the project for the specified configuration.

The AddSwitch method is used to set a switch in the given tool’s property page.

Here is an example in VB:

Dim str

Set app = CreateObject( "VisualDSP.ADspApplication" ) Set project_list = app.ProjectList

If ( project_list.Count = 0 ) Then
app.PrintText tabConsole, "No project loaded"
Else
Rem get the first project object
Set project = project_list( 0 )
Set tool_list = project.ToolList
Set tool = tool_list("Compiler")
str = tool.AddSwitch("Debug", "-D", "MY_MACRO") End If

To use this script, you must have VBScript set as your current scripting language in the console window of the IDDE. The script can then be loaded via the File->Load Script... menu item or by opening it in an editor window and selecting Load Script from the editor context menu.

Please refer in VisualDSP++ help for more details:
Contents > Automation > API Reference > ADspTool > Methods > AddSwitch

Regards,

Kader

EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin