Matrices with prescribed characteristic polynomial and principal blocks