diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 215198482..aa2f13c78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: ci-format: strategy: matrix: - os: [ubuntu-22.04] + os: [ubuntu-24.04] # The type of runner that the job will run on runs-on: ${{ matrix.os }} @@ -23,12 +23,14 @@ jobs: with: submodules: false # LVGL makefile manually installs the submodule - name: ci-format + env: + TOCK_SUPPRESS_CC_VERSION_CHECK: "true" run: pushd examples; ./format_all.sh || exit; popd ci-build: strategy: matrix: - os: [ubuntu-22.04] + os: [ubuntu-24.04] # The type of runner that the job will run on runs-on: ${{ matrix.os }} @@ -37,11 +39,18 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive + - uses: carlosperate/arm-none-eabi-gcc-action@v1 - run: arm-none-eabi-gcc --version - name: setup-riscv-toolchain run: sudo apt-get install -y gcc-riscv64-unknown-elf + + - name: Disable wget progress output + run: | + echo "verbose = off" >> $HOME/.wgetrc + - name: ci-build run: pushd examples; ./build_all.sh || exit; popd + - name: ci-debug-build run: pushd examples/blink; make debug RAM_START=0x20004000 FLASH_INIT=0x30051 || exit; popd diff --git a/Configuration.mk b/Configuration.mk index f5d135e28..83368d793 100644 --- a/Configuration.mk +++ b/Configuration.mk @@ -18,6 +18,9 @@ CONFIGURATION_MAKEFILE = 1 MAKEFLAGS += -r MAKEFLAGS += -R +# Enforce a minimum complier version +MINIMUM_GCC_MAJOR := 13 + # Toolchain programs. AR := -ar AS := -as @@ -260,6 +263,16 @@ ifneq ($(findstring rv32i,$(TOCK_ARCH_FAMILIES)),) CC_rv32_version_major := $(shell echo $(CC_rv32_version) | cut -f1 -d.) endif +# Validate the the toolchain is new enough +ifeq ($(TOCK_SUPPRESS_CC_VERSION_CHECK),) +ifneq ($(CC_rv32_version),) +ifneq (1,$(shell [ $(CC_rv32_version_major) -ge $(MINIMUM_GCC_MAJOR) ] && echo "1")) + $(info $(TOOLCHAIN_rv32)$(CC_rv32) -dumpfullversion: $(CC_rv32_version)) + $(error Your compiler is too old. Need gcc version >= $(MINIMUM_GCC_MAJOR)) +endif +endif +endif + # Match compiler version to support libtock-newlib versions. ifeq ($(CC_rv32_version_major),10) NEWLIB_VERSION_rv32 := 4.2.0.20211231 @@ -406,6 +419,16 @@ ifneq ($(findstring cortex-m,$(TOCK_ARCH_FAMILIES)),) CC_cortex-m_version_major := $(shell echo $(CC_cortex-m_version) | cut -f1 -d.) endif +# Validate the the toolchain is new enough +ifeq ($(TOCK_SUPPRESS_CC_VERSION_CHECK),) +ifneq ($(CC_cortex-m_version),) +ifneq (1,$(shell [ $(CC_cortex-m_version_major) -ge $(MINIMUM_GCC_MAJOR) ] && echo "1")) + $(info $(TOOLCHAIN_cortex-m)$(CC_cortex-m) -dumpfullversion: $(CC_cortex-m_version)) + $(error Your compiler is too old. Need gcc version >= $(MINIMUM_GCC_MAJOR)) +endif +endif +endif + # Match compiler version to support libtock-newlib versions. ifeq ($(CC_cortex-m_version_major),10) NEWLIB_VERSION_cortex-m := 4.2.0.20211231 diff --git a/Helpers.mk b/Helpers.mk index a1f13bd16..076e6aac0 100644 --- a/Helpers.mk +++ b/Helpers.mk @@ -40,26 +40,6 @@ ifdef TOCK_USERLAND_BASE_DIR endif endif -# # Validate the the toolchain is new enough (known not to work for gcc <= 5.1) -# CC_VERSION_MAJOR := $(shell $(CC) -dumpversion | cut -d '.' -f1) -# ifeq (1,$(shell expr $(CC_VERSION_MAJOR) \>= 6)) -# # Opportunistically turn on gcc 6.0+ warnings since we're already version checking: -# override CPPFLAGS += -Wduplicated-cond # if (p->q != NULL) { ... } else if (p->q != NULL) { ... } -# override CPPFLAGS += -Wnull-dereference # deref of NULL (thought default if -fdelete-null-pointer-checks, in -Os, but no?) -# else -# ifneq (5,$(CC_VERSION_MAJOR)) -# $(info CC=$(CC)) -# $(info $$(CC) -dumpversion: $(shell $(CC) -dumpversion)) -# $(error Your compiler is too old. Need gcc version > 5.1) -# endif -# CC_VERSION_MINOR := $(shell $(CC) -dumpversion | cut -d '.' -f2) -# ifneq (1,$(shell expr $(CC_VERSION_MINOR) \> 1)) -# $(info CC=$(CC)) -# $(info $$(CC) -dumpversion: $(shell $(CC) -dumpversion)) -# $(error Your compiler is too old. Need gcc version > 5.1) -# endif -# endif - # Format check rule .PHONY: _format_check_unstaged diff --git a/examples/tutorials/thread_tutorials/temperature_sensor/10_screen_ipc/main.c b/examples/tutorials/thread_tutorials/temperature_sensor/10_screen_ipc/main.c index d14653ba6..2b194ac67 100644 --- a/examples/tutorials/thread_tutorials/temperature_sensor/10_screen_ipc/main.c +++ b/examples/tutorials/thread_tutorials/temperature_sensor/10_screen_ipc/main.c @@ -83,7 +83,7 @@ static void sensor_callback(__attribute__ ((unused)) int pid, __attribute__ ((unused)) int arg2, __attribute__ ((unused)) void* ud) { // update measured temperature - measured_temperature = *((int*) &temperature_buffer[0]); + memcpy(&measured_temperature, temperature_buffer, sizeof(measured_temperature)); // Indicate that we have received a callback. callback_event = true; @@ -99,7 +99,7 @@ static void openthread_callback(__attribute__ ((unused)) int pid, network_up = true; // update setpoint temperature - global_temperature_setpoint = *((int*) &openthread_buffer[0]); + memcpy(&global_temperature_setpoint, openthread_buffer, sizeof(global_temperature_setpoint)); // Indicate that we have received a callback. callback_event = true; diff --git a/libtock/tock.h b/libtock/tock.h index 061ee1f17..beaa1be4b 100644 --- a/libtock/tock.h +++ b/libtock/tock.h @@ -194,25 +194,25 @@ yield_waitfor_return_t yield_wait_for(uint32_t driver, uint32_t subscribe); void tock_exit(uint32_t completion_code) __attribute__ ((noreturn)); void tock_restart(uint32_t completion_code) __attribute__ ((noreturn)); -__attribute__ ((warn_unused_result)) +[[ nodiscard ]] syscall_return_t command(uint32_t driver, uint32_t command, int arg1, int arg2); // Pass this to the subscribe syscall as a function pointer to // be the Null Upcall. #define TOCK_NULL_UPCALL 0 -__attribute__ ((warn_unused_result)) +[[ nodiscard ]] subscribe_return_t subscribe(uint32_t driver, uint32_t subscribe, subscribe_upcall uc, void* userdata); -__attribute__ ((warn_unused_result)) +[[ nodiscard ]] allow_rw_return_t allow_readwrite(uint32_t driver, uint32_t allow, void* ptr, size_t size); -__attribute__ ((warn_unused_result)) +[[ nodiscard ]] allow_userspace_r_return_t allow_userspace_read(uint32_t driver, uint32_t allow, void* ptr, size_t size); -__attribute__ ((warn_unused_result)) +[[ nodiscard ]] allow_ro_return_t allow_readonly(uint32_t driver, uint32_t allow, const void* ptr, size_t size); // Call the memop syscall.