EE458 - Real Time Programming HW 2 References: RTC Chapter 2

advertisement
EE458 - Real Time Programming
HW 2
References:
RTC Chapter 2
RTC Chapter 3
C stdio man pages
Please type all responses. Hand written work will not be accepted.
1. In contrast to cross-platform development, applications that execute in the same environment
as that used for development is known as ______________________________.
2. Use the i386-rtems4.9-readelf command with the “-a” option to display information about
the test.o object file created in the hello_world_c example program. How many sections are
present? How many symbols are contained in the “.symtab” symbol table?
3. Use the i386-rtems4.9-readelf command with the “-a” option to display information about
the hello.exe object file created in the hello_world_c example program. How many sections
are present? How many symbols are contained in the “.symtab” symbol table?
4. Write a printf or scanf statement for each of the following:
(a)Print an unsigned integer left justified in a 15-digit field with 8 digits.
(b)Read a hexadecimal value in variable hex.
(c)Print 200 with and without a sign.
(d)Read a string of the form “characters” from the standard input. Store the string in
character array s. Eliminate the quotation marks from the input stream.
(e)Read a time of the hh:mm:ss storing the parts of the time in the integer variables hour,
minute, and second. Skip the colons (:) in the input stream.
5. Write an RTEMS application that converts integer Fahrenheit temperatures from 0 to 212
degrees to floating-point Celsius temperatures with 3 digits of precision. Use only stdio
routines. Use the formula
celsius = 5.0 / 9.0 * (fahrenheit – 32);
to perform the calculation. Print both values in two right-justified columns of 10 characters
each. The Celsius temperature should be preceded by a sign for both positive and negative
values. The program should operate in loop, prompting for new input until a non-integer is
input. (You can use the return value from scanf to detect this.) Submit a hardcopy of your
source code.
Note: You must add the lines
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
at the bottom of the source code file (before the “#include <rtems/confdefs.h>” line) for the
stdio input routines to work. Without it the application will hang.
1-1
6. We use GRUB to load and start our RTEMS applications. Does GRUB best fit the definition
of an embedded loader, an embedded monitor, or a target debug agent?
7. In which type of memory (ROM or RAM) can a .text section by stored? The .data section?
The .bss section? The .const section? The stack?
8. What are OCD and JTAG?
9. Briefly describe each of the steps in the software initialization process (Figure 3.7).
10.Write code that clears the PC screen and then displays “Hello world!” in the middle of the
screen. The code should work directly with PC text memory and not use any stdio routines.
1-2
Download