The goals for the assignment this week:
- To gain in depth understanding of the pass-by-value nature of C.
- To gain hands on experience with the ARM Cortex-M4 assembly language.
Problems:
- Create a function that allows swapping of two pointers.
- Explain what the main function does to the CSTACK in order setup the input arguments prior to calling the swap_pointer() function?
- And what are the values in R0 & R1 when swap_pointer() is called?
- Share a screen shot of the local variables inside of main after the function swap_pointer() returns, showing the values of the pointers and what they are pointing to, similar to the picture below:
- Run sqrAsm code from the class demo:
- Copy HelloWorld from Assignment 1.
- Download the file s and copy it to the project directory.
- In IAR, add sqrAsm.s file to your project. Now you should be able to see the file from the Workspace Window.
- Modify main.c to call sqrAsm function.
- Run your program on the board, and capture a snapshot image of the output from TeraTerm.
- Create a new file s and add the file to the same HelloWorld project above.
- Write the assembly code to take an input argument, divide it by 2, and return the result.
- Invoke the function PrintString from within divAsm before doing the division computation.
- Add a comment for every statement in your assembly function code.
- In the main.c, invoke dev2Asm(foo) and capture the screen output from TeraTerm.
- Implement a swap function in assembly and call it swapCharsAsm:
- It takes as input two variables of char data type and swaps the two chars
- Add a comment for every statement in your assembly function code.
- Bonus: Returns 0 if the two chars are identical; otherwise, return 1.
- Bonus: Implement the swap_pointer() function from #1 above in assembly and call it swapPointersAsm().
- Add a comment for every statement in your assembly function code.
- Take a snap shot of the output after invoking the swapPointerAsm() subroutine.

![[Solved] EMBSYS100 Module 6- pass-by-value nature of C](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[Solved] EMBSYS100 Module 5- bit-banding region](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.