When the castle was built atop the hill , the original city of Edinburgh grew on this ridge , reaching down in a ribbon of development toward the Abbey of Holyrood , at the foot of the hill in the east .
The castle was built deep in the valley .