RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

sys: preprocessor successor module

Open fabian18 opened this issue 2 years ago • 1 comments

Contribution description

Generate a header file, containing successor definitions up to a fixed maximum. This allows to use the preprocessor to compute the successor of a number and is useful to construct priority values for auto_init. This is similar to boost preprocessor arithmetik.

Testing procedure

See usage in tests/external_module_dirs/external_modules/external_module/external_module.c

CFLAGS+=-DCONFIG_AUTO_INIT_ENABLE_DEBUG=1 BOARD=nucleo-f767zi make flash term

2022-07-06 09:39:31,837 # auto_init: ztimer_init (1010)
2022-07-06 09:39:31,840 # auto_init: auto_init_random (1040)
2022-07-06 09:39:31,844 # auto_init: auto_init_external_module (1041)
2022-07-06 09:39:31,847 # auto_init: auto_init_miot_mtd (1249)
2022-07-06 09:39:31,851 # auto_init: auto_init_miot_node (1359)
2022-07-06 09:39:31,860 # main(): This is RIOT! (Version: 2022.07-devel-788-g87bda-preprocessor_successor)
2022-07-06 09:39:31,862 # Message: Linking worked
2022-07-06 09:39:31,863 # Initialization worked!

Issues/PRs references

#18003

fabian18 avatar Jul 06 '22 07:07 fabian18

@fjmolinas could be interested

fabian18 avatar Jul 06 '22 07:07 fabian18

I think this is useful for external modules to hook into the auto init code in a more robust fashion.

I think that @gdoffe and many @benpicco may be interested in this. IMO, this only needs a rebase to get in.

maribu avatar Oct 12 '22 21:10 maribu

Please rebase & squash

benpicco avatar Oct 13 '22 12:10 benpicco

Oops forgot the rebase ...

fabian18 avatar Oct 13 '22 16:10 fabian18

Murdock results

:heavy_check_mark: PASSED

fefd8baef6704cad0acdbf9f35807a7fcb9a46c5 sys/preprocessor: add Kconfig file

Success Failures Total Runtime
1983 0 1983 07m:47s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

riot-ci avatar Oct 13 '22 19:10 riot-ci

looks like KConfig is still missing

benpicco avatar Oct 15 '22 22:10 benpicco

Please squash!

benpicco avatar Oct 16 '22 21:10 benpicco

Thank You!

fabian18 avatar Oct 18 '22 08:10 fabian18