This is an automated email from the ASF dual-hosted git repository. kasjer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit fc4a9d955e5f2645ddad5253c5c505df73188cd3 Author: Jerzy Kasenberg <[email protected]> AuthorDate: Mon Oct 19 20:57:54 2026 +0200 compiler/xc32: Add XC32 v5 support XC32 v5.00 removed newlib (-mnewlib-libc, libc-newlib), picolibc or musl are provided instead. Linker in XC32 v5 also allocates sections initialized by .dinit template by default. Those include interrupt vector offset registers (OFFx in SFR area) so binary image created from elf file was over 1GB. New setting XC32_V5 selects picolibc and adds --no-alloc-dinit-mapping linker option. Default values keep compiler options used with older XC32 versions unchanged. For XC32 v5 target needs: syscfg.vals: XC32_V5: 1 and device family pack location in XC32_DFP_FLAGS (or in environment variable with the same name). Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jerzy Kasenberg <[email protected]> --- compiler/xc32/compiler.yml | 4 ++-- compiler/xc32/syscfg.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/compiler/xc32/compiler.yml b/compiler/xc32/compiler.yml index 7406c35c9..36f24f64e 100644 --- a/compiler/xc32/compiler.yml +++ b/compiler/xc32/compiler.yml @@ -25,7 +25,7 @@ compiler.path.objdump: "xc32-objdump" compiler.path.objsize: "xc32-size" compiler.path.objcopy: "xc32-objcopy" -compiler.flags.base: [-std=gnu11, -fno-common, -mnewlib-libc, -ffunction-sections, -fdata-sections, $(XC32_DFP_FLAGS)] +compiler.flags.base: [-std=gnu11, -fno-common, $(XC32_LIBC_CFLAGS), -ffunction-sections, -fdata-sections, $(XC32_DFP_FLAGS)] compiler.flags.default: [compiler.flags.base, -O2, -g3] compiler.flags.optimized: [compiler.flags.base, -O2, -g3] compiler.flags.speed: [compiler.flags.base, -O2, -g3] @@ -33,6 +33,6 @@ compiler.flags.debug: [compiler.flags.base, -Og, -g3] compiler.as.flags: [-x, assembler-with-cpp, $(XC32_DFP_FLAGS)] -compiler.ld.flags: -nostartfiles -nostdlib -static-libgcc -lgcc -lm -lc-newlib -lpic32 -Wl,--gc-sections $(XC32_DFP_FLAGS) +compiler.ld.flags: -nostartfiles -nostdlib -static-libgcc -lgcc -lm -lpic32 $(XC32_LIBC_LDFLAGS) -Wl,--gc-sections $(XC32_DINIT_LDFLAGS) $(XC32_DFP_FLAGS) compiler.ld.resolve_circular_deps: true compiler.ld.mapfile: true diff --git a/compiler/xc32/syscfg.yml b/compiler/xc32/syscfg.yml index 8e6b75908..2bc0ff738 100644 --- a/compiler/xc32/syscfg.yml +++ b/compiler/xc32/syscfg.yml @@ -27,3 +27,31 @@ syscfg.defs: The path is machine specific, so when this setting is empty newt uses the environment variable with the same name instead. value: "" + XC32_V5: + description: > + Set to 1 when XC32 v5.00 or later is used. XC32 v5.00 removed + newlib, picolibc is used instead. Device family pack must be + provided with XC32_DFP_FLAGS. + value: 0 + XC32_LIBC_CFLAGS: + description: > + Compiler options selecting C library. Set based on XC32_V5. + value: "-mnewlib-libc" + XC32_LIBC_LDFLAGS: + description: > + Linker options selecting C library. Set based on XC32_V5. + newt sorts linker flags, so libraries that depend on each other + are passed in one -Wl option to keep their order. + value: "-lc-newlib" + XC32_DINIT_LDFLAGS: + description: > + Linker options for data initialization template. Set based on + XC32_V5. XC32 v5 by default allocates sections initialized by + .dinit (e.g. interrupt vector offset registers in SFR area), + which makes binary image span up to SFR addresses. + value: "" + +syscfg.vals.XC32_V5: + XC32_LIBC_CFLAGS: "-mchp-stdlibc=picolibc" + XC32_LIBC_LDFLAGS: "-Wl,--start-group,-lc-pico,-lm-pico,-lgcc,--end-group" + XC32_DINIT_LDFLAGS: "-Wl,--no-alloc-dinit-mapping"
