arduino-cli
arduino-cli copied to clipboard
Build error when setting `upload.maximum_size` or `upload.maximum_data_size` properties in hexadecimal format
Describe the problem
When the boards.txt definition contains either {upload.maximum_size}
or {upload.maximum_data_size}
as hex values instead of decimal the build fails with error:
Using library ArduinoJson at version 6.21.4 in folder: C:\Users\xxx\Arduino\libraries\ArduinoJson
Using library SrcWrapper at version 1.0.1 in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\libraries\SrcWrapper
Error during build: strconv.Atoi: parsing "0x20000": invalid syntax
Used library Version Path
SparkFun u-blox SARA-R5 Arduino Library 1.1.9 C:\Users\xxx\Repo\tacoman\SparkFun_u-blox_SARA-R5_Arduino_Library
SoftwareSerial 1.0.0 C:\Users\xxx\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\libraries\SoftwareSerial
ArduinoUniqueID 1.3.0 C:\Users\xxx\Arduino\libraries\ArduinoUniqueID
STM32duino RTC 1.4.0 C:\Users\xxx\Arduino\libraries\STM32duino_RTC
ArduinoJson 6.21.4 C:\Users\xxx\Arduino\libraries\ArduinoJson
SrcWrapper 1.0.1 C:\Users\xxx\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1\libraries\SrcWrapper
Used platform Version Path
CustomBoard:stm32 1.0.0 C:\Users\xxx\Arduino\hardware\CustomBoard\stm32
STMicroelectronics:stm32 2.7.1 C:\Users\xxx\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.7.1
IntelliSense configuration already up to date. To manually rebuild your IntelliSense configuration run "Ctrl+Alt+I"
[Error] Verifying sketch 'main.ino': Exit with code=1
To reproduce
Edit boards.txt entry to set {upload.maximum_size}
or {upload.maximum_data_size}
to a hex value i.e. 0x20000
instead of 131072
[......]
BOARD_ID.upload.maximum_size=0x20000
[......]
Expected behavior
Hexadecimal property values when prefixed with 0x
should be parsed normally just like the {build.flash_offset}
property is.
Arduino CLI version
nightly-20240131 Commit: 205a6a5 Date: 2024-01-31T01:27:13Z
Operating system
Windows
Operating system version
10.0.19045 Build 19045
Additional context
arduino-cli.exe is run from VSCode using Microsoft's Arduino extension: vsciot-vscode.vscode-arduino
Issue checklist
- [X] I searched for previous reports in the issue tracker
- [X] I verified the problem still occurs when using the nightly build
- [X] My report contains all necessary details
:wave: currently we're giving support only to decimal values. As you can see here: https://github.com/arduino/arduino-cli/blob/master/internal/arduino/builder/sizer.go#L138-L149 https://github.com/arduino/arduino-cli/blob/master/internal/arduino/builder/sketch.go#L254
We can add support for that, but I cannot guarantee you when as we're considering this is a low priority. If you're willing to make a PR we'll be more than happy the review it.