annotate python/st-flash.py @ 113:1f40be088ee8

Added first start stlink
author Windel Bouwman
date Sat, 05 Jan 2013 00:06:27 +0100
parents
children 92b2bf0da1ec
rev   line source
113
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
1 #!/usr/bin/python
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
2
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
3 import argparse
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
4 from stlink import STLink
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
5
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
6 def hex2int(s):
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
7 return int(s, 16)
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
8
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
9 parser = argparse.ArgumentParser(description='ST-link flash utility')
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
10 #parser.add_argument('filename', type=str)
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
11 #parser.add_argument('address', type=hex2int)
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
12
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
13 args = parser.parse_args()
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
14 print(args)
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
15
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
16 stl = STLink()
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
17 print(stl)
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
18 stl.open()
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
19 if stl.CurrentMode == STLink.DFU_MODE:
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
20 pass
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
21
1f40be088ee8 Added first start stlink
Windel Bouwman
parents:
diff changeset
22