summaryrefslogtreecommitdiffstats
path: root/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
diff options
context:
space:
mode:
authorPavel Štemberk <stemberk@gmail.com>2013-10-04 20:33:11 +0200
committerMichael Buesch <m@bues.ch>2013-10-04 20:33:11 +0200
commitd48a15b628b517aab47beefed4552da329cb0070 (patch)
tree0e3fd710526f6aab7c833d013bf6ec07d9589a45 /libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
parent90632de5833a2b3e706a7ee55ad9c4258cebefd2 (diff)
downloadtoprammer-d48a15b628b517aab47beefed4552da329cb0070.tar.xz
toprammer-d48a15b628b517aab47beefed4552da329cb0070.zip
Add more Microchip implementations
Signed-off-by: Michael Buesch <m@bues.ch>
Diffstat (limited to 'libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py')
-rw-r--r--libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py b/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
new file mode 100644
index 0000000..b7bd991
--- /dev/null
+++ b/libtoprammer/chips/microchip8/microchip8_splittedPMarea_hasResetPC.py
@@ -0,0 +1,72 @@
+"""
+# TOP2049 Open Source programming suite
+#
+# pic8_splittedPMarea - file for newer 8bit PIC MCUs
+#
+# Copyright (c) 2013 Pavel Stemberk <stemberk@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+"""
+
+from libtoprammer.chips.microchip8.microchip8_splittedPMarea import *
+
+class microchip8_splittedPMarea_hasResetPC(microchip8_splittedPMarea):
+
+ CMD_RESET_ADDRESS = 0x16
+
+ userIDLocationSize = 4
+ voltageVDD = 3
+ voltageVPP = 8.5
+
+ logicalFlashProgramMemorySize = 0x8000
+ logicalFlashConfigurationMemorySize = 0x8000
+
+ def __init__(self,
+ chipPackage, chipPinVCC, chipPinsVPP, chipPinGND,
+ signature,
+ flashPageSize, flashPages,
+ eepromPageSize, eepromPages,
+ fuseBytes
+ ):
+ microchip8_splittedPMarea.__init__(self, chipPackage, chipPinVCC, chipPinsVPP, chipPinGND, signature, flashPageSize, flashPages, eepromPageSize, eepromPages, fuseBytes)
+
+ def setPC(self, address):
+ if(self.isInsideProgramMemoryArea):
+ if(address >= self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address inside PM {:x}'.format(address)))
+ if(address < self.PC):
+ self.resetPC()
+ self.setPC(address)
+ else:
+ if(address < self.logicalFlashProgramMemorySize):
+ raise(TOPException('Cannot set PC to address outside PM {:x}'.format(address)))
+ if(address < self.PC):
+ self.resetPC()
+ self.enterConfigArea()
+ self.setPC(address)
+ while(self.PC != address):
+ self.incrementPC(1)
+
+ def resetPC(self):
+ if hasattr(self, 'osccalAddr'):
+ if not hasattr(self, 'CMD_RESET_ADDRESS'):
+ print("reset instruction is not supported")
+ self.exitPM()
+ self.enterPM()
+ else:
+ self.sendCommand(0, 0, 0, self.CMD_RESET_ADDRESS)
+ self.PC = 0
+ self.isInsideProgramMemoryArea = True
+
bues.ch cgit interface