From what I understand, by the time the Shahnameh was published, Iranians had mostly forgotten about the Achaemenids and the Medians that preceded them, and instead in the epic Alexander's conquest was preceded by the legendary Pishdadians and Kayanians. Are there really no traces of the Achaemenids in the Shahnameh? [Persia]
I answered related questions on the Achaemenids here and here, though please do let me know if you have any follow-ups on what's written there. As for the Medes (Mād in New Persian), I don't think Ferdowsi mentions them; certainly not as a separate, pre-Achaemenid dynasty. However, in Gorgāni's antiquarian romance Vis and Ramin (c. 1050 CE), Vis's mother Shāhru is queen of Māh, "Media" (though in New Persian the name is homophonous with māh, "moon," fitting for a land that's home to women of exceptional beauty). In the poem, Māh is the region around Hamedān (ancient Ecbatana), in mountainous northwestern Iran.