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


How do I compile a .h file?

I am using the fp-net-blestar1 (https://www.st.com/en/embedded-software/fp-net-blestar1.html) in order to make a bluetooth low energy web between a master board, 7 slave SensorTiles (STEVAL-STLCS02V1) and WiFi connectivity to the IBM Watson cloud. Currently the example code only allows these tiles to send environmental data but having read through it, it appears the functionality for sending all sensor data, acceleration, orientation etc, is in the code.

To enable this it looks like you have to change a single line of code in the main.h folder:

/*
* Enable/Disable the possibility to receive MEMS (AGM and SFUSION) notifications
* (1 = MEMS Enabled, 0 = MEMS Disabled)
* WARNING: To be used with ST SensNet V>2.0 application
*/
“HASHTAG”define ENABLE_MEMS 0

I have changed the 0 to a 1 but when I rebuild the project, main.h isn’t being compiled so nothing is actually changing and the sensor tiles are still only sending environmental data.

How to I get SW4STM32 to compile this altered header file? Or is there a work around I can use in order to get these tiles to send all their data over and not just environmental?

France

Hi,

You can’t compile a .h file; to have an effect it must be included in a ‘.c’ file that uses the definitions in this file. I suggest you search in your project for the ENABLE_MEMS symbol (uses the “File Search” feature of System Workbench for STM32 2018 08 06 192822 ) and verifies that “main.h” is included by the corresponding files, then recompile your project.

Bernard (Ac6)


Thank you for the response.

I have checked and main.h is included in multiple locations. Maininclude1 Maininclude2

I have also done what you suggested and searched for the ENABLE_MEMS symbol and I have found all instances of it. Even after I’ve rebuilt he program the macro is still showing it as a 0. ENABLE MEMS Macro

This is really frustrating as I have looked through the code and I can see (or at least believe) that the functionality to send Acc, Gyr and Mag data is there but I don’t understand enough about this code in order to get it to work and send all sensor data over.

France

Hi,

Have you checked that it’s your main.h file that is included; it may happen that there are several files of the same name in different directoies and that a given include get the wrong one... To test you may search for files named “main.h” and/or put a syntax error in your file and check that you get the error message.

If you really get the main.h where you define the symbol as 1 and the code that depends on it is not compiled, that may mean that it is redefined as 0 somewhere else and setting it on the command line will probably not help.

Bernard (Ac6)

France

Hi again,

BTW the fact that Eclipse shows the macro expanding as 0 (which is seen also as the code itself is grayed out) may be an artifact due to indexing problems. To check you may rebuild th eindex, or go in th efile where the #if shows the value as 0 and

  1. add a syntax error in the conditionnaly compiled zone to check if it is compiled or not
  2. search which “main.h” file Eclipse think you are including by double clicking on “main.h” in the file outline (right column in your workspace): this will open the main.h file and you can check if your macro is defined as 1 or 0 (you can get the full pathname by hovering on the editor tab title).


Hope this helps

Bernard (Ac6)


you could always try adding it to your compiler preprocessor defines?
eg: on gcc that would look like -DENABLE_MEMS

so right click on your project, go to “C/C++ Build”. “Settings”, “MCU GCC Compiler”, “Preprocessor”

that’s a pretty blunt instrument but at least you’ll be able to start doing something


To force the compiler to re-include the changes in a header file, you must include that file in a .c file and change something in the .c file (add a space than delete it) so that the compiler would re-build the .c file that includes your .h file. Hope this helps. — BM

 

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