Deploy external SDK on Pyboard

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Keja
Posts: 12
Joined: Sat Dec 19, 2020 9:56 am

Deploy external SDK on Pyboard

Post by Keja » Sun Apr 25, 2021 3:56 pm

Hello,
Is it possible to deploy an external SDK with both C and C++ files? I have deployed custom C modules with a couple of C files on either a port or via .mpy files but this seems a much harder task to do and I'm not even sure it's possible .

The makefile (I removed the flags and all the files name for readability) of the SDK I m trying to deploy looks like this :

Code: Select all

CC ?= gcc
CXX ?= g++

CFLAGS += list of flags


LDFLAGS += -lm -lstdc++

CSOURCES = list of C sources
CXXSOURCES =list of cpp sources
CCSOURCES =list of cc sources
APP_CSOURCES =source of the custom C function not part of the SDK  

COBJECTS := $(patsubst %.c,%.o,$(CSOURCES))
CXXOBJECTS := $(patsubst %.cpp,%.o,$(CXXSOURCES))
CCOBJECTS := $(patsubst %.cc,%.o,$(CCSOURCES))
APP_COBJECTS = $(patsubst %.c,%.o,$(APP_CSOURCES))

all: app

.PHONY: app clean

$(COBJECTS) : %.o : %.c
$(CXXOBJECTS) : %.o : %.cpp
$(CCOBJECTS) : %.o : %.cc
$(APP_COBJECTS) : %.o : %.c

%.o: %.c
	$(CC) $(CFLAGS) -c $^ -o $@

%.o: %.cc
	$(CXX) $(CFLAGS) $(CXXFLAGS) -c $^ -o $@

%.o: %.cpp
	$(CXX) $(CFLAGS) $(CXXFLAGS) -c $^ -o $@

build/lib.so: $(COBJECTS) $(CXXOBJECTS) $(CCOBJECTS)
	$(MKDIR_BUILD)
	$(CXX) $(COBJECTS) $(CXXOBJECTS) $(CCOBJECTS) -shared -o build/lib.so $(LDFLAGS)

app: $(APP_COBJECTS) build/lib.so
	$(MKDIR_BUILD)
	$(CXX) $(APP_COBJECTS) build/lib.so -o build/$(NAME) $(LDFLAGS)

clean: clean command

Is the .so file can be a problem ?
I read that some ports don't support C++, if that s true which ones do?

Thank you

Post Reply