Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Properties expansions insidebuild.variant break core build #762

Closed
Assignees
cmaglie
Labels
topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project
@matthijskooijman

Description

@matthijskooijman

Bug Report

Current behavior

With the following modification to the the AVR core:

--- a/boards.txt+++ b/boards.txt@@ -75,7 +75,8 @@ uno.build.mcu=atmega328p uno.build.f_cpu=16000000L uno.build.board=AVR_UNO uno.build.core=arduino-uno.build.variant=standard+uno.build.variant={build.realvariant}+uno.build.realvariant=standard  ##############################################################

(This is a bit of a contrived and simplified example, the original usecase was to specify a part of the variant in a menu rather than the direct board definition, seestm32duino/Arduino_Core_STM32#1091 for the more complete usecase).

Run:

arduino-cli compile /path/to/arduino/examples/01.Basics/BareMinimum -b arduino-git:avr:uno -v

(Note that I usearduino-git in the FQBN to get the modified version from my sketchbook rather than the board-manager installed version)

This produces the following error:

Compiling sketch.../home/matthijs/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino -I/home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/variants/standard /tmp/arduino-sketch-96B93CFDA539CD461E0E63C5A43503EE/sketch/BareMinimum.ino.cpp -o /tmp/arduino-sketch-96B93CFDA539CD461E0E63C5A43503EE/sketch/BareMinimum.ino.cpp.o[ ... output snipped ... ]Compiling core.../home/matthijs/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino /home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino/WInterrupts.c -o /tmp/arduino-sketch-96B93CFDA539CD461E0E63C5A43503EE/core/WInterrupts.c.oIn file included from /home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino/wiring_private.h:31:0,                 from /home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino/wiring.c:23:/home/matthijs/docs/Electronics/Arduino/hardware/arduino-git/avr/cores/arduino/Arduino.h:258:10: fatal error: pins_arduino.h: No such file or directory #include "pins_arduino.h"          ^~~~~~~~~~~~~~~~compilation terminated.

Note that the compiler command has no-I option for the variant when compiling the core (but itis present for the sketch).

Expected behavior

I would expect this to build without problems, usingbuild.variant=standard

Environment

  • CLI version (output ofarduino-cli version): arduino-cli Version: 0.0.0-git Commit:7541c80
    (todays git master)
  • OS and platform: Debian/Linux on amd64

Additional context

It seems the problem here is that normally property expansion happens very late, basically when interpreting the compilation recipe:

commandLine:=buildProperties.ExpandPropsInString(pattern)

For most properties that are included in the recipe, this is fine, since then all references will be recursively processed at the end. However, when compiling the core, thebuild.variant property is not included as-is, but its raw value (without expanding properties) is checked to be a valid directory name, if not it is ignored:

variantFolder:=buildProperties.GetPath("build.variant.path")
targetCoreFolder:=buildProperties.GetPath(constants.BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH)
includes:= []string{}
includes=append(includes,coreFolder.String())
ifvariantFolder!=nil&&variantFolder.IsDir() {
includes=append(includes,variantFolder.String())
}
includes=utils.Map(includes,utils.WrapWithHyphenI)

Note that this looks atcore.variant.path, which isthe same asbuild.variant but as a full path.

Also note that for sketches, the value is added to the commandline as-is (throughctx.IncludeFolders generated by the includes finder).

An easy fix could be to just to drop theisDir() check here (replacing it with an empty string check, I think). If an invalid directory is specified, that would previously silently be dropped, and then it would just be passed to gcc which I think would ignore it anyway. Also, the sketch and library compilation steps already just add the variant to the commandline without checking, so it seems this check does not really add anything anyway.

Metadata

Metadata

Assignees

Labels

topic: build-processRelated to the sketch build processtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp