In this paper, a Mars ascent trajectory optimization algorithm based on convex optimization is designed for the Mars ascent trajectory optimization problem. The main accomplishment of this paper is the trajectory optimization of the second-stage ignition based on the convex optimization. For the first-stage ignition, open-loop guidance is used. In this stage, the ascender flies using the maximum thrust to track the attitude profile, thus completing the ascent flight control. In the presence of errors in the first-stage ignition, the experiment generates multiple sets of first-stage shutdown point data and completes simulation verification experiments based on them. The simulation verifies that the second-stage ignition trajectory optimization based on convex optimization algorithm can achieve high accuracy into orbit despite the large starting point deviation.