Skip to content

Commit cf9d7fc

Browse files
committed
Merge branch 'main' of https://github.com/nanoframework/nf-interpreter into develop
2 parents 6f7513c + e953699 commit cf9d7fc

12 files changed

Lines changed: 117 additions & 25 deletions

File tree

.github/copilot-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ There is no standalone test suite or test runner in this repository. Testing is
103103

104104
### Language Standards
105105

106-
- **C++20** (`stdcpp20`) for C++ files (`.cpp`).
107-
- **C17** (`stdc17`) for C files (`.c`).
106+
- **C++23** (`stdcpp23`) for C++ files (`.cpp`).
107+
- **C23** (`stdc23`) for C files (`.c`).
108108
- HAL-level code tends to be C; CLR, PAL, and device API code is C++.
109109

110110
### Formatting

.github/workflows/posix-nanoclr.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,22 @@ jobs:
4242
- name: Checkout
4343
uses: actions/checkout@v4
4444

45+
- name: Install GCC 15
46+
if: startsWith(matrix.os, 'ubuntu')
47+
run: |
48+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
49+
sudo apt-get update
50+
sudo apt-get install -y gcc-15 g++-15
51+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100
52+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 100
53+
4554
- name: Install arm64 cross-toolchain
4655
if: matrix.posix_rid == 'linux-arm64'
47-
run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
56+
run: |
57+
curl -fsSL "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz" \
58+
| sudo tar -xJ -C /opt
59+
echo "/opt/arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu/bin" >> $GITHUB_PATH
60+
4861
4962
- name: Configure
5063
run: |

CMake/Modules/FindChibiOS_RP2040_HAL.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ endforeach()
184184
# Suppress -Wshadow for ChibiOS ADC HAL (variable shadowing in macro expansion)
185185
SET_SOURCE_FILES_PROPERTIES(${chibios_SOURCE_DIR}/os/hal/ports/RP/LLD/ADCv1/hal_adc_lld.c PROPERTIES COMPILE_FLAGS -Wno-shadow)
186186

187-
# Force -fno-inline for ChibiOS USB HAL on RP2040 (Cortex-M0+ / Thumb-1).
188-
# Inlining ChibiOS static inline helpers creates composite functions whose stack frames
189-
# exceed the Thumb-1 SP-relative ldr offset limit (1020 bytes), causing assembler errors.
190-
SET_SOURCE_FILES_PROPERTIES(${chibios_SOURCE_DIR}/os/hal/ports/RP/LLD/USBv1/hal_usb_lld.c PROPERTIES COMPILE_FLAGS -fno-inline)
187+
# Force -Os -fno-inline for ChibiOS USB HAL on RP2040 (Cortex-M0+ / Thumb-1).
188+
# -fno-inline prevents inlining static inline helpers that would create composite
189+
# functions with stack frames exceeding the Thumb-1 SP-relative ldr offset limit (1020 bytes).
190+
# -Os overrides the global -Og: GCC 15 changed -Og to keep more variables on the stack for
191+
# debuggability, pushing individual function frames past 1020 bytes even without inlining.
192+
SET_SOURCE_FILES_PROPERTIES(${chibios_SOURCE_DIR}/os/hal/ports/RP/LLD/USBv1/hal_usb_lld.c PROPERTIES COMPILE_FLAGS "-Os -fno-inline")
191193

192194
include(FindPackageHandleStandardArgs)
193195

CMake/binutils.ESP32.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,18 @@ macro(nf_add_idf_as_library)
870870
message(STATUS "Using default XTAL frequency")
871871
endif()
872872

