Uoc LogoΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ
ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ

CS428 - Embedded Systems Lab
Ενότητα: 1 
Άγγελος Μπίλας
Τμήμα Επιστήμης Υπολογιστών






The goal of this assignment is to help you become familiar with the lego nxt platform and the tools for programming the ARM processors under unix.

1. Get a lego kit from the lab!

For this assignment you will need the lego nxt controller, the light sensor, the charger for the controller battery, and a usb cable. Details on the procedure you need to follow for getting access to these will be given in class.

Create a file as1_readme.txt that will contain the answers to questions below.

2. Experiment with the kit

Read the following introductory lego documentation:
The kit is currently running the original firmware. Charge the battery, turn it on, and experiment with the menus and sensors. This is the only time you can expertiment with the default/original firmware. In the steps below you will replace it with custom firmware and you will not be able to re-use the original one (unless you re-load it).

Answer the following questions
2.1 How many processors are there in the controller. What architecture (ISA) and speed supports each processor? 
2.2 What type of memory and how much of each type is accessible by each processor?
2.3 What sensors come with the kit? To which processor can each sensor be connected?
2.4 Why do some of the sensors connect on one and not the other processor?

3. Install the unix toolchain

For this (and most subsequent) assignments you will need a system running Linux. Many flavors (and kernel versions) will work, but the assignments (the toolchain mostly) have been tested with Ubuntu. You may use the systems that are already setup for this purposes in the lab (Γ020).
 
Copy the file ~hy428/files/toolchain.tar.gz in your home account and unpack it. This directory tree contains the utitlities needed for compiling and downloading code (firmware) to the lego NXT.The toolchain is self-contained and you should not need any files outside this directory.

4. Build a very simple first firmware

Copy the file ~hy428/files/as1_helloworld.tar.gz to your home account and unpack it. This directory tree contains the skeleton of a very simple firmware program. 

To build the firmware:
- Go to the as1_helloworld directory
- Edit the Makefile and change the "PREFIX" variable to point to the directory of the toolchain in your account
- make clean; make

Answer the following questions
4.1 In which file is the main function?
4.2 In which directory(ies) are located the .h files used by the firmware .c files?
4.3 Which path(s) does gcc use for locating each type of file? (use --print-search-paths)
4.4 What are the targets in the Makefile? What does each target do?

5. Download the new firmware

To download the firmware:
- Connect the controller to the usb port.
- The controller has a hidden button under the usb port. Use a pin to press this button for 3 seconds. Wait for 5 more seconds (or so). You will hear a characteristic periodic beep sound.
- Type "make download"
- You should get a message that the firmware was downloaded succesfully and is running. A fairly useless firmware is now running!

Answer the following questions
5.1 On which processor is this firmware downloaded? What is running on the other processor?
5.2 Can you turn off the controller using the original on/off button? Yes or no and why?

6. Your first firmware

6.1 Modify the firmware to display "Hello World!" 100 times.You will need to examine the code for the display, to figure out which functions to use and how.
6.2 Modify your firmware to display "Hello World!" and blink at about 1sec intervals. Write a function that delays for about 1ms and then use this.
6.3 Move your helloworld function in a separate helloworld.c file and modify the Makefile accordingly.
6.4 Make the led of the light sensor blink before and after the "Hello World!" message is displayed, using the provided led.h module.

Answer the following questions
6.4 What happens when main returns?
6.5 What happens if you press the orange button while your firmware is running? Explain briefly.
6.6 What happens if you press the orange button after your firmware has stopped running? Explain briefly.
6.7 (optional) In your delay function, you use some counting variable. What happens if you declare this to be volatile? Explain briefly.

7. Submit

Submit the as1_answers.txt file with all your answers and the files of your final firmware. Also, follow the procedure outlined in class for returning the components you used in this assignment. Use the submit procedure in the Policies section.

Άδειες Χρήσης
 •Το παρόν εκπαιδευτικό υλικό υπόκειται στην άδεια χρήσης Creative Commons και
ειδικότερα
Αναφορά - Μη εμπορική Χρήση - Όχι Παράγωγο Έργο 3.0 Ελλάδα
(Attribution - Non Commercial - Non-derivatives 3.0 Greece) 

•Εξαιρείται από την ως άνω άδεια υλικό που περιλαμβάνεται στις διαφάνειες
του μαθήματος, και υπόκειται σε άλλου τύπου άδεια χρήσης. Η άδεια χρήσης
στην οποία υπόκειται το υλικό αυτό αναφέρεται ρητώς.

Χρηματοδότηση
•Το παρόν εκπαιδευτικό υλικό έχει αναπτυχθεί στα πλαίσια του εκπαιδευτικού έργου του διδάσκοντα.
•Το έργο «Ανοικτά Ακαδημαϊκά Μαθήματα στο Πανεπιστήμιο Κρήτης» έχει χρηματοδοτήσει μόνο τη αναδιαμόρφωση του εκπαιδευτικού υλικού. 
•Το έργο υλοποιείται στο πλαίσιο του Επιχειρησιακού Προγράμματος «Εκπαίδευση και Δια Βίου Μάθηση» και συγχρηματοδοτείται από την Ευρωπαϊκή Ένωση (Ευρωπαϊκό Κοινωνικό Ταμείο) και από εθνικούς πόρους.


espa

Last modified: Friday, 10 July 2015, 1:50 PM