[DUPLICATE] -D pass-through to compilation tools

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [DUPLICATE] -D pass-through to compilation tools

    Referring to this thread from Feb 2018:

    [SOLVED] EMBuild -D option

    ...can I ask if it is still the case that there is no way to pass in #defines from the outside world into Segger Embedded Studio? I don't mean change ones that SES knows about, I mean just pass in the random stuff I need to get into my code. Not being able to do this is a real barrier to automation and to writing/maintaining cross-platform code. I have to deal with building/testing my code under many different SDKs at the same time and the last thing I want to have to do is tell each IDE about ever little thing when it matters not a jot: my code deals with the consequences and only my code cares, it really should be transparent to the IDE.

    Please tell me there's a way to do this. Make can obviously do it and even CMake is able to do it with a little persuasion. If there's really no way to do this then, unfortunately, SES is not a viable option for me.

  • FYI, I've found a workaround for this. In my common pre-processor definitions I have added 10 generic entries with dummy default values as follows:


    I can then launch SES from the command line and supply the actual values for each one as parameters, e.g.:

    "C:\Program Files\Segger\SEGGER Embedded Studio for ARM 4.50\bin\emstudio" -D EXTRA0="MY_CONDITIONAL=1"

    Not elegant but it works.
  • Hello Rob,

    Thank you for your inquiry.
    The only way to do this was described in the linked thread by Johannes which is essentially your "workaround".

    Best regards,
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.