873+
# Workaround for MODLOG_N implicit-declaration error with GCC 15+ in NimBLE debug builds.
874+
# NimBLE defines log-level names as integers (DEBUG=1, INFO=2, ...). When these are used as
875+
# the level argument to MODLOG_DFLT(), they expand to their numeric values before the ## paste
876+
# in modlog.h, producing e.g. MODLOG_1 which is not defined. GCC 15 turns that implicit-
877+
# function-declaration into a hard error. The compat header provides silent no-op fallbacks.
878+
if(HAL_USE_BLE_OPTION AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
879+
idf_build_set_property(COMPILE_OPTIONS
880+
"-include${CMAKE_SOURCE_DIR}/targets/ESP32/_include/nimble_modlog_compat.h"
881+
APPEND
882+
)
883+
endif()
884+
873885
# create IDF static libraries
874886
idf_build_process(${TARGET_SERIES_SHORT}
875887
COMPONENTS

CMake/toolchain.arm-none-eabi.cmake

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,5 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
5050
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
5151

5252
# set required C and C++ standard for ALL targets
53-
set(CMAKE_C_STANDARD 17 CACHE INTERNAL "C standard for all targets")
54-
set(CMAKE_CXX_STANDARD 17 CACHE INTERNAL "C++ standard for all targets")
55-
56-
# set all C and C++ extensions to be OFF on ALL targets
57-
# this forces the use of -std=c17 and -std=c++17 instead of -std=gnu17 and -std=gnu++17
58-
set(CMAKE_C_EXTENSIONS OFF CACHE INTERNAL "C compiler extensions OFF")
59-
set(CMAKE_CXX_EXTENSIONS OFF CACHE INTERNAL "C++ compiler extensions OFF")
53+
set(CMAKE_C_STANDARD 23 CACHE INTERNAL "C standard for all targets")
54+
set(CMAKE_CXX_STANDARD 23 CACHE INTERNAL "C++ standard for all targets")

azure-pipelines.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
{
9595
Write-Host "##[command] **This is a PR build**"
9696
97-
$pr = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestId" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
97+
$pr = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestNumber" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
9898
9999
# check if this is a version update PR, if so, skip build
100100
if( ($pr.user.login -eq "nfbot") -and ($pr.title -like "*[version update]*") )
@@ -1301,7 +1301,9 @@ jobs:
13011301
# Install arm64 cross-compiler when building linux-arm64 on an x86_64 agent.
13021302
TOOLCHAIN_ARG=""
13031303
if [ "$(POSIX_RID)" = "linux-arm64" ]; then
1304-
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
1304+
curl -fsSL "https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz" \
1305+
| sudo tar -xJ -C /opt
1306+
export PATH="/opt/arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu/bin:$PATH"
13051307
TOOLCHAIN_ARG="-DCMAKE_TOOLCHAIN_FILE=$(pwd)/targets/posix/toolchain-aarch64-linux-gnu.cmake"
13061308
fi
13071309

nf.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ClCompile>
2626
<PreprocessorDefinitions>VIRTUAL_DEVICE;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;VERSION_MAJOR=$(NBGV_VersionMajor);VERSION_MINOR=$(NBGV_VersionMinor);VERSION_BUILD=$(NBGV_BuildNumber);VERSION_REVISION=$(TARGET_BUILD_COUNTER);PLATFORMNAMESTRING="WINDOWS";</PreprocessorDefinitions>
2727
<AdditionalIncludeDirectories>..\..\targets\win32\Include;..\..\targets\netcore\nanoFramework.nanoCLR;..\..\..\targets\netcore\nanoFramework.nanoCLR;..\..\..\..\targets\netcore\nanoFramework.nanoCLR;..\CLR\Include;..\..\CLR\Include;..\CorLib;..\HAL\Include;..\..\src\HAL\Include;..\..\..\src\HAL\Include;..\..\..\..\src\HAL\Include;..\PAL\Include;</AdditionalIncludeDirectories>
28-
<LanguageStandard>stdcpp20</LanguageStandard>
28+
<LanguageStandard>stdcpp23</LanguageStandard>
2929
<LanguageStandard_C>stdc17</LanguageStandard_C>
3030
</ClCompile>
3131
</ItemDefinitionGroup>

targets/ChibiOS/RP_PICO_W_RP2040/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,16 @@ nf_setup_target_build(
6565
if(USE_NETWORKING_OPTION AND TARGET_HAS_WIFI)
6666
foreach(CYW43_SRC ${CYW43_DRIVER_SOURCES})
6767
get_filename_component(CYW43_SRC_NAME ${CYW43_SRC} NAME)
68-
if(CYW43_SRC_NAME MATCHES "^cyw43_")
68+
if(CYW43_SRC_NAME STREQUAL "cyw43_ll.c")
69+
# cyw43_ll.c is a very large file. GCC 15 changed -Og to keep more variables on
70+
# the stack for debuggability, pushing function frames past the Thumb-1
71+
# SP-relative ldr offset limit (1020 bytes). Force -Os -fno-inline to prevent
72+
# this — same fix applied to hal_usb_lld.c for the same reason.
6973
set_source_files_properties(${CYW43_SRC} PROPERTIES COMPILE_FLAGS
70-
"-Wno-error=shadow -Wno-error=return-type -Wno-error=implicit-function-declaration -Wno-error=type-limits -Wno-error=unused-parameter -Wno-error=missing-prototypes -Wno-error=missing-declarations -Wno-error=old-style-definition -Wno-error=undef")
74+
"-Os -fno-inline -Wno-undef -Wno-error=shadow -Wno-error=return-type -Wno-error=implicit-function-declaration -Wno-error=type-limits -Wno-error=unused-parameter -Wno-error=missing-prototypes -Wno-error=missing-declarations -Wno-error=old-style-definition")
75+
elseif(CYW43_SRC_NAME MATCHES "^cyw43_")
76+
set_source_files_properties(${CYW43_SRC} PROPERTIES COMPILE_FLAGS
77+
"-Wno-undef -Wno-error=shadow -Wno-error=return-type -Wno-error=implicit-function-declaration -Wno-error=type-limits -Wno-error=unused-parameter -Wno-error=missing-prototypes -Wno-error=missing-declarations -Wno-error=old-style-definition")
7178
endif()
7279
endforeach()
7380
endif()

targets/ChibiOS/_nanoCLR/nanoFramework.Hardware.Stm32/nf_hardware_stm32_native_nanoFramework_Hardware_Stm32_Configuration.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ HRESULT Library_nf_hardware_stm32_native_nanoFramework_Hardware_Stm32_Configurat
5757
alternateFunction = (uint8_t)gpioConfiguration[GpioConfiguration::FIELD___alternateFunction].NumericByRef().s4;
5858

5959
// configure the pin
60-
palSetPadMode(port, pad, mode | pullUpDown | speed | (PAL_MODE_ALTERNATE(alternateFunction)));
60+
palSetPadMode(
61+
port,
62+
pad,
63+
(iomode_t)((uint32_t)mode | (uint32_t)pullUpDown | (uint32_t)speed | PAL_MODE_ALTERNATE(alternateFunction)));
6164

6265
NANOCLR_NOCLEANUP_NOLABEL();
6366
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// See LICENSE file in the project root for full license information.
4+
//
5+
6+
// Compatibility shim for NimBLE modlog numeric-level macros with GCC 15+.
7+
//
8+
// NimBLE defines log-level constants as integers (e.g. DEBUG=1, INFO=2, ...).
9+
// When MODLOG_DFLT(DEBUG, ...) expands, DEBUG is resolved to 1 before the
10+
// ## token-paste in modlog.h fires, producing MODLOG_1 which is not defined
11+
// in the ESP-IDF NimBLE port's modlog.h. GCC 15 promotes that implicit-
12+
// function-declaration from a warning to an error. The definitions below
13+
// provide silent no-op fallbacks for every numeric variant that modlog.h
14+
// leaves undefined, without modifying any ESP-IDF source files.
15+
16+
#ifndef NIMBLE_MODLOG_COMPAT_H
17+
#define NIMBLE_MODLOG_COMPAT_H
18+
19+
#ifndef MODLOG_1
20+
// NOLINTBEGIN
21+
#define MODLOG_1(ml_mod_, ...) ((void)0)
22+
// NOLINTEND
23+
#endif
24+
25+
#ifndef MODLOG_2
26+
// NOLINTBEGIN
27+
#define MODLOG_2(ml_mod_, ...) ((void)0)
28+
// NOLINTEND
29+
#endif
30+
31+
#ifndef MODLOG_3
32+
// NOLINTBEGIN
33+
#define MODLOG_3(ml_mod_, ...) ((void)0)
34+
// NOLINTEND
35+
#endif
36+
37+
#ifndef MODLOG_4
38+
// NOLINTBEGIN
39+
#define MODLOG_4(ml_mod_, ...) ((void)0)
40+
// NOLINTEND
41+
#endif
42+
43+
#ifndef MODLOG_5
44+
// NOLINTBEGIN
45+
#define MODLOG_5(ml_mod_, ...) ((void)0)
46+
// NOLINTEND
47+
#endif
48+
49+
#endif // NIMBLE_MODLOG_COMPAT_H

0 commit comments

Comments
 (0)