Skip to content

Commit 36433f2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into dev/fetch-script-fail-on-error
2 parents 0e980dc + 3d8c19b commit 36433f2

File tree

330 files changed

+10705
-1624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+10705
-1624
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,9 @@ jobs:
2222
- uses: actions/checkout@v2
2323
with:
2424
submodules: false # LVGL makefile manually installs the submodule
25-
26-
- uses: carlosperate/arm-none-eabi-gcc-action@v1
27-
with:
28-
release: '10.3-2021.07' # The arm-none-eabi-gcc release to use.
29-
30-
- name: setup-riscv-toolchain
31-
run: sudo apt-get install -y gcc-riscv64-unknown-elf
32-
3325
- name: Disable wget progress output
3426
run: |
3527
echo "verbose = off" >> $HOME/.wgetrc
36-
3728
- name: ci-format
3829
run: pushd examples; ./format_all.sh || exit; popd
3930

@@ -49,20 +40,14 @@ jobs:
4940
- uses: actions/checkout@v2
5041
with:
5142
submodules: recursive
52-
5343
- uses: carlosperate/arm-none-eabi-gcc-action@v1
54-
with:
55-
release: '10.3-2021.07' # The arm-none-eabi-gcc release to use.
56-
44+
- run: arm-none-eabi-gcc --version
5745
- name: setup-riscv-toolchain
5846
run: sudo apt-get install -y gcc-riscv64-unknown-elf
59-
6047
- name: Disable wget progress output
6148
run: |
6249
echo "verbose = off" >> $HOME/.wgetrc
63-
6450
- name: ci-build
6551
run: pushd examples; ./build_all.sh || exit; popd
66-
6752
- name: ci-debug-build
6853
run: pushd examples/blink; make debug RAM_START=0x20004000 FLASH_INIT=0x30051 || exit; popd

.gitmodules

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
[submodule "lua53/lua"]
22
path = lua53/lua
33
url = https://github.com/lua/lua.git
4+
shallow = true
45
[submodule "lvgl/lvgl"]
56
path = lvgl/lvgl
67
url = https://github.com/littlevgl/lvgl.git
8+
shallow = true
79
[submodule "libopenthread/openthread"]
810
path = libopenthread/openthread
911
url = https://github.com/openthread/openthread.git
12+
shallow = true
1013
[submodule "RadioLib/RadioLib"]
1114
path = RadioLib/RadioLib
1215
url = https://github.com/jgromes/RadioLib.git
16+
shallow = true
17+
[submodule "lwip/lwip"]
18+
path = lwip/lwip
19+
# Using GitHub mirror, as git.savannah.gnu.org seems to cause
20+
# problems with `git submodule sync`
21+
#url = https://git.savannah.gnu.org/git/lwip.git
22+
url = https://github.com/lwip-tcpip/lwip.git
23+
shallow = true

AppMakefile.mk

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ include $(TOCK_USERLAND_BASE_DIR)/libtock-sync/Makefile
3939
# Include the makefile that has the programming functions for each board.
4040
include $(TOCK_USERLAND_BASE_DIR)/Program.mk
4141

42+
# Remove any leading or trailing spaces from PACKAGE_NAME and then verify there
43+
# are no spaces within the PACKAGE_NAME variable.
44+
override PACKAGE_NAME := $(strip $(PACKAGE_NAME))
45+
$(call check_no_spaces, PACKAGE_NAME)
4246

4347
# Rules to call library makefiles to build required libraries.
4448
#
@@ -53,14 +57,29 @@ include $(TOCK_USERLAND_BASE_DIR)/Program.mk
5357
# Arguments:
5458
# - $(1): Pattern matching all arch-specific library files.
5559
# - $(2): The path to the library.
60+
# - $(3): The uppercase name of the library.
5661
define EXTERN_LIB_BUILD_RULE
5762

5863
ifneq "$$(wildcard $(2)/Makefile.setup)" ""
5964
# Since a Makefile.setup exists, do any setup steps needed to fetch the library.
65+
66+
ifneq "$$(wildcard $(2)/Makefile.version)" ""
67+
# Since a Makefile.version exists, use it to set the necessary dependency.
68+
include $(2)/Makefile.version
69+
70+
$$($(3)_SENTINEL_FILE):
71+
$$(MAKE) -C $(2) -f Makefile.setup all
72+
$$(MAKE) -C $(2) -f Makefile all
73+
74+
$(1): $$($(3)_SENTINEL_FILE) ;
75+
else
76+
# No Makefile.version, so this will work the first time the library is built.
6077
$(1):
6178
$$(MAKE) -C $(2) -f Makefile.setup all
6279
$$(MAKE) -C $(2) -f Makefile all
80+
endif
6381
else
82+
# No setup needed, just build the library the first time.
6483
$(1):
6584
$$(MAKE) -C $(2) -f Makefile all
6685
endif
@@ -86,8 +105,8 @@ $$(notdir $(1))_BUILDDIR ?= $(1)/build
86105
$$(foreach arch, $$(TOCK_ARCHS), $$(eval LIBS_$$(arch) += $$($(notdir $(1))_BUILDDIR)/$$(arch)/$(notdir $(1)).a))
87106

