The formation of planetary systems with SPICA