{"action":"created","comment":{"url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/comments/30473191","id":30473191,"diff_hunk":"@@ -141,3 +164,20 @@ def massErase(self):\n         else:\n             logging.error(\"Failed to unlock. MDM status: 0x%x\", val)\n             return False\n+\n+    ## @brief Write the unsecure FSEC value to flash.\n+    #\n+    # This will prevent the device from being secured after the next reset.\n+    def unlockFlash(self):\n+        logging.info(\"Unlocking chip...\")\n+\n+        # Init flash algorithm.\n+        self.flash.init()\n+\n+        logging.info(\"Performing mass erase\")\n+        self.massErase()","path":"pyOCD/target/target_kinetis.py","position":103,"original_position":103,"commit_id":"59a4a6f47939b32d467e7bb08dcd5bc155e7a414","original_commit_id":"59a4a6f47939b32d467e7bb08dcd5bc155e7a414","user":{"login":"flit","id":3116536,"avatar_url":"https://avatars.githubusercontent.com/u/3116536?v=3","gravatar_id":"","url":"https://api.github.com/users/flit","html_url":"https://github.com/flit","followers_url":"https://api.github.com/users/flit/followers","following_url":"https://api.github.com/users/flit/following{/other_user}","gists_url":"https://api.github.com/users/flit/gists{/gist_id}","starred_url":"https://api.github.com/users/flit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flit/subscriptions","organizations_url":"https://api.github.com/users/flit/orgs","repos_url":"https://api.github.com/users/flit/repos","events_url":"https://api.github.com/users/flit/events{/privacy}","received_events_url":"https://api.github.com/users/flit/received_events","type":"User","site_admin":false},"body":"Mass erase actually leaves the FCF blank. Internally, mass erase (however triggered) uses the Erase All Blocks flash command.\r\n\r\nFrom the FTFA chapter's description of the Erase All Blocks command:\r\nIf the flash memory module verifies that all flash memories were properly erased, access\r\ncontrol is disabled and security is released by setting the FSEC[SEC] field _[this means the FSEC register in FTFA]_ to the unsecure state. … The security byte and all other contents of the flash configuration field (see Flash Configuration Field Description) are erased by the Erase All Blocks command.\r\n\r\nSo security is only temporarily disabled until the next reset.\r\n\r\nOn the KL43 and follow-on L-series devices we added a new Erase All Unsecure flash command that _does_ program the FSEC field of FCF after erasing everything. But this command is not used by mass erase triggered from the MDM-AP.","created_at":"2015-05-17T18:37:57Z","updated_at":"2015-05-17T18:37:57Z","html_url":"https://github.com/mbedmicro/pyOCD/pull/135#discussion_r30473191","pull_request_url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/comments/30473191"},"html":{"href":"https://github.com/mbedmicro/pyOCD/pull/135#discussion_r30473191"},"pull_request":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135","id":35579779,"html_url":"https://github.com/mbedmicro/pyOCD/pull/135","diff_url":"https://github.com/mbedmicro/pyOCD/pull/135.diff","patch_url":"https://github.com/mbedmicro/pyOCD/pull/135.patch","issue_url":"https://api.github.com/repos/mbedmicro/pyOCD/issues/135","number":135,"state":"open","locked":false,"title":"New device support and command line script.","user":{"login":"flit","id":3116536,"avatar_url":"https://avatars.githubusercontent.com/u/3116536?v=3","gravatar_id":"","url":"https://api.github.com/users/flit","html_url":"https://github.com/flit","followers_url":"https://api.github.com/users/flit/followers","following_url":"https://api.github.com/users/flit/following{/other_user}","gists_url":"https://api.github.com/users/flit/gists{/gist_id}","starred_url":"https://api.github.com/users/flit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flit/subscriptions","organizations_url":"https://api.github.com/users/flit/orgs","repos_url":"https://api.github.com/users/flit/repos","events_url":"https://api.github.com/users/flit/events{/privacy}","received_events_url":"https://api.github.com/users/flit/received_events","type":"User","site_admin":false},"body":"Added a new `pyocd.py` script that lets you perform low level operations like read and write memory, reset, and so on from the command line. This is an early version and not all features work, and a lot of useful features are missing. The command line interface is likely to change. `pyocd.py` supports printing the disassembly of data you read using the Capstone library. If Capstone is not present, you'll just get a warning if you try to use the --disasm option.\r\n\r\nInstall Capstone via `pip install capstone`.\r\n\r\nAlso added new pre-launch KL28Z device support. And some refactoring and minor improvements.","created_at":"2015-05-17T00:53:14Z","updated_at":"2015-05-17T18:37:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bac7e9108c10577d8505356ccdb20de86f54fa1a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135/commits","review_comments_url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135/comments","review_comment_url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mbedmicro/pyOCD/issues/135/comments","statuses_url":"https://api.github.com/repos/mbedmicro/pyOCD/statuses/59a4a6f47939b32d467e7bb08dcd5bc155e7a414","head":{"label":"flit:dev_kl28","ref":"dev_kl28","sha":"59a4a6f47939b32d467e7bb08dcd5bc155e7a414","user":{"login":"flit","id":3116536,"avatar_url":"https://avatars.githubusercontent.com/u/3116536?v=3","gravatar_id":"","url":"https://api.github.com/users/flit","html_url":"https://github.com/flit","followers_url":"https://api.github.com/users/flit/followers","following_url":"https://api.github.com/users/flit/following{/other_user}","gists_url":"https://api.github.com/users/flit/gists{/gist_id}","starred_url":"https://api.github.com/users/flit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flit/subscriptions","organizations_url":"https://api.github.com/users/flit/orgs","repos_url":"https://api.github.com/users/flit/repos","events_url":"https://api.github.com/users/flit/events{/privacy}","received_events_url":"https://api.github.com/users/flit/received_events","type":"User","site_admin":false},"repo":{"id":14731481,"name":"pyOCD","full_name":"flit/pyOCD","owner":{"login":"flit","id":3116536,"avatar_url":"https://avatars.githubusercontent.com/u/3116536?v=3","gravatar_id":"","url":"https://api.github.com/users/flit","html_url":"https://github.com/flit","followers_url":"https://api.github.com/users/flit/followers","following_url":"https://api.github.com/users/flit/following{/other_user}","gists_url":"https://api.github.com/users/flit/gists{/gist_id}","starred_url":"https://api.github.com/users/flit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flit/subscriptions","organizations_url":"https://api.github.com/users/flit/orgs","repos_url":"https://api.github.com/users/flit/repos","events_url":"https://api.github.com/users/flit/events{/privacy}","received_events_url":"https://api.github.com/users/flit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flit/pyOCD","description":"Open source python library for programming and debugging ARM Cortex-M microcontrollers using CMSIS-DAP","fork":true,"url":"https://api.github.com/repos/flit/pyOCD","forks_url":"https://api.github.com/repos/flit/pyOCD/forks","keys_url":"https://api.github.com/repos/flit/pyOCD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flit/pyOCD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flit/pyOCD/teams","hooks_url":"https://api.github.com/repos/flit/pyOCD/hooks","issue_events_url":"https://api.github.com/repos/flit/pyOCD/issues/events{/number}","events_url":"https://api.github.com/repos/flit/pyOCD/events","assignees_url":"https://api.github.com/repos/flit/pyOCD/assignees{/user}","branches_url":"https://api.github.com/repos/flit/pyOCD/branches{/branch}","tags_url":"https://api.github.com/repos/flit/pyOCD/tags","blobs_url":"https://api.github.com/repos/flit/pyOCD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flit/pyOCD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flit/pyOCD/git/refs{/sha}","trees_url":"https://api.github.com/repos/flit/pyOCD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flit/pyOCD/statuses/{sha}","languages_url":"https://api.github.com/repos/flit/pyOCD/languages","stargazers_url":"https://api.github.com/repos/flit/pyOCD/stargazers","contributors_url":"https://api.github.com/repos/flit/pyOCD/contributors","subscribers_url":"https://api.github.com/repos/flit/pyOCD/subscribers","subscription_url":"https://api.github.com/repos/flit/pyOCD/subscription","commits_url":"https://api.github.com/repos/flit/pyOCD/commits{/sha}","git_commits_url":"https://api.github.com/repos/flit/pyOCD/git/commits{/sha}","comments_url":"https://api.github.com/repos/flit/pyOCD/comments{/number}","issue_comment_url":"https://api.github.com/repos/flit/pyOCD/issues/comments{/number}","contents_url":"https://api.github.com/repos/flit/pyOCD/contents/{+path}","compare_url":"https://api.github.com/repos/flit/pyOCD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flit/pyOCD/merges","archive_url":"https://api.github.com/repos/flit/pyOCD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flit/pyOCD/downloads","issues_url":"https://api.github.com/repos/flit/pyOCD/issues{/number}","pulls_url":"https://api.github.com/repos/flit/pyOCD/pulls{/number}","milestones_url":"https://api.github.com/repos/flit/pyOCD/milestones{/number}","notifications_url":"https://api.github.com/repos/flit/pyOCD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flit/pyOCD/labels{/name}","releases_url":"https://api.github.com/repos/flit/pyOCD/releases{/id}","created_at":"2013-11-26T22:48:46Z","updated_at":"2014-07-23T15:16:30Z","pushed_at":"2015-05-17T00:33:04Z","git_url":"git://github.com/flit/pyOCD.git","ssh_url":"git@github.com:flit/pyOCD.git","clone_url":"https://github.com/flit/pyOCD.git","svn_url":"https://github.com/flit/pyOCD","homepage":null,"size":744,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mbedmicro:master","ref":"master","sha":"f2e68338a05c7bd2a2a330631c0275bf5ffd71de","user":{"login":"mbedmicro","id":3626466,"avatar_url":"https://avatars.githubusercontent.com/u/3626466?v=3","gravatar_id":"","url":"https://api.github.com/users/mbedmicro","html_url":"https://github.com/mbedmicro","followers_url":"https://api.github.com/users/mbedmicro/followers","following_url":"https://api.github.com/users/mbedmicro/following{/other_user}","gists_url":"https://api.github.com/users/mbedmicro/gists{/gist_id}","starred_url":"https://api.github.com/users/mbedmicro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbedmicro/subscriptions","organizations_url":"https://api.github.com/users/mbedmicro/orgs","repos_url":"https://api.github.com/users/mbedmicro/repos","events_url":"https://api.github.com/users/mbedmicro/events{/privacy}","received_events_url":"https://api.github.com/users/mbedmicro/received_events","type":"Organization","site_admin":false},"repo":{"id":13862423,"name":"pyOCD","full_name":"mbedmicro/pyOCD","owner":{"login":"mbedmicro","id":3626466,"avatar_url":"https://avatars.githubusercontent.com/u/3626466?v=3","gravatar_id":"","url":"https://api.github.com/users/mbedmicro","html_url":"https://github.com/mbedmicro","followers_url":"https://api.github.com/users/mbedmicro/followers","following_url":"https://api.github.com/users/mbedmicro/following{/other_user}","gists_url":"https://api.github.com/users/mbedmicro/gists{/gist_id}","starred_url":"https://api.github.com/users/mbedmicro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbedmicro/subscriptions","organizations_url":"https://api.github.com/users/mbedmicro/orgs","repos_url":"https://api.github.com/users/mbedmicro/repos","events_url":"https://api.github.com/users/mbedmicro/events{/privacy}","received_events_url":"https://api.github.com/users/mbedmicro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mbedmicro/pyOCD","description":"Open source python library for programming and debugging ARM Cortex-M microcontrollers using CMSIS-DAP","fork":false,"url":"https://api.github.com/repos/mbedmicro/pyOCD","forks_url":"https://api.github.com/repos/mbedmicro/pyOCD/forks","keys_url":"https://api.github.com/repos/mbedmicro/pyOCD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mbedmicro/pyOCD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mbedmicro/pyOCD/teams","hooks_url":"https://api.github.com/repos/mbedmicro/pyOCD/hooks","issue_events_url":"https://api.github.com/repos/mbedmicro/pyOCD/issues/events{/number}","events_url":"https://api.github.com/repos/mbedmicro/pyOCD/events","assignees_url":"https://api.github.com/repos/mbedmicro/pyOCD/assignees{/user}","branches_url":"https://api.github.com/repos/mbedmicro/pyOCD/branches{/branch}","tags_url":"https://api.github.com/repos/mbedmicro/pyOCD/tags","blobs_url":"https://api.github.com/repos/mbedmicro/pyOCD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mbedmicro/pyOCD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mbedmicro/pyOCD/git/refs{/sha}","trees_url":"https://api.github.com/repos/mbedmicro/pyOCD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mbedmicro/pyOCD/statuses/{sha}","languages_url":"https://api.github.com/repos/mbedmicro/pyOCD/languages","stargazers_url":"https://api.github.com/repos/mbedmicro/pyOCD/stargazers","contributors_url":"https://api.github.com/repos/mbedmicro/pyOCD/contributors","subscribers_url":"https://api.github.com/repos/mbedmicro/pyOCD/subscribers","subscription_url":"https://api.github.com/repos/mbedmicro/pyOCD/subscription","commits_url":"https://api.github.com/repos/mbedmicro/pyOCD/commits{/sha}","git_commits_url":"https://api.github.com/repos/mbedmicro/pyOCD/git/commits{/sha}","comments_url":"https://api.github.com/repos/mbedmicro/pyOCD/comments{/number}","issue_comment_url":"https://api.github.com/repos/mbedmicro/pyOCD/issues/comments{/number}","contents_url":"https://api.github.com/repos/mbedmicro/pyOCD/contents/{+path}","compare_url":"https://api.github.com/repos/mbedmicro/pyOCD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mbedmicro/pyOCD/merges","archive_url":"https://api.github.com/repos/mbedmicro/pyOCD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mbedmicro/pyOCD/downloads","issues_url":"https://api.github.com/repos/mbedmicro/pyOCD/issues{/number}","pulls_url":"https://api.github.com/repos/mbedmicro/pyOCD/pulls{/number}","milestones_url":"https://api.github.com/repos/mbedmicro/pyOCD/milestones{/number}","notifications_url":"https://api.github.com/repos/mbedmicro/pyOCD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mbedmicro/pyOCD/labels{/name}","releases_url":"https://api.github.com/repos/mbedmicro/pyOCD/releases{/id}","created_at":"2013-10-25T14:10:05Z","updated_at":"2015-05-04T07:11:23Z","pushed_at":"2015-05-17T03:24:03Z","git_url":"git://github.com/mbedmicro/pyOCD.git","ssh_url":"git@github.com:mbedmicro/pyOCD.git","clone_url":"https://github.com/mbedmicro/pyOCD.git","svn_url":"https://github.com/mbedmicro/pyOCD","homepage":null,"size":1741,"stargazers_count":62,"watchers_count":62,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":16,"forks":54,"open_issues":16,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135"},"html":{"href":"https://github.com/mbedmicro/pyOCD/pull/135"},"issue":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/issues/135"},"comments":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/mbedmicro/pyOCD/statuses/59a4a6f47939b32d467e7bb08dcd5bc155e7a414"}}}}