summaryrefslogtreecommitdiff
path: root/bsp/airm2m/air105/makesoc.py
blob: fb5ebbe08fd7ac81fbb1322ed77fa64db69a889a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import os
import sys
import shutil
import urllib

out_path='./'
bin_file_name='rtthread.bin'
pack_path='./pack'
out_file='./rtthread_air105'

cwd_path = os.getcwd()
if __name__=='__main__':
    
    print(cwd_path)
    if os.path.exists(out_file+'.soc'):
        os.remove(out_file+'.soc')

    if not os.path.exists(pack_path+'/bootloader.bin'):
        urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/bootloader.bin", pack_path+'/bootloader.bin')

    if not os.path.exists(pack_path+'/soc_download.exe'):
        urllib.urlretrieve("http://cdndownload.openluat.com/rt-thread/airm2m/air105/soc_download.exe", pack_path+'/soc_download.exe')

    shutil.copy(out_path+bin_file_name, pack_path+'/'+bin_file_name)
    shutil.make_archive(out_file, 'zip', root_dir=pack_path)
    os.remove(pack_path+'/'+bin_file_name)
    os.rename(out_file+'.zip',out_file+'.soc')
    print('end')