as other answer already say, do as fortification usually do. 

like throwing stone or brick or other hard object from the crenelation or machicolation if the zombie try to climb (hopefully crush their head or bone to make them unable to move) or try to burn them with any flammable object.

also if the castle have water moat i suggest it link with strong current or wave like from river or ocean or put a creature that can eat the zombie in the moat or it contain flamable thing like oil just in case the zombie can pass the water since i assume they dont need oxygen to breath and they still can float to move or swim or just walk through the bottom of water by wearing heavy stuff like metal armor.

my concern is more on your food supply though if your zombie never rot, since i expect they dont really need to eat while your men still need food for energy.

but honestly i dont think someone will need castle to defend against zombie they have advantage in attricion if they dont rot to cancel the magic, by turtling yourself it will only increase dead body into zombie from unfortified village, in my opinion you need is offense and bait (use cavalry since i doubt the zombie can ride or is there a horse zombie too?) to entrap them to flammable area like flammable forest or plain full of dry grass and burn the area or goes to higher place and lit a balls of hay and roll it to the zombie bellow or other type of fire trap or tactic.