1 # 2 # Copyright (C) 2016 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 set flash-start 08000000 18 set flash-size 00080000 19 set flash-block 00000400 20 set flash-buffer 20000200 21 22 function flash-setup 23 attach 24 reset-stop 25 stop 26 stop 27 28 #prepare for erase 29 download misc/platform/stm32f4xx/flash_script/tool.bin 20000100 30 wr sp 200000fc 31 wr psr 01000000 32 wr 200000fc be00be00 33 wr lr 200000fd 34 35 #do erase 36 wr pc 20000100 37 go 38 end 39 40 41 function flash-erase 42 #nothing since setup did the erase 43 end 44 45 function flash-write 46 wr r0 $1 47 wr r1 $flash-buffer 48 wr pc 20000104 49 wr lr 200000fd 50 go 51 end 52 53