It's hard to believe that Holyrood palace could have provided its Royal inhabitants with any degree of safety.....let alone defence. But, the palace started life as a Royal bolt-hole....to all intents and purposes, a thinly disguised castle. Most of the defensive qualities have long since been re-modelled or demolished and replaced, but some elements remain, and can still be seen. For the palace's history, and some additional photos, check this link.
Above. A view of the palace from the West.
James IV commenced building his Royal palace here in the late 1400's. Indeed, the tower to the left of the photo above, was mostly complete by around 1505 (probably having been started in 1498). This tower is commonly known as James IV's tower, and is all that remains (apart from one half of the gatehouse) of his attempt at fortifying his palace. The tower consists of a central rectangular block, with three corner turrets. The stone work of the tower is significantly different to that of its neighbour, rougher and of a different colour, indicating the difference in age.
An engraving dated 1650, shows the James IV tower as the only corner structure at this time. It was no doubt built as a stout and secure residence for the King, away from the more military comforts of Edinburgh Castle. The walls of both the central block, and the three towers are much thicker than the more modern tower to the right of the top photo, and the interior is split by a thick cross wall. The palace as a whole was remodelled by James V and later monarchs.
The gatehouse, otherwise known as Abbey Pend, was also added to the palace by James IV, at roughly the same time as the tower. Originally this would have been a long building with a narrow passageway leading off Canongate. All that now remains, is the Southern side of the gatehouse. There are some great photos of the gatehouse here at Castleuk. The gatehouse was extended over the course of sixteen years (1647 to 1663) and eventually almost totally dismantled in 1753. Again, the rougher stone work of parts of this building, demonstrate the age compared to neighbouring buildings.