Question: Assume that you have an ARM Cortex M processor, with the instruction set as done in the class. Use the bit - banding feature of

Assume that you have an ARM Cortex M processor, with the instruction set as done in the class. Use the bit-banding feature of ARM Cortex M processor and create a two functional routines for doing the SPI read and SPI write. Assume that each bit-banding bit is an IO (input or output) of the chip (like a general purpose IO [gpio]).
Name the two functional routines as :
1. cm_spi_write(uint8 address, uint16 data) ; //master write to an address which is 8bits wide (uint8) a data value which is 16bits wide (uint16).
2. uint16 cm_spi_read(uint8 address) ; //read a uint1616bit data from the slave using an 8bit address
A. Write the functions in C routine as you would normally do to maintain a processor independent code
B. Convert your C routine to Assembly using Compiler techniques. You can also use your intuition, to ensure that the C code and assembly should be equivalent in functionality
C. Assume each instruction takes 1 processor clock cycle, how many clock cycles does it take to do (a) write function (b) read function

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 Programming Questions!