The gemara says that if one would shecht a korban shlomim inside the heichal rather than in the courtyard, it would be valid. The gemara learns this out from the combination of the pasuk that says it should be shechted by the opening of the ohel mo'ed, implying that the ohel mo'ed would even be ideal, just that it can also be shechted by the opening of the ohel mo'ed, in conjunction with the logic of לא יהא טפל חמור מן העיקר - since it can be shechted at the opening of the ohel mo'ed, it can certainly be shechted in the ohlem mo'ed. The gemara asks that based on this approach, it should be obvious that when one is unable to eat kodshim in the courtyard, it can be eaten in the hei'chal (as rashi explains that we have a pasuk saying "in the courtyard of the ohel mo'ed and the logic of לא יהא טפל חמור מן העיקר indicating that the ohel mo'ed would be ideal). Why would R. Yochanan Ben Beseira require a pasuk to teach what seems obvious in sevara? The gemara answers that the logic of לא יהא טפל חמור מן העיקר only works for the shechita which is an avoda and is normal to be done in front of one's master, so the closer the better. But, eating which is not normal to do in front of one's master, the logic would not apply. Rashi explains that no only would the logic "not apply", it would apply in the opposite direction - making it prohibited to eat kodshim in the hei'chal. It is therefore necessary to have a special pasuk to teach that when it is impossible to eat kodshei kodshim in the courtyard because the goyim are bombing it, it can be eaten in the hei'chal.
The obvious question on this gemara is that if the pasuk of פתח אוהל מועד and the logic of לא יהא טפל חמור מן העיקר really apply, it should be ideal to shecht the korban in the ohel mo'ed. Why does R. Yochanan say that bidieved it is kasher, implying that it shouldn't be done lichat'chila? The Rambam (ma'aseh korbanos 5:4) also writes clearly that lichatchila it can be shechted anywhere in the courtyard, but shechting in the hei'chal is only bidieved. Why? It seems that the logic of לא יהא טפל חמור מן העיקר is only on the kashrus of the korban, but not on the action of shechting the korban. Meaning, that the gemara understands that the ideal place for the korban is as the pasuk describes by the opening of the ohel mo'ed in the courtyard, but regarding the kashrus of the korban if shechted elsewhere, it should certainly be kasher if it is shechted in the hei'chal.
Regarding the second halacha that kodshei kodshim can be eaten inside the hei'chal and is learned from a special pasuk - The Rambam (ma'aseh korbanos 10:3) writes - ואם נאכלו בהיכל נאכלו. The Rambam's language is very strange. Clearly the Rambam holds that lichatchila it cannot be eaten in the hei'chal because the case where the gemara permits eating in the hei'chal is only for extenuating circumstances when it absolutely cannot be eaten in the courtyard. The Rambam understands from this that the heter to eat in the hei'chal is only bi'dieved. However, this doesn't seem to make sense because the entire requirement to eat the meat is only lichatchila, but bidieved isn't me'akev! The Even Ha'azel (miluim in the back of kodshim 2, pg. 129b) in responding to R. Tzvi Pesach Frank who asked exactly this question writes that the Rambam seems to disagree with Tosafos in Pesachim 59 and holds that the eating of the meat by the kohanim is me'akev the atonement. Therefore, the Rambam writes ואם נאכלו בהיכל נאכלו, meaning that bidieved the mitzvah of eating is fulfilled even if the kohanim eat it in the heichal and the ba'alim would receive atonement. This approach is also not so me'duayak in the Rambam because he should have written ואם נאכלו בהיכל נתכפרו - that the ba'alim get ATONEMENT. The language of ואם נאכלו נאכלו implies that they aren't fulfilling any mitzvah, just that it is considered "eaten". But it isn't clear what nafka minah this would make!