diff --git a/Makefile.include b/Makefile.include index 462c3ab82e..cd65dba748 100644 --- a/Makefile.include +++ b/Makefile.include @@ -407,7 +407,10 @@ ifneq (,$(IOTLAB_NODE)) endif # Add standard include directories -INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include +INCLUDES += -I$(RIOTBASE)/core/lib/include +INCLUDES += -I$(RIOTBASE)/core/include +INCLUDES += -I$(RIOTBASE)/drivers/include +INCLUDES += -I$(RIOTBASE)/sys/include # process provided features include $(RIOTBASE)/Makefile.features diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 3ba0c19aae..118eb8a4b4 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -1,5 +1,6 @@ NATIVEINCLUDES += -DNATIVE_INCLUDES NATIVEINCLUDES += -I$(RIOTBOARD)/native/include/ +NATIVEINCLUDES += -I$(RIOTBASE)/core/lib/include/ NATIVEINCLUDES += -I$(RIOTBASE)/core/include/ NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/ diff --git a/core/Makefile b/core/Makefile index f387da65ef..50308607e3 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,5 +1,5 @@ # exclude submodule sources from *.c wildcard source selection -SRC := $(filter-out init.c mbox.c msg.c msg_bus.c panic.c thread_flags.c,$(wildcard *.c)) +SRC := $(filter-out mbox.c msg.c msg_bus.c thread_flags.c,$(wildcard *.c)) # enable submodules SUBMODULES := 1 diff --git a/core/lib/Makefile b/core/lib/Makefile new file mode 100644 index 0000000000..43b65f5209 --- /dev/null +++ b/core/lib/Makefile @@ -0,0 +1,12 @@ +MODULE = core_lib + +# enable submodules +SUBMODULES := 1 +# set this so the panic and init code is available as "core_panic" and "core_init" +# instead of "core_lib_..." +BASE_MODULE = core + +# exclude submodule sources from *.c wildcard source selection +SRC := $(filter-out panic.c init.c,$(wildcard *.c)) + +include $(RIOTBASE)/Makefile.base diff --git a/core/assert.c b/core/lib/assert.c similarity index 100% rename from core/assert.c rename to core/lib/assert.c diff --git a/core/atomic_c11.c b/core/lib/atomic_c11.c similarity index 100% rename from core/atomic_c11.c rename to core/lib/atomic_c11.c diff --git a/core/atomic_sync.c b/core/lib/atomic_sync.c similarity index 100% rename from core/atomic_sync.c rename to core/lib/atomic_sync.c diff --git a/core/bitarithm.c b/core/lib/bitarithm.c similarity index 100% rename from core/bitarithm.c rename to core/lib/bitarithm.c diff --git a/core/clist.c b/core/lib/clist.c similarity index 100% rename from core/clist.c rename to core/lib/clist.c diff --git a/core/include/assert.h b/core/lib/include/assert.h similarity index 100% rename from core/include/assert.h rename to core/lib/include/assert.h diff --git a/core/include/bitarithm.h b/core/lib/include/bitarithm.h similarity index 100% rename from core/include/bitarithm.h rename to core/lib/include/bitarithm.h diff --git a/core/include/cib.h b/core/lib/include/cib.h similarity index 100% rename from core/include/cib.h rename to core/lib/include/cib.h diff --git a/core/include/clist.h b/core/lib/include/clist.h similarity index 100% rename from core/include/clist.h rename to core/lib/include/clist.h diff --git a/core/include/debug.h b/core/lib/include/debug.h similarity index 100% rename from core/include/debug.h rename to core/lib/include/debug.h diff --git a/core/include/irq.h b/core/lib/include/irq.h similarity index 100% rename from core/include/irq.h rename to core/lib/include/irq.h diff --git a/core/include/kernel_defines.h b/core/lib/include/kernel_defines.h similarity index 100% rename from core/include/kernel_defines.h rename to core/lib/include/kernel_defines.h diff --git a/core/include/kernel_init.h b/core/lib/include/kernel_init.h similarity index 100% rename from core/include/kernel_init.h rename to core/lib/include/kernel_init.h diff --git a/core/include/list.h b/core/lib/include/list.h similarity index 100% rename from core/include/list.h rename to core/lib/include/list.h diff --git a/core/include/log.h b/core/lib/include/log.h similarity index 100% rename from core/include/log.h rename to core/lib/include/log.h diff --git a/core/include/macros/units.h b/core/lib/include/macros/units.h similarity index 100% rename from core/include/macros/units.h rename to core/lib/include/macros/units.h diff --git a/core/include/macros/xtstr.h b/core/lib/include/macros/xtstr.h similarity index 100% rename from core/include/macros/xtstr.h rename to core/lib/include/macros/xtstr.h diff --git a/core/include/panic.h b/core/lib/include/panic.h similarity index 100% rename from core/include/panic.h rename to core/lib/include/panic.h diff --git a/core/include/priority_queue.h b/core/lib/include/priority_queue.h similarity index 100% rename from core/include/priority_queue.h rename to core/lib/include/priority_queue.h diff --git a/core/include/ringbuffer.h b/core/lib/include/ringbuffer.h similarity index 100% rename from core/include/ringbuffer.h rename to core/lib/include/ringbuffer.h diff --git a/core/include/rmutex.h b/core/lib/include/rmutex.h similarity index 100% rename from core/include/rmutex.h rename to core/lib/include/rmutex.h diff --git a/core/include/thread_config.h b/core/lib/include/thread_config.h similarity index 100% rename from core/include/thread_config.h rename to core/lib/include/thread_config.h diff --git a/core/include/xfa.h b/core/lib/include/xfa.h similarity index 100% rename from core/include/xfa.h rename to core/lib/include/xfa.h diff --git a/core/init.c b/core/lib/init.c similarity index 100% rename from core/init.c rename to core/lib/init.c diff --git a/core/panic.c b/core/lib/panic.c similarity index 100% rename from core/panic.c rename to core/lib/panic.c diff --git a/core/priority_queue.c b/core/lib/priority_queue.c similarity index 100% rename from core/priority_queue.c rename to core/lib/priority_queue.c diff --git a/core/ringbuffer.c b/core/lib/ringbuffer.c similarity index 100% rename from core/ringbuffer.c rename to core/lib/ringbuffer.c diff --git a/core/rmutex.c b/core/lib/rmutex.c similarity index 100% rename from core/rmutex.c rename to core/lib/rmutex.c diff --git a/makefiles/application.inc.mk b/makefiles/application.inc.mk index 68e867f268..0460b057c1 100644 --- a/makefiles/application.inc.mk +++ b/makefiles/application.inc.mk @@ -1,7 +1,7 @@ MODULE = $(APPLICATION_MODULE) DIRS += $(RIOTCPU)/$(CPU) $(BOARDDIR) -DIRS += $(RIOTBASE)/core $(RIOTBASE)/drivers $(RIOTBASE)/sys +DIRS += $(RIOTBASE)/core $(RIOTBASE)/core/lib $(RIOTBASE)/drivers $(RIOTBASE)/sys # For regular modules, adding files to BLOBS to their Makefile is sufficient to # create the corresponding headers. diff --git a/makefiles/defaultmodules.inc.mk b/makefiles/defaultmodules.inc.mk index 74849bbbab..8e3f6b21df 100644 --- a/makefiles/defaultmodules.inc.mk +++ b/makefiles/defaultmodules.inc.mk @@ -1,4 +1,7 @@ -DEFAULT_MODULE += board board_common_init cpu core core_init core_msg core_panic sys +DEFAULT_MODULE += board board_common_init \ + cpu \ + core core_init core_lib core_msg core_panic \ + sys # Include potentially added default modules by the board -include $(BOARDDIR)/Makefile.default diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 2531e39681..94ce28ad20 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -274,6 +274,9 @@ PSEUDOMODULES += ztimer64_% ## configuration header board.h. These can be found out by running tests/ztimer_overhead PSEUDOMODULES += ztimer_auto_adjust +# core_lib is not a submodule +NO_PSEUDOMODULES += core_lib + # ztimer's main module is called "ztimer_core" NO_PSEUDOMODULES += ztimer_core NO_PSEUDOMODULES += netdev_ieee802154_submac