nf-interpreter icon indicating copy to clipboard operation
nf-interpreter copied to clipboard

Update gcc 14.2 - fix [workaround] for mbedTLS

Open networkfusion opened this issue 7 months ago • 10 comments

Description

  • Fixes GCC path due to top level directory being removed with zips for windows (still requires PS re-signing).
  • Updates the docker action (this is split into a seperate PR #3198 ).
  • Fixes CMSIS install in devcontainer (see https://github.com/ARM-software/CMSIS_5/issues/1201).
  • Adds a workaround fix for mbed TLS, to allow futher discovery and fixes with other GCC related issues.

It unlocks the new issues :

(speculative fix applied):

/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp: In function 'long long unsigned int& Interop_Marshal_GetField_UINT64(CLR_RT_HeapBlock*, unsigned int)':
/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp:894:65: error: casting 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::U8' to 'long long unsigned int&' does not use 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::U8::operator CLR_UINT64() const' [-Werror=cast-user-defined]
  894 |     return (unsigned __int64 &)pThis[fieldIndex].NumericByRef().u8;
      |                                                                 ^~
/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp: In function 'long long int& Interop_Marshal_GetField_INT64(CLR_RT_HeapBlock*, unsigned int)':
/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp:928:63: error: casting 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::S8' to 'long long int&' does not use 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::S8::operator CLR_INT64() const' [-Werror=cast-user-defined]
  928 |     return (signed __int64 &)pThis[fieldIndex].NumericByRef().s8;
      |                                                               ^~
/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp: In function 'double& Interop_Marshal_GetField_double(CLR_RT_HeapBlock*, unsigned int)':
/workspaces/nf-interpreter/src/CLR/Core/CLR_RT_Interop.cpp:950:55: error: casting 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::R8' to 'double&' does not use 'CLR_RT_HeapBlock::CLR_RT_HeapBlock_AtomicData::Numeric::R8::operator double() const' [-Werror=cast-user-defined]
  950 |     return (double &)pThis[fieldIndex].NumericByRef().r8;
      |                                                       ^~
cc1plus: all warnings being treated as errors

(not fixed yet):

D:/a/1/s/targets/TI_SimpleLink/_nanoCLR/nanoFramework.Hardware.TI/nf_hardware_ti_native_nanoFramework_Hardware_TI_Power.cpp:14:59: error: narrowing conversion of '-1' from 'int' to 'uint8_t' {aka 'unsigned char'} [-Wnarrowing]
   14 |     PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {.intPriority = ~0, .swiPriority = 0};
      |                                                           ^~
     

Motivation and Context

GCC updates. #3061

How Has This Been Tested?

The CI.

Screenshots

Types of changes

  • [ ] Improvement (non-breaking change that improves a feature, code or algorithm)
  • [ ] Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • [ ] New feature (non-breaking change which adds functionality to code)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Config and build (change in the configuration and build system, has no impact on code or features)
  • [ ] Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • [ ] Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • [ ] Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • [ ] My code follows the code style of this project (only if there are changes in source code).
  • [ ] My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • [ ] I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated base image versions for multiple development containers to newer releases.
    • Upgraded ARM GNU GCC toolchain version from 13.3.rel1 to 14.2.rel1 across various build scripts and container configurations.
    • Updated cryptographic signature in the ARM GCC installation script.
    • Modified pipeline and build configuration files to use the new GCC toolchain version.
    • Updated GitHub Actions workflows to use the latest Docker build-push action version.
    • Added Ninja build system installation steps to Azure Pipelines for multiple build jobs.
  • New Features
    • Added a compiler optimization flag for MbedTLS builds to improve performance.

networkfusion avatar Jul 05 '25 15:07 networkfusion

[!IMPORTANT]

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update the ARM GNU GCC toolchain version from 13.3.rel1 to 14.2.rel1 across multiple Dockerfiles, build scripts, and CI templates. Several base Docker image tags are also incremented. Additionally, a compiler flag is added for the MbedTLS build, and a new code signing signature block is introduced in a PowerShell script. Minor C++ cast style improvements were made in CLR interop code.

Changes

File(s) Change Summary
.devcontainer/All/Dockerfile.All Base image updated from v2.57 to v2.58.
.devcontainer/AzureRTOS/Dockerfile.AzureRTOS Base image updated from v1.34 to v1.35.
.devcontainer/ChibiOS/Dockerfile.ChibiOS Base image updated from v1.35 to v1.36.
.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP Base image updated from v1.07 to v1.08.
.devcontainer/All/Dockerfile.All.SRC
.devcontainer/AzureRTOS/Dockerfile.AzureRTOS.SRC
.devcontainer/ChibiOS/Dockerfile.ChibiOS.SRC
.devcontainer/FreeRTOS-NXP/Dockerfile.FreeRTOS-NXP.SRC
.devcontainer/TI/Dockerfile.TI.SRC
GCC toolchain version argument changed from 13.3.rel1 to 14.2.rel1; download URLs updated accordingly. CMSIS cloning now skips Git LFS smudge in some Dockerfiles.
azure-pipelines-templates/download-install-arm-gcc-toolchain.yml Default GCC version updated to 14.2.rel1; cache key updated to match new version; extraction path changed to versioned subfolder.
install-scripts/install-arm-gcc-toolchain.ps1 Default GCC version updated to 14.2.rel1; changed order of archive extraction; new cryptographic signature block added.
CMake/binutils.common.cmake Added -fomit-frame-pointer flag to MbedTLS build options; comment added for future removal.
src/CLR/Core/CLR_RT_Interop.cpp Replaced C-style casts with reinterpret_cast for returning references to 64-bit numeric fields.
.github/workflows/devcontainer-*.yaml (all affected workflows) Updated docker/build-push-action from version 5 to version 6 for all dev container workflows.
azure-pipelines.yml
azure-pipelines-nightly.yml
Added steps to download and install Ninja build system in multiple build jobs.

Sequence Diagram(s)

sequenceDiagram
    participant DevContainer as Dev Container Build
    participant ARMDownload as ARM Toolchain Server

    DevContainer->>ARMDownload: Download ARM GCC toolchain (14.2.rel1)
    ARMDownload-->>DevContainer: Provide toolchain archive
    DevContainer->>DevContainer: Extract and install GCC 14.2.rel1
sequenceDiagram
    participant CI as CI Pipeline
    participant ARMDownload as ARM Toolchain Server

    CI->>ARMDownload: Download ARM GCC toolchain (14.2.rel1)
    ARMDownload-->>CI: Provide toolchain archive
    CI->>CI: Cache and install GCC 14.2.rel1
sequenceDiagram
    participant Build as CMake Build
    participant MbedTLS as mbedcrypto Target

    Build->>MbedTLS: Compile with -fomit-frame-pointer flag
    MbedTLS-->>Build: Build output with new compiler option
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch update-gcc-14-2-tls

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jul 05 '25 15:07 coderabbitai[bot]

@coderabbit review

networkfusion avatar Jul 05 '25 16:07 networkfusion

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar Jul 05 '25 16:07 coderabbitai[bot]

@coderabbit review

networkfusion avatar Jul 05 '25 16:07 networkfusion

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar Jul 05 '25 16:07 coderabbitai[bot]

@CodeRabbit full review

networkfusion avatar Jul 05 '25 16:07 networkfusion

✅ Actions performed

Full review triggered.

coderabbitai[bot] avatar Jul 05 '25 16:07 coderabbitai[bot]

@CodeRabbit full review

networkfusion avatar Jul 07 '25 12:07 networkfusion

✅ Actions performed

Full review triggered.

coderabbitai[bot] avatar Jul 07 '25 12:07 coderabbitai[bot]

@josesimoes , I am done playing here. All the above needs testing (and potentially fixing), but hopefully give the correct way forward.

networkfusion avatar Jul 07 '25 14:07 networkfusion