uCNC
uCNC copied to clipboard
Sketch to big to fit into Arduino UNO memory
I've downloaded the newest master branch and loaded with a simple config generated by the web tool (I attached the config file). My Arduino IDE says it uses too much of program memory "Sketch uses 33024 bytes (102%) of program storage space. Maximum is 32256 bytes." I also tried compiling it with the -Os and -Oz flags to reduce the program size but with no luck.
I've been able to get it compile by turning off some options (DISABLE_PROBING_SUPPORT, DISABLE_COORD_SYS_SUPPORT, DISABLE_G10_SUPPORT, DISABLE_PATH_MODES) that were turned on be default. I think the web tool should automatically disable some of those options
This is a intrinsic problem with Arduino IDE. The compiled binary is bigger than the one generated via VSCode because you cannot customize the building flags (not without messing with the Arduino IDE platform.txt file). The default configuration can be build...just not with Arduino IDE.
If you know how to tweak the build flags on Arduino IDE use the ones that are used inside the avr.ini file in the uCNC/src/hal/board/avr/
dir to be able to build a better/optimized version of the binary.
EDIT As a reference the default master branch compiled for UNO produces a binary with this size:
RAM: [======= ] 66.8% (used 1368 bytes from 2048 bytes)
Flash: [==========] 98.4% (used 31748 bytes from 32256 bytes)
On Arduino IDE 2.2 the same compilation produces this:
Sketch uses 34030 bytes (105%) of program storage space. Maximum is 32256 bytes.
Global variables use 1398 bytes (68%) of dynamic memory, leaving 650 bytes for local variables. Maximum is 2048 bytes.
It's a significant difference..
Can you please explain how to compile it in VSCode? I'm having the following problem. I'd appreciate any help.
With flags from mikh3x4 Sketch uses 33418 bytes (103%).
Can you share more details about your config files/options?
TBH I just cloned the repository and open ino file into VSCode, selected the Arduino UNO platform from the list and that's it. Is there any manual witch I should have checked before?
That is odd. Using the default settings should have compiled anyway. You should get a hex file similar to the one that is available in the release.
Edit In that case try to upload the released hex with an external tool like XLoader
FWIW: I had no problem installing VSCode + PlatformIO (on Win10) and then compiling and uploading the master branch, without any warnings or errors just a few days ago. If it helps, I could post screenshots of my build; or other files if instructed.
H.M.