Repository: mesonbuild/meson

Issue:
Unknown CPU family atmega
**Describe the bug**
I'm trying to compile a project for the Arduino Nano. This is based on https://github.com/jpakkane/mesonarduino/blob/master/arduino_uno_cross.txt .

Submitting this issue due to the output:
```
WARNING: Unknown CPU family atmega, please report this at https://github.com/mesonbuild/meson/issues/new
```

**To Reproduce**

Cross file:
```
[binaries]
c = '/usr/bin/avr-gcc'
cpp = '/usr/bin/avr-g++'
ar = '/usr/bin/avr-ar'
strip = '/usr/bin/avr-strip'

[properties]
root = '/usr/share/arduino'

c_args = [
  '-I/usr/share/arduino/hardware/arduino/variants/standard',
  '-I/usr/share/arduino/hardware/arduino/cores/arduino',
  '-ffunction-sections',
  '-fdata-sections',
  '-mmcu=atmega328p',
  '-DF_CPU=16000000L',
  '-DUSB_VID=null',
  '-DUSB_PID=null',
  '-DARDUINO=105',
  '-D__PROG_TYPES_COMPAT__',
  ]

cpp_args = ['-I/usr/share/arduino/hardware/arduino/variants/standard',
  '-I/usr/share/arduino/hardware/arduino/cores/arduino',
  '-fno-exceptions',
  '-ffunction-sections',
  '-fdata-sections',
  '-mmcu=atmega328p',
  '-DF_CPU=16000000L',
  '-DUSB_VID=null',
  '-DUSB_PID=null',
  '-DARDUINO=105',
  '-D__PROG_TYPES_COMPAT__',
  ]

c_link_args = ['-Wl,--gc-sections', '-mmcu=atmega328p']
cpp_link_args = ['-Wl,--gc-sections', '-mmcu=atmega328p']

ardu_src = [
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/CDC.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/IPAddress.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/Print.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/Stream.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/Tone.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/WInterrupts.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/WMath.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/WString.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/abi.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/hooks.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/main.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/new.cpp',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/wiring.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/wiring_analog.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/wiring_digital.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c',
  '/usr/share/arduino/hardware/arduino/avr/cores/arduino/wiring_shift.c']

[host_machine]
system = 'bare'
cpu_family = 'atmega'
cpu = 'atmega328P'
endian = 'none'

```

Output:
```
$ rm -r build*;  meson build --cross-file arduino_nano_cross.txt
WARNING: Unknown CPU family atmega, please report this at https://github.com/mesonbuild/meson/issues/new
WARNING: Unknown endian none
The Meson build system
Version: 0.54.1
Source dir: /home/schroeter/projects/tinyfeat
Build dir: /home/schroeter/projects/tinyfeat/build
Build type: cross build
Project name: tinyfeat
Project version: undefined
C compiler for the build machine: cc (gcc 10.0.1 "cc (GCC) 10.0.1 20200430 (Red Hat 10.0.1-0.13)")
C linker for the build machine: cc ld.bfd 2.34-2
C++ compiler for the build machine: c++ (gcc 10.0.1 "c++ (GCC) 10.0.1 20200430 (Red Hat 10.0.1-0.13)")
C++ linker for the build machine: c++ ld.bfd 2.34-2
C compiler for the host machine: /usr/bin/avr-gcc (gcc 9.2.0 "avr-gcc (Fedora 9.2.0-3.fc32) 9.2.0")
C linker for the host machine: /usr/bin/avr-gcc ld.bfd 2.32
C++ compiler for the host machine: /usr/bin/avr-g++ (gcc 9.2.0 "avr-g++ (Fedora 9.2.0-3.fc32) 9.2.0")
C++ linker for the host machine: /usr/bin/avr-g++ ld.bfd 2.32
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: atmega
Host machine cpu: atmega328P
Target machine cpu family: atmega
Target machine cpu: atmega328P
Program avr-objcopy found: YES (/usr/bin/avr-objcopy)
Program avrdude found: YES (/usr/bin/avrdude)
```

**Expected behavior**
CPU is known, no warning

**system parameters**
Cross build on Fedora 32 Host with meson 54.0



Discussion:
@jpakkane. I think the family here should actually be either `AVR` or `megaAVR`. Since you wrote this up originally, what do you think?
FWICT `avr` is the microprocessor line, so it should be the family name.
`avr` is also not known, see https://github.com/mesonbuild/meson/blob/247eecc8fc61822e10ccbef54641fd326484a80a/mesonbuild/envconfig.py#L38-L67

Resolving patch:
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -40,6 +40,7 @@
     'alpha',
     'arc',
     'arm',
+    'avr',
     'c2000',
     'e2k',
     'ia64',


Test patch: