Hi,
I bought chinese printer 3d - Ender 3 and I want to upgrade firmaware to marlin 2.0.x. The printer is based on ATmega1284p.
Juggling with functionality which I want to enable causes that the firmaware is to big (even when I turned off functionalitis which I do not need). I found this webpage
These flagues are recommended in the link above
compiler.c.extra_flags=-fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
compiler.cpp.extra_flags=-fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
compiler.c.elf.extra_flags=-Wl,--relax
I do not have any knowledge about these compilation flagues and I do not know if it safe to use them, but I've checked that they do the job. The firmware size is much smaller and I am able to enable much more functionalities.
Do these flagues change the behaviour of the firmware? Why the firmware is smaller? Could I have some problems with some of the functionality using these compiltaion flagues, for example during long prints?
Best regards
gc
Smaller than the firmware compiled without using these flagues.
In these way I can enable functionality which cause (without flagues comilation) compilation error - to big firmware for the board...
The flags are all described in the gcc documentation.
In documentation I found these two. It is clear that debuggging info is not needed, but from the description of the second flague I understand only "code will be smaller". Can it cause any unwanted behaviour?
-ggdb
Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF 2, stabs, or the native format if neither of those are supported), including GDB extensions if at all possible.
-mcall-prologues
Functions prologues/epilogues expanded as call to appropriate sub-routines. Code size will be smaller.
Other flagues I found on some website (I do not know if these description are from documentation).
First is rather obvious (vectorising calculation is almost always a win in many other languages).
Second description is not clear for me and it mention about 32bit. Could it be harmful for 8bit?
Third description for me is a magic. I am not convinced with "Almost always a win". What does it do?
-fno-tree-scev-cprop
This option is new in GCC 4.3.0. It will vectorise the outer loop when multiple loops are nested for a size benefit.
-fno-split-wide-types
When using a type that occupies multiple registers, such as long long on a 32-bit system, split the registers apart and allocate them independently. This normally generates better code for those types, but may make debugging more difficult. The option -fno-split-wide-types will stop this.
-Wl,--relax
Almost always a win. Note that this is a linker flag that is passed to the linker using the -Wl flag.
Enables linker relaxations. By default, the linker links functions will a full CALL statement, which is wasteful if two functions are near each other. Relaxations will do more in the future, but currently (AFAIK) just replace CALL statements with RCALL where possible to save a few bytes.
gc