88107
# Generate rule for building the library.
89-
# $$(info $$(call EXTERN_LIB_BUILD_RULE,$$(foreach arch,$$(TOCK_ARCHS),%/$$(arch)/$(notdir $(1)).a),$(1)))
90-
$$(eval $$(call EXTERN_LIB_BUILD_RULE,$$(foreach arch,$$(TOCK_ARCHS),%/$$(arch)/$(notdir $(1)).a),$(1)))
108+
# $$(info $$(call EXTERN_LIB_BUILD_RULE,$$(foreach arch,$$(TOCK_ARCHS),%/$$(arch)/$(notdir $(1)).a),$(1),$(shell echo '$(notdir $(1))' | tr '[:lower:]' '[:upper:]')))
109+
$$(eval $$(call EXTERN_LIB_BUILD_RULE,$$(foreach arch,$$(TOCK_ARCHS),%/$$(arch)/$(notdir $(1)).a),$(1),$(shell echo '$(notdir $(1))' | tr '[:lower:]' '[:upper:]')))
91110

92111
endef
93112

Configuration.mk

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ OPENTITAN_TOCK_TARGETS := rv32imc|rv32imc.0x20030080.0x10005000|0x20030080|0x100
6666
ARTY_E21_TOCK_TARGETS := rv32imac|rv32imac.0x40430080.0x80004000|0x40430080|0x80004000\
6767
rv32imac|rv32imac.0x40440080.0x80007000|0x40440080|0x80007000
6868

69+
# Specific addresses useful for the QEMU rv32i "virt" machine memory map.
70+
QEMU_RV32_VIRT_TOCK_TARGETS := rv32imac|rv32imac.0x80100080.0x80210000|0x80100080|0x80210000\
71+
rv32imac|rv32imac.0x80104080.0x80214000|0x80104080|0x80214000
72+
6973
VEER_EL2_TOCK_TARGETS := rv32imc|rv32imc.0x20300080.0x20602000|0x20300080|0x20602000
7074

7175
# Include the RISC-V targets.
@@ -83,7 +87,8 @@ TOCK_TARGETS ?= cortex-m0\
8387
rv32imc|rv32imc.0x00080080.0x40008000|0x00080080|0x40008000\
8488
$(OPENTITAN_TOCK_TARGETS) \
8589
$(ARTY_E21_TOCK_TARGETS) \
86-
$(VEER_EL2_TOCK_TARGETS)
90+
$(VEER_EL2_TOCK_TARGETS) \
91+
$(QEMU_RV32_VIRT_TOCK_TARGETS)
8792

