AtomVM
AtomVM copied to clipboard
Allow cross platform code and components
- Following directories will be created:
-
src/common
-
src/components
-
src/common
will contain common code, that can be shared across different platforms. A platform might require a "common module", but it is not mandatory to build and use all of them. E.g.src/libAtomVM/inet.(c,h)
should be moved tosrc/common/inet/inet.(c,h)
, so it might be used from network enabled platforms, butSTM32
platform will not build and use it. -
src/components
will contain cross platform components. This will be useful for components that are the same across different platforms. Compared tosrc/common
,src/components
is focused on complete (and standalone) components, that are accessible from erlang as NIFs or port driver. E.g.src/libAtomVM/otp_socket.c
should be moved tosrc/components/socket/otp_socket.c
and ESP32 crypto functions should be moved tosrc/components/crypto/crypto.c
.
A reorganization of the code would be very welcome.
It's not clear how this would be articulated with CMake targets. The only platform with components is esp32 and they do define targets per component. Do we want an otp_socket component that could be included by various platforms? How would we configure them? Right now, we need otp_socket_platform.c for several platforms. This component also relies on inet.h and inet.c. Should it link an inet library?
Do we want a libatomvmcore and libatomvmsocket, libatomvmcrypto, libatomvminet?