This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Getting rid of warning for optional workspace variable usage in project expansion

Other Parts Discussed in Thread: MSP-FET

I have a situation where for developers using an MSP-FET for a UART connection, it drops characters unless the baud rate is slowed down. But normally the baudrate should be a different value. So I set up as follows.

In the code:

#ifdef SLOW_DEBUG_PORT
  params.baudRate = 19200;
#else
  params.baudRate = 115200;
#endif

In the project settings (Project > Properties, then CCS Build > ARM Compiler > Predefined Symbols) added an entry ${WORKSPACE_PREPROCESSOR_DEFS}.

In the workspace settings (Window > Preferences, then Code Composer Studeio > Build > Variables) added an entry with variable name WORKSPACE_PREPROCESSOR_DEFS, type String, value SLOW_DEBUG_PORT.

The problem is: this works on my machine and anyone else who takes the time to set up the WORKSPACE_PREPROCESSOR_DEFS variable. But for everyone else it gives a warning, even though the variable isn't needed. What I want is:

  • for those who need it, they can add WORKSPACE_PREPROCESSOR_DEFS manually
  • everyone else, project should build with no warnings even with empty/default workspace

So I need a way to silence the warning and it never complains if WORKSPACE_PREPROCESSOR_DEFS is not defined. I tried to replace in project settings `${WORKSPACE_PREPROCESSOR_DEFS}` with  `${build_var:WORKSPACE_PREPROCESSOR_DEFS}` but the SLOW_DEBUG_PORT doesn't pass through like it should anymore.

With bash I could do something like `${WORKSPACE_PREPROCESSOR_DEFS:=}` to set as empty string if the variable is not defined, but I don't think that works in CCS? Is there a similar syntax? Why doesn't `${build_var:}` work and is there documentation for its options and behavior?