A new and improved version of where I setup the Standard C tool chain for the ATmega328P on the Raspberry Pi, however I use VS Code on my Mac (or Windows) for development and connect via SSH to the Raspberry Pi. This is the easy setup and requires the least amount of tool installation.
Note: This new, “easy” version is due to using Raspberry Pi OS Trixie, which now provides fairly up-to-date tools for the AVR microcontollers. The previous version has been deprecated. Make sure you are on the latest version of Raspberry Pi OS (which as of December 2025 is Trixie).