The primary reference for terrain and obstacle awareness and avoidance is Radio Altitude.
The gear / flaps alerts come from comparing the selected position against RA – gear normally < 500ft, flaps < 200ft – flaps can be overridden by selection.
Baro / GPS inputs as per model and installation; some restrict QFE ops others provided baro comparator from GPS.