Example of Core Log Level using compile-sketch GitHub action

I would appreciate a working example setting / overriding the Core Log Level (e.g. to info) when compiling my sketch using GitHub Action compile-sketch and Arduino CLI.

I have tried

          libraries: |
            - name: log4arduino
            - name: ArduinoJson
          cli-compile-flags: |
            - --log-level
            - info
            - --output-dir
            - ./build
            - --build-property 
            - "compiler.c.extra_flags=-DVERSION=\"ci-SNAPSHOT\" -DCORE_DEBUG_LEVEL=3"
            - --build-property 
            - "compiler.cpp.extra_flags=-DVERSION=\"ci-SNAPSHOT\" -DCORE_DEBUG_LEVEL=3"
          sketch-paths: .

but without any luck. I can see in the build logs that CORE_DEBUG_LEVEL is being set twice, and not with my value last.

...
-Wextra -DF_CPU=160000000L -DARDUINO=10607 -DARDUINO_ESP32C3_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32C3_DEV\"" "-DARDUINO_VARIANT=\"esp32c3\"" -DARDUINO_PARTITION_default "-DVERSION=\"0.7.7\"" -DCORE_DEBUG_LEVEL=3 -DESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/tmp/arduino-sketch-3D54A62C537BF9DEC041C07883B6DD14/build_opt.h
...

Hi @sosandstrom. Please provide the value of the fqbn input from your workflow.

        include:
          - arduino-platform: "esp32:esp32"
            fqbn: "esp32:esp32:esp32c3"

"Core Debug Level" is a custom board option. Custom board options can be set via the FQBN.

The format of the FQBN is like this:

<vendor ID>:<architecture>:<board ID>[:<menu ID>=<option ID>[,<menu ID>=<option ID>]...]

You can learn all the available menu IDs and option IDs for a given board by running the following arduino-cli command:

arduino-cli board details --fqbn <FQBN>

(where <FQBN> is replaced by the fully qualified board name of the board you are using)

For example:

$ arduino-cli board details -b esp32:esp32:esp32c3
Board name:            ESP32C3 Dev Module
FQBN:                  esp32:esp32:esp32c3
Board version:         2.0.5

Package name:          esp32
Package maintainer:    Espressif Systems
Package URL:           https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Package website:       https://github.com/espressif/arduino-esp32
Package online help:   http://esp32.com

Platform name:         esp32
Platform category:     ESP32
Platform architecture: esp32
Platform URL:          https://github.com/espressif/arduino-esp32/releases/download/2.0.5/esp32-2.0.5.zip
Platform file name:    esp32-2.0.5.zip
Platform size (bytes): 260916106
Platform checksum:     SHA-256:c7a1040c5f007a799ef9eb249508e3544c3cf5246f67cdfdc1e80f7d0ca7b41d

Required tool:         esp32:riscv32-esp-elf-gcc                                            gcc8_4_0-esp-2021r2-patch3

Required tool:         esp32:xtensa-esp32-elf-gcc                                           gcc8_4_0-esp-2021r2-patch3

Required tool:         esp32:xtensa-esp32s2-elf-gcc                                         gcc8_4_0-esp-2021r2-patch3

Required tool:         esp32:xtensa-esp32s3-elf-gcc                                         gcc8_4_0-esp-2021r2-patch3

Required tool:         esp32:esptool_py                                                     4.2.1

Required tool:         esp32:mkspiffs                                                       0.2.3

Required tool:         esp32:mklittlefs                                                     3.0.0-gnu12-dc7f933

Option:                USB CDC On Boot                                                                                 CDCOnBoot
                       Disabled                                                             ✔                          CDCOnBoot=default
                       Enabled                                                                                         CDCOnBoot=cdc
