Skip to content

Instantly share code, notes, and snippets.

View dz111's full-sized avatar

David Zhong dz111

View GitHub Profile
@dz111
dz111 / building-gcc-for-avr.md
Last active May 24, 2026 13:27
Building GCC toolchain for AVR

Outline

We assume that the build environment will be a terminal-only Linux environment, in our case, Ubuntu Server. Linux is preferred because build tools are readily available (and we don't end up with a bootstrapping problem).

The strategy is as follows:

  1. Build binutils for avr target and Linux host
  2. Build gcc stage-1 bootstrapping compiler for avr target and Linux host
  3. Using the stage 1 compiler, build avr-libc
  4. Build gcc for avr target and Windows/Linux host
#!/bin/bash
iptables -t nat -A PREROUTING -p $3 -i eth0 -d $1 --dport $2 -j DNAT --to-destination $1
iptables -A FORWARD -i eth0 -p $3 -d $1 --dport $2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT