Skip to content

Commit 14dae42

Browse files
iabdalkaderdpgeorge
authored andcommitted
extmod/modopenamp: Add new OpenAMP module.
This module implements OpenAMP's basic initialization and shared resources support, and provides support for OpenAMP's RPMsg component, by providing an `endpoint` type (a logical connection on top of RPMsg channel) which can be used to communicate with the remote core. Signed-off-by: iabdalkader <[email protected]>
1 parent 162054b commit 14dae42

File tree

3 files changed

+518
-0
lines changed

3 files changed

+518
-0
lines changed

extmod/extmod.mk

+42
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SRC_EXTMOD_C += \
3131
extmod/modmachine.c \
3232
extmod/modnetwork.c \
3333
extmod/modonewire.c \
34+
extmod/modopenamp.c \
3435
extmod/modos.c \
3536
extmod/modplatform.c\
3637
extmod/modrandom.c \
@@ -515,3 +516,44 @@ include $(TOP)/extmod/btstack/btstack.mk
515516
endif
516517

517518
endif
519+
520+
################################################################################
521+
# openamp
522+
523+
ifeq ($(MICROPY_PY_OPENAMP),1)
524+
OPENAMP_DIR = lib/open-amp
525+
LIBMETAL_DIR = lib/libmetal
526+
GIT_SUBMODULES += $(LIBMETAL_DIR) $(OPENAMP_DIR)
527+
include $(TOP)/extmod/libmetal/libmetal.mk
528+
529+
INC += -I$(TOP)/$(OPENAMP_DIR)
530+
CFLAGS += -DMICROPY_PY_OPENAMP=1
531+
532+
CFLAGS_THIRDPARTY += \
533+
-I$(BUILD)/openamp \
534+
-I$(TOP)/$(OPENAMP_DIR) \
535+
-I$(TOP)/$(OPENAMP_DIR)/lib/include/ \
536+
-DMETAL_INTERNAL \
537+
-DVIRTIO_DRIVER_ONLY \
538+
-DNO_ATOMIC_64_SUPPORT \
539+
-DRPMSG_BUFFER_SIZE=512 \
540+
541+
# OpenAMP's source files.
542+
SRC_OPENAMP_C += $(addprefix $(OPENAMP_DIR)/lib/,\
543+
rpmsg/rpmsg.c \
544+
rpmsg/rpmsg_virtio.c \
545+
virtio/virtio.c \
546+
virtio/virtqueue.c \
547+
virtio_mmio/virtio_mmio_drv.c \
548+
)
549+
550+
# Disable compiler warnings in OpenAMP (variables used only for assert).
551+
$(BUILD)/$(OPENAMP_DIR)/lib/rpmsg/rpmsg_virtio.o: CFLAGS += -Wno-unused-but-set-variable
552+
$(BUILD)/$(OPENAMP_DIR)/lib/virtio_mmio/virtio_mmio_drv.o: CFLAGS += -Wno-unused-but-set-variable
553+
554+
# We need to have generated libmetal before compiling OpenAMP.
555+
$(addprefix $(BUILD)/, $(SRC_OPENAMP_C:.c=.o)): $(BUILD)/openamp/metal/config.h
556+
557+
SRC_THIRDPARTY_C += $(SRC_LIBMETAL_C) $(SRC_OPENAMP_C)
558+
559+
endif # MICROPY_PY_OPENAMP

0 commit comments

Comments
 (0)