Question: MUST USE STM32CubeIDE using board STM32F401RET6. Modify the main body of your project, main.s, such that it performs the following mathematical operation. a. Using the

MUST USE STM32CubeIDE using board STM32F401RET6.

Modify the main body of your project, main.s, such that it performs the following mathematical operation.

a. Using the last 6 digits of your student ID number, load the first two digits to register 1, the next two digits to register 2, the last two digits to register 3. For example, if the last 6 digits of your student ID are 930582, then your three registers will store as follows: 1 = 93, 2 = 05 and 3 = 82.

b. Using the three register values, write a series of mathematical operations in assembly code which result will be the last 6 digits of your student ID number, saved in register 0. - Using the example digits from part a, this means that after all the operations the content of register 0 will be 0 = 930582. - You are explicitly prohibited from manually assigning your student ID number to register 0. - You may use the additional registers available to have additional values needed in your mathematical operation.

Code that must be modified.

.syntax unified .cpu cortex-m4 .fpu softvfp .thumb

.section .text .align .global main

/** *============================================================================ * main() * @param None * @return None * * @brief * Compute required equation and hold in infinite loop when done. * Notice how we target the operations in parenthesis first when * computing a complex math expression. *============================================================================ */ main:

//-- initialize variables ------------------------------------------------- mov r1, #12 mov r2, #3 mov r3, #4 mov r4, #5

//-- evaluate equation ---------------------------------------------------- mov r0, #3 // r0 = 3 mul r0, r0, r4 // r0 = (3 * r4) add r0, r0, r1 // r0 = (3 * r4) + r1 sub r0, r0, r2 // r0 = (3 * r4) + r1 - r2 add r0, r0, r3 // r0 = (3 * r4) + r1 - r2 + r3

forever: b forever

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!