[SOLVED] COMP8049 -Lab 1 Solution

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

3/5 - (2 votes)

Embedded Systems

Engineering  – Labs

Q1

Write a c program which  reads in a text file and finds all the identifiers in the file. An identifier is a token (sequence of characters)  that starts with an underscore or a letter and continues with underscores or letters or digits.

You are to sort all the identifiers in the input text file and output them in alphabetical order.

Q2

Create a model for the traffic light simulation and state machine that is detailed in section 10.4 of the traffic-light-simulator.pdf  also here

http://users.ece.utexas.edu/~valvano/Volume1/E-Book/ C10_FiniteStateMachines.htm

This model is a c program that runs on your laptop in Linux. You can use the code in traffic-model.c. You can then emulate a button press by simple key presses on the keyboard. For example:-

  1. enter the letter N to indicate that the North button is on.
  2. enter the letter E to indicate that the East button is on.
  3. enter the letter B to indicate that both buttons are on.
  4. any other key to indicate that both buttons are off

Q3

Using your code in Q2 build a traffic light controller model and simulation that is cross compiled for an ARM based SOC.

You can use the qemu-system-arm emulator https://wiki.qemu.org/Documentation/Platforms/ARM.

  • | P a g e

See here for steps to build a binary for the qemu emulated versatilepb board.

https://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-usingqemu/

See emulating-arm-pl011-serial-ports.pdf for an example which emulates the serial communications to the qemu emulated versatilepb board. https://balau82.wordpress.com/2010/11/30/emulating-arm-pl011-serial-ports/

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.