How to deal with a state-space model with kalman fliter

Dear all:
I built a very simple DSGE model with 3 equation ,and transform the model to a LRE model . I solve the LRE model with BK method and then I got a state space model just as x(t)=Ax(t-1)+Bz(t). I want to do the bayesian estimate . However as I know , before the bayesian estimate, we must get the maximum likelihood function of the state-space. My question is that how can I get the maximum likelihood function of the state-space by using the kalman fliter? Can I find the code in dynare?
I know dynare can do it with just a command and I want to know more details about it .thank you .

If you want to program Bayesian estimation from scratch, using Dynare’s routines for this is not ideal. Have a look at Schmitt-Grohé/Uribe’s codes for “What’s news in business cycles”.