Mixed C and Assembly By Justin Kim Mixed
Mixed C and Assembly By Justin Kim
Mixed C and Assembly • Set-up – Create Project and Gather Essential Files • Strategy and Method – Assigning Tasks and How to Mix Languages • Implementation – Apply Methods to the Serial to Parallel Lab • Improvements – Minimize Code and Include Other Capabilities
Set-up • Create a New Project named Mixed. C and a c-file titled Mixed. C. c (Refer to the Blink Lab Instructions from the EE-347 website. ) • Go to the EE-346 website and download Amazing. Lab, Lab. C, and sketch_shift. Out_16 bit. Extract the following documents from the respected files: – Amazing. Lab – Lab. C – sketch_shift. Out_16 bit spi. inc m 328 Pdef. h sketch_shift. Out_16 bit. c • Change the spi. inc document to a. S file (spi. S) and move to the Mixed. C Project File. Move the m 328 Pdef. h to the Mixed. C Project File as well. Copy the code from the sketch_shift. Out_16 bit. c document and paste it into the Mixed. C. c document. • Add all header files and. c files from C: arduino-0015hardwarecoresarduino to the Mixed. C Project File.
Strategy and Method • Determine the operations needed • Understand the strengths of each language • Figure out how to execute goals with each language • Divide the tasks between the C functions and the assembly subroutines. • Learn to globalize subroutines, use proper syntax for the specific compiler, and pass parameters between each language.
Implementation • Imitate the Serial to Parallel Lab by Mixing C and Assembly • Learn the GCC syntax • Use C as the main program and Assembly to send the information to the displays • Globalize the subroutines, use correct syntax, and pass a parameter (a byte) from C to Assembly using mask and register 24 • Delete or Comment out any unnecessary code.
Changes to the C Code Original Code New Code
Changes to the C Code Original Code New Code *Comment out shift. Out and blink. All entirely
Changes to the C Code Original Code New Code
Changes to the Assembly Code Original Code New Code
Changes to the Assembly Code Original Code New Code
Improvements • Minimize spi. Tx • Incorporate blink. All • Pass Parameter from Assembly to C:
References • EE-346 website – Labs and References http: //www. cecs. csulb. edu/~hill/ee 346/ • EE-347 website – Labs and References http: //www. cecs. csulb. edu/~hill/ee 347/ • Equate Statement Syntax http: //www. experts-exchange. com/Programming/Languages/Assembly/Q_23559266. html • Examples of Mixed C and Assembly http: //people. msoe. edu/~barnicks/courses/CE 2800/documents/Mixing%20 C%20 and%20 assembly%20 language%20 programs. pdf
- Slides: 12