You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe both GCC and Clang support the -Os option, and this is normally an embedded application's default. Support for this in Rust would follow that tradition.
@engstad, the idea of -Os can be safely decoupled from anything embedded or binary size in general - it used to be a rule that hot C++ code compiled for size ran faster (better fit in cache) than -O3.
So yeah, that would be a welcome addition with benchmarking in mind.
@engstad Are you working on an embedded system already without libstd, and the output binary size is still that important? Well, I tend to agree that smaller binaries are faster to load...
FYI, when I compiled GNU Make with Clang 4.8 x86_64 -Ofast and -Os, the stripped binary sizes were 192 KB vs 175 KB, 10 % difference.
@engstad@nodakai I've been looking for up to date information in regards to using Rust with embedded systems such as the Cortex M range of MCU that do not run Linux OS due to lack of resources. Is there any reference/information you can refer me to? I'm aware of Zinc.rs but that is not quite ready yet from what I understand. Are you able to interact with Arduino or mbed libraries?
Are you using Rust freestanding/bare metal or with an RTOS like FreeRTOS/ChibiOS/Zephyr? I've read that for MCU to have Rust working we must avoid using the std lib, @nodakai gives me the impression that higher end MCU do not have to avoid this?
Activity
steveklabnik commentedon Mar 16, 2016
As far as I know, yes, this isn't a thing.
engstad commentedon Mar 17, 2016
I believe both GCC and Clang support the
-Os
option, and this is normally an embedded application's default. Support for this in Rust would follow that tradition.nodakai commentedon Mar 17, 2016
Give this a try:
I guess static linking of libstd is "to blame" for the output size rather than the optimization level.
By the way, Rust FAQ must have an item on the issue of "huge" binary size.
engstad commentedon Mar 17, 2016
Embedded systems don't usually include
libstd
, onlylibcore
. However, for embedded systems (and IoT), size is often more important than speed.MagaTailor commentedon Mar 17, 2016
@engstad, the idea of
-Os
can be safely decoupled from anything embedded or binary size in general - it used to be a rule that hot C++ code compiled for size ran faster (better fit in cache) than-O3
.So yeah, that would be a welcome addition with benchmarking in mind.
nodakai commentedon Mar 18, 2016
@engstad Are you working on an embedded system already without libstd, and the output binary size is still that important? Well, I tend to agree that smaller binaries are faster to load...
FYI, when I compiled GNU Make with Clang 4.8 x86_64 -Ofast and -Os, the stripped binary sizes were 192 KB vs 175 KB, 10 % difference.
engstad commentedon Mar 18, 2016
@nodakai Yes, indeed. My two chips have 4 KiB (http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc-cortex-m0-plus-m0/lpc800-series/low-cost-32-bit-microcontroller-mcu-based-on-arm-cortex-m0-plus-core:LPC810M021FN8) and 32 KiB total ROM (http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc-cortex-m0-plus-m0/lpc1100-series/32kb-flash-4kb-sram-dip28-package:LPC1114FN28), so memory size is quite important.
Add CodeGen options to allow for specifying optimize for size and min…
Auto merge of #32386 - brandonedens:llvm_min_size, r=alexcrichton
polarathene commentedon Jul 5, 2016
@engstad @nodakai I've been looking for up to date information in regards to using Rust with embedded systems such as the Cortex M range of MCU that do not run Linux OS due to lack of resources. Is there any reference/information you can refer me to? I'm aware of Zinc.rs but that is not quite ready yet from what I understand. Are you able to interact with Arduino or mbed libraries?
Are you using Rust freestanding/bare metal or with an RTOS like FreeRTOS/ChibiOS/Zephyr? I've read that for MCU to have Rust working we must avoid using the std lib, @nodakai gives me the impression that higher end MCU do not have to avoid this?