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


Auto generate build/version number

France

Hi,

You may, for example, create a file named makefile.targets at the root of your project, with the following content:
all: ../build_number.h

../build.number:
		if [ ! -r ../build.number ]; then \
			echo build_number=1 > ../build.number; \
		fi

bump.build.number:
		source ../build.number; \
		echo "build_number=$$((build_number + 1))" > ../build.number

.PHONY: bump.build.number
post-build: bump.build.number

../build_number.h: ../build.number
		source ../build.number; \
		echo "#define BUILD_NUMBER $$build_number" > $@
Be careful: the backslashes at the end of some lines must really be the last character of the line, with no spaces after, or this will not work (you can also put everything on one line but it’s far less readable).


Then include build_number.h in the file in which you need the build number; this file will define a macro named BUILD_NUMBER which will be bumped at each successful build.

Beware that each time you will launch a build, even if nothing else has changed, the program will be updated as th ebuild number has changed... Only bumping the build number when something has effectively changed (and not for each successful build) will need quite a few more logic...

Also you may have to slightly edit this makefile fragment if you want the generated files elsewhere in your project (although makefile.targets must stay at the root of the project).

Note also that this will only work if you use the external builder (make), not the internal one.This is one of the advantages of the external builder.

Bernard (Ac6)

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs