Here is another short construction which is much simpler and just takes a few lines. 1. Let $M$ be a closed $n$-manifold. Consider the diagonal $M \to M \times M$. It is an embedding. Take its Pontryagin-Thom construction to get a map $$ M_+ \wedge M_+ \to M^\tau $$ (we have identified a tubular neighborhood of the diagonal with the total space of the tangent bundle). 2. If $M$ is (stably) framed, then $M^\tau \simeq M_+ \wedge S^n$ (stably). Then we have the map $M_+ \wedge S^n \to S^n$ induced by smashing $M_+ \to \text{pt}_+$ with $S^n$. 3. The composition $$ M_+ \wedge M_+ \to M^\tau \simeq M_+ \wedge S^n \to S^n $$ is what you want: it's a duality map. This can be seen on the level of homology (but it is enough to check a map is a duality map on the level of homology). 4. If $M$ is compact with non-empty boundary $\partial M$, then there is a map of pairs $$ (M\times M, M\times \partial M) \to (M\times M,M\times M - U) $$ where $U$ is a tubular neighborhood of the diagonal. To get this map, one might choose a collar neighborhood $C$ of $\partial M$ and thereafter identify $M$ with $M-C$. Then $M-C $ and $\partial M$ are disjoint. The map of pairs determines a map of quotients $$ M_+ \wedge M/\partial M \to M^\tau \, , $$ and one then proceed as in the empty boundary case, assuming that $M$ is framed, to obtain a map $$ M_+ \wedge M/\partial M \to S^n $$ which will be an $S$-duality.