How can I build a $C^\infty$-function like this on a cube of $\mathbb{R}^m$ Build a function $f: \mathbb{R}^m \to \mathbb{R}, f\in C^\infty(\mathbb{R}^m)$, such that for a cube $C^m_\epsilon(0):=\{x|\space\epsilon>|x_i|\}\subseteq\mathbb{R^m}$. $\forall x \in C^m_\epsilon(0), f(x)\equiv 1$, and $\forall x \in\mathbb{R}^m\backslash C^m_{2\epsilon}(0), f(x)\equiv 0$. Between $\epsilon$ and $2\epsilon$, it doesn't matter how it goes.
Is there also an analytical function like this?

Let $\phi:\>t\mapsto\phi(t)$ $(-\infty<t<\infty)$ be a bump function satisfying $\phi(t)\equiv1$ for $|t|\leq\epsilon$ and $\phi(t)\equiv0$ when $|t|\geq2\epsilon$. Then
$$f(x_1,\ldots, x_m):=\prod_{k=1}^m\phi(x_k)$$
satisfies your requirements.
Such a $\phi$ can be obtained as follows: Start with
$$\psi(t):=e^{-1/t}\qquad(t>0)$$
and $:\equiv0$ otherwise. It is well known that this $\psi$ is $C^\infty$ on all of ${\mathbb R}$. It is easily checked that the function
$$\Psi(t):={\psi(t)\over\psi(t)+\psi(1-t)}\qquad(-\infty<t<\infty)$$
is $\equiv0$ when $t\leq0$, is $\equiv1$ when $t\geq1$, and is increasing  in between. Using this $\Psi$ it is not difficult to fabricate a $\phi$ as required.
All these functions are of course not analytic, since an analytic function which is constant on some open set is globally constant.
