His successor , Dom Dinis ( 1279-1325 ) , consolidated Portugal 's borders by constructing castles along the frontier with Castile .
Castles were built along Portugal 's borders during the late 13th and early 14th centuries .