Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: compile ... --dump-profile now produces a clean output #2852

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Feb 27, 2025

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

When a compile --dump-profile is performed, the output is the clean profile that could be redirected in a file.

What is the current behavior?

A regression in the Arduino CLI 1.2.0 made the profile disappear from the non-verbose output:

$ arduino-cli compile -b arduino:avr:uno --dump-profile
Lo sketch usa 444 byte (1%) dello spazio disponibile per i programmi. Il massimo è 32256 byte.
Le variabili globali usano 9 byte (0%) di memoria dinamica, lasciando altri 2039 byte liberi per le variabili locali. Il massimo è 2048 byte.

the only way to get the profile with --dump-profile is to enable verbose -v, but this is really inconvenient:

$ arduino-cli compile -b arduino:avr:uno --dump-profile -v
FQBN: arduino:avr:uno
Utilizzo della scheda 'uno' dalla piattaforma nella cartella: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Utilizzo del core 'arduino' dalla piattaforma nella cartella: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

Rilevamento delle librerie utilizzate in corso...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
Sto generando i prototipi di funzione...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/709592250/sketch_merged.cpp
/home/megabug/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/709592250/sketch_merged.cpp

Compilazione dello sketch in corso...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/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/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o
Compilazione delle librerie in corso...
Compilazione del core in corso...
Utilizzo del core precompilato: /home/megabug/.cache/arduino/cores/arduino_avr_uno_12e4cfbdc0590d50ab9cd20e50a4c3c5/core.a
Collegare tutto insieme...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/../../cores/arduino_avr_uno_12e4cfbdc0590d50ab9cd20e50a4c3c5/core.a -L/home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3 -lm
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.eep
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.hex
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf
Lo sketch usa 444 byte (1%) dello spazio disponibile per i programmi. Il massimo è 32256 byte.
Le variabili globali usano 9 byte (0%) di memoria dinamica, lasciando altri 2039 byte liberi per le variabili locali. Il massimo è 2048 byte.

Piattaforma utilizzata Versione Percorso
arduino:avr            1.8.6    /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

profiles:
  uno:
    fqbn: arduino:avr:uno
    platforms:
      - platform: arduino:avr (1.8.6)

What is the new behavior?

$ arduino-cli compile -b arduino:avr:uno --dump-profile
profiles:
  uno:
    fqbn: arduino:avr:uno
    platforms:
      - platform: arduino:avr (1.8.6)


$

Does this PR introduce a breaking change, and is titled accordingly?

Other information

Fix #2848

@cmaglie cmaglie self-assigned this Feb 27, 2025
@cmaglie cmaglie added priority: medium Resolution is a medium priority type: imperfection Perceived defect in any part of project topic: CLI Related to the command line interface labels Feb 27, 2025
Copy link

codecov bot commented Feb 27, 2025

Codecov Report

Attention: Patch coverage is 62.71186% with 22 lines in your changes missing coverage. Please review.

Project coverage is 67.87%. Comparing base (079a28f) to head (0c79a98).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
internal/cli/compile/compile.go 60.71% 17 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2852      +/-   ##
==========================================
+ Coverage   67.73%   67.87%   +0.13%     
==========================================
  Files         238      238              
  Lines       22402    22412      +10     
==========================================
+ Hits        15175    15212      +37     
+ Misses       6033     6005      -28     
- Partials     1194     1195       +1     
Flag Coverage Δ
unit 67.87% <62.71%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cmaglie cmaglie requested a review from a team February 27, 2025 16:31
Copy link

@lucarin91 lucarin91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@manchoz
Copy link
Contributor

manchoz commented Feb 28, 2025

LTGM but --dump-profile parameter now takes over -verbose

 ./arduino-cli compile -b arduino:mbed_opta:opta --verbose --dump-profile TestProfile/
profiles:
  opta:
    fqbn: arduino:mbed_opta:opta
    platforms:
      - platform: arduino:mbed_opta (4.2.2)
    libraries:
      - ArduinoIoTCloud (2.4.0)
      - Arduino_ConnectionHandler (1.0.0)
      - Arduino_DebugUtils (1.4.0)
      - ArduinoMqttClient (0.1.8)
      - Arduino_SecureElement (0.3.0)
      - ArduinoECCX08 (1.3.8)
      - ArduinoHttpClient (0.6.1)

It might be a good idea to have them ORed. WDYT?

@cmaglie
Copy link
Member Author

cmaglie commented Feb 28, 2025

It might be a good idea to have them ORed. WDYT?

Do you mean XORed?
Actually, the -v has an effect: in case of errors the verbose output is displayed instead of the normal output.

$ arduino-cli compile -v -b arduino:avr:uno --dump-profile
FQBN: arduino:avr:uno
Utilizzo della scheda 'uno' dalla piattaforma nella cartella: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Utilizzo del core 'arduino' dalla piattaforma nella cartella: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

Rilevamento delle librerie utilizzate in corso...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
Sto generando i prototipi di funzione...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/3218949563/sketch_merged.cpp
/home/megabug/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/3218949563/sketch_merged.cpp

Compilazione dello sketch in corso...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/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/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /home/megabug/.cache/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o
/home/megabug/Arduino/Blink/Blink.ino:6:1: error: 'aaa' does not name a type
 aaa
 ^~~

Piattaforma utilizzata Versione Percorso
arduino:avr            1.8.6    /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Si è verificato un errore durante la compilazione: exit status 1

vs

$ arduino-cli compile -b arduino:avr:uno --dump-profile
/home/megabug/Arduino/Blink/Blink.ino:6:1: error: 'aaa' does not name a type
 aaa
 ^~~

Piattaforma utilizzata Versione Percorso
arduino:avr            1.8.6    /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Si è verificato un errore durante la compilazione: exit status 1

@manchoz
Copy link
Contributor

manchoz commented Feb 28, 2025

With ORed, I mean showing both the verbose output and dumping the profile, but I don't know if it is a good idea. It may be better to separate the two features. I let you have the last word.

@cmaglie
Copy link
Member Author

cmaglie commented Feb 28, 2025

With ORed, I mean showing both the verbose output and dumping the profile, but I don't know if it is a good idea. It may be better to separate the two features. I let you have the last word.

Ah, no then, I'll keep it as in this PR.

@cmaglie cmaglie merged commit b9edb78 into arduino:master Feb 28, 2025
98 checks passed
@cmaglie cmaglie deleted the fix_profile_dump branch February 28, 2025 10:03
@per1234 per1234 added the topic: code Related to content of the project itself label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Resolution is a medium priority topic: CLI Related to the command line interface topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dumping profile should work in non verbose mode
4 participants