diff --git a/.Makefile.mk b/.Makefile.mk deleted file mode 100644 index db5d368..0000000 --- a/.Makefile.mk +++ /dev/null @@ -1,277 +0,0 @@ -# -# see .Makefile.template for help -# - -### variables ### - -VARIABLE+=ESPPORT -HELP_ESPPORT=which device to flash/monitor -export ESPPORT - -### internal variables ### - -# assume /etc/passwd holds right shell of user -USERSHELL=$(shell awk -F ':' '/^'$$(id -un)':/{print $$NF}' /etc/passwd) - -# export any additional docker options for docker Makefile -export DOCKEROPTS - -# assume we are in projectdir -PROJECTDIR=$(shell pwd) - -# assume dirname is projectname -PROJECT=$(notdir $(shell pwd)) - -# assume docker Makefile dir -DOCKERDIR=../docker - -# assume template path -TEMPLATEPATH=../.Makefile.template - -### default target ### -DEFAULT += help - -### menuconfig targets ### - -.PHONY: menuconfig -TARGET += menuconfig - -HELP_menuconfig = configure project -menuconfig: | check-docker - @make --no-print-directory -C $(DOCKERDIR) idf \ - WORKDIR=$(PROJECTDIR) \ - EXEC="idf.py menuconfig" - -### build targets ### - -.PHONY: reconfigure -TARGET += reconfigure -ALL += reconfigure -HELP_reconfigure = reconfigure project (rebuilds cmake files) -reconfigure: | check-docker - @make --no-print-directory -C $(DOCKERDIR) idf \ - WORKDIR=$(PROJECTDIR) \ - EXEC="idf.py reconfigure" - -.PHONY: build -TARGET += build -ALL += build -HELP_build = build project -build: | check-docker - @make --no-print-directory -C $(DOCKERDIR) idf \ - WORKDIR=$(PROJECTDIR) \ - EXEC="idf.py --ccache build" - -.PHONY: clean-build -CLEAN += clean-build -HELP_clean-build = remove generated files of project components -clean-build: | check-docker - rm -rf $(addprefix $(PROJECTDIR)/build/esp-idf/, $(shell find $(PROJECTDIR)/../components -mindepth 1 -maxdepth 1 -type d -printf "%f\n") main) - -.PHONY: distclean-build -DISTCLEAN += distclean-build -HELP_distclean-build = remove all generated files -distclean-build: - rm -f $(PROJECTDIR)/sdkconfig - rm -rf $(PROJECTDIR)/build - -### flash targets ### - -.PHONY: flash -TARGET += flash -HELP_flash = flash project to esp. Use ESPPORT=path to provide path to device or use make dev -flash: | check-flash - @make --no-print-directory -C $(DOCKERDIR) idf \ - WORKDIR=$(PROJECTDIR) \ - EXEC="sudo chgrp developer $(ESPPORT);\ - idf.py flash -p '$(ESPPORT)'" - -.PHONY: check-flash -CHECK += check-flash -HELP_check-flash = check env if flashing is possible -check-flash: | check-docker check-dev - -### monitor targets ### - -.PHONY: monitor -TARGET += monitor -HELP_monitor = connect to esp32 via serial. Use ESPPORT=path to provide path to device or use make dev -monitor: | check-monitor - @make --no-print-directory -C $(DOCKERDIR) idf \ - WORKDIR=$(PROJECTDIR) \ - EXEC="sudo chgrp developer $(ESPPORT); \ - idf.py monitor -p '$(ESPPORT)'" - -.PHONY: check-monitor -CHECK += check-monitor -HELP_check-monitor = check env if monitor is possible -check-monitor: | check-docker check-dev - -### vscode ### - -.PHONY: vscode -TARGET += vscode -HELP_vscode = starts vscode inside docker container -vscode: | check-docker - @make --no-print-directory -C $(DOCKERDIR) vscode \ - WORKDIR=$(PROJECTDIR) \ - EXEC="code .; bash" - -### qemu targets ### - -.PHONY: qemu -TARGET += qemu -HELP_qemu = start qemu and run build image -qemu: qemu-image | check-docker - @make --no-print-directory -C $(DOCKERDIR) qemu \ - WORKDIR=$(PROJECTDIR) \ - EXEC="echo \"############################\"; \ - echo \"# TO EXIT QEMU: #\"; \ - echo \"############################\"; \ - qemu-system-xtensa \ - -no-reboot \ - -nographic \ - -machine esp32 \ - -drive file=$(PROJECTDIR)/build/qemu.bin,if=mtd,format=raw \ - 2>&1 | tee build/qemu.log; \ - grep -q \"0 Failures\" build/qemu.log" - -.PHONY: qemu-image -TARGET_qemu += qemu-image -HELP_qemu-image = converts build image to image runnable by qemu -qemu-image: $(PROJECTDIR)/build/qemu.bin -.DELETE_ON_ERROR: $(PROJECTDIR)/build/qemu.bin -$(PROJECTDIR)/build/qemu.bin: $(PROJECTDIR)/build/$(PROJECT).bin - dd if=/dev/zero bs=1024 count=4096 of=$@ - dd if=$(PROJECTDIR)/build/bootloader/bootloader.bin bs=1 seek=$$((0x1000)) of=$@ conv=notrunc - dd if=$(PROJECTDIR)/build/partition_table/partition-table.bin bs=1 seek=$$((0x8000)) of=$@ conv=notrunc - dd if=$(PROJECTDIR)/build/$(PROJECT).bin bs=1 seek=$$((0x10000)) of=$@ conv=notrunc - -.PHONY: qemu-gdb -TARGET += qemu-gdb -HELP_qemu-gdb = start qemu and wait for gdb -qemu-gdb: qemu-image | check-docker - @make --no-print-directory -C $(DOCKERDIR) qemu \ - DOCKEROPTS="--name $(PROJECT).qemu" \ - WORKDIR=$(PROJECTDIR) \ - EXEC="echo \"###################################\"; \ - echo \"# TO START GDB RUN #\"; \ - echo \"# make PROJECT= gdb-qemu #\"; \ - echo \"# IN ANOTHER SHELL #\"; \ - echo \"###################################\"; \ - qemu-system-xtensa \ - -s -S \ - -no-reboot \ - -nographic \ - -machine esp32 \ - -drive file=build/qemu.bin,if=mtd,format=raw" - - -### gdb targets ### - -.PHONY: gdb-qemu -TARGET += gdb-qemu -gdb-HELP_qemu = start gdb and connect to qemu -gdb-qemu: $(PROJECTDIR)/build/$(PROJECT).elf | check-docker - docker exec -ti $(PROJECT).qemu \ - bash -ic "xtensa-esp32-elf-gdb $^ \ - -ex \"target remote :1234\" \ - -ex \"tb app_main\" \ - -ex \"c\"" - -### dev targets ### - -.PHONY: dev -TARGET += dev -HELP_dev = specify which USB device to connect to -dev: | check-dialog - export ESPPORT=$$((for dev in $$(ls /dev/serial/by-id); do echo "$$(readlink -f /dev/serial/by-id/$$dev) $$dev "; done ) \ - | dialog \ - --stdout \ - --menu "choose which device to use" 0 0 0 "none" "disable device passthrough"\ - --file /dev/stdin);\ - clear; \ - exec $(USERSHELL) - -.PHONY: check-dev -CHECK += check-dev -HELP_check-dev = check if device is specified -check-dev: - @1>&2 echo -n "checking if device is valid & specified..." -ifndef ESPPORT - @1>&2 echo - @1>&2 echo "##############################" - @1>&2 echo "# FLASH DEVICE NOT SPECIFIED #" - @1>&2 echo "##############################" - @1>&2 echo - @1>&2 echo "specify device by adding ESPPORT as parameter" - @1>&2 echo - @1>&2 echo "make $(MAKECMDGOALS) ESPPORT=/path/to/device" - @1>&2 echo - @1>&2 echo "or by running" - @1>&2 echo - @1>&2 echo "make dev" - @1>&2 echo - @exit 1 -endif -ifeq ($(shell ! test -c $(ESPPORT); echo $$?),0) - @1>&2 echo - @1>&2 echo "#############################" - @1>&2 echo "# FLASH DEVICE IS NOT VALID #" - @1>&2 echo "#############################" - @1>&2 echo - @1>&2 echo "the specified device ($(ESPPORT)) is not a character device!" - @1>&2 echo - @1>&2 echo "specify device by adding ESPPORT as parameter" - @1>&2 echo - @1>&2 echo "make $(MAKECMDGOALS) ESPPORT=/path/to/device" - @1>&2 echo - @1>&2 echo "or by running" - @1>&2 echo - @1>&2 echo "make dev" - @1>&2 echo - @exit 1 -endif - @1>&2 echo "SUCCESS" - -.PHONY: check-dialog -CHECK += check-dialog -HELP_check-dialog = check if dialog is installed -check-dialog: - @1>&2 echo -n "checking if dialog is installed..." -ifeq ($(shell which dialog 2> /dev/null),) - @1>&2 echo - @1>&2 echo "###########################" - @1>&2 echo "# DIALOG IS NOT INSTALLED #" - @1>&2 echo "###########################" - @1>&2 echo - @1>&2 echo "Consider installing dialog." - @1>&2 echo - @1>&2 echo "on debian based systems:" - @1>&2 echo " sudo apt-get install dialog" - @1>&2 echo - @1>&2 echo "on arch based systems:" - @1>&2 echo " sudo pacman -S dialog" - @1>&2 echo - @exit 1 -endif - @1>&2 echo "SUCCESS" - -### docker targets ### - -.PHONY: check-docker -CHECK += check-docker -HELP_check-docker = check if docker is usable -check-docker: - @make --no-print-directory -C $(DOCKERDIR) check - -### git targets - -.PHONY: setup-git -SETUP += setup-git -HELP_setup-git = setup git commit message -setup-git: - git config --replace-all commit.template .gitcommitmsg - git config --replace-all pull.rebase true - -include $(TEMPLATEPATH) diff --git a/.Makefile.template b/.Makefile.template deleted file mode 100644 index 647f1a8..0000000 --- a/.Makefile.template +++ /dev/null @@ -1,113 +0,0 @@ -############################################################################### -### MAKEFILE TEMPLATE ### -############################################################################### -# This Makefile template can be used to qickly generate help messages for make. -# It is based on dynamic variables (see make manual) -# -# THIS MAKEFILE NEEDS TO BE INCLUDED AFTER ALL DECLARATIONS -# -# predefined targets: -# default: is executed when no target is specified -# all: executes all steps -# check: check if targets can run -# setup: modify environment -# clean: remove generated files -# distclean: remove everything that was created by the toolchain -# -# to add your own targets to these predefined targets, -# just append your target name to the uppercase variable. -# I.e. to add your target 'build' to 'default' and 'all', do -# ALL+=build -# DEFAULT+=build -# -# own targets should be added to the 'TARGET' variable, so help can find them. -# I.e. to add your target 'build', do -# TARGET+=build -# -# if a target has subtargets, you can add them to the 'TARGET_' to -# indicate them as subtarget. -# I.e. to add your subtarget 'build-lib' of 'build', do -# TARGET_build+=build-lib -# -# to set the help text you have to set the variable 'HELP_' -# I.e to add the helptext for our 'build' target, do -# HELP_build=builds project -# -# if you want to define variables, just add them to 'VARIABLES' -# I.e to add the variable 'CXX', do -# VARIABLE+=CXX -# HELP_CXX=what compiler to use -# - -.DEFAULT_GOAL=default - -HELP_default = make $(DEFAULT) -.PHONY: default -default: $(DEFAULT) - -HELP_all = make $(ALL) -.PHONY: all -all: $(ALL) - -HELP_check = make $(CHECK) -.PHONY: check -check: $(CHECK) - -HELP_setup = make $(SETUP) -.PHONY: setup -setup: $(SETUP) - -HELP_clean = make $(CLEAN) -.PHONY: clean -clean: $(CLEAN) - -HELP_distclean = make clean $(DISTCLEAN) -.PHONY: distclean -distclean: clean $(DISTCLEAN) - -.PHONY: help -help: - @echo "--- help ---" - @[ -n "$(DEFAULT)" ] && echo -e "make \n\t$(HELP_default)" || true; - @[ -n "$(ALL)" ] && echo -e "make all \n\t$(HELP_all)" || true; - @[ -n "$(CHECK)" ] && echo -e "make check \n\t$(HELP_check)" || true; - @[ -n "$(SETUP)" ] && echo -e "make setup \n\t$(HELP_setup)" || true; - @[ -n "$(CLEAN)" ] && echo -e "make clean \n\t$(HELP_clean)" || true; - @[ -n "$(DISTCLEAN)" ] && echo -e "make distclean\n\t$(HELP_distclean)" || true; - @echo - @$(foreach \ - target, \ - $(TARGET), \ - echo "make $(target)"; \ - [ -n "$(HELP_$(target))" ] && echo -e "\t$(HELP_$(target))" || true; \ - ) - @$(foreach \ - target, \ - $(TARGET), \ - [ -n "$(TARGET_$(target))" ] && echo -e "\n--- $(target) sub targets ---" || true; \ - $(foreach \ - subtarget, \ - $(TARGET_$(target)), \ - echo "make $(subtarget)"; \ - [ -n "$(HELP_$(subtarget))" ] && echo -e "\t$(HELP_$(subtarget))" || true; \ - ) \ - ) - @$(foreach \ - main, \ - CHECK SETUP CLEAN DISTCLEAN, \ - [ -n "$($(main))" ] && echo -e "\n--- $(main) sub targets ---" || true; \ - $(foreach \ - target, \ - $($(main)), \ - echo "make $(target)"; \ - [ -n "$(HELP_$(target))" ] && echo -e "\t$(HELP_$(target))" || true; \ - ) \ - ) - @[ -n "$(VARIABLE)" ] && echo -e "\n--- VARIABLES ---" || true; - @$(foreach \ - variable, \ - $(VARIABLE), \ - echo "$(variable)"; \ - [ -n "$(HELP_$(variable))" ] && echo -e "\t$(HELP_$(variable))" || true; \ - echo -e "\t(currently: $($(variable)))"; \ - ) diff --git a/.gitcommitmsg b/.gitcommitmsg deleted file mode 100644 index cf06679..0000000 --- a/.gitcommitmsg +++ /dev/null @@ -1,30 +0,0 @@ -#makefile:fix -#makefile:feature -#makefile:refactor -#docker:fix -#docker:feature -#docker:refactor -#pio:fix -#pio:feature -#pio:refactor -#esp32:fix -#esp32:feature -#esp32:refactor -#ulp:fix -#ulp:feature -#ulp:refactor - -####################################################### -### A single commit should only be using one prefix ### -### : ### -### action descriptions: ### -### fix : corrected undesired effect ### -### feature : added functionality ### -### refactor : rewrote sth, no feature or fix ### -### for example ### -### ### -### esp32:feature added uart support ### -### added device dependencies and callback support ### -### ### -####################################################### - diff --git a/.github/workflows/lifesensor.yml b/.github/workflows/lifesensor.yml deleted file mode 100644 index 425f5d8..0000000 --- a/.github/workflows/lifesensor.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Build project lifesensor - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: build idf image - run: make -C docker idf-image - - name: build idf project - run: make -C lifesensor DOCKEROPTS=--tty=false build diff --git a/.github/workflows/lifesensor_ci.yml b/.github/workflows/lifesensor_ci.yml deleted file mode 100644 index 0217697..0000000 --- a/.github/workflows/lifesensor_ci.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Project lifesensor_ci - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: build idf image - run: make -C docker idf-image - - name: build qemu image - run: make -C docker qemu-image - - name: build idf project - run: make -C lifesensor_ci DOCKEROPTS=--tty=false build - - name: convert firmware image - run: make -C lifesensor_ci DOCKEROPTS=--tty=false qemu-image - - name: run qemu - run: make -C lifesensor_ci DOCKEROPTS=--tty=false qemu diff --git a/.github/workflows/lifesensor_test.yml b/.github/workflows/lifesensor_test.yml deleted file mode 100644 index 178ef73..0000000 --- a/.github/workflows/lifesensor_test.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Build project lifesensor_test - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: build idf image - run: make -C docker idf-image - - name: build idf project - run: make -C lifesensor_test DOCKEROPTS=--tty=false build diff --git a/.github/workflows/push_pr.yml b/.github/workflows/push_pr.yml new file mode 100644 index 0000000..216c97e --- /dev/null +++ b/.github/workflows/push_pr.yml @@ -0,0 +1,21 @@ +name: Project LifeSensor + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build Docker Images + run: make -C docker build + - name: Build Parts + run: make -C parts DOCKER_VARS_OPTIONS=--tty=false build + - name: Test Parts + run: make -C parts DOCKER_VARS_OPTIONS=--tty=false test + - name: Build Products + run: make -C products DOCKER_VARS_OPTIONS=--tty=false build + - name: Test Products + run: make -C products DOCKER_VARS_OPTIONS=--tty=false test diff --git a/.make/README.md b/.make/README.md new file mode 100644 index 0000000..12a66d2 --- /dev/null +++ b/.make/README.md @@ -0,0 +1,69 @@ +# Makefiles + +This is a collection of Makefiles that may be included for some default behavior. + +## General Makefiles + +### [help.mk](./help.mk) +- generates help text as default target +- help text is generated by adding targets & variables to dynamic variables +- variables + - `TARGETS` + - tracks targets that should appear in help text + - `TARGETS_` + - tracks targets that should appear as a subtarget of `` + - `VARIABLES` + - tracks groups of variables that should appear in help text + - `VARIABLES_` + - tracks variables that should appear as part og the `` group in help text + - `HELP_` + - if `` is in `TARGETS` or `VARIABLES` it is used as help text + + + +### [common.mk](./common.mk) +- common behavior for all Makefiles + - includes `help.mk` + - should be used as base if new specific Makefile is added +- creates common targets + - `all` + - `build` + - `test` + - `check` + - `setup` + - `clean` + - `distclean` + - `docker` + - starts docker container + - onlt exists if `DOCKER_IMAGE` is specified +- variables + - `DEPENDS` + - array of directories + - if common target is executed, make will execute the same target in these directories prior to executing it in the current Makefile + - `DOCKER_IMAGE` + - default docker image to use if target should be executed in docker + - `DOCKER_` + - custom docker image for the target `` + - `DOCKER` + - tracks targets which should be executed inside the specified docker image + - when one target is executed in docker, dependencies are also executed in docker if not specified otherwise + - `NO_DOCKER` + - tracks targets which shall not be executed inside docker + +## Specific Makefiles + +### [docker.mk](./docker.mk) + +- common behavior for all docker images + +### [idf.mk](./idf.mk) + +- common behavior for all idf framework related projects + +### [part.mk](./part.mk) + +- common behaviour for all parts + +### [product.mk](./product.mk) + +- common behaviour for all products diff --git a/.make/common.mk b/.make/common.mk new file mode 100644 index 0000000..057cca3 --- /dev/null +++ b/.make/common.mk @@ -0,0 +1,137 @@ +.DEFAULT_GOAL := help +HELP ?= LifeSensor Makefile + +VARIABLES += MAKEFILE +HELP_MAKEFILE := Makefile options + +VARIABLES_MAKEFILE += DEPENDS +HELP_DEPENDS ?= dependencies that should be run prior to this Makefile +DEPENDS ?= #empty + +VARIABLES_MAKEFILE += DOCKER +HELP_DOCKER := run target inside docker (disable with 'DOCKER=') +DOCKER ?= #empty + +VARIABLES_MAKEFILE += DOCKER_IMAGE +HELP_DOCKER_IMAGE := docker image to use for targets +DOCKER_IMAGE ?= #empty + +VARIABLES_MAKEFILE += DOCKER_VARS +HELP_DOCKER_VARS := variables to pass to docker Makefile when running docker as shell +DOCKER_VARS ?= #empty + +ifeq ($(find OPTIONS, $(DOCKER_VARS)),) +DOCKER_VARS += OPTIONS +DOCKER_VARS_OPTIONS ?= #empty +# for github actions set to +# DOCKER_VARS_OPTIONS := --tty=false +endif + +ifeq ($(find WORKDIR, $(DOCKER_VARS)),) +DOCKER_VARS += WORKDIR +DOCKER_VARS_WORKDIR := $(shell pwd) +endif + +ifeq ($(find MOUNT, $(DOCKER_VARS)),) +DOCKER_VARS += MOUNT +DOCKER_VARS_MOUNT := $(shell git rev-parse --show-toplevel) +endif + +TARGETS_common += all +TARGETS_common += build +TARGETS_common += test +TARGETS_common += check +TARGETS_common += setup +TARGETS_common += clean +TARGETS_common += distclean + +define TEMPLATE_DEPEND_TARGET +.PHONY: $3 +TARGETS_$2 := $3 $(TARGETS_$2) +HELP_$3 := run 'make -C $1 $4' +NO_DOCKER += $3 +$3: + $(MAKE) -C $1 $4 +endef + +$(foreach \ + SUBDIR, \ + $(DEPENDS), \ + $(foreach \ + TARGET, \ + $(TARGETS_common), \ + $(eval $(call TEMPLATE_DEPEND_TARGET,$(SUBDIR),$(TARGET),$(TARGET)-$(SUBDIR),$(TARGET))) \ + ) \ +) + +define TEMPLATE_COMMON_TARGET +.PHONY: $1 +HELP_$1 ?= run common $1 jobs ($2) +NO_DOCKER += $1 +$1: $(TARGETS_$1) +endef + +TARGETS_distclean := clean $(TARGETS_distclean) +HELP_all := run common jobs ($(TARGETS_all)) +$(foreach \ + TARGET, \ + $(TARGETS_common), \ + $(eval $(call TEMPLATE_COMMON_TARGET,$(TARGET),$(TARGETS_$(TARGET)))) \ +) + +.PHONY: docker +ifdef DOCKER_IMAGE +TARGETS += docker +HELP_docker := enter docker container +docker: + $(MAKE) -C $(shell git rev-parse --show-toplevel)/docker/$(DOCKER_IMAGE) run \ + WORKDIR=$(shell pwd) \ + MOUNT=$(shell git rev-parse --show-toplevel) \ + EXEC=bash +else +docker: ; +endif + +define TEMPLATE_DOCKER_TARGET +$(if $(DOCKER_$1),,$(if $(DOCKER_IMAGE), $(eval DOCKER_$1 := $(DOCKER_IMAGE)),$(error TARGET '$1' MISSES DOCKER IMAGE!. SET 'DOCKER_$1 = '))) +DOCKER_IMAGES += $(DOCKER_$1) +$1: | docker-$(DOCKER_$1) docker-info +$1: SHELL := $(shell $(MAKE) -sC $$(git rev-parse --show-toplevel)/docker/$(DOCKER_$1) shell $(foreach VAR,$(DOCKER_VARS),$(VAR)=$(DOCKER_VARS_$(VAR))) | grep "docker run" ) +endef + +$(foreach \ + TARGET, \ + $(DOCKER), \ + $(eval $(call TEMPLATE_DOCKER_TARGET,$(TARGET))) \ +) + +define TEMPLATE_DOCKER_IMAGE +docker-$1: SHELL := /bin/bash +docker-$1: + $(MAKE) -C $(shell git rev-parse --show-toplevel)/docker/$1 build +endef + +.PHONY: docker-info +docker-info: + $(info RUNNING IN DOCKER: $(SHELL)) + +$(foreach \ + IMAGE, \ + $(sort $(DOCKER_IMAGES)), \ + $(eval $(call TEMPLATE_DOCKER_IMAGE,$(IMAGE))) \ +) + +define TEMPLATE_NODOCKER_TARGET +$1: SHELL := /bin/bash +endef + +$(foreach \ + TARGET, \ + $(sort $(NO_DOCKER)), \ + $(eval $(call TEMPLATE_NODOCKER_TARGET,$(TARGET))) \ +) + +include $(shell git rev-parse --show-toplevel)/.make/templating.mk + +TARGETS := $(TARGETS_common) $(TARGETS) +include $(shell git rev-parse --show-toplevel)/.make/help.mk diff --git a/.make/docker.mk b/.make/docker.mk new file mode 100644 index 0000000..f35644a --- /dev/null +++ b/.make/docker.mk @@ -0,0 +1,162 @@ +HELP := LifeSensor docker image & container + +COMMIT := $(shell git rev-list --all --abbrev-commit -1 -- $(realpath $(firstword $(MAKEFILE_LIST)))) +ifndef COMMIT +COMMIT := unknown +$(warning COMMIT OF $(realpath $(firstword $(MAKEFILE_LIST))) UNDEFINED!) +endif + +VERSION := $(shell basename $$(dirname $(realpath $(firstword $(MAKEFILE_LIST))))) +ifndef VERSION +VERSION := unknown +$(warning VERSION OF $(realpath $(firstword $(MAKEFILE_LIST))) UNDEFINED!) +endif + +NAME := $(shell basename $$(dirname $$(dirname $(realpath $(firstword $(MAKEFILE_LIST)))))) +ifndef NAME +NAME := unknown +$(error NAME OF $(realpath $(firstword $(MAKEFILE_LIST))) UNDEFINED!) +endif + +VARIABLES += DOCKER_IMAGE +HELP_DOCKER_IMAGE := docker image options + +VARIABLES_DOCKER_IMAGE += IMAGE +HELP_IMAGE := name of the docker image +IMAGE := lifesensor/$(NAME)/$(VERSION) + +VARIABLES_DOCKER_IMAGE += TAG +HELP_TAG := tag of the docker image +TAG ?= latest + + +VARIABLES += DOCKER_BUILD +HELP_DOCKER_BUILD := docker build options + +VARIABLES_DOCKER_BUILD += $(ARGS) + +VARIABLES_DOCKER_BUILD += BUILD +HELP_BUILD := additional docker build options +BUILD ?= #empty + +VARIABLES += DOCKER_RUN +HELP_DOCKER_RUN := docker run options + +VARIABLES_DOCKER_RUN += OPTIONS +HELP_OPTIONS := additional docker run options +OPTIONS ?= #empty + +VARIABLES_DOCKER_RUN += VOLUMES +HELP_VOLUMES := volumes to mount inside container +VOLUMES ?= #empty + +VARIABLES_DOCKER_RUN += WORKDIR +HELP_WORKDIR := where to start in docker volume +WORKDIR ?= #empty + +VARIABLES_DOCKER_RUN += ENVS +HELP_ENVS := additional environment variables to set +ENVS ?= #empty + +VARIABLES_DOCKER_RUN += EXEC +HELP_EXEC := additional environment variables to set +EXEC ?= /bin/bash + +VARIABLES_DOCKER_RUN += MOUNT +HELP_MOUNT := what directory to mount into the container +MOUNT ?= #empty + +VARIABLES_DOCKER_RUN += DEVICE +HELP_DEVICE := what device to pass into the container +DEVICE ?= #empty + +.PHONY: build-image +TARGETS_build += build-image +HELP_build-image := build docker image '$(IMAGE):$(TAG)' +build-image: | check-docker + docker build \ + $(foreach ARG,$(ARGS),--build-arg=$(ARG)=$($(ARG)) ) \ + $(BUILD) \ + -t "$(IMAGE):$(COMMIT)" \ + . + docker image tag "$(IMAGE):$(COMMIT)" "$(IMAGE):$(TAG)" + +.PHONY: run +TARGETS += run +HELP_run := run docker image '$(IMAGE):$(TAG)' +run: build | check-docker + docker run --rm -ti --hostname $(NAME) --name $(NAME)\ + $(foreach VOLUME, $(VOLUMES),-v "$(VOLUME)" ) \ + $(foreach ENV, $(ENVS),-e "$(ENV)" ) \ + $(if $(WORKDIR),-w "$(WORKDIR)") \ + $(if $(DEVICE),--device "$(DEVICE)") \ + $(if $(MOUNT),-v $(abspath $(MOUNT)):$(abspath $(MOUNT)):rw) \ + $(OPTIONS) \ + "$(IMAGE):$(TAG)" \ + /bin/bash -ic '$(EXEC)' + +.PHONY: shell +TARGETS += shell +HELP_shell := prints command used by run without executing anything +shell: + echo docker run --rm -ti --hostname $(NAME) --name $(NAME)\ + $(foreach VOLUME, $(VOLUMES),-v "$(VOLUME)" ) \ + $(foreach ENV, $(ENVS),-e "$(ENV)" ) \ + $(if $(WORKDIR),-w "$(WORKDIR)") \ + $(if $(DEVICE),--device "$(DEVICE)") \ + $(if $(MOUNT),-v $(abspath $(MOUNT)):$(abspath $(MOUNT)):rw) \ + $(OPTIONS) \ + "$(IMAGE):$(TAG)"\ + /bin/bash -i + +.PHONY: exec +TARGETS += exec +HELP_run := execute command in docker container '$(NAME)' +exec: build | check-docker + docker exec -ti $(NAME) /bin/bash -ic '$(EXEC)' + +.PHONY: clean-volume +TARGETS_clean += clean-volume +HELP_clean-volume := delete docker volumes +clean-volume: | check-docker + $(foreach \ + VOLUME, \ + $(shell echo "$(VOLUMES)"| tr ' ' '\n' | grep -o '^[^/][^:]*'), \ + docker volume rm -f $(VOLUME); \ + ) + +.PHONY: distclean-image +TARGETS_distclean += distclean-image +HELP_distclean-image := delete docker image +distclean-image: | check-docker + for parent in $$(docker images $(IMAGE) -q | sort -u); \ + do \ + echo $$parent; \ + for image in $$(docker images -q --filter since=$$parent);\ + do \ + docker history $$image | grep -q $$parent && echo $$image; \ + done; \ + done | sort -u | xargs -r docker image rm -f + +.PHONY: check-docker +check-docker: +ifeq ($(shell which docker 2> /dev/null),) + @1>&2 echo "########################################" + @1>&2 echo "# DOCKER DOES NOT SEEM TO BE INSTALLED #" + @1>&2 echo "########################################" + @1>&2 echo "the docker binary could not be found in your PATH!" + @1>&2 echo "This usally means docker is simply not installed." + @exit 1 +endif +ifneq ($(shell groups | grep -q docker),) + @1>&2 echo "##############################################" + @1>&2 echo "# YOUR USER IS NOT PART OF THE DOCKER GROUP! #" + @1>&2 echo "##############################################" + @1>&2 echo "This means you need to execute every docker command with sudo" + @1>&2 echo "To avoid this, please add your user ($$USER) to the docker group with the following command:" + @1>&2 echo " sudo usermod -a -G docker $$USER" + @1>&2 echo "you may need to login again to apply the settings" + @exit 1 +endif + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/.make/help.mk b/.make/help.mk new file mode 100644 index 0000000..3fa1492 --- /dev/null +++ b/.make/help.mk @@ -0,0 +1,91 @@ +################################################################################ +### MAKEFILE HELP TEMPLATE ### +################################################################################ +# This Makefile template can be used to qickly generate help messages for make. +# It is based on dynamic variables (see make manual) +# +# THIS MAKEFILE NEEDS TO BE INCLUDED AFTER ALL DECLARATIONS! +# +# own targets should be added to the 'TARGETS' variable, so help can find them. +# I.e. to add your target 'bar', do +# TARGETS += bar +# +# if a target has subtargets, you can add them to 'TARGETS_' to +# indicate them as subtarget. +# I.e. to add your target 'bar-foo' to 'bar', do +# TARGETS_bar += bar-foo +# +# you may set the HELP variable to print a header in the help output +# I.e. HELP := This Makefile does something +# +# for a target specific help text you have to set the variable 'HELP_' +# I.e. HELP_bar := helptext for bar +# +# if you want to define variables, you have to create a variable group by +# adding the group's name to the variable 'VARIABLES' +# I.e to add the variable group 'BUILDOPTION', do +# VARIABLES += BUILDOPTION +# HELP_BUILDOPTION := build options +# +# you can now add variables to your new group +# I.e to add the variable 'CXX' to the group 'BUILDOPTION', do +# VARIABLE_BUILDOPTION += CXX +# HELP_CXX := what compiler to use +# + +.PHONY: help +help: + @echo "--- help ---" + @[ -n "$(HELP)" ] && echo -e "$(HELP)\n" || true; + @$(foreach \ + target, \ + $(TARGETS), \ + [ -n "$(HELP_$(target))" ] && echo "make $(target)" || true; \ + [ -n "$(HELP_$(target))" ] && echo -e "\t$(HELP_$(target))" || true; \ + ) + @echo -e "\n--- further help ---" + @$(foreach \ + target, \ + $(TARGETS), \ + [ -n "$(TARGETS_$(target))" ] && echo -e "make help-$(target)\n\thelp for $(target) subtargets" || true; \ + $(foreach \ + subtarget, \ + $(TARGETS_$(target)), \ + ) \ + ) + @$(foreach \ + group, \ + $(VARIABLES), \ + [ -n "$(VARIABLES_$(group))" ] && echo -e "\n--- $(HELP_$(group)) ---" || true; \ + $(foreach \ + variable, \ + $(VARIABLES_$(group)), \ + echo "$(variable)"; \ + [ -n "$(HELP_$(variable))" ] && echo -e "\t$(HELP_$(variable))" || true; \ + echo -e "\t(currently: $($(variable)))"; \ + ) \ + ) + +.PHONY: help-% +help-%: + @echo "--- help for target $(@:help-%=%) ---" + @[ -n "$(HELP)" ] && echo -e "$(HELP)\n" || true; + @[ -n "$(TARGETS_$(@:help-%=%))" ] && echo -e "\n--- $(@:help-%=%) targets ---" || true; + @$(foreach \ + target, \ + $(TARGETS_$(@:help-%=%)), \ + [ -n "$(HELP_$(target))" ] && echo "make $(target)" || true; \ + [ -n "$(HELP_$(target))" ] && echo -e "\t$(HELP_$(target))" || true; \ + ) + @$(foreach \ + group, \ + $(VARIABLES_$(@:help-%=%)), \ + [ -n "$(VARIABLES_$(group))" ] && echo -e "\n--- $(HELP_$(group)) ---" || true; \ + $(foreach \ + variable, \ + $(VARIABLES_$(group)), \ + echo "$(variable)"; \ + [ -n "$(HELP_$(variable))" ] && echo -e "\t$(HELP_$(variable))" || true; \ + echo -e "\t(currently: $($(variable)))"; \ + ) \ + ) \ No newline at end of file diff --git a/.make/idf.mk b/.make/idf.mk new file mode 100644 index 0000000..b057567 --- /dev/null +++ b/.make/idf.mk @@ -0,0 +1,139 @@ + +DOCKER_IMAGE := idf/v4.0 + +# load DEVICE configuration +-include .setup-device.mk +# delete DEVICE configuration if invalid +ifeq ($(shell ! test -c $(DEVICE); echo $$?),0) +$(shell rm -f .setup-device.mk) +undefine DEVICE +else +export DEVICE +endif + +DOCKER_VARS += DEVICE +DOCKER_VARS_DEVICE := $(DEVICE) + +DOCKER_VARS += ENVS +DOCKER_VARS_ENVS := "IDF_PORT=$(DEVICE)" + +IDF = idf.py --ccache + +VARIABLES += DOCKEROPTIONS +HELP_DOCKEROPTIONS := Docker options + +VARIABLES_DOCKEROPTIONS += DEVICE +HELP_DEVICE := specifies which device to pass to docker + +TARGETS_all += build +TARGETS_all += test + +.PHONY: menuconfig +TARGETS += menuconfig +HELP_menuconfig = configure project +DOCKER += menuconfig +menuconfig: + $(IDF) menuconfig + +.PHONY: reconfigure +TARGET += reconfigure +HELP_reconfigure = reconfigure project (rebuilds cmake files) +DOCKER += reconfigure +reconfigure: + $(IDF) reconfigure + +.PHONY: build-firmware +TARGETS_build += build-firmware +HELP_build-firmware = build firmware files +DOCKER += build-firmware +build-firmware: + $(IDF) all + +.PHONY: clean-build +TARGETS_clean += clean-build +HELP_clean-build = remove generated files of project components +clean-build: + rm -rf build/esp-idf/ + +.PHONY: distclean-build +TARGETS_distclean += distclean-build +HELP_distclean-build = remove all generated files +distclean-build: + rm -f sdkconfig + rm -rf build + rm -rf .setup-device.mk + +.PHONY: flash +TARGETS += flash +HELP_flash = flash project to esp. Use DEVICE=path to provide path to device or use make setup +DOCKER += flash +flash: | check-device + $(IDF) flash -p '$(DEVICE)' + +.PHONY: monitor +TARGETS += monitor +HELP_monitor = connect to esp32 via serial. Use DEVICE=path to provide path to device or use make dev +DOCKER += monitor +monitor: | check-device + $(IDF) monitor -p '$(DEVICE)' + +.PHONY: check-device +TARGETS_check += check-device +HELP_check-device = check if valid device is specified +NO_DOCKER += check-device +check-device: +ifndef DEVICE + @1>&2 echo "##############################" + @1>&2 echo "# FLASH DEVICE NOT SPECIFIED #" + @1>&2 echo "##############################" + @1>&2 echo "specify device by adding DEVICE as parameter" + @1>&2 echo " make $(MAKECMDGOALS) DEVICE=/path/to/device" + @1>&2 echo "or by running" + @1>&2 echo " make setup" + @exit 1 +endif +ifeq ($(shell ! test -c $(DEVICE); echo $$?),0) + @1>&2 echo "#############################" + @1>&2 echo "# FLASH DEVICE IS NOT VALID #" + @1>&2 echo "#############################" + @1>&2 echo "the specified device '$(DEVICE)' is not a character device!" + @1>&2 echo "specify device by adding DEVICE as parameter" + @1>&2 echo " make $(MAKECMDGOALS) DEVICE=/path/to/device" + @1>&2 echo "or by running" + @1>&2 echo " make setup" + @exit 1 +endif + @exit 0 + +.PHONY: check-dialog +TARGETS_check += check-dialog +HELP_check-dialog = check if dialog is installed +NO_DOCKER += check-dialog +check-dialog: +ifeq ($(shell which dialog 2> /dev/null),) + @1>&2 echo "###########################" + @1>&2 echo "# DIALOG IS NOT INSTALLED #" + @1>&2 echo "###########################" + @1>&2 echo "Consider installing dialog." + @1>&2 echo "on debian based systems:" + @1>&2 echo " sudo apt-get install dialog" + @1>&2 echo "on arch based systems:" + @1>&2 echo " sudo pacman -S dialog" + @exit 1 +endif + @exit 0 + +.PHONY: setup-device +TARGETS_setup += setup-device +HELP_setup-device = sets device +NO_DOCKER += setup-device +setup-device: | check-dialog + echo -n DEVICE= > .setup-device.mk + for dev in $$(ls /dev/serial/by-id); do echo "$$(readlink -f /dev/serial/by-id/$$dev) $$dev "; done \ + | dialog \ + --stdout \ + --menu "choose which device to use" 0 0 0 "none" "disable device passthrough"\ + --file /dev/stdin\ + >> .setup-device.mk || rm -f .setup-device.mk + +include $(shell git rev-parse --show-toplevel)/.make/part.mk \ No newline at end of file diff --git a/.make/part.mk b/.make/part.mk new file mode 100644 index 0000000..c2ca6ee --- /dev/null +++ b/.make/part.mk @@ -0,0 +1,3 @@ +HELP ?= LifeSensor part + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/.make/product.mk b/.make/product.mk new file mode 100644 index 0000000..8fbf315 --- /dev/null +++ b/.make/product.mk @@ -0,0 +1,37 @@ +HELP := LifeSensor product + +TARGET_default := all +TARGET_all := build test + +VARIABLE += PARTS +HELP_PARTS := parts this product uses + +.phony: build-requirements +TARGET_build += build-requirements +HELP_build-requirements := build requirements documents +build-requirements: + #todo + +.phony: test-requirements +TARGET_test += test-requirements +HELP_test-requirements := test if requirements are fullfilled +test-requirements: + #todo + +.phony: clean-requirements +TARGET_clean += clean-requirements +HELP_clean-requirements := clean generated requirement files +clean-requirements: + #todo + +define PART_TEMPLATE +.phony: $1-parts +TARGET_$1 += $1-parts +HELP_$1-parts := run make $1 for all parts +$1-parts: + $(foreach PART,$(PARTS),make -C ../../../parts/$(PART) $1) +endef + +$(foreach TARGET, build test clean distclean, $(eval $(call PART_TEMPLATE,$(TARGET)))) + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/.make/templating.mk b/.make/templating.mk new file mode 100644 index 0000000..86fbba6 --- /dev/null +++ b/.make/templating.mk @@ -0,0 +1,103 @@ + +-include .template.mk + +ifdef TEMPLATING_CHOICES + +VARIABLES += TEMPLATING +HELP_TEMPLATING := Templating options + +VARIABLES_TEMPLATING += TEMPLATING_CHOICES +HELP_TEMPLATING_CHOICES := existing templates + +VARIABLES_new += TEMPLATING_COMMON +HELP_TEMPLATING_COMMON := Common template options + +VARIABLES_TEMPLATING_COMMON += NAME +HELP_NAME := how to rename the template +NAME ?= #empty + +TEMPLATING_SUFFIXES += m4 +TEMPLATING_SUFFIXES += envsubst + +define TEMPLATE_NEW_TEMPLATING_TARGET + +$$(if $$(TEMPLATING_PATH_$1),,$$(error Variable 'TEMPLATING_PATH_$1' is not set in .template.mk)) +$$(if $$(TEMPLATING_HELP_$1),,$$(error Variable 'TEMPLATING_HELP_$1' is not set in .template.mk)) + +VARIABLES_new += new-$1-vars +VARIABLES_new-$1-vars := $$(TEMPLATING_VARS_$1) +HELP_new-$1-vars := 'new-$1' template options + +TEMPLATING_M4_$1 := $$(foreach DEFINE,$$(VARIABLES_TEMPLATING_COMMON) $$(TEMPLATING_VARS_$1),-D__$$(DEFINE)__=$$($$(DEFINE))) +TEMPLATING_ENVSUBST_$1 := $$(foreach DEFINE,$$(VARIABLES_TEMPLATING_COMMON) $$(TEMPLATING_VARS_$1),$$$${$$(DEFINE)} ) + +TEMPLATING_INPUT_$1 := $$(foreach PATH,$$(TEMPLATING_PATH_$1),$$(shell find $$(PATH) -type f)) +TEMPLATING_FILES_$1 := $$(foreach PATH,$$(TEMPLATING_PATH_$1), $$(shell find $$(PATH) -type f -printf '%P\n') ) +TEMPLATING_INDEX_$1 := $$(shell for i in $$$$(seq 1 $$(words $$(TEMPLATING_FILES_$1))); do echo $$$$i; done) +TEMPLATING_COPY_$1 := $$(shell echo '$$(addprefix $$(NAME)/, $$(TEMPLATING_FILES_$1))' | m4 $$(TEMPLATING_M4_$1)) +TEMPLATING_OUTPUT_$1 := $$(shell echo "$$(TEMPLATING_COPY_$1) " | sed -E $$(foreach SUFFIX,$$(TEMPLATING_SUFFIXES), -e 's/([^\S]+)\.$$(SUFFIX)/\1/g')) + + +.PHONY: _check-new-$1 +_check-new-$1: + $$(foreach \ + VAR, \ + $$(VARIABLES_TEMPLATING_COMMON) $$(TEMPLATING_VARS_$1), \ + $$(if \ + $$($$(VAR)), \ + , \ + $$(info ERROR: option $$(VAR) is missing. please specify via '$$(VAR)='. see 'make help-new' for more information) $$(error ) \ + ) \ + ) + +.PHONY: new-$1 +TARGETS_new += new-$1 +HELP_new-$1 := $$(TEMPLATING_HELP_$1) +new-$1: $$(TEMPLATING_OUTPUT_$1) | _check-new-$1 + +$$(NAME)/%:$$(NAME)/%.m4 + @mkdir -p $$(dir $$@) + m4 $$(TEMPLATING_M4_$1) -D__FILENAME__=$$(notdir $$@) -D__DIRNAME__=$$(dir $$@) $$^ > $$@ + +$$(NAME)/%:$$(NAME)/%.envsubst + @mkdir -p $$(dir $$@) + FILENAME=$$(notdir $$@) DIRNAME=$$(dir $$@) $$(foreach DEFINE,$$(VARIABLES_TEMPLATING_COMMON) $$(TEMPLATING_VARS_$1),$$(DEFINE)=$$($$(DEFINE))) \ + envsubst '$$(TEMPLATING_ENVSUBST_$1) $$$${FILENAME} $$$${DIRNAME}' < $$^ > $$@ + + +define TEMPLATE_RULE_COPY +.INTERMEDIATE: $$2 +$$2:$$1 + @mkdir -p $$(dir $$2) + cp $$1 $$2 +endef + +.SECONDARY: $$(TEMPLATING_OUTPUT_$1) + +$$(foreach \ + INDEX, \ + $$(TEMPLATING_INDEX_$1), \ + $$(eval \ + $$(call \ + TEMPLATE_RULE_COPY, \ + $$(word $$(INDEX), $$(TEMPLATING_INPUT_$1)), \ + $$(word $$(INDEX), $$(TEMPLATING_COPY_$1)) \ + ) \ + ) \ +) + +endef + +$(foreach \ + TEMPLATE, \ + $(TEMPLATING_CHOICES), \ + $(eval $(call TEMPLATE_NEW_TEMPLATING_TARGET,$(TEMPLATE))) \ +) + +.PHONY:new +TARGETS_common += new +HELP_new := create something new from a template +DOCKER_NO += new +new: | help-new + +endif diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..89b59fc --- /dev/null +++ b/LICENSE.md @@ -0,0 +1 @@ +# License information \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/README.md b/README.md index 7813393..9c59c45 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,60 @@ -# LifeSensor -- Esp32-core -ESP32 firmware for the lifesensor project. +# LifeSensor Project - health devices for all -## Components -See [components/README.md](components/README.md) for an overview of features. +![LifeSensor logo](./docs/lifesensor_logo.png) -## Project flavors -This repository features multiple idf projects for different purposes. +The [*LifeSensor*](https://lifesensor.org) project is an open-source, modular, low-cost bio sensing platform. -
-
lifesensor
main project
-
lifesensor_test
unit tests of components
-
+- This project is a collection of [*parts*](./parts/) and [*products*](./products/). +- [*Parts*](./parts/) are components that provide a set of features. +- [*Products*](./products/) are [*LifeSensor*](https://lifesensor.org) devices consisting of [*parts*](./parts/). +- [*Parts*](./parts/) are subjects to requirements and constraints imposed by [*products*](./products/) and other [*parts*](./parts/). -## Build & Flash & Run +--- +## Directories -* via Docker - 1. Choose flavor - * i.e. `cd lifesensor` - 2. Building - * `make build` - 1. creates idf docker image if needed - 2. starts idf docker container to build project - 3. Choosing device - * `make dev` - * configures which serial port to use - 4. Flashing - * `make flash` - 1. creates idf docker image if needed - 2. starts idf docker container to flash project to connected ESP via specified device by `make dev` - 5. Monitoring - * `make monitor` - 1. creates idf docker image if needed - 2. starts idf docker container to connect to ESP via specified device by `make dev` -* via local esd-idf toolchain - 1. Choose flavor - * i.e. `cd lifesensor` - 2. Building - * `idf.py build` - 3. Flashing - * `idf.py flash -p ` - 4. Monitoring - * `idf.py monitor -p ` +See [Structure.md](./Structure.md) for an overview on how this repository is organized. -## Simulating with qemu +### [docker/](./docker/) +- Docker images used by this project +- Every used toolchain exists as docker image -**Important:** Qemu port of the xtensa architecture is in active development, -each docker image creation builds with latest version, mileage may vary! +### [docs/](./docs/) +- Documents regarding the whole project -* via Docker - * simple execution - 1. Choose flavor - * i.e. `cd lifesensor` - 2. Building - * `make build` - 1. creates idf docker image if needed - 2. starts idf docker container to build project - 3. Start qemu - * `make qemu` - 1. creates qemu docker image if needed - 2. starts qemu docker container to simulate project - * with gdb - 1. Choose flavor - * i.e. `cd lifesensor` - 2. Building - * `make build` - 1. creates docker docker image if needed - 2. starts qemu docker container to simulate project - 3. Start qemu and wait for gdb connection - * `make qemu-gdb` - 1. creates qemu docker image if needed - 2. starts qemu docker container to simulate project - 5. Start gdb and connect to qemu in second terminal - * `make gdb-qemu` - 1. starts idf docker container to run gdb +### [parts/](./parts/) +- [*LifeSensor*](https://lifesensor.org) components used to build [*products*](./products/) +### [products/](./products/) +- [*LifeSensor*](https://lifesensor.org) devices consisting of [*parts*](./parts/) + +--- +## Makefile + +This project makes heavy use of Makefiles. +See [Structure.md](./Structure.md) & [./.make](./.make) for more information. + + +- `make help` + - show Makefile options +- `make all` + - build & test all components +- `make build` + - build all components +- `make test` + - test all components +- `make clean` + - clean all components +- `make distclean` + - distclean all components + +--- ## Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md) +Please see +[CONTRIBUTING.md](./CONTRIBUTING.md) +for more information on how to contribute. + +--- +## License +Please see +[LICENSE.md](./LICENSE.md) +for more information on the used licenses. diff --git a/Structure.md b/Structure.md new file mode 100644 index 0000000..58ffd2a --- /dev/null +++ b/Structure.md @@ -0,0 +1,106 @@ +# Project structure & rules + + + +--- +## General project structure +- The project consists of *components* +- *Components* reside inside the root of the repository +- All *component* directories should feature a README.md +- All *component* directories should feature a Makefile + +``` +lifesensor +│ +├── README.md : main README.md of the project +├── Makefile : Makefile executing targets in all components +│ +├── CONTRIBUTING.md : information on how to contribute +├── LICENSE.md : license information +│ +├── docs +│   ├── README.md : list & description of project documents +│   ├── Makefile : Makefile building/generating documents +│ └── ...   +│ +├── : component name +│   ├── README.md : general description of the component, +│ │ its structure and a list of all subcomponents +│   ├── Makefile : Makefile executing targets in all subcomponents +│ │ +│   ├── : subcomponent name +│ │ ├── README.md : general description of the subcomponent +│ │ │ and list of all subcomponent variants +│ │   ├── Makefile : Makefile bundeling all variants +│ │ │ +│   │   ├── docs +│ │ │   ├── README.md : list & description of subcomponent documents +│ │ │   ├── Makefile : Makefile building/generating documents +│ │ │ └── ...   +│ │ │ +│ │   ├── : a variant is a non-exchangeable component +│ │ │ ├── README.md : general description of the variant +│ │ │   ├── Makefile : Makefile integrating component toolchain +│ │ │ │ +│   │   │   ├── docs +│ │ │ │   ├── README.md : list & description of variant documents +│ │ │ │   ├── Makefile : Makefile building/generating documents +│ │ │ │ └── ...   +│ │ │ └── ... +│ │ │ +│ │   ├── +│ │ │ └── ... +│ │ └── ...   +│ │ +│   ├── +│ └── ...   +│ +├── +│ └── ...   +└── ...   +``` + +--- +## README.md +- A README.md should link to all subdirectories that contain a README.md +- Links to directories should always end with a slash (`/`) + - I.e `[dir/](./dir/)` +- Links should always have a relative prefix (`./`,`../`, ... ) + - I.e `[file.txt](./file.txt)` +- All README.md's should describe important Makefile targets +- All README.md's should describe the structure of subdirectories + +--- +## Makefiles +- All Makefiles should support the common targets. + - `help` + - show information about targets and variables + - `all` + - run common jobs (like `build` & `test`) + - `check` + - run all check jobs + - *check* jobs are environment validations + - I.e. check if toolchain is installed + - `setup` + - run all setup jobs + - *setup* jobs are environment configurations + - I.e. define devices to flash + - `build` + - run all build jobs + - should not be dependent on any `setup` target + - `test` + - run all test jobs + - should not be dependent on any `setup` target + - `clean` + - delete everything build + - `distclean` + - delete everything generated + - should reset the state prior execution of any target +- All Makefiles should integrate Makefiles in subdirectories. +- Targets that fall in one of these target categories should be named +`-`. + - I.e. `build-library`, `clean-library`, `test-library`, ... +- A Makefile should include the [.common.mk](./.make/common.mk) Makefile +to define these common targets. + - simply add `include $(shell git rev-parse --show-toplevel)/.make/common.mk` +as last statement in the Makefile. diff --git a/components/README.md b/components/README.md deleted file mode 100644 index 816b337..0000000 --- a/components/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Components - -"Component" is a term for structures used by the espressif idf framework, -separating code into libraries and defining dependencies. - -## Adding a new component -See the [template](template/README.md) component. - -## List of Components - -* [ulp adc](spo2/README.md) - * Utilize the Ultra-low-power Co-processor to sample the ADCs of the ESP -* [SpO2](spo2/README.md) - * Driver for the original remo2hbo SpO2 hardware - - diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index 34a9f95..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -esp32_overview.svg : esp32_overview.gv - neato -Tsvg $^ > $@ diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100644 index 499b1e8..0000000 --- a/docker/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -**/Dockerfile.log -.check* diff --git a/docker/.template/Makefile b/docker/.template/Makefile new file mode 100644 index 0000000..f03dffd --- /dev/null +++ b/docker/.template/Makefile @@ -0,0 +1 @@ +include $(shell git rev-parse --show-toplevel)/.make/subdirs.mk \ No newline at end of file diff --git a/docker/.template/README.md b/docker/.template/README.md new file mode 100644 index 0000000..6a084e5 --- /dev/null +++ b/docker/.template/README.md @@ -0,0 +1,38 @@ + +# Docker image template + + +This template should be used to create a new image. +1. Copy this template directory +2. Give your new image a meaningful name. +3. Append your new image to the image list in [../README.md](../README.md) +4. Edit this README + - Change title! +5. Continue editing in [v1/README.md](./1/README.md) + +--- +## Features + +- provides template for docker image + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build all versions +- `make build` + - build all versions +- `make clean` + - delete volumes of all versions +- `make distclean` + - delete images of all version + +--- +## Versions + + + +- [v1](./v1/) + - initial version \ No newline at end of file diff --git a/docker/.template/v1/Dockerfile b/docker/.template/v1/Dockerfile new file mode 100644 index 0000000..419b768 --- /dev/null +++ b/docker/.template/v1/Dockerfile @@ -0,0 +1,26 @@ +FROM lifesensor/base:latest + +ARG FOO +ARG BAR + +########################### +# install needed packages # +########################### +RUN sudo -HE apt-get install -y \ +g++ \ +cmake \ +python3 \ +; + +############################################################### +# build & install some software # +# please build & install & remove in a single RUN instruction # +# to avoid intermediate images # +############################################################### +RUN export REPO=/tmp/BAR \ + && git clone https://github.com/FOO/BAR.git $REPO \ + && mkdir $REPO/build \ + && cd $REPO/build \ + && cmake .. \ + && sudo make install \ + && sudo rm -rf $REPO \ No newline at end of file diff --git a/docker/.template/v1/Makefile b/docker/.template/v1/Makefile new file mode 100644 index 0000000..7f532be --- /dev/null +++ b/docker/.template/v1/Makefile @@ -0,0 +1,25 @@ +### DOCKER IMAGE DEPENDENCY ### +FROM := base/v1 + +### DOCKER IMAGE ARGUMENTS ### +ARGS += FOO +HELP_FOO := modifies something +FOO := default_value + +ARGS += BAR +HELP_BAR := modifies something else +BAR := default_value + +### DOCKER BUILD OPTIONS ### +TAG := latest +BUILD := #empty + +### DOCKER RUN OPTIONS ### +RUN := #empty +VOLUMES := #empty +WORKDIR := $(shell pwd) +ENVS := #empty +EXEC := #empty +MOUNT := $(shell pwd) + +include $(shell git rev-parse --show-toplevel)/.make/docker.mk \ No newline at end of file diff --git a/docker/.template/v1/README.md b/docker/.template/v1/README.md new file mode 100644 index 0000000..9c5769b --- /dev/null +++ b/docker/.template/v1/README.md @@ -0,0 +1,45 @@ + +# Docker image template (version v1) + + +This template should be used to create a new docker image version. +1. Copy this template directory +2. Give your new image a meaningful name. +3. Append your new version to the version list in [../README.md](../README.md) +4. Edit this README + - Change title & version! +5. Edit the [Dockerfile](./Dockerfile) +6. Edit the [Makefile](./Makefile) + +--- +## Features + +- installs `software one` +- installs `software two` + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build image & run container +- `make build` + - build image +- `make run` + - run container +- `make clean` + - delete volumes +- `make distclean` + - delete image + +--- +## Image arguments + +- `FOO` + - modifies something +- `BAR` + - modifies something else + +--- +See the [Dockerfile](./Dockerfile) or [Makefile](./Makefile) for more information diff --git a/docker/Makefile b/docker/Makefile index 6a96160..7f48ff4 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,305 +1,2 @@ -# -# see ../.Makefile.template for help -# - -### variables ### - -VARIABLE += IDF_VERSION -HELP_IDF_VERSION = which idf version to use -IDF_VERSION=v4.0 - -VARIABLE += QEMU_VERSION -HELP_QEMU_VERSION = which qemu version to use -QEMU_VERSION=esp-develop - -VARIABLE += ESPPORT -HELP_ESPPORT = which device to map into container - -ifdef ESPPORT -DOCKER_DEV=--device $(ESPPORT) -endif - -VARIABLE += UID -HELP_UID = user id of user inside of container -UID=$(shell id -u) - -VARIABLE += GID -HELP_GID = group id of user inside of container -GID=$(shell id -g) - -VARIABLE += EXEC -HELP_EXEC = what to execute in the container -EXEC=bash - -VARIABLE += DOCKEROPTS -HELP_DOCKEROPTS = additional docker options - -VARIABLE += WORKDIR -HELP_WORKDIR = Where to enter docker container -WORKDIR=$(shell pwd)/.. - -### docker build targets ### - -.PHONY: idf-image -ALL += idf-image -DEFAULT += idf-image -TARGET_idf += idf-image -HELP_idf-image = builds docker idf image -idf-image: | check-docker - docker build \ - --build-arg=idf_version=$(IDF_VERSION) \ - --build-arg=UID=$(UID) \ - --build-arg=GID=$(GID) \ - -t "lifesensor/idf:$(IDF_VERSION)" \ - idf - -.PHONY: qemu-image -ALL += qemu-image -DEFAULT += qemu-image -TARGET_qemu += qemu-image -HELP_qemu-image = buils docker qemu image -qemu-image: idf-image | check-docker - docker build \ - --build-arg=idf_version=$(IDF_VERSION) \ - --build-arg=qemu_version=$(QEMU_VERSION) \ - -t "lifesensor/qemu:$(QEMU_VERSION)" \ - qemu - -.PHONY: vscode-image -ALL += vscode-image -TARGET_vscode += vscode-image -HELP_vscode-image = buils docker vscode image -vscode-image: qemu-image | check-docker - docker build \ - --build-arg=qemu_version=$(QEMU_VERSION) \ - -t "lifesensor/vscode:latest" \ - vscode - -### docker run targets ### - -.PHONY: idf -TARGET += idf -HELP_idf = runs idf container -idf: | idf-image check-docker - docker run \ - --rm \ - -ti \ - $(DOCKER_DEV) \ - -v idf-home:/home/developer:rw \ - -v "$(shell pwd)/..:$(shell pwd)/..:rw" \ - -w "$(WORKDIR)" \ - --hostname idf \ - $(DOCKEROPTS) \ - lifesensor/idf:$(IDF_VERSION) \ - /bin/bash -ic '$(EXEC)' - -.PHONY: qemu -TARGET += qemu -HELP_qemu = runs qemu container -qemu: | qemu-image check-docker - docker run \ - --rm \ - -ti \ - $(DOCKER_DEV) \ - -v qemu-home:/home/developer:rw \ - -v "$(shell pwd)/..:$(shell pwd)/..:rw" \ - -w "$(WORKDIR)" \ - --hostname qemu \ - $(DOCKEROPTS) \ - lifesensor/qemu:$(QEMU_VERSION) \ - /bin/bash -ic '$(EXEC)' - -.PHONY: code vscode -TARGET += vscode -HELP_vscode = runs vscode container -TARGET += code -HELP_code = runs vscode container -code vscode: | vscode-image check-docker - xhost local:root - docker run \ - --rm \ - -ti \ - $(DOCKER_DEV) \ - -v vscode-home:/home/developer:rw \ - -v /tmp/.X11-unix/:/tmp/.X11-unix \ - -e DISPLAY=$(DISPLAY) \ - -e LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 \ - -v "$(shell pwd)/..:$(shell pwd)/..:rw" \ - -w "$(WORKDIR)" \ - --shm-size=512m \ - --hostname vscode \ - $(DOCKEROPTS) \ - lifesensor/vscode:latest \ - /bin/bash -ic '$(EXEC)' - -### docker remove volume targets ### - -.PHONY: clean-idf -CLEAN += clean-idf -HELP_clean-idf = removes idf volume -clean-idf: - -docker volume rm idf-home - -.PHONY: clean-qemu -CLEAN += clean-qemu -HELP_clean-qemu = removes qemu volume -clean-qemu: - -docker volume rm qemu-home - -.PHONY: clean-vscode -CLEAN += clean-vscode -HELP_clean-vscode = removes vscode volume -clean-vscode: - -docker volume rm vscode-home - -### docker remove image targets ### - -.PHONY: distclean-idf -DISTCLEAN += distclean-idf -HELP_distclean-idf = removes idf docker image -distclean-idf: clean-idf - -docker image remove "lifesensor/idf:$(IDF_VERSION)" - docker image prune - -.PHONY: distclean-qemu -DISTCLEAN += distclean-qemu -HELP_distclean-qemu = removes qemu docker image -distclean-qemu: clean-qemu - -docker image remove "lifesensor/qemu:$(QEMU_VERSION)" - docker image prune - -.PHONY: distclean-vscode -DISTCLEAN += distclean-vscode -HELP_distclean-vscode = removes vscode docker image -distclean-vscode: clean-vscode - -docker image remove "lifesensor/vscode:latest" - docker image prune - -### docker check installation targets ### - -.PHONY: check-docker -CHECK += check-docker -check-docker: check-docker-installed check-docker-group - -.PHONY: check-docker-installed -check-docker-installed: - @1>&2 echo -n "checking if docker is installed..." -ifeq (,$(shell which docker 2> /dev/null)) - @1>&2 echo - @1>&2 echo "########################################" - @1>&2 echo "# DOCKER DOES NOT SEEM TO BE INSTALLED #" - @1>&2 echo "########################################" - @1>&2 echo "the docker binary could not be found in your PATH!" - @1>&2 echo "This usally means docker is simply not installed." - @1>&2 echo -ifneq (,$(shell grep -i debian /etc/*-release)) - @1>&2 echo "I detected your platform as DEBIAN, so please run" - @1>&2 echo - @1>&2 make -sn install-docker-debian - @1>&2 echo - @1>&2 echo OR simply - @1>&2 echo - @1>&2 echo make install-docker-debian - @1>&2 echo -else ifneq (,$(shell grep -i ubuntu /etc/*-release)) - @1>&2 echo "I detected your platform as UBUNTU, so please run" - @1>&2 echo - @1>&2 make -sn install-docker-ubuntu - @1>&2 echo - @1>&2 echo OR simply - @1>&2 echo - @1>&2 echo make install-docker-ubuntu - @1>&2 echo -else ifneq (,$(shell grep -i "arch linux" /etc/*-release)) - @1>&2 echo "I detected your platform as ARCHLINUX, so please run" - @1>&2 echo - @1>&2 make -sn install-docker-archlinux - @1>&2 echo - @1>&2 echo OR simply - @1>&2 echo - @1>&2 echo make install-docker-archlinux - @1>&2 echo -else ifneq (,$(shell grep -i centos /etc/*-release)) - @1>&2 echo "I detected your platform as CENTOS, so please run" - @1>&2 echo - @1>&2 make -sn install-docker-centos - @1>&2 echo - @1>&2 echo OR simply - @1>&2 echo - @1>&2 echo make install-docker-centos - @1>&2 echo -else ifneq (,$(shell grep -i fedora /etc/*-release)) - @1>&2 echo "I detected your platform as FEDORA, so please run" - @1>&2 echo - @1>&2 make -sn install-docker-fedora - @1>&2 echo - @1>&2 echo OR simply - @1>&2 echo - @1>&2 echo make install-docker-fedora - @1>&2 echo -else - @1>&2 echo "I detected your platform as UNKNOWN," - @1>&2 echo - @1>&2 echo please run your package manager to install docker -endif - @exit 1 -endif - @1>&2 echo "SUCCESS" - - -### docker install targets ### - -.PHONY: install-docker-debian -install-docker-debian: - sudo apt-get update - sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common - curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $$(lsb_release -cs) stable" - sudo apt-get update - sudo apt-get install docker-ce docker-ce-cli containerd.io - -.PHONY: install-docker-ubuntu -install-docker-ubuntu: - sudo apt-get update - sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $$(lsb_release -cs) stable" - sudo apt-get install docker-ce docker-ce-cli containerd.io - sudo apt-get update - -.PHONY: install-docker-archlinux -install-docker-archlinux: - sudo pacman -Sy docker - -.PHONY: install-docker-centos -install-docker-centos: - sudo yum install -y yum-utils device-mapper-persistent-data lvm2 - sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - sudo yum install docker-ce docker-ce-cli containerd.io - -.PHONY: install-docker-fedora -install-docker-fedora: - sudo dnf -y install dnf-plugins-core - sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo - sudo dnf install docker-ce docker-ce-cli containerd.io - -### docker check group target ### - -.PHONY: check-docker-group -check-docker-group: - @1>&2 echo -n "checking if user is in docker group..." -ifneq (,$(shell groups | grep -q docker)) - @1>&2 echo - @1>&2 echo "##############################################" - @1>&2 echo "# YOUR USER IS NOT PART OF THE DOCKER GROUP! #" - @1>&2 echo "##############################################" - @1>&2 echo "This means you need to execute every docker command with sudo" - @1>&2 echo "To avoid this, please add your user ($$USER) to the docker group with the following command:" - @1>&2 echo - @1>&2 echo "sudo usermod -a -G docker $$USER" - @1>&2 echo - @exit 1 -endif - @1>&2 echo "SUCCESS" - -include ../.Makefile.template +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index c7f3e83..c18a8cf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,18 +1,74 @@ # Docker -This directory contains the Dockerfiles for the containers used in this project. +This directory contains Dockerfiles for the containers used in this project. -The images are build and run by make. -Run `make help` for more information. +--- +## List of images +- [base](./base/) + - base image for all other images +- [idf](./idf/) + - idf framework for the esp32 firmware +- [qemu](./qemu/) + - qemu for architecture simulation -## idf +--- +## Makefile + +- `make help` + - show Makefile options +- `make build` + - build all versions of all images +- `make clean` + - delete all volumes of all versions of all images +- `make distclean` + - delete all all versions of all images -- used to build the src and to create the resulting image +--- +## Run a container +1. change into the version directory of the image +2. run `make run` + - you may specify additional options, see `make help` for more information + - you may specify `EXEC` to run a single command + - i.e. `make run EXEC='echo hello world'` -## Qemu +--- +## Adding new images +- If you want to add a new image, +please copy and modify the [Template](./.template/) -- used to simulate the esp32 core and test the image +--- +## Structure +``` +. +├── README.md : mandatory README.md you are currently reading +├── Makefile : mandatory Makefile executing targets in all subdirs +│ +├── : mandatory unique name of the image +│   ├── README.md : mandatory general description of the image +│   │ and elaboration of differences between version +│ ├── Makefile : mandatory Makefile executing targets in all subdirs +│   │ +│   ├── : mandatory unique image version +│   │   ├── README.md : mandatory version specific description of the image, +│   │   │   should list all features +│   │ ├── Makefile : mandatory Makefile for integration of the image +│   │ ├── Dockerfile : mandatory Dockerfile to build image +│   │ └── ... +│   │ +│   ├── +│   │   └── ... +│   └── ... +│ +├── +│   └── ... +└── ... +``` -## Vscode - -- used to run a standardized IDE out of the box +--- +## Rules +- *Docker images* of the LifeSensor project should have a dedicated directory here. +- *Docker images* can be based on each other (see [base](./base/) image). +- *Docker images* may compete for the same functionality. + - Different [*parts*](../parts/) may use different *docker images* +- *Docker images* should follow the directory scheme defined by the [*template image*](./.template/) + - *Docker images* may contain any additional files & directories diff --git a/docker/base/Makefile b/docker/base/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/docker/base/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/docker/base/README.md b/docker/base/README.md new file mode 100644 index 0000000..56a1e4d --- /dev/null +++ b/docker/base/README.md @@ -0,0 +1,32 @@ + +# Docker image base + + +This is the base image of all other images. + +--- +## Features + +- setup of user `developer` + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build all versions +- `make build` + - build all versions +- `make clean` + - delete volumes of all versions +- `make distclean` + - delete images of all version + +--- +## Versions + + + +- [v1](./v1/) + - initial version \ No newline at end of file diff --git a/docker/base/v1/Dockerfile b/docker/base/v1/Dockerfile new file mode 100644 index 0000000..4884971 --- /dev/null +++ b/docker/base/v1/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:18.04 +RUN apt-get update && apt-get -y install \ +git \ +make \ +sudo \ +; + +# creates user 'developer' +ARG UID=1000 +ARG GID=1000 +RUN groupadd -g $GID -o developer \ + && useradd -m -u $UID -g $GID -s /bin/bash developer \ + && echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers +WORKDIR /home/developer +USER developer +ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 DEBIAN_FRONTEND=noninteractive diff --git a/docker/base/v1/Makefile b/docker/base/v1/Makefile new file mode 100644 index 0000000..ca26c3b --- /dev/null +++ b/docker/base/v1/Makefile @@ -0,0 +1,25 @@ +### DOCKER IMAGE DEPENDENCY ### +FROM := #empty + +### DOCKER IMAGE ARGUMENTS ### +ARGS += UID +HELP_UID := user id of developer +UID := $(shell id -u) + +ARGS += GID +HELP_GID := group id of developer +GID := $(shell id -g) + +### DOCKER BUILD OPTIONS ### +TAG := latest +BUILD := #empty + +### DOCKER RUN OPTIONS ### +RUN := #empty +VOLUMES := #empty +WORKDIR := $(shell pwd) +ENVS := #empty +EXEC := #empty +MOUNT := $(shell pwd) + +include $(shell git rev-parse --show-toplevel)/.make/docker.mk \ No newline at end of file diff --git a/docker/base/v1/README.md b/docker/base/v1/README.md new file mode 100644 index 0000000..932ecef --- /dev/null +++ b/docker/base/v1/README.md @@ -0,0 +1,38 @@ + +# Docker image base (version v1) + + +This is the base image of all other images. + +## Features + +- installs `sudo`, `make`, `git` +- creates user `developer` +- adds `developer` to sudoers + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build image & run container +- `make build` + - build image +- `make run` + - run container +- `make clean` + - delete volumes +- `make distclean` + - delete image + +--- +## Image arguments + +- `UID` + - sets uid of `developer` +- `GID` + - sets gid of `developer` + +--- +See the [Dockerfile](./Dockerfile) or [Makefile](./Makefile) for more information diff --git a/docker/idf/Dockerfile b/docker/idf/Dockerfile deleted file mode 100644 index d1d1e85..0000000 --- a/docker/idf/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -FROM ubuntu:18.04 -RUN apt-get update && apt-get -y install \ -bison \ -ccache \ -cmake \ -flex \ -git \ -gperf \ -libffi-dev \ -libncurses5-dev \ -libssl-dev \ -libusb-1.0-0 \ -ninja-build \ -python \ -python-pip \ -python-setuptools \ -python3 \ -python3-pip \ -python3-setuptools \ -sudo \ -wget - -RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10 - -ARG UID=1000 -ARG GID=1000 -RUN groupadd -g $GID -o developer -RUN useradd -m -u $UID -g $GID -s /bin/bash developer -RUN echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -WORKDIR /home/developer -USER developer -ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 - -ARG idf_version -RUN sudo git clone --depth 1 -b ${idf_version} \ ---recursive https://github.com/espressif/esp-idf.git /opt/esp-idf -WORKDIR /opt/esp-idf -COPY idf_tools.py.patch idf_tools.py.patch -RUN sudo git apply idf_tools.py.patch -ENV IDF_TOOLS_PATH=/opt/espressif -RUN sudo -HE python tools/idf_tools.py --non-interactive install \ -&& sudo rm -rf ${IDF_TOOLS_PATH}/dist -RUN sudo -HE python tools/idf_tools.py --non-interactive install-python-env -RUN python tools/idf_tools.py export >> ~/.bashrc - -WORKDIR /home/developer diff --git a/docker/idf/Makefile b/docker/idf/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/docker/idf/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/docker/idf/README.md b/docker/idf/README.md new file mode 100644 index 0000000..4de25bc --- /dev/null +++ b/docker/idf/README.md @@ -0,0 +1,32 @@ + +# Docker image idf + + +This is the idf image used to build the esp32 firmware. + +--- +## Features + +- installs [idf](https://github.com/espressif/esp-idf) & dependencies + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build all versions +- `make build` + - build all versions +- `make clean` + - delete volumes of all versions +- `make distclean` + - delete images of all version + +--- +## Versions + + + +- [v4.0](./v4.0/) + - idf version v4.0 \ No newline at end of file diff --git a/docker/idf/v4.0/Dockerfile b/docker/idf/v4.0/Dockerfile new file mode 100644 index 0000000..be4f4f1 --- /dev/null +++ b/docker/idf/v4.0/Dockerfile @@ -0,0 +1,38 @@ +FROM lifesensor/base/v1:latest + +RUN sudo -HE apt-get -y install \ +bison \ +ccache \ +cmake \ +flex \ +git \ +gperf \ +libffi-dev \ +libncurses5-dev \ +libssl-dev \ +libusb-1.0-0 \ +ninja-build \ +python \ +python-pip \ +python-setuptools \ +python3 \ +python3-pip \ +python3-setuptools \ +wget \ +; + +RUN sudo -HE update-alternatives --install /usr/bin/python python /usr/bin/python3 10 + +ARG IDF_VERSION +RUN sudo git clone --depth 1 -b ${IDF_VERSION} \ +--recursive https://github.com/espressif/esp-idf.git /opt/esp-idf +COPY idf_tools.py.patch /opt/esp-idf/idf_tools.py.patch +ENV IDF_TOOLS_PATH=/opt/espressif IDF_PATH=/opt/esp-idf/ +RUN sudo git -C ${IDF_PATH} apply idf_tools.py.patch \ + && sudo -HE python ${IDF_PATH}/tools/idf_tools.py --non-interactive install \ + && sudo rm -rf ${IDF_TOOLS_PATH}/dist \ + && sudo -HE python ${IDF_PATH}/tools/idf_tools.py --non-interactive install-python-env \ + && python ${IDF_PATH}/tools/idf_tools.py export >> ~/.bashrc \ +; +RUN echo '[ -n "$IDF_PORT" ] && sudo chgrp developer $IDF_PORT' >> ~/.bashrc +RUN mkdir ~/.ccache \ No newline at end of file diff --git a/docker/idf/v4.0/Makefile b/docker/idf/v4.0/Makefile new file mode 100644 index 0000000..bc9c100 --- /dev/null +++ b/docker/idf/v4.0/Makefile @@ -0,0 +1,20 @@ +DEPENDS := ../../base/v1 + +### DOCKER IMAGE ARGUMENTS ### +ARGS += IDF_VERSION +HELP_IDF_VERSION := idf version to use +IDF_VERSION := v4.0 + +### DOCKER BUILD OPTIONS ### +TAG := latest +BUILD := #empty + +### DOCKER RUN OPTIONS ### +RUN := #empty +VOLUMES += lifesensor-idf-v4.0-home-ccache:/home/developer/.ccache:rw +WORKDIR := $(shell pwd) +ENVS := #empty +EXEC := #empty +MOUNT := $(shell pwd) + +include $(shell git rev-parse --show-toplevel)/.make/docker.mk \ No newline at end of file diff --git a/docker/idf/v4.0/README.md b/docker/idf/v4.0/README.md new file mode 100644 index 0000000..60a9983 --- /dev/null +++ b/docker/idf/v4.0/README.md @@ -0,0 +1,35 @@ + +# Docker image idf (version v4.0) + + +This is the idf image used to build the esp32 firmware. + +--- +## Features + +- installs [idf](https://github.com/espressif/esp-idf) version v4.0 & dependencies + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build image & run container +- `make build` + - build image +- `make run` + - run container +- `make clean` + - delete volumes +- `make distclean` + - delete image + +---- +## Image arguments + +- `IDF_VERSION` + - idf version to use + +--- +See the [Dockerfile](./Dockerfile) or [Makefile](./Makefile) for more information \ No newline at end of file diff --git a/docker/idf/idf_tools.py.patch b/docker/idf/v4.0/idf_tools.py.patch similarity index 100% rename from docker/idf/idf_tools.py.patch rename to docker/idf/v4.0/idf_tools.py.patch diff --git a/docker/platformio/Dockerfile b/docker/platformio/Dockerfile deleted file mode 100644 index 2d9250a..0000000 --- a/docker/platformio/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM ubuntu:18.04 - -RUN apt-get update -RUN apt-get -y install python3 python3-pip git sudo - -ARG UID=1000 -ARG GID=1000 -RUN groupadd -g $GID -o developer -RUN useradd -m -u $UID -g $GID -s /bin/bash developer -RUN echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -WORKDIR /home/developer -USER developer -ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 -ENV PATH="${PATH}:/home/developer/.local/bin" -ENV PATH="${PATH}:/home/developer/.platformio/packages/toolchain-xtensa32/bin/" - -ARG platformio_version -RUN pip3 install --no-cache --upgrade pip setuptools wheel platformio==${platformio_version} diff --git a/docker/qemu/Dockerfile b/docker/qemu/Dockerfile deleted file mode 100644 index 438b34c..0000000 --- a/docker/qemu/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -ARG idf_version -FROM lifesensor/idf:${idf_version} - -RUN sudo apt-get -y install \ -bison \ -curl \ -flex \ -gettext \ -libcairo2-dev \ -libffi-dev \ -libglib2.0-dev \ -libgsl-dev \ -libreadline-dev \ -libxml2-dev \ -pkg-config \ -zlib1g-dev - -RUN curl -L \ -http://ftp.gnome.org/pub/gnome/sources/glib/2.48/glib-2.48.0.tar.xz \ -| unxz | tar -xC /tmp \ -&& cd /tmp/glib-2.48.0/ \ -&& ./configure \ -&& make -j $(grep -ci processor /proc/cpuinfo) \ -&& sudo make install \ -&& rm -rf /tmp/glib-2.48.0 - -ARG qemu_version -RUN git clone --depth 1 -b ${qemu_version} \ ---recursive https://github.com/espressif/qemu.git /tmp/qemu \ -&& mkdir -p /tmp/qemu/build \ -&& cd /tmp/qemu/build \ -&& ../configure \ ---target-list=xtensa-softmmu \ ---enable-debug \ ---enable-sanitizers \ ---disable-strip \ ---disable-user \ ---disable-capstone \ ---disable-vnc \ ---disable-sdl \ ---disable-gtk \ -&& make -j $(grep -ci processor /proc/cpuinfo) \ -&& sudo make install \ -&& rm -rf /tmp/qemu - diff --git a/docker/qemu/Makefile b/docker/qemu/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/docker/qemu/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/docker/qemu/README.md b/docker/qemu/README.md new file mode 100644 index 0000000..271d32c --- /dev/null +++ b/docker/qemu/README.md @@ -0,0 +1,30 @@ + +# Docker image qemu + + +This is the qemu image used to simulate various architectures. + +--- +## Features + +- installs qemu + +--- +## Makefile + +- `make help` + - show Makefile options +- `make build` + - build all versions +- `make clean` + - delete volumes of all versions +- `make distclean` + - delete images of all version + +--- +## Versions + + + +- [esp-develop](./esp-develop/) + - qemu fork for xtensa (esp32) architecture \ No newline at end of file diff --git a/docker/qemu/esp-develop/Dockerfile b/docker/qemu/esp-develop/Dockerfile new file mode 100644 index 0000000..5e7db4c --- /dev/null +++ b/docker/qemu/esp-develop/Dockerfile @@ -0,0 +1,49 @@ +ARG IDF_VERSION +FROM lifesensor/idf/${IDF_VERSION}:latest + +RUN sudo -HE apt-get -y install \ +bison \ +curl \ +flex \ +gettext \ +git \ +libcairo2-dev \ +libffi-dev \ +libglib2.0-dev \ +libgsl-dev \ +libreadline-dev \ +libxml2-dev \ +pkg-config \ +zlib1g-dev \ +; + +RUN curl -L \ + http://ftp.gnome.org/pub/gnome/sources/glib/2.48/glib-2.48.0.tar.xz \ + | unxz | tar -xC /tmp \ + && cd /tmp/glib-2.48.0/ \ + && ./configure \ + && make -j $(grep -ci processor /proc/cpuinfo) \ + && sudo make install \ + && rm -rf /tmp/glib-2.48.0 \ +; + +ARG QEMU_VERSION +RUN git clone --depth 1 -b ${QEMU_VERSION} \ + https://github.com/espressif/qemu.git /tmp/qemu \ + && mkdir -p /tmp/qemu/build \ + && cd /tmp/qemu/build \ + && ../configure \ + --target-list=xtensa-softmmu \ + --enable-debug \ + --enable-sanitizers \ + --disable-strip \ + --disable-user \ + --disable-capstone \ + --disable-vnc \ + --disable-sdl \ + --disable-gtk \ + && make -j $(grep -ci processor /proc/cpuinfo) \ + && sudo make install \ + && rm -rf /tmp/qemu \ +; + diff --git a/docker/qemu/esp-develop/Makefile b/docker/qemu/esp-develop/Makefile new file mode 100644 index 0000000..5e05de1 --- /dev/null +++ b/docker/qemu/esp-develop/Makefile @@ -0,0 +1,23 @@ +DEPENDS := ../../idf/v4.0 + +### DOCKER IMAGE ARGUMENTS ### +ARGS += QEMU_VERSION +HELP_QEMU_VERSION := qemu version to use +QEMU_VERSION := esp-develop + +ARGS += IDF_VERSION +IDF_VERSION := v4.0 + +### DOCKER BUILD OPTIONS ### +TAG := latest +BUILD := #empty + +### DOCKER RUN OPTIONS ### +RUN := #empty +VOLUMES := lifesensor-qemu-esp-develop-home:/home/developer:rw +WORKDIR := $(shell pwd) +ENVS := #empty +EXEC := #empty +MOUNT := $(shell pwd) + +include $(shell git rev-parse --show-toplevel)/.make/docker.mk \ No newline at end of file diff --git a/docker/qemu/esp-develop/README.md b/docker/qemu/esp-develop/README.md new file mode 100644 index 0000000..9d9d9cc --- /dev/null +++ b/docker/qemu/esp-develop/README.md @@ -0,0 +1,35 @@ + +# Docker image qemu (version esp-develop) + + +This is the qemu image used to simulate the esp32. + +--- +## Features + +- installs xtensa-architecture capable [qemu](https://github.com/espressif/qemu) & dependencies + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build image & run container +- `make build` + - build image +- `make run` + - run container +- `make clean` + - delete volumes +- `make distclean` + - delete image + +--- +## Image arguments + +- `QEMU_VERSION` + - qemu version to use + +--- +See the [Dockerfile](./Dockerfile) or [Makefile](./Makefile) for more information \ No newline at end of file diff --git a/docker/vscode/Dockerfile b/docker/vscode/Dockerfile deleted file mode 100644 index 830804c..0000000 --- a/docker/vscode/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -ARG qemu_version -FROM lifesensor/qemu:${qemu_version} - -RUN sudo apt-get -y install libx11-xcb1 libasound2 -RUN \ - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/packages.microsoft.gpg > /dev/null&& \ - sudo chmod 664 /usr/share/keyrings/packages.microsoft.gpg && \ - sudo chown root:root /usr/share/keyrings/packages.microsoft.gpg && \ - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null && \ - sudo apt-get -y install apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get -y install code - -RUN LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 code -w --install-extension espressif.esp-idf-extension -RUN bash -ic 'find ~/.vscode -name requirements.txt -exec sudo -H $IDF_PYTHON_ENV_PATH/bin/pip install -r "{}" ";"' -RUN mkdir -p /home/developer/.config/Code/User/ \ -&& bash -ic 'echo "{ \ - \"telemetry.enableCrashReporter\": false, \ - \"telemetry.enableTelemetry\": false, \ - \"update.mode\": "none", \ - \"idf.pythonSystemBinPath\": \""$IDF_PYTHON_ENV_PATH/bin/python"\", \ - \"idf.espIdfPath\": \"/opt/esp-idf\", \ - \"idf.customExtraPaths\": \"\", \ - \"idf.showOnboardingOnInit\": false \ -}"' > /home/developer/.config/Code/User/settings.json diff --git a/doc/CODEOWNERS b/docs/CODEOWNERS similarity index 100% rename from doc/CODEOWNERS rename to docs/CODEOWNERS diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..7b2e621 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,6 @@ +# LifeSensor documents + +## Documents + +- [lifesensor_logo.png](./lifesensor_logo.png) + - official logo of the [*LifeSensor*](https://lifesensor.org) project \ No newline at end of file diff --git a/doc/freertos/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf b/docs/freertos/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf similarity index 100% rename from doc/freertos/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf rename to docs/freertos/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf diff --git a/doc/freertos/FreeRTOS_Reference_Manual_V10.0.0.pdf b/docs/freertos/FreeRTOS_Reference_Manual_V10.0.0.pdf similarity index 100% rename from doc/freertos/FreeRTOS_Reference_Manual_V10.0.0.pdf rename to docs/freertos/FreeRTOS_Reference_Manual_V10.0.0.pdf diff --git a/doc/freertos/source-code-for-book-examples.zip b/docs/freertos/source-code-for-book-examples.zip similarity index 100% rename from doc/freertos/source-code-for-book-examples.zip rename to docs/freertos/source-code-for-book-examples.zip diff --git a/docs/lifesensor_logo.png b/docs/lifesensor_logo.png new file mode 100644 index 0000000..85ef3ad Binary files /dev/null and b/docs/lifesensor_logo.png differ diff --git a/lifesensor/Makefile b/lifesensor/Makefile deleted file mode 120000 index 068ea8b..0000000 --- a/lifesensor/Makefile +++ /dev/null @@ -1 +0,0 @@ -../.Makefile.mk \ No newline at end of file diff --git a/lifesensor_ci/Makefile b/lifesensor_ci/Makefile deleted file mode 120000 index 068ea8b..0000000 --- a/lifesensor_ci/Makefile +++ /dev/null @@ -1 +0,0 @@ -../.Makefile.mk \ No newline at end of file diff --git a/lifesensor_test/Makefile b/lifesensor_test/Makefile deleted file mode 120000 index 068ea8b..0000000 --- a/lifesensor_test/Makefile +++ /dev/null @@ -1 +0,0 @@ -../.Makefile.mk \ No newline at end of file diff --git a/parts/.template.mk b/parts/.template.mk new file mode 100644 index 0000000..0b732aa --- /dev/null +++ b/parts/.template.mk @@ -0,0 +1,8 @@ + +TEMPLATING_CHOICES += part +TEMPLATING_HELP_part := create a new part +TEMPLATING_PATH_part += .template/part +TEMPLATING_VARS_part += VERSION + +VERSION := v1 +HELP_VERSION := Sets the first version \ No newline at end of file diff --git a/parts/.template/part/Makefile b/parts/.template/part/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/parts/.template/part/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/.template/part/README.md b/parts/.template/part/README.md new file mode 100644 index 0000000..caeb0db --- /dev/null +++ b/parts/.template/part/README.md @@ -0,0 +1,40 @@ + +# Part template + + +This template should be used to create a new part. +1. Copy this template directory +2. Give your new part a meaningful name. +3. Append your new part to the part list in [../README.md](../README.md) +4. Edit this README + - Change title! +5. Continue editing in [v1/README.md](./1/README.md) + +--- +## Features + +- provides template for part + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all versions +- `make build` + - build all versions +- `make test` + - test all versions +- `make clean` + - clean all versions +- `make distclean` + - distclean all version + +--- +## Versions + + + +- [v1](./v1/) + - initial version \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/Makefile b/parts/.template/part/__VERSION__/Makefile new file mode 100644 index 0000000..020dacd --- /dev/null +++ b/parts/.template/part/__VERSION__/Makefile @@ -0,0 +1 @@ +include $(shell git rev-parse --show-toplevel)/.make/part.mk \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/README.md b/parts/.template/part/__VERSION__/README.md new file mode 100644 index 0000000..d5be71e --- /dev/null +++ b/parts/.template/part/__VERSION__/README.md @@ -0,0 +1,71 @@ + +# Part template (version v1) + + +This template should be used to create a new part version. +1. Edit this README + - Change title & version! +2. Delete unneeded directories +3. Edit READMEs of directories +4. Edit Makefile + +--- +## Features + +- provides template for part version + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test everything +- `make build` + - build everything +- `make test` + - test everything +- `make clean` + - clean everything +- `make distclean` + - distclean everything + +---- +## [Code](./code/) + + + +- template code directory + +---- +## [Docs](./docs/) + + +- template docs directory + +--- +## [Kicad](./kicad/) + + +- template kicad directory + +--- +## [Mechanics](./mechanics/) + + +- template machanics directory + +--- +## [Requirements](./requirements/) + + +- template requirements directory + +--- +## [Scripts](./scripts/) + + +- template scripts directory + +--- +See the other READMEs or [Makefile](./Makefile) for more information \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/code/.gitignore b/parts/.template/part/__VERSION__/code/.gitignore new file mode 100644 index 0000000..cc2dd92 --- /dev/null +++ b/parts/.template/part/__VERSION__/code/.gitignore @@ -0,0 +1 @@ +firmware \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/code/Makefile b/parts/.template/part/__VERSION__/code/Makefile new file mode 100644 index 0000000..4ba67a3 --- /dev/null +++ b/parts/.template/part/__VERSION__/code/Makefile @@ -0,0 +1,17 @@ + +TARGET_default := all +TARGET_all := build-firmware + +firmware: main.c + gcc -o $@ $< + +.phony: build-firmware +TARGET_build += build-firmware +build-firmware: firmware + +.phony: clean-firmware +TARGET_clean += clean-firmware +clean-firmware: + rm -f firmware + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/code/README.md b/parts/.template/part/__VERSION__/code/README.md new file mode 100644 index 0000000..0b04bbe --- /dev/null +++ b/parts/.template/part/__VERSION__/code/README.md @@ -0,0 +1,14 @@ + +# Part template code (version v1) + + +This the firmware implementation of the template. +1. Edit this README + - Change title & version! + +--- +## Features + +- hello world application +- Makefile building the application + diff --git a/parts/.template/part/__VERSION__/code/main.c b/parts/.template/part/__VERSION__/code/main.c new file mode 100644 index 0000000..9c85873 --- /dev/null +++ b/parts/.template/part/__VERSION__/code/main.c @@ -0,0 +1,5 @@ +#include + +int main() { + printf("firmware!\n"); +} diff --git a/parts/.template/part/__VERSION__/docs/README.md b/parts/.template/part/__VERSION__/docs/README.md new file mode 100644 index 0000000..e886a1a --- /dev/null +++ b/parts/.template/part/__VERSION__/docs/README.md @@ -0,0 +1,12 @@ + +# Part template documents (version v1) + + +This the document collection of the part template. +1. Edit this README + - Change title & version! + +--- +## Documents + +- none \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/kicad/README.md b/parts/.template/part/__VERSION__/kicad/README.md new file mode 100644 index 0000000..20a8d3d --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/README.md @@ -0,0 +1,15 @@ + +# Part template kicad (version v1) + + +These are the kicad files of the template. +1. Edit this README + - Change title & version! + +--- +## Projects + +- [voltage_divider](./voltage_divider/) + - simple voltage divider +- [simulation](./simulation/) + - simple simulation setup for the voltage divider \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/kicad/simulation/simulation-cache.lib b/parts/.template/part/__VERSION__/kicad/simulation/simulation-cache.lib new file mode 100644 index 0000000..3400715 --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/simulation/simulation-cache.lib @@ -0,0 +1,54 @@ +EESchema-LIBRARY Version 2.4 +#encoding utf-8 +# +# Device_R +# +DEF Device_R R 0 0 N Y 1 F N +F0 "R" 80 0 50 V V C CNN +F1 "Device_R" 0 0 50 V V C CNN +F2 "" -70 0 50 V I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + R_* +$ENDFPLIST +DRAW +S -40 -100 40 100 0 1 10 N +X ~ 1 0 150 50 D 50 50 1 1 P +X ~ 2 0 -150 50 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# Simulation_SPICE_VSIN +# +DEF Simulation_SPICE_VSIN V 0 1 N Y 1 F N +F0 "V" 100 100 50 H V L CNN +F1 "Simulation_SPICE_VSIN" 100 0 50 H V L CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +F4 "Y" 0 0 50 H I L CNN "Spice_Netlist_Enabled" +F5 "V" 0 0 50 H I L CNN "Spice_Primitive" +F6 "sin(0 1 1k)" 100 -100 50 H V L CNN "Spice_Model" +DRAW +A -25 0 25 1 1800 0 0 0 N 0 0 -50 0 +A 25 0 25 1800 -1 0 0 0 N 0 0 50 0 +C 0 0 100 0 1 10 f +T 0 0 75 50 0 0 0 + Normal 0 C C +X ~ 1 0 200 100 D 50 50 1 1 P +X ~ 2 0 -200 100 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +# power_GND +# +DEF power_GND #PWR 0 0 Y Y 1 F P +F0 "#PWR" 0 -250 50 H I C CNN +F1 "power_GND" 0 -150 50 H V C CNN +F2 "" 0 0 50 H I C CNN +F3 "" 0 0 50 H I C CNN +DRAW +P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N +X GND 1 0 0 0 D 50 50 1 1 W N +ENDDRAW +ENDDEF +# +#End Library diff --git a/parts/.template/part/__VERSION__/kicad/simulation/simulation.kicad_pcb b/parts/.template/part/__VERSION__/kicad/simulation/simulation.kicad_pcb new file mode 100644 index 0000000..02c8ecb --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/simulation/simulation.kicad_pcb @@ -0,0 +1 @@ +(kicad_pcb (version 4) (host kicad "dummy file") ) diff --git a/parts/.template/part/__VERSION__/kicad/simulation/simulation.pro b/parts/.template/part/__VERSION__/kicad/simulation/simulation.pro new file mode 100644 index 0000000..152769c --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/simulation/simulation.pro @@ -0,0 +1,33 @@ +update=22/05/2015 07:44:53 +version=1 +last_client=kicad +[general] +version=1 +RootSch= +BoardNm= +[pcbnew] +version=1 +LastNetListRead= +UseCmpFile=1 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 +[cvpcb] +version=1 +NetIExt=net +[eeschema] +version=1 +LibDir= +[eeschema/libraries] diff --git a/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch b/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch new file mode 100644 index 0000000..4dddb22 --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch @@ -0,0 +1,68 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 2 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Sheet +S 3800 2700 950 700 +U 5EB613C9 +F0 "DUT" 50 +F1 "../voltage_divider/voltage_divider.sch" 50 +F2 "Vcc" U R 4750 2800 50 +F3 "Gnd" U R 4750 3300 50 +F4 "out" U R 4750 3050 50 +$EndSheet +$Comp +L Simulation_SPICE:VSIN V1 +U 1 1 5EB61A71 +P 5650 3050 +F 0 "V1" H 5780 3141 50 0000 L CNN +F 1 "VSIN" H 5780 3050 50 0000 L CNN +F 2 "" H 5650 3050 50 0001 C CNN +F 3 "~" H 5650 3050 50 0001 C CNN +F 4 "Y" H 5650 3050 50 0001 L CNN "Spice_Netlist_Enabled" +F 5 "V" H 5650 3050 50 0001 L CNN "Spice_Primitive" +F 6 "sin(0 1 1k)" H 5780 2959 50 0000 L CNN "Spice_Model" + 1 5650 3050 + 1 0 0 -1 +$EndComp +Wire Wire Line + 5650 2850 5650 2800 +Wire Wire Line + 5650 2800 4750 2800 +Wire Wire Line + 5650 3250 5650 3300 +Wire Wire Line + 5650 3300 4750 3300 +$Comp +L power:GND #PWR01 +U 1 1 5EB61DF2 +P 5650 3300 +F 0 "#PWR01" H 5650 3050 50 0001 C CNN +F 1 "GND" H 5655 3127 50 0000 C CNN +F 2 "" H 5650 3300 50 0001 C CNN +F 3 "" H 5650 3300 50 0001 C CNN + 1 5650 3300 + 1 0 0 -1 +$EndComp +Connection ~ 5650 3300 +Text Label 5200 3050 0 50 ~ 0 +out +Wire Wire Line + 5200 3050 4750 3050 +Text Label 5650 2700 1 50 ~ 0 +in +Wire Wire Line + 5650 2700 5650 2800 +Connection ~ 5650 2800 +$EndSCHEMATC diff --git a/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch-bak b/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch-bak new file mode 100644 index 0000000..fff8c68 --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/simulation/simulation.sch-bak @@ -0,0 +1,4 @@ +EESchema Schematic File Version 2 +EELAYER 25 0 +EELAYER END +$EndSCHEMATC diff --git a/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider-cache.lib b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider-cache.lib new file mode 100644 index 0000000..478905e --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider-cache.lib @@ -0,0 +1,21 @@ +EESchema-LIBRARY Version 2.4 +#encoding utf-8 +# +# Device_R +# +DEF Device_R R 0 0 N Y 1 F N +F0 "R" 80 0 50 V V C CNN +F1 "Device_R" 0 0 50 V V C CNN +F2 "" -70 0 50 V I C CNN +F3 "" 0 0 50 H I C CNN +$FPLIST + R_* +$ENDFPLIST +DRAW +S -40 -100 40 100 0 1 10 N +X ~ 1 0 150 50 D 50 50 1 1 P +X ~ 2 0 -150 50 U 50 50 1 1 P +ENDDRAW +ENDDEF +# +#End Library diff --git a/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.kicad_pcb b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.kicad_pcb new file mode 100644 index 0000000..02c8ecb --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.kicad_pcb @@ -0,0 +1 @@ +(kicad_pcb (version 4) (host kicad "dummy file") ) diff --git a/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.pro b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.pro new file mode 100644 index 0000000..152769c --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.pro @@ -0,0 +1,33 @@ +update=22/05/2015 07:44:53 +version=1 +last_client=kicad +[general] +version=1 +RootSch= +BoardNm= +[pcbnew] +version=1 +LastNetListRead= +UseCmpFile=1 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 +[cvpcb] +version=1 +NetIExt=net +[eeschema] +version=1 +LibDir= +[eeschema/libraries] diff --git a/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch new file mode 100644 index 0000000..ca0296f --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch @@ -0,0 +1,55 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 2 2 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:R R1 +U 1 1 5EB5A4B7 +P 5500 3050 +F 0 "R1" H 5430 3004 50 0000 R CNN +F 1 "1k" H 5430 3095 50 0000 R CNN +F 2 "" V 5430 3050 50 0001 C CNN +F 3 "~" H 5500 3050 50 0001 C CNN + 1 5500 3050 + -1 0 0 1 +$EndComp +$Comp +L Device:R R2 +U 1 1 5EB5A7C0 +P 5500 3550 +F 0 "R2" H 5430 3504 50 0000 R CNN +F 1 "1k" H 5430 3595 50 0000 R CNN +F 2 "" V 5430 3550 50 0001 C CNN +F 3 "~" H 5500 3550 50 0001 C CNN + 1 5500 3550 + -1 0 0 1 +$EndComp +Wire Wire Line + 5500 2700 5500 2900 +Wire Wire Line + 5500 3200 5500 3300 +Wire Wire Line + 5500 3700 5500 3900 +Wire Wire Line + 5500 3300 5800 3300 +Connection ~ 5500 3300 +Wire Wire Line + 5500 3300 5500 3400 +Text HLabel 5500 2700 1 50 UnSpc ~ 0 +Vcc +Text HLabel 5500 3900 3 50 UnSpc ~ 0 +Gnd +Text HLabel 5800 3300 2 50 UnSpc ~ 0 +out +$EndSCHEMATC diff --git a/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch-bak b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch-bak new file mode 100644 index 0000000..fbd6215 --- /dev/null +++ b/parts/.template/part/__VERSION__/kicad/voltage_divider/voltage_divider.sch-bak @@ -0,0 +1,55 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:R R1 +U 1 1 5EB5A4B7 +P 5500 3050 +F 0 "R1" H 5430 3004 50 0000 R CNN +F 1 "1k" H 5430 3095 50 0000 R CNN +F 2 "" V 5430 3050 50 0001 C CNN +F 3 "~" H 5500 3050 50 0001 C CNN + 1 5500 3050 + -1 0 0 1 +$EndComp +$Comp +L Device:R R2 +U 1 1 5EB5A7C0 +P 5500 3550 +F 0 "R2" H 5430 3504 50 0000 R CNN +F 1 "1k" H 5430 3595 50 0000 R CNN +F 2 "" V 5430 3550 50 0001 C CNN +F 3 "~" H 5500 3550 50 0001 C CNN + 1 5500 3550 + -1 0 0 1 +$EndComp +Wire Wire Line + 5500 2700 5500 2900 +Wire Wire Line + 5500 3200 5500 3300 +Wire Wire Line + 5500 3700 5500 3900 +Wire Wire Line + 5500 3300 5800 3300 +Connection ~ 5500 3300 +Wire Wire Line + 5500 3300 5500 3400 +Text HLabel 5500 2700 1 50 UnSpc ~ 0 +Vcc +Text HLabel 5500 3900 3 50 UnSpc ~ 0 +Gnd +Text HLabel 5800 3300 2 50 UnSpc ~ 0 +out +$EndSCHEMATC diff --git a/parts/.template/part/__VERSION__/mechanics/README.md b/parts/.template/part/__VERSION__/mechanics/README.md new file mode 100644 index 0000000..9cb5eec --- /dev/null +++ b/parts/.template/part/__VERSION__/mechanics/README.md @@ -0,0 +1,12 @@ + +# Part template mechanics (version v1) + + +These are the mechanics files of the template. +1. Edit this README + - Change title & version! + +--- +## Files + +- none \ No newline at end of file diff --git a/parts/.template/part/__VERSION__/requirements/README.md b/parts/.template/part/__VERSION__/requirements/README.md new file mode 100644 index 0000000..e1d90b8 --- /dev/null +++ b/parts/.template/part/__VERSION__/requirements/README.md @@ -0,0 +1,17 @@ + +# Part template requirements (version v1) + + +These are the requirements files of the part template. +1. Edit this README + - Change title & version! + +--- +## Requirements + +- none + +--- +## Constraints + +- none \ No newline at end of file diff --git a/lifesensor_ci/main/component.mk b/parts/.template/part/__VERSION__/scripts/README.md similarity index 100% rename from lifesensor_ci/main/component.mk rename to parts/.template/part/__VERSION__/scripts/README.md diff --git a/parts/Makefile b/parts/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/parts/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/README.md b/parts/README.md new file mode 100644 index 0000000..632954d --- /dev/null +++ b/parts/README.md @@ -0,0 +1,115 @@ +# LifeSensor parts +*Parts* are components which are used as building blocks of [*products*](../products/). + +--- +## List of parts +- [interconnect](./interconnect/) + - interconnect between pcbs +- [esp32-firmware](./esp32-firmware/) + - firmware for the Esp32 +- [esp32-components](./esp32-components/) + - components of the esp32 firmware + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build all versions of all parts +- `make build` + - build all versions of all parts +- `make test` + - test all versions of all parts +- `make clean` + - clean all versions of all parts +- `make distclean` + - distclean all versions of all parts + +--- +## Adding new parts +- If you want to add a new part, +please copy the [*template part*](./.template/) and modify your copy. + +--- +## Structure + +``` +. +├── README.md : mandatory README.md you are currently reading +├── Makefile : mandatory Makefile executing targets in all subdirs +│ +├── : mandatory unique name of the part +│   ├── README.md : mandatory general description of the part +│   │ and elaboration of differences between version +│   │ +│   ├── : mandatory unique part version +│   │   ├── README.md : mandatory version specific description of the part, +│   │   │   should list all features +│   │   │ +│   │ ├── Makefile : mandatory Makefile for integration of the part +│   │   │ +│   │   ├── code : optional parent directory of any source code and build system files +│   │   │   │ i.e. firmware +│   │   │   ├── README.md : description of the source code +│   │   │   └── ... +│   │   │ +│   │   ├── docs : optional parent directory for documents +│   │   │   │ i.e. documentation, datasheets +│   │   │   ├── README.md : description of documents +│   │   │   └── ... +│   │   │ +│   │   ├── kicad : optional parent directory for kicad files +│   │   │   │ i.e. project files, schematics +│   │   │   ├── README.md : description of the kicad files +│   │   │   └── ... +│   │   │ +│   │   ├── mechanics : optional parent directory for mechanic files +│   │   │   │ i.e. 3D-printer models +│   │   │   ├── README.md : description of the mechanics files +│   │   │   └── ... +│   │   │ +│   │   ├── requirements : mandatory parent directory for requirements +│   │   │   │ used by requirement management tools +│   │   │   ├── README.md : description of requirements +│   │   │   └── ... +│   │   │ +│   │   └── scripts : optional parent directory of part specific helper scripts +│   │      │ i.e. documentation generation, calculators +│   │   ├── README.md : description of scripts +│   │      └── ... +│   │ +│   ├── +│   │   └── ... +│   └── ... +│ +├── +│   └── ... +└── ... +``` + +--- +## Rules +- *Parts* of the LifeSensor project should have a dedicated directory here. +- *Parts* should not include other *parts*, instead they should refer to other *parts*. +- *Parts* may compete for the same functionality. + - Different [*products*](../products/) may choose different *parts* +- *Parts* should follow the directory scheme defined by the [*template part*](./.template/) + - *Parent directories* may contain any structure + - Optional *parent directories* can be removed +- Only non-breaking changes may be introduced as patch for a *part* +- *Part versions* denote non-backwards-compatible variants of the same *part* + - If major implementations change, consider creating a new *part* or *part version* +- *Part versions* should never denote the state of the *part* + - All *part versions* should provide their intended functionality + +--- +## F.a.q +- Why no hierarchical structure? + - *Parts* may implement multiple features therefore can't be sorted by distinct features + - *Parts* may consist of file from multiple categories (*code*, *mechanics*, ...) breaking these up makes things complicated + - *Parts* may be outsourced in the future and reintegrated vai git submodules +- Why version directories inside git? + - Git can deduplicate files therefore the internal structure isn't bloated + - *Part versions* are not necessarily incremental changes + - This repo aims to support multiple [*products*](../products/) at once which may require different versions of *parts* \ No newline at end of file diff --git a/components/template/CMakeLists.txt b/parts/esp32-components/.template/CMakeLists.txt similarity index 100% rename from components/template/CMakeLists.txt rename to parts/esp32-components/.template/CMakeLists.txt diff --git a/components/template/Kconfig b/parts/esp32-components/.template/Kconfig similarity index 100% rename from components/template/Kconfig rename to parts/esp32-components/.template/Kconfig diff --git a/components/template/README.md b/parts/esp32-components/.template/README.md similarity index 100% rename from components/template/README.md rename to parts/esp32-components/.template/README.md diff --git a/components/template/include/counter.h b/parts/esp32-components/.template/include/counter.h similarity index 100% rename from components/template/include/counter.h rename to parts/esp32-components/.template/include/counter.h diff --git a/components/template/src/counter.c b/parts/esp32-components/.template/src/counter.c similarity index 100% rename from components/template/src/counter.c rename to parts/esp32-components/.template/src/counter.c diff --git a/components/template/test/CMakeLists.txt b/parts/esp32-components/.template/test/CMakeLists.txt similarity index 100% rename from components/template/test/CMakeLists.txt rename to parts/esp32-components/.template/test/CMakeLists.txt diff --git a/components/template/test/test.c b/parts/esp32-components/.template/test/test.c similarity index 100% rename from components/template/test/test.c rename to parts/esp32-components/.template/test/test.c diff --git a/parts/esp32-components/Makefile b/parts/esp32-components/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/parts/esp32-components/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/esp32-components/README.md b/parts/esp32-components/README.md new file mode 100644 index 0000000..a9e29a1 --- /dev/null +++ b/parts/esp32-components/README.md @@ -0,0 +1,47 @@ + +# Part Esp32 Components + + +"Component" is a term for structures used by the espressif idf framework, +separating code into libraries and defining dependencies. + + + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all variants +- `make build` + - build all variants +- `make test` + - test all variants +- `make clean` + - clean all variants +- `make distclean` + - distclean all variants + +--- +## Variants + + + +* [ulp_adc](./ulp_adc/) + * Utilize the Ultra-low-power Co-processor to sample the ADCs of the ESP +* [SpO2](./spo2/) + * Driver for the original remo2hbo SpO2 hardware +* [linux](./linux/) + * Source code that originates from the linux kernel +* [lifesensor_common](./lifesensor_common/) + * Commonly used structures and defines +* [channel](./channel/) + * Event abstraction for FreeRTOS + + +--- +## Adding a new component +See the [.template/](./.template/) component. diff --git a/components/channel/CMakeLists.txt b/parts/esp32-components/channel/CMakeLists.txt similarity index 100% rename from components/channel/CMakeLists.txt rename to parts/esp32-components/channel/CMakeLists.txt diff --git a/components/channel/Kconfig b/parts/esp32-components/channel/Kconfig similarity index 100% rename from components/channel/Kconfig rename to parts/esp32-components/channel/Kconfig diff --git a/components/channel/README.md b/parts/esp32-components/channel/README.md similarity index 100% rename from components/channel/README.md rename to parts/esp32-components/channel/README.md diff --git a/components/channel/include/channel.h b/parts/esp32-components/channel/include/channel.h similarity index 100% rename from components/channel/include/channel.h rename to parts/esp32-components/channel/include/channel.h diff --git a/components/channel/include/channel_debug.h b/parts/esp32-components/channel/include/channel_debug.h similarity index 100% rename from components/channel/include/channel_debug.h rename to parts/esp32-components/channel/include/channel_debug.h diff --git a/components/channel/include/channel_internal.h b/parts/esp32-components/channel/include/channel_internal.h similarity index 100% rename from components/channel/include/channel_internal.h rename to parts/esp32-components/channel/include/channel_internal.h diff --git a/components/channel/src/channel.c b/parts/esp32-components/channel/src/channel.c similarity index 100% rename from components/channel/src/channel.c rename to parts/esp32-components/channel/src/channel.c diff --git a/components/channel/test/CMakeLists.txt b/parts/esp32-components/channel/test/CMakeLists.txt similarity index 100% rename from components/channel/test/CMakeLists.txt rename to parts/esp32-components/channel/test/CMakeLists.txt diff --git a/components/channel/test/channel_test.c b/parts/esp32-components/channel/test/channel_test.c similarity index 100% rename from components/channel/test/channel_test.c rename to parts/esp32-components/channel/test/channel_test.c diff --git a/components/lifesensor_common/CMakeLists.txt b/parts/esp32-components/lifesensor_common/CMakeLists.txt similarity index 100% rename from components/lifesensor_common/CMakeLists.txt rename to parts/esp32-components/lifesensor_common/CMakeLists.txt diff --git a/components/lifesensor_common/README.md b/parts/esp32-components/lifesensor_common/README.md similarity index 100% rename from components/lifesensor_common/README.md rename to parts/esp32-components/lifesensor_common/README.md diff --git a/components/lifesensor_common/include/macro/queue.h b/parts/esp32-components/lifesensor_common/include/macro/queue.h similarity index 100% rename from components/lifesensor_common/include/macro/queue.h rename to parts/esp32-components/lifesensor_common/include/macro/queue.h diff --git a/components/lifesensor_common/include/macro/task.h b/parts/esp32-components/lifesensor_common/include/macro/task.h similarity index 100% rename from components/lifesensor_common/include/macro/task.h rename to parts/esp32-components/lifesensor_common/include/macro/task.h diff --git a/components/linux/CMakeLists.txt b/parts/esp32-components/linux/CMakeLists.txt similarity index 100% rename from components/linux/CMakeLists.txt rename to parts/esp32-components/linux/CMakeLists.txt diff --git a/components/linux/include/list.h b/parts/esp32-components/linux/include/list.h similarity index 100% rename from components/linux/include/list.h rename to parts/esp32-components/linux/include/list.h diff --git a/components/spo2/CMakeLists.txt b/parts/esp32-components/spo2/CMakeLists.txt similarity index 100% rename from components/spo2/CMakeLists.txt rename to parts/esp32-components/spo2/CMakeLists.txt diff --git a/components/spo2/README.md b/parts/esp32-components/spo2/README.md similarity index 100% rename from components/spo2/README.md rename to parts/esp32-components/spo2/README.md diff --git a/components/spo2/include/spo2.h b/parts/esp32-components/spo2/include/spo2.h similarity index 100% rename from components/spo2/include/spo2.h rename to parts/esp32-components/spo2/include/spo2.h diff --git a/components/spo2/include/spo2_driver.h b/parts/esp32-components/spo2/include/spo2_driver.h similarity index 100% rename from components/spo2/include/spo2_driver.h rename to parts/esp32-components/spo2/include/spo2_driver.h diff --git a/components/spo2/include/spo2_filter.h b/parts/esp32-components/spo2/include/spo2_filter.h similarity index 100% rename from components/spo2/include/spo2_filter.h rename to parts/esp32-components/spo2/include/spo2_filter.h diff --git a/components/spo2/src/spo2.c b/parts/esp32-components/spo2/src/spo2.c similarity index 100% rename from components/spo2/src/spo2.c rename to parts/esp32-components/spo2/src/spo2.c diff --git a/components/spo2/src/spo2_driver.c b/parts/esp32-components/spo2/src/spo2_driver.c similarity index 100% rename from components/spo2/src/spo2_driver.c rename to parts/esp32-components/spo2/src/spo2_driver.c diff --git a/components/spo2/src/spo2_filter.c b/parts/esp32-components/spo2/src/spo2_filter.c similarity index 100% rename from components/spo2/src/spo2_filter.c rename to parts/esp32-components/spo2/src/spo2_filter.c diff --git a/components/ulp_adc/CMakeLists.txt b/parts/esp32-components/ulp_adc/CMakeLists.txt similarity index 100% rename from components/ulp_adc/CMakeLists.txt rename to parts/esp32-components/ulp_adc/CMakeLists.txt diff --git a/components/ulp_adc/README.md b/parts/esp32-components/ulp_adc/README.md similarity index 100% rename from components/ulp_adc/README.md rename to parts/esp32-components/ulp_adc/README.md diff --git a/components/ulp_adc/component.mk b/parts/esp32-components/ulp_adc/component.mk similarity index 100% rename from components/ulp_adc/component.mk rename to parts/esp32-components/ulp_adc/component.mk diff --git a/components/ulp_adc/include/ulp.h b/parts/esp32-components/ulp_adc/include/ulp.h similarity index 100% rename from components/ulp_adc/include/ulp.h rename to parts/esp32-components/ulp_adc/include/ulp.h diff --git a/components/ulp_adc/src/ulp.c b/parts/esp32-components/ulp_adc/src/ulp.c similarity index 100% rename from components/ulp_adc/src/ulp.c rename to parts/esp32-components/ulp_adc/src/ulp.c diff --git a/components/ulp_adc/ulp/ulp_program.S b/parts/esp32-components/ulp_adc/ulp/ulp_program.S similarity index 100% rename from components/ulp_adc/ulp/ulp_program.S rename to parts/esp32-components/ulp_adc/ulp/ulp_program.S diff --git a/parts/esp32-firmware/Makefile b/parts/esp32-firmware/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/parts/esp32-firmware/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/esp32-firmware/README.md b/parts/esp32-firmware/README.md new file mode 100644 index 0000000..9af56e5 --- /dev/null +++ b/parts/esp32-firmware/README.md @@ -0,0 +1,39 @@ + +# Part Esp32 Firmware + + +This is the firmware for the esp32 that controls the various sensor boards. + +--- +## Features + +- modular by design +- consists of components + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all variants +- `make build` + - build all variants +- `make test` + - test all variants +- `make clean` + - clean all variants +- `make distclean` + - distclean all variants + +--- +## Variants + + + +- [prototype](./prototype/) + - firmware of the current prototype +- [test](./test/) + - firmware for on-device component testing +- [qemu](./qemu/) + - firmware for component testing in qemu \ No newline at end of file diff --git a/lifesensor/.gitignore b/parts/esp32-firmware/prototype/.gitignore similarity index 100% rename from lifesensor/.gitignore rename to parts/esp32-firmware/prototype/.gitignore diff --git a/lifesensor/CMakeLists.txt b/parts/esp32-firmware/prototype/CMakeLists.txt similarity index 83% rename from lifesensor/CMakeLists.txt rename to parts/esp32-firmware/prototype/CMakeLists.txt index 9fefc48..9418eba 100644 --- a/lifesensor/CMakeLists.txt +++ b/parts/esp32-firmware/prototype/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -set(EXTRA_COMPONENT_DIRS "../components" ) +set(EXTRA_COMPONENT_DIRS "components" ) get_filename_component(PROJECT_PATH "." ABSOLUTE) get_filename_component(PROJECT_NAME ${PROJECT_PATH} NAME) diff --git a/parts/esp32-firmware/prototype/Makefile b/parts/esp32-firmware/prototype/Makefile new file mode 100644 index 0000000..b91ac51 --- /dev/null +++ b/parts/esp32-firmware/prototype/Makefile @@ -0,0 +1,4 @@ +HELP = LifeSensor esp32 prototype firmware +DEPENDS = $(dir $(wildcard components/*/Makefile */Makefile) ) + +include $(shell git rev-parse --show-toplevel)/.make/idf.mk diff --git a/lifesensor/README.md b/parts/esp32-firmware/prototype/README.md similarity index 100% rename from lifesensor/README.md rename to parts/esp32-firmware/prototype/README.md diff --git a/parts/esp32-firmware/prototype/components/channel b/parts/esp32-firmware/prototype/components/channel new file mode 120000 index 0000000..accdca2 --- /dev/null +++ b/parts/esp32-firmware/prototype/components/channel @@ -0,0 +1 @@ +../../../esp32-components/channel \ No newline at end of file diff --git a/parts/esp32-firmware/prototype/components/lifesensor_common b/parts/esp32-firmware/prototype/components/lifesensor_common new file mode 120000 index 0000000..f2784ee --- /dev/null +++ b/parts/esp32-firmware/prototype/components/lifesensor_common @@ -0,0 +1 @@ +../../../esp32-components/lifesensor_common \ No newline at end of file diff --git a/parts/esp32-firmware/prototype/components/linux b/parts/esp32-firmware/prototype/components/linux new file mode 120000 index 0000000..f65f287 --- /dev/null +++ b/parts/esp32-firmware/prototype/components/linux @@ -0,0 +1 @@ +../../../esp32-components/linux \ No newline at end of file diff --git a/parts/esp32-firmware/prototype/components/spo2 b/parts/esp32-firmware/prototype/components/spo2 new file mode 120000 index 0000000..69c3e87 --- /dev/null +++ b/parts/esp32-firmware/prototype/components/spo2 @@ -0,0 +1 @@ +../../../esp32-components/spo2 \ No newline at end of file diff --git a/parts/esp32-firmware/prototype/components/ulp_adc b/parts/esp32-firmware/prototype/components/ulp_adc new file mode 120000 index 0000000..aabc842 --- /dev/null +++ b/parts/esp32-firmware/prototype/components/ulp_adc @@ -0,0 +1 @@ +../../../esp32-components/ulp_adc \ No newline at end of file diff --git a/parts/esp32-firmware/prototype/docs/Makefile b/parts/esp32-firmware/prototype/docs/Makefile new file mode 100644 index 0000000..3ab63d4 --- /dev/null +++ b/parts/esp32-firmware/prototype/docs/Makefile @@ -0,0 +1,21 @@ +HELP = LifeSensor Documents + +TARGETS_all += build + +GRAPHVIZ += esp32_overview.svg + +.PHONY: build-graphviz +TARGETS_build += build-graphviz +HELP_build-graphviz = run graphviz to generate images +build-graphviz: $(GRAPHVIZ) + +.PHONY: clean-graphviz +TARGETS_clean += clean-graphviz +HELP_clean-graphviz = remove images produced by graphviz +clean-graphviz: + rm -f $(GRAPHVIZ) + +%.svg : %.neato.gv + neato -Tsvg $^ > $@ + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/doc/esp32_overview.gv b/parts/esp32-firmware/prototype/docs/esp32_overview.neato.gv similarity index 100% rename from doc/esp32_overview.gv rename to parts/esp32-firmware/prototype/docs/esp32_overview.neato.gv diff --git a/doc/esp32_overview.svg b/parts/esp32-firmware/prototype/docs/esp32_overview.svg similarity index 99% rename from doc/esp32_overview.svg rename to parts/esp32-firmware/prototype/docs/esp32_overview.svg index f8adf93..7945df6 100644 --- a/doc/esp32_overview.svg +++ b/parts/esp32-firmware/prototype/docs/esp32_overview.svg @@ -1,7 +1,7 @@ - &1 | tee build/qemu.log + +build/qemu.img: build-firmware + +.PHONY: build-firmware +TARGETS_build += build-firmware +HELP_build-firmware = build image runnable by qemu +DOCKER += build-firmware +DOCKER_build-firmware = idf/v4.0 +build-firmware: + $(IDF) all + dd if=/dev/zero bs=1024 count=4096 of=build/qemu.img; \ + dd if=build/bootloader/bootloader.bin bs=1 seek=$$((0x1000)) of=build/qemu.img conv=notrunc; \ + dd if=build/partition_table/partition-table.bin bs=1 seek=$$((0x8000)) of=build/qemu.img conv=notrunc; \ + dd if=$$(ls build/*.bin) bs=1 seek=$$((0x10000)) of=build/qemu.img conv=notrunc; + +.PHONY: qemu-gdb +TARGETS += qemu-gdb +HELP_qemu-gdb = start qemu and wait for gdb +DOCKER += qemu-gdb +qemu-gdb: build/qemu.img + qemu-system-xtensa \ + -s -S \ + -no-reboot \ + -nographic \ + -machine esp32 \ + -drive file=$^,if=mtd,format=raw" + +.PHONY: gdb +TARGETS += gdb +HELP_gdb = start gdb and connect to qemu +DOCKER += gdb +gdb: + xtensa-esp32-elf-gdb $$(ls build/*.elf) \ + -ex \"target remote :1234\" \ + -ex \"tb app_main\" \ + -ex \"c\"" + +build/qemu.log: qemu + +.PHONY: test-qemu +TARGETS_test += test-qemu +HELP_test-qemu = check errors in qemu run +test-qemu: build/qemu.log + grep -q "0 Failures" $^ + + +.PHONY: clean-build +TARGETS_clean += clean-build +HELP_clean-build = remove generated files of project components +clean-build: + rm -rf build/esp-idf/ + +.PHONY: distclean-build +TARGETS_distclean += distclean-build +HELP_distclean-build = remove all generated files +distclean-build: + rm -f sdkconfig + rm -rf build + +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/lifesensor_ci/README.md b/parts/esp32-firmware/qemu/README.md similarity index 100% rename from lifesensor_ci/README.md rename to parts/esp32-firmware/qemu/README.md diff --git a/parts/esp32-firmware/qemu/components/channel b/parts/esp32-firmware/qemu/components/channel new file mode 120000 index 0000000..accdca2 --- /dev/null +++ b/parts/esp32-firmware/qemu/components/channel @@ -0,0 +1 @@ +../../../esp32-components/channel \ No newline at end of file diff --git a/parts/esp32-firmware/qemu/components/lifesensor_common b/parts/esp32-firmware/qemu/components/lifesensor_common new file mode 120000 index 0000000..f2784ee --- /dev/null +++ b/parts/esp32-firmware/qemu/components/lifesensor_common @@ -0,0 +1 @@ +../../../esp32-components/lifesensor_common \ No newline at end of file diff --git a/parts/esp32-firmware/qemu/components/linux b/parts/esp32-firmware/qemu/components/linux new file mode 120000 index 0000000..f65f287 --- /dev/null +++ b/parts/esp32-firmware/qemu/components/linux @@ -0,0 +1 @@ +../../../esp32-components/linux \ No newline at end of file diff --git a/parts/esp32-firmware/qemu/components/spo2 b/parts/esp32-firmware/qemu/components/spo2 new file mode 120000 index 0000000..69c3e87 --- /dev/null +++ b/parts/esp32-firmware/qemu/components/spo2 @@ -0,0 +1 @@ +../../../esp32-components/spo2 \ No newline at end of file diff --git a/parts/esp32-firmware/qemu/components/ulp_adc b/parts/esp32-firmware/qemu/components/ulp_adc new file mode 120000 index 0000000..aabc842 --- /dev/null +++ b/parts/esp32-firmware/qemu/components/ulp_adc @@ -0,0 +1 @@ +../../../esp32-components/ulp_adc \ No newline at end of file diff --git a/lifesensor_ci/main/CMakeLists.txt b/parts/esp32-firmware/qemu/main/CMakeLists.txt similarity index 100% rename from lifesensor_ci/main/CMakeLists.txt rename to parts/esp32-firmware/qemu/main/CMakeLists.txt diff --git a/lifesensor_test/main/component.mk b/parts/esp32-firmware/qemu/main/component.mk similarity index 100% rename from lifesensor_test/main/component.mk rename to parts/esp32-firmware/qemu/main/component.mk diff --git a/lifesensor_ci/main/main.c b/parts/esp32-firmware/qemu/main/main.c similarity index 100% rename from lifesensor_ci/main/main.c rename to parts/esp32-firmware/qemu/main/main.c diff --git a/lifesensor_ci/sdkconfig.defaults b/parts/esp32-firmware/qemu/sdkconfig.defaults similarity index 100% rename from lifesensor_ci/sdkconfig.defaults rename to parts/esp32-firmware/qemu/sdkconfig.defaults diff --git a/lifesensor_test/.gitignore b/parts/esp32-firmware/test/.gitignore similarity index 69% rename from lifesensor_test/.gitignore rename to parts/esp32-firmware/test/.gitignore index f2e74fa..14bde84 100644 --- a/lifesensor_test/.gitignore +++ b/parts/esp32-firmware/test/.gitignore @@ -1,3 +1,4 @@ build sdkconfig* !sdkconfig.defaults +.setup-device.mk \ No newline at end of file diff --git a/lifesensor_ci/CMakeLists.txt b/parts/esp32-firmware/test/CMakeLists.txt similarity index 78% rename from lifesensor_ci/CMakeLists.txt rename to parts/esp32-firmware/test/CMakeLists.txt index c16ed85..1102b5e 100644 --- a/lifesensor_ci/CMakeLists.txt +++ b/parts/esp32-firmware/test/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -set(EXTRA_COMPONENT_DIRS "../components" ) +set(EXTRA_COMPONENT_DIRS "components/" ) set(PROJECT_COMPONENTS "") @@ -15,12 +15,7 @@ endforeach() get_filename_component(PROJECT_PATH "." ABSOLUTE) get_filename_component(PROJECT_NAME ${PROJECT_PATH} NAME) -set( - TEST_COMPONENTS - ${PROJECT_COMPONENTS} - CACHE STRING - "List of components to test" -) +set(TEST_COMPONENTS ${PROJECT_COMPONENTS}) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(${PROJECT_NAME}) diff --git a/parts/esp32-firmware/test/Makefile b/parts/esp32-firmware/test/Makefile new file mode 100644 index 0000000..1abed14 --- /dev/null +++ b/parts/esp32-firmware/test/Makefile @@ -0,0 +1,4 @@ +HELP = LifeSensor esp32 test firmware +DEPENDS = $(dir $(wildcard components/*/Makefile)) + +include $(shell git rev-parse --show-toplevel)/.make/idf.mk \ No newline at end of file diff --git a/lifesensor_test/README.md b/parts/esp32-firmware/test/README.md similarity index 100% rename from lifesensor_test/README.md rename to parts/esp32-firmware/test/README.md diff --git a/parts/esp32-firmware/test/components/channel b/parts/esp32-firmware/test/components/channel new file mode 120000 index 0000000..accdca2 --- /dev/null +++ b/parts/esp32-firmware/test/components/channel @@ -0,0 +1 @@ +../../../esp32-components/channel \ No newline at end of file diff --git a/parts/esp32-firmware/test/components/lifesensor_common b/parts/esp32-firmware/test/components/lifesensor_common new file mode 120000 index 0000000..f2784ee --- /dev/null +++ b/parts/esp32-firmware/test/components/lifesensor_common @@ -0,0 +1 @@ +../../../esp32-components/lifesensor_common \ No newline at end of file diff --git a/parts/esp32-firmware/test/components/linux b/parts/esp32-firmware/test/components/linux new file mode 120000 index 0000000..f65f287 --- /dev/null +++ b/parts/esp32-firmware/test/components/linux @@ -0,0 +1 @@ +../../../esp32-components/linux \ No newline at end of file diff --git a/parts/esp32-firmware/test/components/spo2 b/parts/esp32-firmware/test/components/spo2 new file mode 120000 index 0000000..69c3e87 --- /dev/null +++ b/parts/esp32-firmware/test/components/spo2 @@ -0,0 +1 @@ +../../../esp32-components/spo2 \ No newline at end of file diff --git a/parts/esp32-firmware/test/components/ulp_adc b/parts/esp32-firmware/test/components/ulp_adc new file mode 120000 index 0000000..aabc842 --- /dev/null +++ b/parts/esp32-firmware/test/components/ulp_adc @@ -0,0 +1 @@ +../../../esp32-components/ulp_adc \ No newline at end of file diff --git a/lifesensor_test/main/CMakeLists.txt b/parts/esp32-firmware/test/main/CMakeLists.txt similarity index 100% rename from lifesensor_test/main/CMakeLists.txt rename to parts/esp32-firmware/test/main/CMakeLists.txt diff --git a/parts/esp32-firmware/test/main/component.mk b/parts/esp32-firmware/test/main/component.mk new file mode 100644 index 0000000..e69de29 diff --git a/lifesensor_test/main/main.c b/parts/esp32-firmware/test/main/main.c similarity index 100% rename from lifesensor_test/main/main.c rename to parts/esp32-firmware/test/main/main.c diff --git a/lifesensor_test/sdkconfig.defaults b/parts/esp32-firmware/test/sdkconfig.defaults similarity index 100% rename from lifesensor_test/sdkconfig.defaults rename to parts/esp32-firmware/test/sdkconfig.defaults diff --git a/parts/interconnect/Makefile b/parts/interconnect/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/parts/interconnect/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/parts/interconnect/README.md b/parts/interconnect/README.md new file mode 100644 index 0000000..8ab938d --- /dev/null +++ b/parts/interconnect/README.md @@ -0,0 +1,37 @@ + +# Part interconnect + + +This is the interconnect that connects the various sensor boards. + +--- +## Features + +- single component +- stackable +- raspberry pi compatible pinout + - raspberry pi can be used as test platform to drive the interconnect + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all versions +- `make build` + - build all versions +- `make test` + - test all versions +- `make clean` + - clean all versions +- `make distclean` + - distclean all version + +--- +## Versions + + + +- [v1](./v1/) + - initial version \ No newline at end of file diff --git a/parts/interconnect/v1/Makefile b/parts/interconnect/v1/Makefile new file mode 100644 index 0000000..d87a11c --- /dev/null +++ b/parts/interconnect/v1/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/part.mk \ No newline at end of file diff --git a/parts/interconnect/v1/README.md b/parts/interconnect/v1/README.md new file mode 100644 index 0000000..5dd7e98 --- /dev/null +++ b/parts/interconnect/v1/README.md @@ -0,0 +1,44 @@ + +# Part interconnect (version v1) + + +This is the interconnect that connects the various sensor boards. + +--- +## Features + +- single component +- stackable +- raspberry pi compatible pinout + - raspberry pi can be used as test platform to drive the interconnect + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test everything +- `make build` + - build everything +- `make test` + - test everything +- `make clean` + - clean everything +- `make distclean` + - distclean everything + +---- +## [Docs](./docs/) + + +- list of vendors + +--- +## [Kicad](./kicad/) + + +- pinout schematic + +--- +See the other READMEs or [Makefile](./Makefile) for more information \ No newline at end of file diff --git a/parts/interconnect/v1/docs/README.md b/parts/interconnect/v1/docs/README.md new file mode 100644 index 0000000..d592c29 --- /dev/null +++ b/parts/interconnect/v1/docs/README.md @@ -0,0 +1,11 @@ + +# Part interconnect documents (version v1) + + +This the document collection of the part interconnect. + +--- +## Documents + +- [vendors.md](./vendors.md) + - List of shops selling the interconnect \ No newline at end of file diff --git a/parts/interconnect/v1/docs/vendors.md b/parts/interconnect/v1/docs/vendors.md new file mode 100644 index 0000000..1e84c6a --- /dev/null +++ b/parts/interconnect/v1/docs/vendors.md @@ -0,0 +1,13 @@ +# Vendor list + +## aliexpress.com +- [Company Connector & Switch Store](https://de.aliexpress.com/item/32829482875.html) + - 2.50$/5pc + +## amazon.com +- [SCHMARTBOARD](https://www.amazon.com/Extra-Long-Female-Stackable-Headers/dp/B06XR5ZPD9) + - 5$/3pc + +## digikey.de +- [SCHMARTBOARD](https://www.digikey.de/products/de?keywords=%20920-0200-01%20) + - 4.61€/3pc \ No newline at end of file diff --git a/parts/interconnect/v1/kicad/README.md b/parts/interconnect/v1/kicad/README.md new file mode 100644 index 0000000..c84c7e5 --- /dev/null +++ b/parts/interconnect/v1/kicad/README.md @@ -0,0 +1,11 @@ + +# Part interconnect kicad (version v1) + + +The kicad schematics of the interconnect. + +--- +## Projects + +- [interconnect](./interconnect/) + - the interconnect schematics \ No newline at end of file diff --git a/parts/interconnect/v1/kicad/interconnect/interconnect.kicad_pcb b/parts/interconnect/v1/kicad/interconnect/interconnect.kicad_pcb new file mode 100644 index 0000000..02c8ecb --- /dev/null +++ b/parts/interconnect/v1/kicad/interconnect/interconnect.kicad_pcb @@ -0,0 +1 @@ +(kicad_pcb (version 4) (host kicad "dummy file") ) diff --git a/parts/interconnect/v1/kicad/interconnect/interconnect.pro b/parts/interconnect/v1/kicad/interconnect/interconnect.pro new file mode 100644 index 0000000..152769c --- /dev/null +++ b/parts/interconnect/v1/kicad/interconnect/interconnect.pro @@ -0,0 +1,33 @@ +update=22/05/2015 07:44:53 +version=1 +last_client=kicad +[general] +version=1 +RootSch= +BoardNm= +[pcbnew] +version=1 +LastNetListRead= +UseCmpFile=1 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 +[cvpcb] +version=1 +NetIExt=net +[eeschema] +version=1 +LibDir= +[eeschema/libraries] diff --git a/parts/interconnect/v1/kicad/interconnect/interconnect.sch b/parts/interconnect/v1/kicad/interconnect/interconnect.sch new file mode 100644 index 0000000..cfb1962 --- /dev/null +++ b/parts/interconnect/v1/kicad/interconnect/interconnect.sch @@ -0,0 +1,451 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 2 2 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Connector_Generic:Conn_02x20_Odd_Even J1 +U 1 1 5EB2A561 +P 5800 3800 +F 0 "J1" H 5850 4917 50 0000 C CNN +F 1 "Conn_02x20_Odd_Even" H 5850 4826 50 0000 C CNN +F 2 "Connector_IDC:IDC-Header_2x20_P2.54mm_Vertical" H 5800 3800 50 0001 C CNN +F 3 "~" H 5800 3800 50 0001 C CNN + 1 5800 3800 + 1 0 0 -1 +$EndComp +Text Label 4900 3000 0 50 ~ 0 +BCM2 +Text Label 5250 2900 0 50 ~ 0 +3v3 +Text Label 4900 3100 0 50 ~ 0 +BCM3 +Text Label 4900 3200 0 50 ~ 0 +BCM4 +Text Label 4900 3400 0 50 ~ 0 +BCM17 +Text Label 4900 3500 0 50 ~ 0 +BCM27 +Text Label 4900 3600 0 50 ~ 0 +BCM22 +Text Label 5250 3700 0 50 ~ 0 +3v3 +Text Label 4900 3800 0 50 ~ 0 +BCM10 +Text Label 4900 3900 0 50 ~ 0 +BCM9 +Text Label 4900 4000 0 50 ~ 0 +BCM11 +Text Label 4900 4200 0 50 ~ 0 +BCM0 +Text Label 4900 4300 0 50 ~ 0 +BCM5 +Text Label 4900 4400 0 50 ~ 0 +BCM6 +Text Label 4900 4500 0 50 ~ 0 +BCM13 +Text Label 4900 4600 0 50 ~ 0 +BCM19 +Text Label 4900 4700 0 50 ~ 0 +BCM26 +Text Label 6450 2900 0 50 ~ 0 +5v +Text Label 6450 3000 0 50 ~ 0 +5v +Wire Notes Line + 5250 2600 5250 4850 +Text Label 5250 3300 0 50 ~ 0 +GND +Text Label 5250 4100 0 50 ~ 0 +GND +Text Label 5250 4800 0 50 ~ 0 +GND +Wire Notes Line + 6450 2600 6450 4850 +Text Label 6800 4800 0 50 ~ 0 +BCM21 +Text Label 6800 4700 0 50 ~ 0 +BCM20 +Text Label 6800 4600 0 50 ~ 0 +BCM16 +Text Label 6800 4400 0 50 ~ 0 +BCM12 +Text Label 6800 4200 0 50 ~ 0 +BCM1 +Text Label 6800 4100 0 50 ~ 0 +BCM7 +Text Label 6800 4000 0 50 ~ 0 +BCM8 +Text Label 6800 3900 0 50 ~ 0 +BCM25 +Text Label 6800 3700 0 50 ~ 0 +BCM24 +Text Label 6800 3600 0 50 ~ 0 +BCM23 +Text Label 6800 3400 0 50 ~ 0 +BCM18 +Text Label 6800 3300 0 50 ~ 0 +BCM15 +Text Label 6800 3200 0 50 ~ 0 +BCM14 +Text Label 6450 3100 0 50 ~ 0 +GND +Text Label 6450 3500 0 50 ~ 0 +GND +Text Label 6450 3800 0 50 ~ 0 +GND +Text Label 6450 4300 0 50 ~ 0 +GND +Text Label 6450 4500 0 50 ~ 0 +GND +Wire Notes Line + 4900 2600 4900 4850 +Wire Notes Line + 6800 2600 6800 4850 +Text Notes 4900 2600 0 50 ~ 0 +RPI\nBCM +Text Notes 5250 2600 0 50 ~ 0 +RPI\nPower +Text Notes 6450 2600 0 50 ~ 0 +RPI\nPower +Text Notes 6800 2600 0 50 ~ 0 +RPI\nBCM +Text Label 4550 3000 0 50 ~ 0 +W8 +Text Label 4550 3100 0 50 ~ 0 +W9 +Text Label 4550 3200 0 50 ~ 0 +W7 +Text Label 4550 3400 0 50 ~ 0 +W0 +Text Label 4550 3500 0 50 ~ 0 +W2 +Text Label 4550 3600 0 50 ~ 0 +W3 +Text Label 4550 3800 0 50 ~ 0 +W12 +Text Label 4550 3900 0 50 ~ 0 +W13 +Text Label 4550 4000 0 50 ~ 0 +W14 +Text Label 4550 4200 0 50 ~ 0 +W30 +Text Label 4550 4300 0 50 ~ 0 +W21 +Text Label 4550 4400 0 50 ~ 0 +W22 +Text Label 4550 4500 0 50 ~ 0 +W23 +Text Label 4550 4600 0 50 ~ 0 +W24 +Text Label 4550 4700 0 50 ~ 0 +W25 +Wire Notes Line + 4550 2600 4550 4850 +Text Notes 4550 2600 0 50 ~ 0 +RPI\nWiring +Text Label 7150 3200 0 50 ~ 0 +W15 +Text Label 7150 3300 0 50 ~ 0 +W16 +Text Label 7150 3400 0 50 ~ 0 +W1 +Text Label 7150 3600 0 50 ~ 0 +W4 +Text Label 7150 3700 0 50 ~ 0 +W5 +Text Label 7150 3900 0 50 ~ 0 +W6 +Text Label 7150 4000 0 50 ~ 0 +W10 +Text Label 7150 4100 0 50 ~ 0 +W11 +Text Label 7150 4200 0 50 ~ 0 +W31 +Text Label 7150 4400 0 50 ~ 0 +W26 +Text Label 7150 4600 0 50 ~ 0 +W27 +Text Label 7150 4700 0 50 ~ 0 +W28 +Text Label 7150 4800 0 50 ~ 0 +W29 +Wire Notes Line + 7150 2600 7150 4850 +Text Notes 7150 2600 0 50 ~ 0 +RPI\nWiring +Text Label 4100 3000 0 50 ~ 0 +I2C1_SDA +Text Label 4100 3100 0 50 ~ 0 +I2C1_SCL +Text Label 4100 3400 0 50 ~ 0 +SP1_CE1 +Text Label 4100 3800 0 50 ~ 0 +SPI0_MOSI +Text Label 4100 3900 0 50 ~ 0 +SPI0_MISO +Text Label 4100 4000 0 50 ~ 0 +SPI0_SCLK +Text Label 4100 4600 0 50 ~ 0 +SPI1_MISO +Wire Notes Line + 4100 2600 4100 4850 +Text Notes 4100 2600 0 50 ~ 0 +RPI\nBus +Text Label 7600 3400 0 50 ~ 0 +SPI1_CE0 +Text Label 7600 4000 0 50 ~ 0 +SPI0_CE0 +Text Label 7600 4100 0 50 ~ 0 +SPI0_CE1 +Text Label 7600 4600 0 50 ~ 0 +SPI1_CE2 +Text Label 7600 4700 0 50 ~ 0 +SPI1_MOSI +Text Label 7600 4800 0 50 ~ 0 +SPI1_SCLK +Wire Notes Line + 7600 2600 7600 4850 +Text Notes 7600 2600 0 50 ~ 0 +RPI\nBus +Text HLabel 3600 2900 0 50 UnSpc ~ 0 +SENS_3V3_ANA +Text HLabel 3600 3000 0 50 UnSpc ~ 0 +SDA +Text HLabel 3600 3100 0 50 UnSpc ~ 0 +SCL +Text HLabel 3600 3200 0 50 UnSpc ~ 0 +SENS_BPM_DRDY +Text HLabel 3600 3400 0 50 UnSpc ~ 0 +SENS_ECG_DRDY +Text HLabel 3600 3500 0 50 UnSpc ~ 0 +SENS_START +Text HLabel 3600 3600 0 50 UnSpc ~ 0 +SENS_RST_BPM_n +Text HLabel 3600 3800 0 50 UnSpc ~ 0 +SENS_MOSI +Text HLabel 3600 3900 0 50 UnSpc ~ 0 +SENS_MISO +Text HLabel 3600 4000 0 50 UnSpc ~ 0 +SENS_SCLK +Text HLabel 8100 2900 2 50 UnSpc ~ 0 +SENS_5V_ANA +Text HLabel 8100 3000 2 50 UnSpc ~ 0 +SENS_5V_ANA +Text HLabel 8100 3200 2 50 UnSpc ~ 0 +SENS_IO0 +Text HLabel 8100 3300 2 50 UnSpc ~ 0 +SENS_IO1 +Text HLabel 8100 3400 2 50 UnSpc ~ 0 +SENS_SPO2_DRDY +Text HLabel 8100 3600 2 50 UnSpc ~ 0 +SENS_RST_ECG_n +Text HLabel 8100 3700 2 50 UnSpc ~ 0 +SENS_RST_SPO2_n +Text HLabel 8100 3900 2 50 UnSpc ~ 0 +SENS_CS_BPM_n +Text HLabel 8100 4000 2 50 UnSpc ~ 0 +SENS_CS_ECG_n +Text HLabel 8100 4100 2 50 UnSpc ~ 0 +SENS_CS_SPO2_n +Wire Notes Line + 8100 2600 8100 4850 +Text Notes 8100 2600 0 50 ~ 0 +LifeSensor +Wire Notes Line + 3600 2600 3600 4850 +Text Notes 3600 2600 0 50 ~ 0 +LifeSensor +Wire Wire Line + 3600 2900 5600 2900 +Wire Wire Line + 6100 2900 8100 2900 +Wire Wire Line + 3600 3000 5600 3000 +Wire Wire Line + 6100 3000 8100 3000 +$Comp +L power:GND #PWR0101 +U 1 1 5EB524D0 +P 8100 3100 +F 0 "#PWR0101" H 8100 2850 50 0001 C CNN +F 1 "GND" V 8105 2972 50 0000 R CNN +F 2 "" H 8100 3100 50 0001 C CNN +F 3 "" H 8100 3100 50 0001 C CNN + 1 8100 3100 + 0 -1 -1 0 +$EndComp +$Comp +L power:GND #PWR0102 +U 1 1 5EB5282B +P 8100 3500 +F 0 "#PWR0102" H 8100 3250 50 0001 C CNN +F 1 "GND" V 8105 3372 50 0000 R CNN +F 2 "" H 8100 3500 50 0001 C CNN +F 3 "" H 8100 3500 50 0001 C CNN + 1 8100 3500 + 0 -1 -1 0 +$EndComp +$Comp +L power:GND #PWR0103 +U 1 1 5EB52A8A +P 8100 3800 +F 0 "#PWR0103" H 8100 3550 50 0001 C CNN +F 1 "GND" V 8105 3672 50 0000 R CNN +F 2 "" H 8100 3800 50 0001 C CNN +F 3 "" H 8100 3800 50 0001 C CNN + 1 8100 3800 + 0 -1 -1 0 +$EndComp +$Comp +L power:GND #PWR0104 +U 1 1 5EB52C69 +P 8100 4300 +F 0 "#PWR0104" H 8100 4050 50 0001 C CNN +F 1 "GND" V 8105 4172 50 0000 R CNN +F 2 "" H 8100 4300 50 0001 C CNN +F 3 "" H 8100 4300 50 0001 C CNN + 1 8100 4300 + 0 -1 -1 0 +$EndComp +$Comp +L power:GND #PWR0105 +U 1 1 5EB52E33 +P 8100 4500 +F 0 "#PWR0105" H 8100 4250 50 0001 C CNN +F 1 "GND" V 8105 4372 50 0000 R CNN +F 2 "" H 8100 4500 50 0001 C CNN +F 3 "" H 8100 4500 50 0001 C CNN + 1 8100 4500 + 0 -1 -1 0 +$EndComp +$Comp +L power:GND #PWR0106 +U 1 1 5EB52FAB +P 3600 4800 +F 0 "#PWR0106" H 3600 4550 50 0001 C CNN +F 1 "GND" V 3605 4672 50 0000 R CNN +F 2 "" H 3600 4800 50 0001 C CNN +F 3 "" H 3600 4800 50 0001 C CNN + 1 3600 4800 + 0 1 1 0 +$EndComp +$Comp +L power:GND #PWR0107 +U 1 1 5EB53392 +P 3600 4100 +F 0 "#PWR0107" H 3600 3850 50 0001 C CNN +F 1 "GND" V 3605 3972 50 0000 R CNN +F 2 "" H 3600 4100 50 0001 C CNN +F 3 "" H 3600 4100 50 0001 C CNN + 1 3600 4100 + 0 1 1 0 +$EndComp +$Comp +L power:GND #PWR0108 +U 1 1 5EB5355E +P 3600 3300 +F 0 "#PWR0108" H 3600 3050 50 0001 C CNN +F 1 "GND" V 3605 3172 50 0000 R CNN +F 2 "" H 3600 3300 50 0001 C CNN +F 3 "" H 3600 3300 50 0001 C CNN + 1 3600 3300 + 0 1 1 0 +$EndComp +Wire Wire Line + 3600 3100 5600 3100 +Wire Wire Line + 6100 3100 8100 3100 +Wire Wire Line + 8100 3200 6100 3200 +Wire Wire Line + 5600 3200 3600 3200 +Wire Wire Line + 3600 3300 5600 3300 +Wire Wire Line + 6100 3300 8100 3300 +Wire Wire Line + 8100 3400 6100 3400 +Wire Wire Line + 5600 3400 3600 3400 +Wire Wire Line + 3600 3500 5600 3500 +Wire Wire Line + 6100 3500 8100 3500 +Wire Wire Line + 8100 3600 6100 3600 +Wire Wire Line + 5600 3600 3600 3600 +Text HLabel 3600 3700 0 50 UnSpc ~ 0 +SENS_3V3_DIG +Wire Wire Line + 3600 3700 5600 3700 +Wire Wire Line + 6100 3700 8100 3700 +Wire Wire Line + 8100 3800 6100 3800 +Wire Wire Line + 5600 3800 3600 3800 +Wire Wire Line + 3600 3900 5600 3900 +Wire Wire Line + 6100 3900 8100 3900 +Wire Wire Line + 8100 4000 6100 4000 +Wire Wire Line + 5600 4000 3600 4000 +Wire Wire Line + 3600 4100 5600 4100 +Wire Wire Line + 6100 4100 8100 4100 +Wire Wire Line + 3600 4200 5600 4200 +Wire Wire Line + 6100 4200 8100 4200 +Wire Wire Line + 8100 4300 6100 4300 +Wire Wire Line + 5600 4300 3600 4300 +Wire Wire Line + 3600 4400 5600 4400 +Wire Wire Line + 6100 4400 8100 4400 +Wire Wire Line + 8100 4500 6100 4500 +Wire Wire Line + 5600 4500 3600 4500 +Wire Wire Line + 3600 4600 5600 4600 +Wire Wire Line + 6100 4600 8100 4600 +Wire Wire Line + 8100 4700 6100 4700 +Wire Wire Line + 5600 4700 3600 4700 +Wire Wire Line + 3600 4800 5600 4800 +Wire Wire Line + 6100 4800 8100 4800 +NoConn ~ 3600 4200 +NoConn ~ 3600 4300 +NoConn ~ 3600 4400 +NoConn ~ 3600 4500 +NoConn ~ 3600 4600 +NoConn ~ 3600 4700 +NoConn ~ 8100 4200 +NoConn ~ 8100 4400 +NoConn ~ 8100 4600 +NoConn ~ 8100 4700 +NoConn ~ 8100 4800 +NoConn ~ 8950 4900 +$EndSCHEMATC diff --git a/products/.template/README.md b/products/.template/README.md new file mode 100644 index 0000000..ec57556 --- /dev/null +++ b/products/.template/README.md @@ -0,0 +1,40 @@ + +# Product template + + +This template should be used to create a new product. +1. Copy this template directory +2. Give your new product a meaningful name. +3. Append your new product to the product list in [../README.md](../README.md) +4. Edit this README + - Change title! +5. Continue editing in [v1/README.md](./v1/README.md) + +--- +## Product features + +- provides template for product + +--- +## Product versions + + + +- [v1/](./v1/) + - initial version + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all versions +- `make build` + - build all versions +- `make test` + - test all versions +- `make clean` + - clean all versions +- `make distclean` + - distclean all version \ No newline at end of file diff --git a/products/.template/v1/Makefile b/products/.template/v1/Makefile new file mode 100644 index 0000000..99bd0d1 --- /dev/null +++ b/products/.template/v1/Makefile @@ -0,0 +1,5 @@ +### PARTS OF THE PRODUCT ### +PARTS += #empty +PARTS += interconnect/v1 + +include $(shell git rev-parse --show-toplevel)/.make/product.mk \ No newline at end of file diff --git a/products/.template/v1/README.md b/products/.template/v1/README.md new file mode 100644 index 0000000..60cd9cc --- /dev/null +++ b/products/.template/v1/README.md @@ -0,0 +1,47 @@ + +# Product template (version v1) + + +This template should be used to create a new product version. +1. Edit this README + - Change title & version! +2. Delete unneeded directories +3. Edit READMEs of directories +4. Edit Makefile + +--- +## Features + +- provides template for product version + +---- +## Directories + +### [docs/](./docs/) + + +- template docs directory + +### [requirements/](./requirements/) + + +- template requirements directory + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test everything +- `make build` + - build everything +- `make test` + - test everything +- `make clean` + - clean everything +- `make distclean` + - distclean everything + +--- +See the other READMEs or [Makefile](./Makefile) for more information \ No newline at end of file diff --git a/products/.template/v1/docs/README.md b/products/.template/v1/docs/README.md new file mode 100644 index 0000000..b1c49a6 --- /dev/null +++ b/products/.template/v1/docs/README.md @@ -0,0 +1,12 @@ + +# Part template documents (version v1) + + +This the document collection of the product template. +1. Edit this README + - Change title & version! + +--- +## Documents + +- none \ No newline at end of file diff --git a/products/.template/v1/requirements/README.md b/products/.template/v1/requirements/README.md new file mode 100644 index 0000000..c4e4f3f --- /dev/null +++ b/products/.template/v1/requirements/README.md @@ -0,0 +1,17 @@ + +# Product template requirements (version v1) + + +These are the requirements files of the product template. +1. Edit this README + - Change title & version! + +--- +## Requirements + +- none + +--- +## Constraints + +- none \ No newline at end of file diff --git a/products/Makefile b/products/Makefile new file mode 100644 index 0000000..7f48ff4 --- /dev/null +++ b/products/Makefile @@ -0,0 +1,2 @@ +DEPENDS = $(dir $(wildcard */Makefile)) +include $(shell git rev-parse --show-toplevel)/.make/common.mk \ No newline at end of file diff --git a/products/README.md b/products/README.md new file mode 100644 index 0000000..7cc4c72 --- /dev/null +++ b/products/README.md @@ -0,0 +1,81 @@ +# LifeSensor products +*Products* are supported [*LifeSensor*](https://lifesensor.org) devices consisting of [*parts*](../parts/). + +--- +## Products +- [prototype/](./prototype/) + - prototype & testing ground of various parts + +--- +## Products structure + +``` +lifesensor/products +│ +├── README.md : mandatory README.md you are currently reading +├── Makefile : mandatory Makefile executing targets in all subdirs +│ +├── : mandatory unique name of the product +│   ├── README.md : mandatory general description of the product +│   │ and elaboration of differences between version +│   │ +│   ├── : mandatory unique product version +│   │   ├── README.md : mandatory version specific description of the product, +│   │   │   should list all features +│   │   │ +│   │ ├── Makefile : mandatory Makefile for integration of the product +│   │   │ +│   │   ├── docs : optional parent directory for documents +│   │   │   │ i.e. documentation, datasheets +│   │   │   ├── README.md : description of documents +│   │   │   └── ... +│   │   │ +│   │   └── requirements : mandatory parent directory for requirements +│   │      │ used by requirement management tools +│   │      ├── README.md : description of requirements +│   │      └── ... +│   │ +│   ├── +│   │   └── ... +│   └── ... +│ +├── +│   └── ... +└── ... +``` + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all products +- `make build` + - build all products +- `make test` + - test all products +- `make clean` + - clean all products +- `make distclean` + - distclean all products + +--- +## Adding new products +- If you want to add a new product, +please copy the [*template product*](./.template/) and modify your copy. + +--- +## Rules +- *Products* of the [*LifeSensor*](https://lifesensor.org) project should have a dedicated directory here. +- *Products* should not include [*parts*](../parts/) or other *products* +- *Products* may compete for the same functionality. + - Different *products* may choose different [*parts*](../parts/) to achieve the same +- *Products* should follow the directory scheme defined by the [*template product*](./.template/) + - *Parent directories* may contain any structure + - Optional *parent directories* can be removed +- Only non-breaking changes may be introduced as patch for a *product* +- *Products versions* denote non-backwards-compatible variants of the same *product* + - If major implementations change, consider creating a new *product* or *product version* +- *Products versions* should never denote the state of the *product* + - All *product versions* should provide their intended functionality diff --git a/products/prototype/README.md b/products/prototype/README.md new file mode 100644 index 0000000..ec57556 --- /dev/null +++ b/products/prototype/README.md @@ -0,0 +1,40 @@ + +# Product template + + +This template should be used to create a new product. +1. Copy this template directory +2. Give your new product a meaningful name. +3. Append your new product to the product list in [../README.md](../README.md) +4. Edit this README + - Change title! +5. Continue editing in [v1/README.md](./v1/README.md) + +--- +## Product features + +- provides template for product + +--- +## Product versions + + + +- [v1/](./v1/) + - initial version + +--- +## Makefile + +- `make help` + - show Makefile options +- `make all` + - build & test all versions +- `make build` + - build all versions +- `make test` + - test all versions +- `make clean` + - clean all versions +- `make distclean` + - distclean all version \ No newline at end of file diff --git a/products/prototype/v1/Makefile b/products/prototype/v1/Makefile new file mode 100644 index 0000000..99bd0d1 --- /dev/null +++ b/products/prototype/v1/Makefile @@ -0,0 +1,5 @@ +### PARTS OF THE PRODUCT ### +PARTS += #empty +PARTS += interconnect/v1 + +include $(shell git rev-parse --show-toplevel)/.make/product.mk \ No newline at end of file diff --git a/products/prototype/v1/README.md b/products/prototype/v1/README.md new file mode 100644 index 0000000..7813393 --- /dev/null +++ b/products/prototype/v1/README.md @@ -0,0 +1,78 @@ +# LifeSensor -- Esp32-core +ESP32 firmware for the lifesensor project. + +## Components +See [components/README.md](components/README.md) for an overview of features. + +## Project flavors +This repository features multiple idf projects for different purposes. + +
+
lifesensor
main project
+
lifesensor_test
unit tests of components
+
+ +## Build & Flash & Run + +* via Docker + 1. Choose flavor + * i.e. `cd lifesensor` + 2. Building + * `make build` + 1. creates idf docker image if needed + 2. starts idf docker container to build project + 3. Choosing device + * `make dev` + * configures which serial port to use + 4. Flashing + * `make flash` + 1. creates idf docker image if needed + 2. starts idf docker container to flash project to connected ESP via specified device by `make dev` + 5. Monitoring + * `make monitor` + 1. creates idf docker image if needed + 2. starts idf docker container to connect to ESP via specified device by `make dev` +* via local esd-idf toolchain + 1. Choose flavor + * i.e. `cd lifesensor` + 2. Building + * `idf.py build` + 3. Flashing + * `idf.py flash -p ` + 4. Monitoring + * `idf.py monitor -p ` + +## Simulating with qemu + +**Important:** Qemu port of the xtensa architecture is in active development, +each docker image creation builds with latest version, mileage may vary! + +* via Docker + * simple execution + 1. Choose flavor + * i.e. `cd lifesensor` + 2. Building + * `make build` + 1. creates idf docker image if needed + 2. starts idf docker container to build project + 3. Start qemu + * `make qemu` + 1. creates qemu docker image if needed + 2. starts qemu docker container to simulate project + * with gdb + 1. Choose flavor + * i.e. `cd lifesensor` + 2. Building + * `make build` + 1. creates docker docker image if needed + 2. starts qemu docker container to simulate project + 3. Start qemu and wait for gdb connection + * `make qemu-gdb` + 1. creates qemu docker image if needed + 2. starts qemu docker container to simulate project + 5. Start gdb and connect to qemu in second terminal + * `make gdb-qemu` + 1. starts idf docker container to run gdb + +## Contributing +See [CONTRIBUTING.md](CONTRIBUTING.md) diff --git a/products/prototype/v1/docs/README.md b/products/prototype/v1/docs/README.md new file mode 100644 index 0000000..b1c49a6 --- /dev/null +++ b/products/prototype/v1/docs/README.md @@ -0,0 +1,12 @@ + +# Part template documents (version v1) + + +This the document collection of the product template. +1. Edit this README + - Change title & version! + +--- +## Documents + +- none \ No newline at end of file diff --git a/products/prototype/v1/requirements/README.md b/products/prototype/v1/requirements/README.md new file mode 100644 index 0000000..c4e4f3f --- /dev/null +++ b/products/prototype/v1/requirements/README.md @@ -0,0 +1,17 @@ + +# Product template requirements (version v1) + + +These are the requirements files of the product template. +1. Edit this README + - Change title & version! + +--- +## Requirements + +- none + +--- +## Constraints + +- none \ No newline at end of file