1 / 12

Mixed C and Assembly

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

grayd
Download Presentation

Mixed C and Assembly

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mixed C and Assembly By Justin Kim

  2. 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

  3. Set-up • Create a New Project named MixedC and a c-file titled MixedC.c (Refer to the Blink Lab Instructions from the EE-347 website.) • Go to the EE-346 website and download AmazingLab, LabC, and sketch_shiftOut_16bit. Extract the following documents from the respected files: • AmazingLab  spi.inc • LabC  m328Pdef.h • sketch_shiftOut_16bit  sketch_shiftOut_16bit.c • Change the spi.inc document to a .S file (spi.S) and move to the MixedC Project File. Move the m328Pdef.h to the MixedC Project File as well. Copy the code from the sketch_shiftOut_16bit.c document and paste it into the MixedC.c document. • Add all header files and .c files from C:\arduino-0015\hardware\cores\arduino to the MixedC Project File.

  4. 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.

  5. 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.

  6. Original Code New Code Changes to the C Code

  7. Changes to the C Code Original Code New Code *Comment out shiftOut and blinkAll entirely

  8. Changes to the C Code Original Code New Code

  9. Changes to the Assembly Code Original Code New Code

  10. Changes to the Assembly Code Original Code New Code

  11. Improvements • Minimize spiTx • Incorporate blinkAll • Pass Parameter from Assembly to C:

  12. References • EE-346 website – Labs and References http://www.cecs.csulb.edu/~hill/ee346/ • EE-347 website – Labs and References http://www.cecs.csulb.edu/~hill/ee347/ • 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%20C%20and%20assembly%20language%20programs.pdf

More Related