Weight distribution of a class of cyclic codes of length $2^n$