Package icaro-bloques :: Module carga'
[hide private]
[frames] | no frames]

Source Code for Module icaro-bloques.carga'

 1  #!/usr/bin/python 
 2  # -*- coding: utf-8 -*- 
 3   
 4  # This program is free software: you can redistribute it and/or modify 
 5  # it under the terms of the GNU General Public License as published by 
 6  # the Free Software Foundation, either version 3 of the License, or 
 7  # (at your option) any later version. 
 8  # 
 9  # This program is distributed in the hope that it will be useful, 
10  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
12  # GNU General Public License for more details. 
13  import os 
14  import docker 
15  import re 
16  import shutil 
17  import sys 
18  from subprocess import Popen,PIPE,STDOUT 
19  processor="18f4550" 
20   
21 -def compilar_pic(ruta,sdcc):
22 23 val=os.system(sdcc.strip("\n")+" -v") 24 if val<>0: 25 return 1 26 chemin = sys.path[0] 27 fichier = open(sys.path[0] + "/tmp/stdout", 'w+') 28 sortie = str(sdcc.strip("\n") +" "+ 29 " -mpic16"+ 30 " --denable-peeps"+ 31 " --obanksel=9"+ 32 " --opt-code-size "+ 33 " --optimize-cmp"+ 34 " --optimize-df"+ 35 " -p" + processor + 36 " -I" + sys.path[0] + 37 "/include"+ " -I" + chemin +ruta 38 + 39 " -c"+ 40 " -c"+ 41 " -o" + 42 sys.path[0] + 43 ruta +"main.o " + 44 sys.path[0] + 45 ruta + "main.c") 46 print sortie 47 48 i=os.system(sortie) 49 return i
50 -def upload_pic(ruta,sdcc):
51 sortie2=str( sdcc.strip("\n") +" " 52 " -o"+sys.path[0].replace(" ","\\ ")+ ruta +".hex"+ 53 " --denable-peeps"+ 54 " --obanksel=9"+ 55 " --opt-code-size"+ 56 " --optimize-cmp"+ 57 " --optimize-df"+ 58 " --no-crt"+ 59 " -Wl-s"+sys.path[0].replace(" ","\\ ")+"/lkr/18f2550.lkr,-m "+ 60 " -mpic16"+ 61 " -p"+processor+ 62 " -l "+sys.path[0].replace(" ","\\ ")+"/lib/libpuf.lib "+ 63 " -l " +sys.path[0].replace(" ","\\ ")+"/lib/libio"+processor+".lib"+ 64 " -l " +sys.path[0].replace(" ","\\ ")+"/lib/libc18f.lib "+ 65 " -l " +sys.path[0].replace(" ","\\ ")+"/lib/libdev18f4550.lib"+ 66 67 " -l " +sys.path[0].replace(" ","\\ ")+"/lib/libm18f.lib "+ 68 sys.path[0].replace(" ","\\ ")+"/obj/application_iface.o "+ 69 sys.path[0].replace(" ","\\ ")+"/obj/usb_descriptors.o "+ 70 sys.path[0].replace(" ","\\ ")+"/obj/crt0ipinguino.o "+ 71 sys.path[0].replace(" ","\\ ")+ruta + ".o ") 72 print sortie2 73 i=os.system(sortie2) 74 if i==0: 75 76 i=docker.docker(sys.path[0]+ruta+".hex") 77 else: 78 return 4 79 return i
80