Correct way to write simulator driver for x86

Hi Rioters,

I would like to use a simulation driver to fake temperature and humidity data (sht11)

for the native platform (x86). What would be the best way to provide an interface to the fake driver such that the temperature or humidity can be supplied from outside.

I know the tap interface is the way to communicate between the RIOT-OS and a Linux application. But is there is any other way to use IPC to directly communicate with the RIOT process?

My goal is to use large-scale RIOT-OS simulation for academic purpose.


Hi Nazmul,

as you are doing a simulation for native only, you could directly use any linux native functions for the implementation. There are already native modules using standard linux/posix interfaces. They should however be configured to not use RIOT posix includes directories. This is done by overwriting INCLUDES by NATIVEINCLUDES in the module makefile.

boards/native/Makefile:INCLUDES = $(NATIVEINCLUDES)
boards/native/drivers/Makefile:INCLUDES = $(NATIVEINCLUDES)
cpu/native/Makefile:INCLUDES = $(NATIVEINCLUDES)
cpu/native/mtd/Makefile:INCLUDES = $(NATIVEINCLUDES)
cpu/native/netdev_tap/Makefile:INCLUDES = $(NATIVEINCLUDES)
cpu/native/socket_zep/Makefile:INCLUDES = $(NATIVEINCLUDES)

One constraint then, is that this module should not interact with RIOT in its API using posix constants as they could have different values in your native module and in the application modules. (posix defines names, not values).

I do not know if there are other constraints regarding implementing these kind of modules…

Regards, Gaëtan

Thank you Gaëtan for your suggestion.