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 k20dx
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 K20D50M_FLM[] = {
Pawel Zarembski 0:01f31e923fe2 25 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
Pawel Zarembski 0:01f31e923fe2 26 0xb510482c, 0x5120f24c, 0xf64d81c1, 0x81c11128, 0xf0218801, 0x80010101, 0x44484827, 0xf884f000,
Pawel Zarembski 0:01f31e923fe2 27 0xd0002800, 0xbd102001, 0x47702000, 0xb5104822, 0xf0004448, 0xb920f86f, 0x2100481f, 0xf0004448,
Pawel Zarembski 0:01f31e923fe2 28 0x491ef903, 0xf442684a, 0x604a0270, 0xb510bd10, 0x46014604, 0x22014818, 0xf0004448, 0xb930f831,
Pawel Zarembski 0:01f31e923fe2 29 0x23004815, 0x46212201, 0xf0004448, 0x4913f8b7, 0xf442684a, 0x604a0270, 0xb5febd10, 0x460b460c,
Pawel Zarembski 0:01f31e923fe2 30 0x46014606, 0x4615480c, 0xf0004448, 0xb958f87f, 0x21012000, 0x1000e9cd, 0x48079002, 0x4622462b,
Pawel Zarembski 0:01f31e923fe2 31 0x44484631, 0xf8dcf000, 0x684a4904, 0x0270f442, 0xbdfe604a, 0x40052000, 0x00000004, 0x4001f000,
Pawel Zarembski 0:01f31e923fe2 32 0x41f0e92d, 0x460d4614, 0xf846f000, 0xd11b2800, 0x1e64442c, 0xd00505a1, 0xeb012101, 0x1e422194,
Pawel Zarembski 0:01f31e923fe2 33 0x2481eb02, 0x447e4e09, 0x8024f8df, 0x42a52709, 0x6830d80a, 0xf8886005, 0xf0007007, 0x2800f8e9,
Pawel Zarembski 0:01f31e923fe2 34 0xf505d102, 0xe7f26580, 0x81f0e8bd, 0x00000236, 0x40020000, 0x4903b120, 0x71c82044, 0xb8d8f000,
Pawel Zarembski 0:01f31e923fe2 35 0x47702004, 0x40020000, 0x4916b190, 0x4a166cc9, 0x6103f3c1, 0xf832447a, 0x03091011, 0x2200d00a,
Pawel Zarembski 0:01f31e923fe2 36 0x2100e9c0, 0x60812101, 0x60c10289, 0x47704610, 0x47702004, 0x47702064, 0xea41b128, 0x079b0302,
Pawel Zarembski 0:01f31e923fe2 37 0x2065d003, 0x20044770, 0x68034770, 0xd804428b, 0x44116840, 0x42884418, 0x2066d201, 0x20004770,
Pawel Zarembski 0:01f31e923fe2 38 0x00004770, 0x40048000, 0x000001c8, 0x47f0e92d, 0x0014461d, 0xd01a460e, 0xf7ff461a, 0x2800ffdd,
Pawel Zarembski 0:01f31e923fe2 39 0x4f0cd116, 0xf8df447f, 0xf04fa030, 0x2d000806, 0x6838d00e, 0x68396006, 0x6048cc01, 0x8007f88a,
Pawel Zarembski 0:01f31e923fe2 40 0xf886f000, 0xd1032800, 0x1f2d1d36, 0x2004e7ef, 0x87f0e8bd, 0x00000178, 0x40020000, 0x47f0e92d,
Pawel Zarembski 0:01f31e923fe2 41 0x4614469a, 0x4605460e, 0xffb6f7ff, 0xd1252800, 0x0101e9d5, 0xf8f1fbb0, 0xf1c84271, 0x40010000,
Pawel Zarembski 0:01f31e923fe2 42 0x42b5424d, 0x4445d100, 0x1bafb1bc, 0xd90042a7, 0x480b4627, 0x447808b9, 0x60066800, 0x22014809,
Pawel Zarembski 0:01f31e923fe2 43 0x0a0a71c2, 0x728172c2, 0xa009f880, 0xf850f000, 0xd1032800, 0x443e1be4, 0x2000e7e5, 0x87f0e8bd,
Pawel Zarembski 0:01f31e923fe2 44 0x00000106, 0x40020000, 0x4804b128, 0x71c22240, 0xf0007181, 0x2004b83d, 0x00004770, 0x40020000,
Pawel Zarembski 0:01f31e923fe2 45 0x4df0e92d, 0xe9dd001c, 0x46168709, 0xd025460d, 0xff72f7ff, 0xd11f2800, 0xb04cf8df, 0xf8df44fb,
Pawel Zarembski 0:01f31e923fe2 46 0x2e00a04c, 0xf8dbd018, 0x600d1000, 0xf88a2202, 0x9a082007, 0x200bf88a, 0x0000f8db, 0x60816821,
Pawel Zarembski 0:01f31e923fe2 47 0xf816f000, 0xf1b8b160, 0xd0010f00, 0x5000f8c8, 0xd0012f00, 0x60392100, 0x8df0e8bd, 0xe7fb2004,
Pawel Zarembski 0:01f31e923fe2 48 0x1d241f36, 0xe7dc1d2d, 0x000000a0, 0x40020000, 0x2170480a, 0x21807001, 0x78017001, 0xd5fc0609,
Pawel Zarembski 0:01f31e923fe2 49 0x06817800, 0x2067d501, 0x06c14770, 0x2068d501, 0x07c04770, 0x2069d0fc, 0x00004770, 0x40020000,
Pawel Zarembski 0:01f31e923fe2 50 0x00000000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x01000000,
Pawel Zarembski 0:01f31e923fe2 51 0x40020004, 0x00000000,
Pawel Zarembski 0:01f31e923fe2 52 };
Pawel Zarembski 0:01f31e923fe2 53
Pawel Zarembski 0:01f31e923fe2 54 /**
Pawel Zarembski 0:01f31e923fe2 55 * List of start and size for each size of flash sector
Pawel Zarembski 0:01f31e923fe2 56 * The size will apply to all sectors between the listed address and the next address
Pawel Zarembski 0:01f31e923fe2 57 * in the list.
Pawel Zarembski 0:01f31e923fe2 58 * The last pair in the list will have sectors starting at that address and ending
Pawel Zarembski 0:01f31e923fe2 59 * at address start + size.
Pawel Zarembski 0:01f31e923fe2 60 */
Pawel Zarembski 0:01f31e923fe2 61 static const sector_info_t sectors_info[] = {
Pawel Zarembski 0:01f31e923fe2 62 {0, 1024},
Pawel Zarembski 0:01f31e923fe2 63 };
Pawel Zarembski 0:01f31e923fe2 64
Pawel Zarembski 0:01f31e923fe2 65 static const program_target_t flash = {
Pawel Zarembski 0:01f31e923fe2 66 0x20000021, // Init
Pawel Zarembski 0:01f31e923fe2 67 0x20000049, // UnInit
Pawel Zarembski 0:01f31e923fe2 68 0x2000004D, // EraseChip
Pawel Zarembski 0:01f31e923fe2 69 0x2000006F, // EraseSector
Pawel Zarembski 0:01f31e923fe2 70 0x2000009B, // ProgramPage
Pawel Zarembski 0:01f31e923fe2 71 0x0, // Verify
Pawel Zarembski 0:01f31e923fe2 72
Pawel Zarembski 0:01f31e923fe2 73 // breakpoint = RAM start + 1
Pawel Zarembski 0:01f31e923fe2 74 // RSB : base address is address of Execution Region PrgData in map file
Pawel Zarembski 0:01f31e923fe2 75 // to access global/static data
Pawel Zarembski 0:01f31e923fe2 76 // RSP : Initial stack pointer
Pawel Zarembski 0:01f31e923fe2 77 {
Pawel Zarembski 0:01f31e923fe2 78 0x20000001, // breakpoint instruction address
Pawel Zarembski 0:01f31e923fe2 79 0x20000000 + 0x20 + 0x324, // static base register value (image start + header + static base offset)
Pawel Zarembski 0:01f31e923fe2 80 0x20000c00 // initial stack pointer
Pawel Zarembski 0:01f31e923fe2 81 },
Pawel Zarembski 0:01f31e923fe2 82
Pawel Zarembski 0:01f31e923fe2 83 0x20001c00, // program_buffer, any valid RAM location with +512 bytes of headroom
Pawel Zarembski 0:01f31e923fe2 84 0x20000000, // algo_start, start of RAM
Pawel Zarembski 0:01f31e923fe2 85 sizeof(K20D50M_FLM), // algo_size, size of array above
Pawel Zarembski 0:01f31e923fe2 86 K20D50M_FLM, // image, flash algo instruction array
Pawel Zarembski 0:01f31e923fe2 87 512 // ram_to_flash_bytes_to_be_written
Pawel Zarembski 0:01f31e923fe2 88 };