The train doesn't reach Tossa de Mar, so you'll have to stop in Blanes. The Renfe R1 train line follows the coast and takes 1 h and 30 min to get to Blanes from Barcelona. Once there, you can take a bus from the train station to Tossa de Mar, which takes approximately 40 min.