Update to latest Zephyr and their Docker repo

This commit is contained in:
Sergio R. Caprile committed 2022-10-04 17:24:13 -03:00
1 parent 0b3f6d6aab
commit 1ef0aa14c0
11 files changed
+8885 -14

No files matched your search

+44 -9
View File
@@ -1,17 +1,52 @@
PROJECT_DIR ?= /mnt
ZEPHYR_DIR ?= /zephyrproject
BOARD ?= nucleo_f746zg
DOCKER ?= docker run -v $(realpath $(CURDIR)):/mnt mdashnet/zephyr
PROJECT_DIR ?= /workdir
ZEPHYR_DIR ?= zephyrproject
BOARD ?= qemu_x86
ifeq "$(BOARD)" "qemu_x86"
OVERLAY ?= -DOVERLAY_CONFIG=overlay-e1000.conf
else
OVERLAY ?=
endif
SHAREUSB ?= --privileged -v /dev/bus/usb/:/dev/bus/usb
SHARETUN ?= --cap-add=NET_ADMIN --device /dev/net/tun --net=host
DOCKER ?= docker run --rm -v $(realpath $(CURDIR)):$(PROJECT_DIR)
REPO ?= zephyrprojectrtos/ci
example:
true
build:
cp ../../../mongoose.c ../../../mongoose.h src/
$(DOCKER) /bin/sh -c 'cd $(ZEPHYR_DIR) && west build -b $(BOARD) -p auto $(PROJECT_DIR)'
cp ../../../mongoose.[c,h] src/
$(DOCKER) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR)/zephyr && \
west build -b $(BOARD) -p auto $(PROJECT_DIR) $(OVERLAY) --build-dir $(PROJECT_DIR)/build'
flash:
cd $(ZEPHYR_DIR) && west flash
run:
$(DOCKER) -it $(SHARETUN) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && \
west build -t run --build-dir $(PROJECT_DIR)/build'
clean:
rm -rf */*/mongoose.*
$(DOCKER) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && \
west build -t clean --build-dir $(PROJECT_DIR)/build'
pristine:
$(DOCKER) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && \
west build -t pristine --build-dir $(PROJECT_DIR)/build'
flash:
$(DOCKER) $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && \
west flash --build-dir $(PROJECT_DIR)/build'
debug:
$(DOCKER) -it $(SHAREUSB) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && \
west debug --build-dir $(PROJECT_DIR)/build'
.PHONY: build flash zephyr clean pristine run
zephyr:
ifeq ($(wildcard $(ZEPHYR_DIR)/.*),)
$(DOCKER) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR) && west init ./$(ZEPHYR_DIR)'
endif
$(DOCKER) $(REPO) /bin/sh -c 'cd $(PROJECT_DIR)/$(ZEPHYR_DIR) && west update'
+1
View File
@@ -0,0 +1 @@
../README.md
+1
View File
@@ -8,6 +8,7 @@ CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POLL_MAX=32
CONFIG_POSIX_MAX_FDS=32
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_LOG=y
CONFIG_LOG=y
+17 -1
View File
@@ -39,7 +39,7 @@ static void wcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
mg_http_serve_dir(c, hm, &opts); // static files
}
} else if (ev == MG_EV_OPEN) {
c->is_hexdumping = 1;
// c->is_hexdumping = 1;
}
}
@@ -68,7 +68,23 @@ static void timer_fn(void *arg) {
if (s_boot_timestamp < 9999) mg_sntp_request(s_sntp_conn);
}
// Zephyr: Define a semaphore and network management callback to be able to wait
// until our IP address is ready. The main function will start and block on this
// semaphore until this event handler releases it when the network is ready
K_SEM_DEFINE(run, 0, 1);
static void zeh(struct net_mgmt_event_callback *cb, uint32_t mgmt_event,
struct net_if *iface) {
if (mgmt_event == NET_EVENT_L4_CONNECTED) k_sem_give(&run);
}
int main(int argc, char *argv[]) {
// Zephyr: Register the network management callback and block on the semaphore
struct net_mgmt_event_callback ncb;
net_mgmt_init_event_callback(&ncb, zeh, NET_EVENT_L4_CONNECTED);
net_mgmt_add_event_callback(&ncb);
k_sem_take(&run, K_FOREVER);
struct mg_mgr mgr;
mg_log_set(MG_LL_DEBUG);
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff