Wireless power transfer (WPT) and cognitive radio (CR) are two promising techniques in designing mobile-edge computing (MEC) systems. In this paper, we study a robust secure wireless powered multiple-input single-output (MISO) cognitive MEC system, which integrates several techniques: physical-layer security, WPT, CR, underlay spectrum sharing and MEC. Three optimization problems are formulated to minimize the total transmission power (TTP) of the primary transmitter (PT) and the secondary base station (SBS) under perfect channel state information (CSI) model, bounded CSI error model and the probabilistic CSI error model, respectively. The formulated problems are nonconvex and hard to solve. Three two-phase iterative optimization algorithms combined with Lagrangian dual, semidefinite relaxation (SDR), S-Procedure and Bernstein-type inequalities are proposed to jointly optimize the beamforming vectors of the PT and the SBS, the central processing unit (CPU) frequency and the transmit power of the MD. Simulation results are provided to verify the effectiveness of the proposed algorithms. INDEX TERMS Mobile edge computing, cognitive radio, underlay spectrum sharing, physical-layer security, wireless power transfer.