This dissertation introduces the Trust Guard Extension (TGX), a software and hardware integration framework to support trusted execution environment (TEE) features in lightweight embedded environments. Unlike existing TEE technologies that rely on a limited set of layers within a fixed hardware architecture, TGX delegates security functions to hardware components while isolating layered tasks to a software implementation. The security functions performed by hardware components include cryptographic operations for memory protection and the capability to monitor security between layered software, all achieved without privilege-level intervention. Consequently, TGX can deliver cost-efficient protection for internal peripherals and advanced security features similar to those provided by Intel SGX in a lightweight embedded system.