• 𞋴𝛂𝛋𝛆@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    28 days ago

    How do languages in GCC map to hardware? Could I, for instance, write in Rust and compile for GCC-MSP430, or a 68k architecture?

    • Rossphorus@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      edit-2
      27 days ago

      Rust has support for many embedded targets. I can personally vouch for the MSP430. Rust compiles down to an intermediate language which can then use the same compilers and linkers as C. For instance when compiling Rust for the MSP430, GCC-MSP430 is actually part of the toolchain.

    • anton@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      6
      ·
      27 days ago

      I think both gcc and clang are roughly build around the C memory model.
      If you want to interface with hardware you probably do volatile reads and writes to specific memory addresses.
      You should be able to compile for most gcc supported platforms.