Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: configure
run: aclocal && autoconf && automake --add-missing && ./configure --host='' 'CFLAGS=-Wall' 'LDFLAGS=' --without-binaries
- name: make
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: prepare
run: aclocal && autoconf && automake --add-missing
working-directory: tests
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ AC_CONFIG_FILES([
examples/0timgalarm/Makefile
examples/0uart/Makefile
examples/0udma/Makefile
examples/1bme280/Makefile
examples/1i2cssd1306/Makefile
examples/1rmtblink/Makefile
examples/1rmtdht/Makefile
Expand Down
45 changes: 31 additions & 14 deletions cov/coverage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ GCOV=gcov
HTML=html/index.html
SRCDIR=../src
MODDIR=../modules
EGDIR=../examples

## we get direct information about modification time
## note: I do not like wildcard, but could not find better solution
SOURCES=$(wildcard $(SRCDIR)/*.c)
HEADERS=$(wildcard $(SRCDIR)/*.h)
OBJS=$(addprefix src/, $(notdir $(SOURCES:.c=.o)))
SOURCES_SRC=$(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/**/*.c)
HEADERS_SRC=$(wildcard $(SRCDIR)/*.h)$(wildcard $(SRCDIR)/**/*.h)
OBJS_SRC_PRE=$(SOURCES_SRC:%.c=%.o)
OBJS_SRC=$(OBJS_SRC_PRE:../%=%)

SOURCES_UTILS=$(wildcard $(SRCDIR)/utils/*.c)
HEADERS_UTILS=$(wildcard $(SRCDIR)/utils/*.h)
OBJS_UTILS=$(addprefix src/utils/, $(notdir $(SOURCES_UTILS:.c=.o)))
SOURCES_MODULES=$(wildcard $(MODDIR)/*.c) $(wildcard $(MODDIR)/**/*.c)
HEADERS_MODULES=$(wildcard $(MODDIR)/*.h) $(wildcard $(MODDIR)/**/*.h)
OBJS_MODULES_PRE=$(SOURCES_MODULES:%.c=%.o)
OBJS_MODULES=$(OBJS_MODULES_PRE:../%=%)

SOURCES_MODULES=$(wildcard $(MODDIR)/*.c)
HEADERS_MODULES=$(wildcard $(MODDIR)/*.h)
OBJS_MODULES=$(addprefix modules/, $(notdir $(SOURCES_MODULES:.c=.o)))
SOURCES_EXAMPLES=$(wildcard $(EGDIR)/*.c) $(wildcard $(EGDIR)/**/*.c)
HEADERS_EXAMPLES=$(wildcard $(EGDIR)/*.h) $(wildcard $(EGDIR)/**/*.h)
OBJS_EXAMPLES_PRE=$(SOURCES_EXAMPLES:%.c=%.o)
OBJS_EXAMPLES=$(OBJS_EXAMPLES_PRE:../%=%)

GCDA=$(OBJS:.o=.gcda) $(OBJS_UTILS:.o=.gcda) $(OBJS_MODULES:.o=.gcda)
GCNO=$(OBJS:.o=.gcno) $(OBJS_UTILS:.o=.gcno) $(OBJS_MODULES:.o=.gcda)

GCDA=$(OBJS_SRC:.o=.gcda) $(OBJS_MODULES:.o=.gcda) $(OBJS_EXAMPLES:.o=.gcda)
GCNO=$(OBJS_SRC:.o=.gcno) $(OBJS_MODULES:.o=.gcno) $(OBJS_EXAMPLES:.o=.gcno)

GCDA_EXIST := $(foreach gcda,$(GCDA),$(wildcard $(gcda)))
GCNO_EXIST := $(foreach gcno,$(GCNO),$(wildcard $(gcno)))
Expand All @@ -44,6 +49,14 @@ src/%.c.gcov: src/%.gcno
cd src && $(GCOV) -wrabcfu -s ../.. $(<:src/%.gcno=%.o)
[ -f $@ ] || mv src/$(notdir $@) $@

modules/%.c.gcov: modules/%.gcno
cd modules && $(GCOV) -wrabcfu -s ../.. $(<:modules/%.gcno=%.o)
[ -f $@ ] || mv modules/$(notdir $@) $@

examples/%.c.gcov: examples/%.gcno
cd examples && $(GCOV) -wrabcfu -s ../.. $(<:examples/%.gcno=%.o)
[ -f $@ ] || mv examples/$(notdir $@) $@

$(HTML): $(PROJ).info
genhtml -s --branch-coverage $(PROJ).info --output-directory $(dir $(HTML))

Expand All @@ -54,12 +67,12 @@ $(PROJ).pre.info: $(PROJ).base.info $(PROJ).test.info
lcov --rc lcov_branch_coverage=1 -a $(PROJ).base.info -a $(PROJ).test.info -o $@

$(PROJ).base.info: testrun
lcov -z -d src
lcov --rc lcov_branch_coverage=1 -c -i -d src -o $@
lcov -z -d src -d modules
lcov --rc lcov_branch_coverage=1 -c -i -d src -d modules -d examples -o $@

$(PROJ).test.info: $(PROJ).base.info
$(MAKE) -C tests check
lcov --rc lcov_branch_coverage=1 -c -d src -o $@
lcov --rc lcov_branch_coverage=1 -c -d src -d modules -d examples -o $@


testrun: tests/Makefile FORCE
Expand All @@ -78,12 +91,16 @@ clean:
rm -f $(PROJ).test.info
rm -rf $(dir $(HTML))
rm -f src/*.gcda
rm -f modules/*.gcda
rm -f examples/*.gcda
rm -f tests/*.gcda
$(MAKE) -C tests clean

distclean: clean
$(MAKE) -C tests distclean
rm -rf src
rm -rf modules
rm -rf examples
rm -rf tests

.PHONY: clean distclean source testrun gcov _gcov
38 changes: 38 additions & 0 deletions examples/1bme280/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
include $(top_srcdir)/scripts/elf2bin.mk
include $(top_srcdir)/ld/flags.mk

noinst_HEADERS = defines.h exptuner.h

AM_CFLAGS = -std=c11 -flto
if WITH_BINARIES
AM_LDFLAGS += \
-T $(top_srcdir)/ld/esp32.rom.ld \
-T $(top_srcdir)/ld/esp32.rom.libgcc.ld \
-T $(top_srcdir)/ld/esp32.rom.newlib-data.ld \
-T $(top_srcdir)/ld/esp32.rom.newlib-locale.ld \
-T $(top_srcdir)/ld/esp32.rom.newlib-nano.ld \
-T $(top_srcdir)/ld/esp32.rom.newlib-time.ld \
-T $(top_srcdir)/ld/esp32.rom.redefined.ld \
-T $(top_srcdir)/ld/esp32.rom.syscalls.ld
else
AM_LDFLAGS += \
-T $(top_srcdir)/ld/esp32.rom.ld \
-T $(top_srcdir)/ld/esp32.rom.libgcc.ld \
-T $(top_srcdir)/ld/esp32.rom.redefined.ld \
-T $(top_srcdir)/ld/esp32.rom.syscalls.ld
endif

AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/modules
LDADD = $(top_builddir)/src/libesp32basic.a $(top_builddir)/modules/libesp32modules.a

bin_PROGRAMS = \
bme280app.elf

bme280app_elf_SOURCES = bme280app.c exptuner.c

if WITH_BINARIES
CLEANFILES = \
bme280app.bin
endif

BUILT_SOURCES = $(CLEANFILES)
44 changes: 44 additions & 0 deletions examples/1bme280/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
### Simple application to BME280 sensor

In this small example application we show how to use the BME280 sensor.

#### Hardware components

BME280 -- BME280 sensor

#### Connections

```
ESP32.GND -- BME280.GND
ESP32.GPIO22 -- BME280.SCL
ESP32.GPIO23 -- BME280.SDA
ESP32.3V3 -- BME280.VCC
ESP32.GPIO21 -- BME280.CSB
ESP32.GND -- BME280.SDO
```

#### Control

The application accepts the following commands (on UART0):

* `-` / `+` - T Oversampling down (off) / up;
* `[` / `]` - P Oversampling down (off) / up;
* `{` / `}` - H Oversampling down (off) / up;
* `<` / `>` - t_standby up / down;
* `,` / `.` - measurement period up / down in forced mode;
* `f` / `n` / `s` - TODO: set mode: forced / normal / sleep;
* `c` - read config/control/status registers to local mirror;
* `r` - reset;
* `i` - information;
* `I` - Toggle verbose information (initially: off);
* `3` / `4` - Decrease / Increase communication speed (SCL frequency, default: 100KHz, multipliers: ..., 0.5, 1, 2, 5, 10, 20, ...);
* `#` / `$` - Decrease / Increase communication speed (smooth multipliers: 1.0, 1.1, 1.2, 1.3, ..., 1.9(, 2.0, 2.1, ..., 2.4));
* `;` / `'` - Decrease / Increase IIR filter value.

Note: The maximal I2C SCL frequency on esp32basic is 5.5 MHz,
this is the upper bound of communication speed the application allows.
However, the BME280 Specificaton states that `Digital interface I2C (up to 3.4 MHz)` (page 2).
With the current I2C timing setting (SCL high/low period, START/STOP/SDA delays),
the maximal communication speed is 1.8 MHz.

#### Practices
Loading
Loading