This paper proposes a real-time operating system (RTOS) based secure routing algorithm for mobile ad-hoc networks (MANETs) to counter wormhole attacks, a major security challenge. It highlights the inadequacies of existing routing protocols that focus on detecting malicious nodes and offers a novel approach that combines software and hardware solutions for monitoring and isolating malicious activities. The algorithm allows for the effective finding of secure shortest paths while addressing the dynamics of network topology and the implications of constant node mobility.