Embedded Linux – Getting started

Create a simple program, compile and run on the target:

  • Create a new directory ~/test1
  • Create a new source file ex1.c – print simple hello world
  • compile using ARM toolchain:
# arm-none-linux-gnueabi-gcc -o app1 ./ex1.c
  • Copy the application to the target folder:
# cp ./app ~/armsystem/outfs
  • run the qemu emulator:
# cd ~/armsystem
# sudo ./run_qemu

The password for developer is 12345

In the emulator shell run the application:

# cd /
# ./app

 

Task 2

 

  1. Write a program to emulate the behaviour of the Unix cat command as follows:If no command line arguments are given, the program should write its standard input to its standard output. If arguments are given, then treat them as filenames and copy the contents of each in turn to standard output.

     

  2. You will notice that if you give a directory name as an argument to your program for question 1, then an error will occur or garbage will be displayed (the exact symptoms differs between operating systems).Modify your program from question 1 so that it detects the fact that a directory has been chosen, and report a suitable error message to the user.
Task 3
  • Write a function void print_dbg(char *msg, int size, int sev) . It should print the message to the standard error if the severity type is bigger than the configured
    The configuration is based on an environment variable – MYDEBUG

 

  • To set the variable : #export MYDEBUG 2