Assuming you are using MCUXpresso IDE, then read chapter 14, "Memory Configuration and Link Scripts" of the MCUXpresso IDE v10.1 User Guide, in particular section 14.10 and 14.11 on Freemarker Link Script Templates.
The other thing you could potentially do is relocate your heap and stack from their default locations into RAM2, allowing you to leave your variables where they are - as described in section 14.9.
Please post any additional questions on this into the MCUXpresso IDE forum : MCUXpresso IDE
Regards,
MCUXpresso IDE Support