If you have a second order ODE it has to be translated in to a first order ODE.
$$ \int_0^{t_F}c(x(t))dt=\sum_{k=0}^{N-1}c(x(t(u)) $$