Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/family/st/stm32f407/flash_blob.c@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file flash_blob.c |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief Flash algorithm for the stm32f407 |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #include "flash_blob.h" |
Pawel Zarembski |
0:01f31e923fe2 | 23 | |
Pawel Zarembski |
0:01f31e923fe2 | 24 | |
Pawel Zarembski |
0:01f31e923fe2 | 25 | static const uint32_t STM32F407_FLM[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 26 | 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, |
Pawel Zarembski |
0:01f31e923fe2 | 27 | |
Pawel Zarembski |
0:01f31e923fe2 | 28 | /*0x020*/ 0xe000300, 0xd3022820L, 0x1d000940, 0x28104770, 0x900d302, 0x47701cc0, 0x47700880, 0x49414842, |
Pawel Zarembski |
0:01f31e923fe2 | 29 | /*0x040*/ 0x49426041, 0x21006041, 0x68c16001, 0x431122f0, 0x694060c1, 0xd4060680L, 0x493d483e, 0x21066001, |
Pawel Zarembski |
0:01f31e923fe2 | 30 | /*0x060*/ 0x493d6041, 0x20006081, 0x48374770, 0x5426901, 0x61014311, 0x47702000, 0x4833b510, 0x24046901, |
Pawel Zarembski |
0:01f31e923fe2 | 31 | /*0x080*/ 0x61014321, 0x3a26901, 0x61014311, 0x4a314933, 0x6011e000, 0x3db68c3, 0x6901d4fb, 0x610143a1, |
Pawel Zarembski |
0:01f31e923fe2 | 32 | /*0x0A0*/ 0xbd102000L, 0xf7ffb530L, 0x4927ffbb, 0x23f068ca, 0x60ca431a, 0x610c2402, 0x700690a, 0x43020e40, |
Pawel Zarembski |
0:01f31e923fe2 | 33 | /*0x0C0*/ 0x6908610a, 0x431003e2, 0x48246108, 0xe0004a21L, 0x68cd6010, 0xd4fb03edL, 0x43a06908, 0x68c86108, |
Pawel Zarembski |
0:01f31e923fe2 | 34 | /*0x0E0*/ 0xf000600, 0x68c8d003, 0x60c84318, 0xbd302001L, 0x4d15b570, 0x8891cc9, 0x8968eb, 0x433326f0, |
Pawel Zarembski |
0:01f31e923fe2 | 35 | /*0x100*/ 0x230060eb, 0x4b16612b, 0x692ce017, 0x612c431c, 0x60046814, 0x3e468ec, 0x692cd4fc, 0x640864, |
Pawel Zarembski |
0:01f31e923fe2 | 36 | /*0x120*/ 0x68ec612c, 0xf240624, 0x68e8d004, 0x60e84330, 0xbd702001L, 0x1d121d00, 0x29001f09, 0x2000d1e5, |
Pawel Zarembski |
0:01f31e923fe2 | 37 | /*0x140*/ 0xbd70, 0x45670123, 0x40023c00, 0xcdef89abL, 0x5555, 0x40003000, 0xfff, 0xaaaa, |
Pawel Zarembski |
0:01f31e923fe2 | 38 | /*0x160*/ 0x201, 0x0, |
Pawel Zarembski |
0:01f31e923fe2 | 39 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 40 | |
Pawel Zarembski |
0:01f31e923fe2 | 41 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 42 | * List of start and size for each size of flash sector |
Pawel Zarembski |
0:01f31e923fe2 | 43 | * The size will apply to all sectors between the listed address and the next address |
Pawel Zarembski |
0:01f31e923fe2 | 44 | * in the list. |
Pawel Zarembski |
0:01f31e923fe2 | 45 | * The last pair in the list will have sectors starting at that address and ending |
Pawel Zarembski |
0:01f31e923fe2 | 46 | * at address start + size. |
Pawel Zarembski |
0:01f31e923fe2 | 47 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 48 | static const sector_info_t sectors_info[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 49 | {0x08000000, 1024}, |
Pawel Zarembski |
0:01f31e923fe2 | 50 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 51 | |
Pawel Zarembski |
0:01f31e923fe2 | 52 | static const program_target_t flash = { |
Pawel Zarembski |
0:01f31e923fe2 | 53 | 0x2000003D, // Init |
Pawel Zarembski |
0:01f31e923fe2 | 54 | 0x2000006B, // UnInit |
Pawel Zarembski |
0:01f31e923fe2 | 55 | 0x20000079, // EraseChip |
Pawel Zarembski |
0:01f31e923fe2 | 56 | 0x200000A5, // EraseSector |
Pawel Zarembski |
0:01f31e923fe2 | 57 | 0x200000F1, // ProgramPage |
Pawel Zarembski |
0:01f31e923fe2 | 58 | 0x0, // Verify |
Pawel Zarembski |
0:01f31e923fe2 | 59 | |
Pawel Zarembski |
0:01f31e923fe2 | 60 | // RSB : base adreess is address of Execution Region PrgData in map file |
Pawel Zarembski |
0:01f31e923fe2 | 61 | // to access global/static data |
Pawel Zarembski |
0:01f31e923fe2 | 62 | // RSP : Initial stack pointer |
Pawel Zarembski |
0:01f31e923fe2 | 63 | |
Pawel Zarembski |
0:01f31e923fe2 | 64 | {0x20000001, 0x20000020 + 0x00000144, 0x20002000}, // {breakpoint, RSB, RSP} |
Pawel Zarembski |
0:01f31e923fe2 | 65 | |
Pawel Zarembski |
0:01f31e923fe2 | 66 | 0x20001000, // program_buffer |
Pawel Zarembski |
0:01f31e923fe2 | 67 | 0x20000000, // algo_start |
Pawel Zarembski |
0:01f31e923fe2 | 68 | 0x00000170, // algo_size |
Pawel Zarembski |
0:01f31e923fe2 | 69 | STM32F407_FLM,// image |
Pawel Zarembski |
0:01f31e923fe2 | 70 | 512 // ram_to_flash_bytes_to_be_written |
Pawel Zarembski |
0:01f31e923fe2 | 71 | }; |