mirror of
https://github.com/OpenSolo/OpenSolo.git
synced 2025-04-29 22:24:32 +02:00
37 lines
666 B
Python
Executable File
37 lines
666 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# stm32loader in /usr/bin is not on the default python path; make
|
|
# sure we always find it no matter where this script is installed
|
|
import sys
|
|
sys.path.append("/usr/bin")
|
|
import stm32loader
|
|
|
|
stm32loader.QUIET = 0
|
|
|
|
cmd = stm32loader.CommandInterface()
|
|
cmd.open("/dev/ttymxc1", 115200)
|
|
cmd.initChip()
|
|
cmd.cmdGet()
|
|
cmd.cmdGetID()
|
|
|
|
status = 1
|
|
|
|
msg = "cal is blank"
|
|
|
|
try:
|
|
data = cmd.readMemory(0x0803f800, 2048)
|
|
for c in data:
|
|
if c != 255:
|
|
msg = "cal is not blank"
|
|
status = 0
|
|
break
|
|
except:
|
|
msg = "error reading cal (readout protect?)"
|
|
pass
|
|
|
|
cmd.releaseChip()
|
|
|
|
print msg
|
|
|
|
sys.exit(status)
|