Repository navigation
Phase 3: Mono runtime glue, Kconfig and SDRAM placement - #696
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The configuration manager treated a runtime version as packed when any of bits 8-23 of the build field were set, so a build number above 255 (for example 1.99.0.19735) was misdecoded, the board reported "Mono version: (null)" and hcom disabled Mono. Test only the top byte instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration-dependent test symbols (hello_world_results, meadow_kt_dispatcher, tensorflow_tests_hello_world) broke the user-space link when the tests were not built. Make each entry .weak, and move the table from .data to .rodata, which saves 62 KB of user SRAM; the loader only searches it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Mono TLS shim runs in user space and needs meadow_client_cert_retrieve_credentials and meadow_client_cert_release_credentials, which are implemented in the kernel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase 3 of the managed runtime plan. apps/system/mono holds the glue ported from Legacy meadow-3.0: the monovm host (mono_main.c), the P/Invoke tables, the mbedTLS 3.6.2 TLS shim and root CA table, and support functions the runtime needs in a protected NuttX 12 build (I-cache maintenance through up_coherent_dcache, an atomic 64-bit compare-and-swap, readlink, mprotect). The runtime archives, libSystem.Native.a and the TLS shim are placed in the SDRAM runtime image; mbedTLS and SQLite stay in user flash. hcom starts meadow_mono_main again. build.sh runs build-mono.sh when CONFIG_SYSTEM_MONO is set. The defconfig enables SYSTEM_MONO, LIBC_LOCALE, FS_RAMMAP (file mmap for assemblies) and mbedTLS threading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fetch the runtime commit recorded in MONO_RUNTIME_COMMIT into runtime-src/, pass it to the build container as MEADOW_RUNTIME_DIR, and install CMake and Ninja in the build image for the runtime build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WildernessLabs/runtime#3 adds the NuttX 12 fixes the phase 3 glue needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of the managed runtime work: the Mono glue, its Kconfig and build wiring, and placement of the runtime in the SDRAM image.
Changes
CONFIG_SYSTEM_MONO). This is the glue ported from Legacy meadow-3.0:mono_main.c)mbedtlslibrary and cell stubspsa_crypto_initand threading enabledup_coherent_dcache, an atomic__sync_val_compare_and_swap_8(NuttX's weak version masks interrupts, which does nothing in unprivileged mode),readlink,mprotectandposix_madvise.libSystem.Native.aand the TLS shim go in the SDRAM runtime image; mbedTLS and SQLite stay in user flash. SDRAM image: 1568 of 3072 KiB. User flash: about 835 of 1024 KiB.meadow_mono_mainagain. The required files are nowSystem.Private.CoreLib.dllandMeadow.dll.build-mono.shwhenCONFIG_SYSTEM_MONO=y. The defconfig enablesSYSTEM_MONO,LIBC_LOCALE,FS_RAMMAPand mbedTLS threading.meadow_client_cert_retrieve_credentialsandmeadow_client_cert_release_credentials..rodata. The test-only symbols no longer break the link, and the move saves 62 KB of user SRAM.runtime-src/; the Docker image installs CMake and Ninja.Runtime
MONO_RUNTIME_COMMITnow pins runtime MergeManagedCode 520e78f6c99 (WildernessLabs/runtime#3). That PR drops thesdram_cache_track_fdhook, callsnxsock_close_notifyinSystemNative_Close, and avoids_Thread_localinminipal_get_current_thread_id. CI run 38608329148 passes against the pinned runtime. The earlier failed run built against the previous pin.Testing (CCM, built with the runtime Phase3 changes)
meadow firmware write runtime.meadow device info: OS 1.99.1.0, Runtime 1.99.1.0.🤖 Generated with Claude Code