How to configure the SPI pins(MOSI,MISO,sclk and SS) for ATMEL ATSAM3X8E?
You use the DDRx register to define the direction of a pin (Data Direction Register).  x is the name of the port you are using.  Set the relevant bit to 1 for an output, and 0 for an input.
Does your mouse have Windows installed on it? No. The same with microcontrollers. They only need the code on them to perform their own task. Why would the slave need the software that runs on the master?
SPI is an incredibly simple protocol.  The main thing to remember with it is it's full duplex and synchronous.  If the slave needs to send data to the master then it is up to the master to request that data - the slave can't just send data at will to the master.  Making sure the slave can respond to the SS signal fast enough is also important - you don't want to miss the first bit of the first byte coming in.