It is $\sum_{n|d} \mu(n)( q^{d/n}-1)\gcd( (q^d-1)/(q^{d/n}-1), m)/\gcd(q^d-1,m)$
Because every m’th power that generates is an m’th power of a generator, it suffices to do the inclusion-exclusion for generators in the set of $m$’th powers, and this is the result.
The number of nonzero elements of a sub field that are $m$th powers is the number of elements, divided by the number of characters of order $m$, times the number of characters of order$m$ trivial on that sub field, explaining the terms in this formula.