Option:                Partition Scheme                                                                                PartitionScheme
                       Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)                     ✔                          PartitionScheme=default
                       Default 4MB with ffat (1.2MB APP/1.5MB FATFS)                                                   PartitionScheme=defaultffat
                       8M with spiffs (3MB APP/1.5MB SPIFFS)                                                           PartitionScheme=default_8MB
                       Minimal (1.3MB APP/700KB SPIFFS)                                                                PartitionScheme=minimal
                       No OTA (2MB APP/2MB SPIFFS)                                                                     PartitionScheme=no_ota
                       No OTA (1MB APP/3MB SPIFFS)                                                                     PartitionScheme=noota_3g
                       No OTA (2MB APP/2MB FATFS)                                                                      PartitionScheme=noota_ffat
                       No OTA (1MB APP/3MB FATFS)                                                                      PartitionScheme=noota_3gffat
                       Huge APP (3MB No OTA/1MB SPIFFS)                                                                PartitionScheme=huge_app
                       Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)                                                PartitionScheme=min_spiffs
                       16M Flash (2MB APP/12.5MB FATFS)                                                                PartitionScheme=fatflash
                       16M Flash (3MB APP/9.9MB FATFS)                                                                 PartitionScheme=app3M_fat9M_16MB
                       RainMaker                                                                                       PartitionScheme=rainmaker
Option:                CPU Frequency                                                                                   CPUFreq
                       160MHz (WiFi)                                                        ✔                          CPUFreq=160
                       80MHz (WiFi)                                                                                    CPUFreq=80
                       40MHz                                                                                           CPUFreq=40
                       20MHz                                                                                           CPUFreq=20
                       10MHz                                                                                           CPUFreq=10
Option:                Flash Mode                                                                                      FlashMode
                       QIO                                                                  ✔                          FlashMode=qio
                       DIO                                                                                             FlashMode=dio
                       QOUT                                                                                            FlashMode=qout
                       DOUT                                                                                            FlashMode=dout
Option:                Flash Frequency                                                                                 FlashFreq
                       80MHz                                                                ✔                          FlashFreq=80
                       40MHz                                                                                           FlashFreq=40
Option:                Flash Size                                                                                      FlashSize
                       4MB (32Mb)                                                           ✔                          FlashSize=4M
                       8MB (64Mb)                                                                                      FlashSize=8M
                       2MB (16Mb)                                                                                      FlashSize=2M
                       16MB (128Mb)                                                                                    FlashSize=16M
Option:                Upload Speed                                                                                    UploadSpeed
                       921600                                                               ✔                          UploadSpeed=921600
                       115200                                                                                          UploadSpeed=115200
                       256000                                                                                          UploadSpeed=256000
                       230400                                                                                          UploadSpeed=230400
                       512000                                                                                          UploadSpeed=512000
Option:                Core Debug Level                                                                                DebugLevel
                       None                                                                 ✔                          DebugLevel=none
                       Error                                                                                           DebugLevel=error
                       Warn                                                                                            DebugLevel=warn
                       Info                                                                                            DebugLevel=info
                       Debug                                                                                           DebugLevel=debug
                       Verbose                                                                                         DebugLevel=verbose
Option:                Erase All Flash Before Sketch Upload                                                            EraseFlash
                       Disabled                                                             ✔                          EraseFlash=none
                       Enabled                                                                                         EraseFlash=all
Programmers:           Id                                                                   Name
                       esptool                                                              Esptool

Here we can see that the ID for the "Core Debug Level" menu is DebugLevel and the ID for the "Info" option is info.

So the full FQBN is:

esp32:esp32:esp32c3:DebugLevel=info

So just replace the esp32:esp32:esp32c3 in your workflow with esp32:esp32:esp32c3:DebugLevel=info and you are set. No need to mess around with adding --build-property flags.

The "extra_flags" properties like compiler.cpp.extra_flags are useful in cases where you need to add arbitrary additional flags to the compilation commands, but in cases like this where you have a dedicated formal API provided by the Arduino boards platform author and framework, using that property instead of setting the custom board option is super hacky.


Please let me know if you have any questions or problems.

Thanks @ptillisch for the prompt and detailed response! :pray:

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.