How to make hex file for attiny402 microcontroller using winavr
Winavr has not been updated since 2010; the ATtiny402 was released in 2018. According to en.wikipedia.org/wiki/ATtiny_microcontroller_comparison_chart the ATtiny402 requires gcc arch id avrxmega3. So winavr will not be able to work. Check whether you have a new enough version of gcc to support ATtiny402 (avrxmega3), the version installed with winavr is probably out of date.