1. Create a new project by selecting New Project from the Project menu. This will open the Project Wizard.

  2. Select C/C++GCC C Executable Project as a template, then specify a project name, select a location and write a solution name for the project. Some startup files will be added to the project by default, which will contain some device specific functions and libraries. Press OK when you are satisfied with the settings.

  3. Select C/C++GCC C Static Library Project as a template, then specify a project name, select a location and write a solution name for the project. This creates a Static Library (LIB) project which is a good way to reuse code.

    Tip

    See the section Static Library Project to know more about Static Library projects.

  4. A device selection table will appear. Choose the device family as SAM3 or SAM4 and select the target platform for your project, to start you can select the ATSAM3S1A device.

  5. The project tree will be set up. Notice that the initial files created in step 2 has been added to the project node. Also, the file containing main() function will be opened in the editor.

    Following are the list of files that will be created,

  6. In order to facilitate applications development and verification you can also use the Driver Selection Wizard, invoked from Project ASF Wizard.

    In the ASF Wizard you can select which Drivers, Components, and Services you would like to use in the project for current build architecture and board.

  7. Now, write the following code into the open editor window

    #define MAXINT 200000
    
    int main(void) 
    {
        unsigned int t=1000, k=0, l=5, pn=2; 
        unsigned int primes[t];
        primes[0]=2;
        primes[1]=3;
    
        while (pn < t || primes[pn] < MAXINT)
        {
            for ( k = 0; k <= pn; k++)
            {
                if (l % primes[k] == 0)
    			{
                    goto otog;
    			}
                else 
                {
                    if (k == pn)
                        primes[pn++]=l;
                } 
            }
    otog:
            l += 2;
        }
        return 0;
    }
  8. Build the project