Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Using multiple build configurations

For my program i need a serval different versions. So i made a few build configurations. The differences in version are defined in C/ Build-> Settings->Preprocessor->Defined symbols. For each configuration i made a different symbol. Type1, Type2 ect.

Now my programs knows the the symbol and with #if defined Type1... and #if defined Type2... enable and disable the code.
However the eclipe editor keeps the code always marked gray as if not active. I know its active because if making a typo it will fail on that.
AC6 please enable the text when the define is true (or do i have to set the define somewhere else?)

I had the same problem (I think) that you’re describing and found a solution.

This is an Eclipse configuration issue and not one with the AC6 extensions.

I was able to resolve it by changing one of the indexer options, which you can get to by navigating to:

Window -> Preferences -> C/C++ -> Indexer

Look for the option “Use active build configuration” (it’s towards the bottom of the dialog) and make sure it’s selected.

Project-specific indexer settings are disabled by default when a new project is created, so while it would be possible to get the indexer to properly highlight/de-highlight #if’ed code sections based on build configuration selected without changing the global setting (which is what you’re doing if you change the setting I mentioned above) it’s more work, and something you need to remember to change every time you start a new project.

Just in case you want to use project-specific indexer settings, you can change these by navigating to:

Project -> Properties -> C/C++ General -> Indexer

Then tick on the “Use project specific settings” checkbox and select the “Use active build configuration” radio button.

The Eclipse syntax highlighting system and symbol indexer are smart enough to recognize preprocessor symbol definitions that are made based on build configuration, but it does not handle this correctly by default. It took me some time to figure out how to get this to work rolleyes


That did the trick, AC6 should enable “Use active build configuration” by default i guess.
Same for the setting Window > Preferences > General > Workspace and check the “Save automatically before build”.
Realy confusing if thats not enabled.


 

Newest Forum Posts

  1. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  2. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  3. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  5. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  6. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  8. Build a project in "release" mode by tang, 2025-02-20 10:36
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35
  10. Fail to debug in Win 11 C/C++ by mortenlund, 2024-12-26 20:27

Last-Modified Blogs