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

How to properly add build flags and/or custom environment for memory tuning #86

Open
bengalih opened this issue Sep 22, 2024 · 1 comment

Comments

@bengalih
Copy link

bengalih commented Sep 22, 2024

Trying to follow this:
https://thborges.github.io/blog/marlin/2019/01/07/reducing-marlin-binary-size.html

which states:

If you are using PlataformIO, it is easier. Just create a new build target in platformio.ini, copying the original config for your printer board and add the new flags:

> build_unflags = -g -ggdb
> build_flags   = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues

I can do something like this at the bottom of platformio.ini:

[env:mega2560_memory_fix]
platform         = atmelavr
board            = megaatmega2560
framework        = arduino
extra_scripts    = ${common.extra_scripts}
build_unflags    = -g -ggdb
build_flags      = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
lib_deps         = ${common.lib_deps}
monitor_speed    = 250000
monitor_eol      = LF
monitor_echo     = yes
monitor_filters  = colorize, time, send_on_enter

But I don't know how to call upon this from AutoBuildMarlin to properly attempt a build and upload with these fixes.

@bengalih
Copy link
Author

bengalih commented Sep 22, 2024

I've figured out how to do this - but probably not in the best fashion.
The file to modify is not platformio.ini but buildroot > ini > avr.ini

I changed this:

build_flags       = ${common.build_flags} -std=gnu++1z -Wl,--relax
build_unflags     = -std=gnu++11

to this:

build_flags       = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -std=gnu++1z -Wl,--relax -mcall-prologues
build_unflags     = -g -ggdb -std=gnu++11

by basically combining my necessary settings with what was there.

However, these seems like a sloppy way to do it.
Is there a cleaner way to create a profile with the tuned memory settings and have it accessible from the ABM panel so you can manage the build and upload process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant