MSP430 Rust and C interop ELF size is just 6 bytes
โ Rust ๐ 2026-07-16 ๐ค surdeus ๐๏ธ 1I'm trying to create a proof of concept for Rust and C interoperability on msp430g2553 platform. The idea is Rust code calls a rudimentary UART library to send text through COM to the computer. My app compiles and links seemingly fine, but when I check with msp430-elf-size utility:
text data bss dec hex filename
6 0 4 10 a msp430-c-interop
And mspdebug utility flashes exactly 6 bytes to the device. The actual file size is 1952 bytes.
msp430-elf-objdump with disassembly prints:
msp430-c-interop: file format elf32-msp430
Disassembly of section .text:
0000c000 <\__crt0_start>:
c000: 31 40 00 04 mov #1024, r1 ;#0x0400
Seems like it enters __crt0_start implementation from the C library and then probably can't find the main function and resets the device continuously.
I tried removing the msp430-rt crate's entry implementation and decorate the Rust main with extern "C" main() -> ! but that didn't work either.
I created a repo on GitHub. The code can be found there: GitHub - burumdev/msp430-rs-c-interop: Experimental and mental app to demonstrate Rust and C interop in msp430 embedded environment ยท GitHub
1 post - 1 participant
๐ท๏ธ Rust_feed