build tools makefiles
play

Build Tools + Makefiles 2 Lab Schedule AcDviDes - PowerPoint PPT Presentation

Computer Systems and Networks ECPE 170 Jeff Shafer University of the Pacific Build Tools + Makefiles 2 Lab Schedule AcDviDes


  1. ì ¡ Computer ¡Systems ¡and ¡Networks ¡ ECPE ¡170 ¡– ¡Jeff ¡Shafer ¡– ¡University ¡of ¡the ¡Pacific ¡ Build ¡Tools ¡ ¡ + ¡Makefiles ¡

  2. 2 ¡ Lab ¡Schedule ¡ AcDviDes ¡ Deadlines ¡ ì This ¡Week ¡ ì Lab ¡3 ¡– ¡Sept ¡14 th ¡2015 ¡ ¡ by ¡5am ¡ Intro ¡to ¡C ¡ ì Intro ¡to ¡Build ¡Tools ¡and ¡ ì ì Lab ¡4 ¡– ¡Sept ¡28 th ¡2015 ¡ ¡ Makefiles ¡ by ¡5am ¡ Lab ¡3 ¡– ¡Build ¡Tools ¡ ì ì Next ¡Week ¡ Lab ¡4 ¡– ¡C ¡Programming ¡ ì Project ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  3. 3 ¡ Person ¡of ¡the ¡Day: ¡Dr. ¡Grace ¡M. ¡Hopper ¡ Ph.D, ¡MathemaDcs, ¡Yale, ¡1934 ¡ ì Enlisted ¡US ¡Navy ¡during ¡WWII ¡ ì Early ¡programmer ¡of ¡Harvard ¡ ì Mark ¡I ¡computer ¡ Developer ¡of ¡ first ¡compiler ¡ ì COBOL ¡designer ¡ ì Caught ¡the ¡first ¡computer ¡ ì “bug” ¡ Rear ¡Admiral, ¡USN ¡ ì Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  4. 4 ¡ Grace ¡Hopper ¡-­‑ ¡ Harvard ¡Mark ¡I ¡(1944) ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  5. 5 ¡ Grace ¡Hopper ¡-­‑ ¡ Harvard ¡Mark ¡I ¡(1944) ¡ ì Electro-­‑mechanical ¡ computer ¡ ì 51 ¡feet ¡long, ¡8 ¡feet ¡high ¡ ì 10,000 ¡pounds ¡ ì Punch ¡tape ¡program ¡ input ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  6. 6 ¡ Grace ¡Hopper ¡– ¡ Computer ¡Bug ¡(1947) ¡ Moth ¡found ¡trapped ¡between ¡ points ¡at ¡Relay ¡# ¡70, ¡Panel ¡F, ¡of ¡ the ¡Mark ¡II ¡Aiken ¡Relay ¡ Calculator ¡while ¡it ¡was ¡being ¡ tested ¡at ¡Harvard ¡University. ¡ The ¡operators ¡affixed ¡the ¡moth ¡ to ¡the ¡computer ¡log ¡and ¡put ¡out ¡ the ¡word ¡that ¡they ¡had ¡ "debugged" ¡the ¡machine. ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  7. 7 ¡ Grace ¡Hopper ¡-­‑ ¡ A-­‑0 ¡Compiler ¡(1951) ¡ ì First ¡compiler ¡ever ¡wriben ¡ for ¡electronic ¡computer ¡ UNIVAC ¡1 ¡computer ¡ ì ì Write ¡your ¡code ¡as ¡a ¡ collecDon ¡of ¡subrouDnes ¡ ì A-­‑0 ¡compiler ¡combined ¡the ¡ subrouDnes ¡into ¡one ¡ machine ¡code ¡program ¡ More ¡like ¡a ¡“linker” ¡today… ¡ ì Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  8. 8 ¡ Grace ¡Hopper ¡– ¡ COBOL ¡Language ¡(1959) ¡ Tribute: ¡ ¡ Google ¡Doodle ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  9. 9 ¡ Tribute: ¡Cray ¡XE6 ¡ “Hopper” ¡at ¡NERSC ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  10. 10 ¡ Person ¡of ¡the ¡Day: ¡Richard ¡Stallman ¡ Founder ¡of ¡ ì GNU ¡project ¡– ¡“GNU’s ¡not ¡Unix” ¡ ì Free ¡Sokware ¡FoundaDon ¡ ¡ ì Author ¡ ì GNU ¡C ¡Compiler ¡(GCC) ¡ ì Emacs ¡text ¡editor ¡ ì GNU ¡Manifesto ¡ ì Freedom ¡to ¡run ¡a ¡program ¡for ¡any ¡purpose ¡ 1. Freedom ¡to ¡study ¡the ¡mechanics ¡of ¡the ¡ 2. program ¡and ¡modify ¡it ¡ Freedom ¡to ¡redistribute ¡copies ¡ 3. Freedom ¡to ¡improve ¡and ¡change ¡modified ¡ 4. versions ¡for ¡public ¡use ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  11. 11 ¡ Person ¡of ¡the ¡Day: ¡Richard ¡Stallman ¡ “Steve ¡Jobs, ¡the ¡pioneer ¡of ¡the ¡computer ¡as ¡a ¡ ì jail ¡made ¡cool, ¡designed ¡to ¡sever ¡fools ¡from ¡ their ¡freedom, ¡has ¡died. ¡ ¡ ¡ As ¡Chicago ¡Mayor ¡Harold ¡Washington ¡said ¡of ¡ the ¡corrupt ¡former ¡Mayor ¡Daley, ¡"I'm ¡not ¡glad ¡ he's ¡dead, ¡but ¡I'm ¡glad ¡he's ¡gone." ¡Nobody ¡ deserves ¡to ¡have ¡to ¡die ¡— ¡not ¡Jobs, ¡not ¡Mr. ¡ Bill, ¡not ¡even ¡people ¡guilty ¡of ¡bigger ¡evils ¡than ¡ theirs. ¡But ¡we ¡all ¡deserve ¡the ¡end ¡of ¡Jobs' ¡ malign ¡influence ¡on ¡people's ¡compuDng. ¡ ¡ ¡ Unfortunately, ¡that ¡influence ¡conDnues ¡ despite ¡his ¡absence. ¡We ¡can ¡only ¡hope ¡his ¡ successors, ¡as ¡they ¡abempt ¡to ¡carry ¡on ¡his ¡ legacy, ¡will ¡be ¡less ¡effecDve.” ¡ Richard ¡Stallman, ¡10/6/2011 ¡ ì Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  12. 12 ¡ ì ¡ Toolchain ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  13. 13 ¡ #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; } unix> ./program hello, world Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  14. 14 ¡ Behind ¡the ¡Scenes ¡ ì MoMvaMng ¡QuesMon ¡ ì What ¡really ¡happens ¡between ¡typing ¡in ¡the ¡“Hello ¡ Word” ¡program, ¡and ¡seeing ¡the ¡output ¡on ¡the ¡ console? ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  15. 15 ¡ Pre-­‑Processor ¡ Think ¡of ¡this ¡as ¡a ¡“find ¡and ¡replace” ¡wizard ¡for ¡your ¡source ¡code ¡ ¡ ì Include ¡header ¡files ¡ ì Literally ¡insert ¡.h ¡file ¡lines ¡into ¡.c ¡file ¡ ì Macro ¡expansion ¡ ì Macro ¡= ¡fragment ¡of ¡C ¡code ¡ ì ì #define IS_POSITIVE( _x ) ( _x > 0 ) Preprocessor ¡replaces ¡macro ¡with ¡original ¡definiDon ¡in ¡source ¡code ¡ ì CondiMonal ¡compilaMon ¡ ì Include ¡or ¡exclude ¡parts ¡of ¡the ¡program ¡ ì ì #ifdef CONTROL Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  16. 16 ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  17. 17 ¡ Compiler ¡ ì Basic ¡goal ¡ Input: ¡ High-­‑level ¡language ¡source ¡code ¡ ì Output: ¡ Machine ¡code ¡ for ¡processor ¡family ¡ ì ì 6 ¡steps ¡to ¡accomplish ¡transformaDon ¡ ì Steps ¡1-­‑3 ¡– ¡source ¡code ¡analysis: ¡ Lexical ¡analysis ¡ extracts ¡tokens, ¡e.g., ¡reserved ¡words ¡and ¡ 1. variables ¡ Syntax ¡analysis ¡ (parsing) ¡checks ¡statement ¡construcDon ¡ 2. SemanMc ¡analysis ¡ checks ¡data ¡types ¡and ¡the ¡validity ¡of ¡ 3. operators ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  18. 18 ¡ Compiler ¡Operation ¡ ì Steps ¡4-­‑6 ¡– ¡ Synthesis ¡phases: ¡ Intermediate ¡code ¡generaMon ¡ creates ¡three ¡address ¡code ¡ 4. (“fake ¡assembly ¡code”) ¡to ¡facilitate ¡opDmizaDon ¡and ¡ translaDon ¡ OpMmizaMon ¡creates ¡(real) ¡assembly ¡code ¡while ¡taking ¡ 5. into ¡account ¡architectural ¡features ¡that ¡can ¡make ¡the ¡ code ¡efficient ¡ Code ¡generaMon ¡ creates ¡binary ¡code ¡from ¡the ¡opDmized ¡ 6. assembly ¡code ¡ ì We ¡write ¡these ¡steps ¡as ¡separate ¡modules ¡ Benefit: ¡Compilers ¡can ¡be ¡wriben ¡for ¡various ¡CPU ¡ ì architectures ¡by ¡rewriDng ¡only ¡the ¡last ¡two ¡modules ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  19. 19 ¡ Compiler ¡Operation ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  20. 20 ¡ Why ¡So ¡Many ¡Compilation ¡Steps? ¡ We ¡don’t ¡ just ¡care ¡about ¡1 ¡language ¡or ¡1 ¡processor ¡family! ¡ C ¡ x86 ¡ C++ ¡ x86-­‑64 ¡ ObjecDve-­‑C ¡ ARM ¡ GNU ¡Compiler ¡ CollecDon ¡ Fortran ¡ PowerPC ¡ Ada ¡ 68000 ¡ Others… ¡ MIPS ¡ (and ¡many ¡more!) ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

  21. 21 ¡ Linker ¡ ì Real ¡programs ¡are ¡typically ¡wriben ¡with ¡ mulMple ¡ source ¡files ¡ and ¡many ¡subrouDnes ¡ ì Each ¡file ¡is ¡compiled ¡separately ¡ ì But ¡we ¡need ¡some ¡way ¡to ¡join ¡everything ¡together ¡ into ¡a ¡single ¡executable ¡file ¡ ì This ¡is ¡the ¡job ¡of ¡the ¡ linker ¡ (aka ¡“link ¡editor”) ¡ ì Input ¡– ¡many ¡files ¡with ¡binary ¡machine ¡code ¡ ì Output ¡– ¡single ¡file ¡with ¡all ¡of ¡the ¡necessary ¡binary ¡ machine ¡code ¡ Computer ¡Systems ¡and ¡Networks ¡ Fall ¡2015 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend