EE109 – Fall 2017 Introduction to Embedded Systems

EE109 – Fall 2017: Introduction to Embedded Systems

Project Setup

Be sure you have all the tools installed (more info available here)

One time setup (both Mac and Windows)

  1. On your Desktop create a folder "ee109"
  2. In that "ee109" folder download the Makefile from the website. This will serve as a template that you can copy into any new project you create and just edit a bit.

Setup per example/project

  1. Start a terminal (search for Terminal in Mac Finder or "cmd" in Windows) or command window (for both Mac and Windows the terminal/command window will start in your top-level user folder). Mac users can drag the Terminal icon to the application launcher bar so it is permanently available.
  2. Go to your ee109 folder on the desktop by using commands in the terminal/command window:
        $ cd Desktop/ee109
    
  3. Create a new folder with the project name for your new example/project: Do NOT use spaces or capital letters ... use names like (ex1, proj2, button_test, etc.)
        $ mkdir proj2  (or whatever name you choose)
    
  4. Copy the Makefile into your project_folder.
        $ cp  Makefile  proj2   (replace proj2 with whatever name you chose)
    
  5. Now you can change directory into the project_folder by typing:
        $ cd proj2  (or whatever name you chose)
    
  6. Create a new text file (using BBEdit (Mac) or Notepad++ (Windows)) and write your C code and save the file with a .c extension (i.e. main.c or example.c) in the project folder you created (i.e. Desktop/ee109/project_folder).
  7. Use your text editor to open and edit the "Makefile" in your project folder (not the one in your ee109 folder). Find the line near the top that says OBJECTS=demo.o and change demo.o to ex1.o or proj2.o or whatever prefix you've chosen (don't change it to ex1.c or proj2.c ... leave the .o extension.)
  8. Save the Makefile.
  9. At the terminal/command prompt list the files in your directory:
        $ ls
    

    Make sure you see your .c file and the Makefile (make sure it isn't name Makefile.txt or anything different like that.)

  10. At the terminal/command prompt compile your program by typing:
        $ make
    

    Fix any compile errors.

  11. Once you compile, do another listing and make sure a .hex file exists.
        $ ls    (look for a .hex file in the files that are printed)
    
  12. Connect your Arduino via USB. (Windows users may need to edit and save your Makefile again to make sure the COM port listed in the Makefile is set with the correct value that your computer assigned to the Arduino.)
  13. Download the code to your Arduino.
        $ make flash
    
  14. Inspect your results on the Arduino board. Make modifications to your code if need be, but be sure to recompile using "make" and redownload using "make flash".