Technically there's no reason you can't call setup() - but there's probably not any good reason to. If your setup does things that should only be done once at program start (like Serial.begin()), then it would be a really bad idea.
Putting a "return" in the loop() function won't do anything. The actual code that's generated by the IDE calls the loop() function in an infinite loop.
Here's the final coded generated for the "Blink" example program:
/*
* Blink
*
* The basic Arduino example. Turns on an LED on for one second,
* then off for one second, and so on... We use pin 13 because,
* depending on your Arduino board, it has either a built-in LED
* or a built-in resistor so that you need only an LED.
*
* http://www.arduino.cc/en/Tutorial/Blink
*/
#include "WProgram.h"
void setup();
void loop();
int ledPin = 13; // LED connected to digital pin 13
void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}
The "real" program that runs is the main() function. Note that it calls some Arduino core initialization that's not visible to the program (init()), calls your set() function, and then loops forever calling loop().
So there's no way to make the program "end". Besides, what would be the point of having a program end on a micorcontroller? If that happened the chip would just go "dead" until it got reset.
If you really want this behavior you can simply comment out the for loop in the main program template so it only calls loop() once (or change it to do something more radical like not call loop() at all):
hardware/cores/arduino/main.cxx