EMBSYS100 Module 2- IAR IDE and the different debug views Solved

30.00 $ 15.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment

Description

Rate this product

The goals for the assignment this week:

  1. To explore the IAR IDE and the different debug views.
  2. Get a better understanding of machine instructions, addresses, variables and pointers.

Setup:

  1. Create a new project in IAR following the steps from the slide deck
  2. Create a counter local variable and increment the counter several times.
  3. Run the program in the simulator environment and answer the following questions:

Observe and answer:

  1. Inject 0x1FFFFFFF for the “counter” value in the variable window, then step thru the program only once to increment “counter”.
    1. What is the value of the “counter” from the “Locals” window?
    2. What is the value of the “counter” in the “Register” window?
    3. Which flags are set in the APSR register? Explain why?
  1. If your write all Fs (0XFFFFFFFF) in the Register value for “counter” then step thru the program once to increment “counter”
    1. What happens to the value of “counter” in the “Locals” window?
    2. What flags, if any, are set in the APSR?
  1. Change the “counter” variable type in your code to “unsigned”. Inject the values “0x1FFFFFFF” then step thru the program to increment the “counter” once:
    1. What is the value of “counter” in the “Locals” window after incrementing for each value?
    2. What flags, if any, are set in the APSR? Explain why?
  1. Change the “counter” variable type in your code to “unsigned”. Inject the values “0xFFFFFFFF” then step thru the program to increment the “counter” once:
    1. What is the value of “counter” in the “Locals” window after incrementing for each value?
    2. What flags, if any, are set in the APSR? Explain why?
  1. Move the “counter’ variable outside of main (at the top of the file):
    1. What is the scope of the variable “counter”?
    2. Is it still visible in the “Locals” view?
    3. In which window view can we track “counter” now?
    4. What is the address of the “counter” variable in memory?
  2. Change the source code to the following, then run the program still in the simulator:
int counter = 0x0; int main() {

int *p_int = (int *)0x20000000;

++(*p_int);

++(*p_int); ++(*p_int); counter ++;

return 0;

}

 

  1. What is the value of “counter” at the end of the program (halting at the return 0 statement)
  2. Explain why the counter value has changed?
  3. Change the setting of IAR to run the same program on the evaluation board:
Setup:

1.       Connect evaluation board to your computer through ST Link cable.

2.       Set the IAR to using STLink:

3.       Project -> Options -> Debugger -> Device: ST-Link

4.       Download setting is flash loader

5.       Make sure ST-Link Interface is set to SWD 6. Run the same code described in the simulator.

 

 

  1. What is the address where “counter” is stored?
  2. Is the “counter” variable stored in RAM or ROM?
  3. What is the value of “counter” at the end of the program (halting at the return 0 statement).

 

  • module02-5qiqyf.zip