Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

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?

UserRevisionLine numberNew 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 static const uint32_t stm32f4xx_512_flash_prog_blob[] = {
Pawel Zarembski 0:01f31e923fe2 25 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
Pawel Zarembski 0:01f31e923fe2 26 0xf3c04601, 0x28203007, 0x2204bf24, 0x1050eb02, 0x2810d205, 0x2203bf26, 0x1010eb02, 0xf4110880,
Pawel Zarembski 0:01f31e923fe2 27 0xbf181f80, 0x0010f040, 0x486b4770, 0x60014969, 0x6001496a, 0x6801486a, 0x01f0f041, 0x48696001,
Pawel Zarembski 0:01f31e923fe2 28 0xf0106800, 0xd1080f20, 0xf2454867, 0x60015155, 0x60412106, 0x71fff640, 0x20006081, 0x49634770,
Pawel Zarembski 0:01f31e923fe2 29 0xf4206808, 0x600a52f8, 0x48616008, 0xf0416801, 0x60014100, 0x47702000, 0xc174f8df, 0x0000f8dc,
Pawel Zarembski 0:01f31e923fe2 30 0x0004f040, 0x0000f8cc, 0x0000f8dc, 0x3080f440, 0x0000f8cc, 0x0004f1ac, 0xf4116801, 0xbf1c3f80,
Pawel Zarembski 0:01f31e923fe2 31 0x21aaf64a, 0xd0044a50, 0x68036011, 0x3f80f413, 0xf8dcd1fa, 0xf0200000, 0xf8cc0004, 0x20000000,
Pawel Zarembski 0:01f31e923fe2 32 0xf3c04770, 0x29203107, 0x2204bf24, 0x1151eb02, 0x2910d205, 0x2203bf26, 0x1111eb02, 0xf4100889,
Pawel Zarembski 0:01f31e923fe2 33 0xbf181f80, 0x0110f041, 0x6802483d, 0x02f0f042, 0xf1006002, 0x22020c04, 0x2000f8cc, 0x2000f8dc,
Pawel Zarembski 0:01f31e923fe2 34 0xea0323f8, 0x431101c1, 0x1000f8cc, 0x1000f8dc, 0x3180f441, 0x1000f8cc, 0xf4116801, 0xbf1c3f80,
Pawel Zarembski 0:01f31e923fe2 35 0x21aaf64a, 0xd0044a30, 0x68036011, 0x3f80f413, 0xf8dcd1fa, 0xf0211000, 0xf8cc0102, 0x68011000,
Pawel Zarembski 0:01f31e923fe2 36 0x0ff0f011, 0x2000bf04, 0x68014770, 0x01f0f041, 0x20016001, 0x4b224770, 0x1cc9b430, 0xc000f8d3,
Pawel Zarembski 0:01f31e923fe2 37 0x0103f031, 0x0cf0f04c, 0xc000f8c3, 0x0404f103, 0x0c00f04f, 0xc000f8c4, 0xf240bf18, 0xd0252501,
Pawel Zarembski 0:01f31e923fe2 38 0xc000f8d4, 0x0c05ea4c, 0xc000f8c4, 0xc000f8d2, 0xc000f8c0, 0xc000f8d3, 0x3f80f41c, 0xf8d4d1fa,
Pawel Zarembski 0:01f31e923fe2 39 0xf02cc000, 0xf8c40c01, 0xf8d3c000, 0xf01cc000, 0xd0060ff0, 0xf0406818, 0x601800f0, 0x2001bc30,
Pawel Zarembski 0:01f31e923fe2 40 0x1d004770, 0xf1021f09, 0xd1d90204, 0x2000bc30, 0x00004770, 0x45670123, 0x40023c04, 0xcdef89ab,
Pawel Zarembski 0:01f31e923fe2 41 0x40023c0c, 0x40023c14, 0x40003000, 0x40023c00, 0x40023c10, 0x00000000
Pawel Zarembski 0:01f31e923fe2 42 };
Pawel Zarembski 0:01f31e923fe2 43
Pawel Zarembski 0:01f31e923fe2 44 // Start address of flash
Pawel Zarembski 0:01f31e923fe2 45 static const uint32_t flash_start = 0x08000000;
Pawel Zarembski 0:01f31e923fe2 46 // Size of flash
Pawel Zarembski 0:01f31e923fe2 47 static const uint32_t flash_size = 0x00080000;
Pawel Zarembski 0:01f31e923fe2 48
Pawel Zarembski 0:01f31e923fe2 49 /**
Pawel Zarembski 0:01f31e923fe2 50 * List of start and size for each size of flash sector - even indexes are start, odd are size
Pawel Zarembski 0:01f31e923fe2 51 * The size will apply to all sectors between the listed address and the next address
Pawel Zarembski 0:01f31e923fe2 52 * in the list.
Pawel Zarembski 0:01f31e923fe2 53 * The last pair in the list will have sectors starting at that address and ending
Pawel Zarembski 0:01f31e923fe2 54 * at address flash_start + flash_size.
Pawel Zarembski 0:01f31e923fe2 55 */
Pawel Zarembski 0:01f31e923fe2 56 static const sector_info_t sectors_info[] = {
Pawel Zarembski 0:01f31e923fe2 57 { 0x08000000, 0x00004000 },
Pawel Zarembski 0:01f31e923fe2 58 { 0x08010000, 0x00010000 },
Pawel Zarembski 0:01f31e923fe2 59 { 0x08020000, 0x00020000 },
Pawel Zarembski 0:01f31e923fe2 60 };
Pawel Zarembski 0:01f31e923fe2 61
Pawel Zarembski 0:01f31e923fe2 62 static const program_target_t flash = {
Pawel Zarembski 0:01f31e923fe2 63 0x2000004b, // Init
Pawel Zarembski 0:01f31e923fe2 64 0x2000007f, // UnInit
Pawel Zarembski 0:01f31e923fe2 65 0x20000099, // EraseChip
Pawel Zarembski 0:01f31e923fe2 66 0x200000e3, // EraseSector
Pawel Zarembski 0:01f31e923fe2 67 0x20000177, // ProgramPage
Pawel Zarembski 0:01f31e923fe2 68 0, // Verify
Pawel Zarembski 0:01f31e923fe2 69
Pawel Zarembski 0:01f31e923fe2 70 // BKPT : start of blob + 1
Pawel Zarembski 0:01f31e923fe2 71 // RSB : blob start + header + rw data offset
Pawel Zarembski 0:01f31e923fe2 72 // RSP : stack pointer
Pawel Zarembski 0:01f31e923fe2 73 {
Pawel Zarembski 0:01f31e923fe2 74 0x20000001,
Pawel Zarembski 0:01f31e923fe2 75 0x20000214,
Pawel Zarembski 0:01f31e923fe2 76 0x20002000
Pawel Zarembski 0:01f31e923fe2 77 },
Pawel Zarembski 0:01f31e923fe2 78
Pawel Zarembski 0:01f31e923fe2 79 0x20000000 + 0x00000A00, // mem buffer location
Pawel Zarembski 0:01f31e923fe2 80 0x20000000, // location to write prog_blob in target RAM
Pawel Zarembski 0:01f31e923fe2 81 sizeof(stm32f4xx_512_flash_prog_blob), // prog_blob size
Pawel Zarembski 0:01f31e923fe2 82 stm32f4xx_512_flash_prog_blob, // address of prog_blob
Pawel Zarembski 0:01f31e923fe2 83 0x00000400 // ram_to_flash_bytes_to_be_written
Pawel Zarembski 0:01f31e923fe2 84 };