TM4C123GH6PM. Using this microprocessor.
Description Write four (4) ARM assembly language subroutines, called read string, output_string, uart init, and lab3. These subroutines will allow the ARM processor to receive user-entered data from PuTTy and transmit data to be displayed in PuTTy via the UART. All user input should be echoed back to the display via your program. Your program should allow the use to enter a simple mathematical expression, and then report the result after the expression is evaluated. The expression will consist of an operand, an operator, and a second operand. The operands are unsigned numbers ranging from 0 to 999. Valid operators are +, -, and /. When the user enters the expression they should hit the Enter key to indicate they have finished entering the expression. The expression should be stored as null terminated ASCII string in memory at the label expression. The user should NOT be asked how many digits will be entered for each number that is entered Presentation is important. For example, when the program starts, the user should be told what the user needs to do. When the user is prompted for data, they should be provided with instructions on what they should enter. When the quotient and remainder are reported, the results should be descriptive, describing what the user is seeing on the screen. The subroutines that need to be submitted (including those from part 1) are defined as follows uart init initializes the user UART for use. This is your version (in assembly language) of the C function serial init .output_character transmits a character from the UART to PuTTy. The character is passed in rO. . read_string reads a string entered in PuTTy and stores it as a null-terminated string in memory The user terminates the string by hitting Enter. The base address of the string should be passed . output string transmits a null-terminated string for display in PuTTy. The base address of the .read character reads a character which is received by the UART from PuTTy, returning the . lab3 is the subroutine which handles getting the user data, performing the division, and displaying into the routine in r4 string should be passed into the routine in r4 character in r0 the result. This routine is called by your C program and is your top-level assembly language routine Testing The following C program can be used to test your code. The program first initializes the UART by calling serial_init, and then calls lab3, which is the assembly language subroutine that contains your code. This code is available on the Labs page of the course website. Use the C subroutine serial init to get your program working. After your program works, replace serial_init with an assembly language routine called uart init which is simply the initialization routine written in assembly instead of C. By developing the program in this manner, you can make certain your output and read character routines work, and then concentrate on the UART initialization #include
extern int lab3 (void); void serial init (void); void serial_init(void) /*Provide clock to UARTO (*((volatile uint32-t *)(0x400FE6 18 ))) /Enable clock to PortA (*((volatile uint32_t *)(0x400FE608))) /*Disable UARTO Control |= 1; 1; ((volatile uint32_t *) (0x4000C030))0 /* Set UARTO_IBRD R for 9,600 baud */ ((volatile uint32_t *) (0x4000c024)))-104; /* Set UARTO_FBRDR for 9,600 baud * (*((volatile uint32_t *)(0x4000C028)))11; /*Use System Clock */ ((volatile uint32_t *) (0x4000CFC8))) -0 /*Use 8-bit word length, 1 stop bit, no parity ((volatile uint32_t *) (0x4000C02C)))-0x60 /*Enable UARTO Control / ((volatile uint32_t *) (0x4000co30))) 0x301 /*Make PA0 and PAl as Digital Ports*/ ((volatile uint32_t *) (0x4000451C)))-0x03; /*Change PAO,PAl to Use an Alternate Function*/ ((volatile uint32_t *) (0x40004420)))- 0x03 /*Configure PA0 and PAl for UART (*( (volatile uint32_t *)(0x4000452C)))-0x11; int main serial init) lab3(); Skeleton Code The following skeleton code can be used to get you started. It is available online on the labs page of the course website .data .global prompt .global expression prompt: .string "Your prompts are placed here",0 expression: .string "Your expression is stored here", 0 .text .global lab3 UOLSR: .equ 0x18 ;UARTO Line Status Register lab3: STMFD SP!,(1r Store register lr on stack ; Your code is placed here LDMFD sp!, (lr) mov pc, r Description Write four (4) ARM assembly language subroutines, called read string, output_string, uart init, and lab3. These subroutines will allow the ARM processor to receive user-entered data from PuTTy and transmit data to be displayed in PuTTy via the UART. All user input should be echoed back to the display via your program. Your program should allow the use to enter a simple mathematical expression, and then report the result after the expression is evaluated. The expression will consist of an operand, an operator, and a second operand. The operands are unsigned numbers ranging from 0 to 999. Valid operators are +, -, and /. When the user enters the expression they should hit the Enter key to indicate they have finished entering the expression. The expression should be stored as null terminated ASCII string in memory at the label expression. The user should NOT be asked how many digits will be entered for each number that is entered Presentation is important. For example, when the program starts, the user should be told what the user needs to do. When the user is prompted for data, they should be provided with instructions on what they should enter. When the quotient and remainder are reported, the results should be descriptive, describing what the user is seeing on the screen. The subroutines that need to be submitted (including those from part 1) are defined as follows uart init initializes the user UART for use. This is your version (in assembly language) of the C function serial init .output_character transmits a character from the UART to PuTTy. The character is passed in rO. . read_string reads a string entered in PuTTy and stores it as a null-terminated string in memory The user terminates the string by hitting Enter. The base address of the string should be passed . output string transmits a null-terminated string for display in PuTTy. The base address of the .read character reads a character which is received by the UART from PuTTy, returning the . lab3 is the subroutine which handles getting the user data, performing the division, and displaying into the routine in r4 string should be passed into the routine in r4 character in r0 the result. This routine is called by your C program and is your top-level assembly language routine Testing The following C program can be used to test your code. The program first initializes the UART by calling serial_init, and then calls lab3, which is the assembly language subroutine that contains your code. This code is available on the Labs page of the course website. Use the C subroutine serial init to get your program working. After your program works, replace serial_init with an assembly language routine called uart init which is simply the initialization routine written in assembly instead of C. By developing the program in this manner, you can make certain your output and read character routines work, and then concentrate on the UART initialization #include extern int lab3 (void); void serial init (void); void serial_init(void) /*Provide clock to UARTO (*((volatile uint32-t *)(0x400FE6 18 ))) /Enable clock to PortA (*((volatile uint32_t *)(0x400FE608))) /*Disable UARTO Control |= 1; 1; ((volatile uint32_t *) (0x4000C030))0 /* Set UARTO_IBRD R for 9,600 baud */ ((volatile uint32_t *) (0x4000c024)))-104; /* Set UARTO_FBRDR for 9,600 baud * (*((volatile uint32_t *)(0x4000C028)))11; /*Use System Clock */ ((volatile uint32_t *) (0x4000CFC8))) -0 /*Use 8-bit word length, 1 stop bit, no parity ((volatile uint32_t *) (0x4000C02C)))-0x60 /*Enable UARTO Control / ((volatile uint32_t *) (0x4000co30))) 0x301 /*Make PA0 and PAl as Digital Ports*/ ((volatile uint32_t *) (0x4000451C)))-0x03; /*Change PAO,PAl to Use an Alternate Function*/ ((volatile uint32_t *) (0x40004420)))- 0x03 /*Configure PA0 and PAl for UART (*( (volatile uint32_t *)(0x4000452C)))-0x11; int main serial init) lab3(); Skeleton Code The following skeleton code can be used to get you started. It is available online on the labs page of the course website .data .global prompt .global expression prompt: .string "Your prompts are placed here",0 expression: .string "Your expression is stored here", 0 .text .global lab3 UOLSR: .equ 0x18 ;UARTO Line Status Register lab3: STMFD SP!,(1r Store register lr on stack ; Your code is placed here LDMFD sp!, (lr) mov pc, r