Towards Energy-Efficient and Secure Edge AI: A Cross-Layer Framework