8893
# Generate `TOCK_ARCH_FAMILIES`, the set of architecture families which will be
8994
# used to determine toolchains to use in the build process.
@@ -102,7 +107,7 @@ TOCK_ARCHS := $(sort $(foreach target, $(TOCK_TARGETS), $(firstword $(subst |, ,
102107

103108
# Check if elf2tab exists, if not, install it using cargo.
104109
ELF2TAB ?= elf2tab
105-
ELF2TAB_REQUIRED_VERSION := 0.12.0
110+
ELF2TAB_REQUIRED_VERSION := 0.13.0
106111
ELF2TAB_EXISTS := $(shell $(SHELL) -c "command -v $(ELF2TAB)")
107112
ELF2TAB_VERSION := $(shell $(SHELL) -c "$(ELF2TAB) --version | cut -d ' ' -f 2")
108113

@@ -158,7 +163,13 @@ endif
158163
# the dos/microsoft lineage chose `.cpp` to address this same issue, leading to
159164
# confusion nowadays about the meaning of 'cpp'.]
160165
override ASFLAGS += -mthumb
161-
override CFLAGS += -std=gnu11
166+
# '-gnu2x' is a deprecated alias for '-gnu23'. We're close enough in time still
167+
# (spring 2025) to the formal ratification of C23 (October 2024) that some
168+
# folks likely still have toolchains which only support the 2x _name_ for the
169+
# now-official C23 standard (even if the toolchain supports all the features
170+
# we care about under the 2x name). Eventually we should replace this with
171+
# explicit C23 selection.
172+
override CFLAGS += -std=gnu2x
162173
override CPPFLAGS += \
163174
-frecord-gcc-switches\
164175
-gdwarf-2\
@@ -244,8 +255,10 @@ CC_rv32imac := $(CC_rv32)
244255

245256
# Determine the version of the RISC-V compiler. This is used to select the
246257
# version of the libgcc library that is compatible.
247-
CC_rv32_version := $(shell $(TOOLCHAIN_rv32)$(CC_rv32) -dumpfullversion)
248-
CC_rv32_version_major := $(shell echo $(CC_rv32_version) | cut -f1 -d.)
258+
ifneq ($(findstring rv32i,$(TOCK_ARCH_FAMILIES)),)
259+
CC_rv32_version := $(shell $(TOOLCHAIN_rv32)$(CC_rv32) -dumpfullversion)
260+
CC_rv32_version_major := $(shell echo $(CC_rv32_version) | cut -f1 -d.)
261+
endif
249262

250263
# Match compiler version to support libtock-newlib versions.
251264
ifeq ($(CC_rv32_version_major),10)
@@ -388,8 +401,10 @@ CC_cortex-m7 := $(CC_cortex-m)
388401

389402
# Determine the version of the ARM compiler. This is used to select the version
390403
# of the libgcc library that is compatible.
391-
CC_cortex-m_version := $(shell $(TOOLCHAIN_cortex-m)$(CC_cortex-m) -dumpfullversion)
392-
CC_cortex-m_version_major := $(shell echo $(CC_cortex-m_version) | cut -f1 -d.)
404+
ifneq ($(findstring cortex-m,$(TOCK_ARCH_FAMILIES)),)
405+
CC_cortex-m_version := $(shell $(TOOLCHAIN_cortex-m)$(CC_cortex-m) -dumpfullversion)
406+
CC_cortex-m_version_major := $(shell echo $(CC_cortex-m_version) | cut -f1 -d.)
407+
endif
393408

394409
# Match compiler version to support libtock-newlib versions.
395410
ifeq ($(CC_cortex-m_version_major),10)
@@ -675,12 +690,17 @@ ifneq ($(V),)
675690
$(info **************************************************)
676691
$(info Config:)
677692
$(info GIT: $(shell git describe --always 2>&1))
693+
ifneq ($(findstring cortex-m,$(TOCK_ARCH_FAMILIES)),)
678694
$(info $(TOOLCHAIN_cortex-m4)$(CC_cortex-m4) --version: $(shell $(TOOLCHAIN_cortex-m4)$(CC_cortex-m4) --version))
695+
endif
696+
ifneq ($(findstring rv32i,$(TOCK_ARCH_FAMILIES)),)
679697
$(info $(TOOLCHAIN_rv32i)$(CC_rv32i) --version: $(shell $(TOOLCHAIN_rv32i)$(CC_rv32i) --version))
698+
endif
680699
$(info LAYOUT=$(LAYOUT))
681700
$(info MAKEFLAGS=$(MAKEFLAGS))
682701
$(info PACKAGE_NAME=$(PACKAGE_NAME))
683702
$(info TOCK_ARCHS=$(TOCK_ARCHS))
703+
$(info TOCK_ARCH_FAMILIES=$(TOCK_ARCH_FAMILIES))
684704
$(info TOCK_TARGETS=$(TOCK_TARGETS))
685705
$(info TOCK_USERLAND_BASE_DIR=$(TOCK_USERLAND_BASE_DIR))
686706
$(info TOOLCHAIN=$(TOOLCHAIN))

Helpers.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ __check_defined = \
2323
$(if $(value $1),, \
2424
$(error Undefined $1$(if $2, ($2))))
2525

26+
# Check that the variable has no leading or trailing spaces, or spaces within
27+
# the variable.
28+
#
29+
# Params:
30+
# 1. Variable name to test.
31+
check_no_spaces = \
32+
$(if $(findstring $(strip $($(strip $1))),$($(strip $1))),,$(error Error: Space in variable $(strip $1))) \
33+
$(if $(word 2,$($(strip $1))),$(error Error: Multiple entries in variable $(strip $1)),)
34+
2635
# Check for a ~/ at the beginning of a path variable (TOCK_USERLAND_BASE_DIR).
2736
# Make will not properly expand this.
2837
ifdef TOCK_USERLAND_BASE_DIR

RadioLib/RadioLib

Submodule RadioLib updated 64 files

RadioLib/libtockHal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class TockRadioLibHal : public RadioLibHal {
169169
#if !defined(RADIOLIB_CLOCK_DRIFT_MS)
170170
return ms;
171171
#else
172-
return ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS);
172+
return (uint64_t)ms * 1000 / (1000 + RADIOLIB_CLOCK_DRIFT_MS);
173173
#endif
174174
}
175175

doc/compilation.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ a prerequisite of building the app.
122122
The `Makefile.setup` file should have rules to download the source for the
123123
library.
124124

125+
If a library includes a `Makefile.version` with a `<LIBRARY_NAME>_SENTINEL_FILE`
126+
variable set, that file will be used to determine if the library needs to be
127+
rebuilt.
128+
125129
**Example:** the `u8g2` library uses this.
126130

127131
### Pre-built libraries

0 commit comments

Comments
 (0)