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 ke15z
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 mke15z7_flash_prog_blob[] = {
Pawel Zarembski 0:01f31e923fe2 25 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
Pawel Zarembski 0:01f31e923fe2 26 0x483cb510, 0x6041493a, 0x6081493b, 0x22806801, 0x22204391, 0x60014311, 0x68c14838, 0x0f890649,
Pawel Zarembski 0:01f31e923fe2 27 0xd0152902, 0x4a362100, 0x444a2900, 0xd0077011, 0x226068c1, 0x60c14391, 0x064968c1, 0xd1fb0f89,
Pawel Zarembski 0:01f31e923fe2 28 0x44484830, 0xf862f000, 0xd0002800, 0xbd102001, 0xe7e82101, 0x4448482a, 0x28007800, 0x4827d00a,
Pawel Zarembski 0:01f31e923fe2 29 0x226068c1, 0x31404391, 0x68c160c1, 0x0f890649, 0xd1fa2902, 0x47702000, 0xb5104822, 0x44484922,
Pawel Zarembski 0:01f31e923fe2 30 0xf892f000, 0xd1042800, 0x2100481e, 0xf0004448, 0xbd10f94c, 0x4c1bb570, 0x444c4605, 0x4b1a4601,
Pawel Zarembski 0:01f31e923fe2 31 0x68e24620, 0xf8b9f000, 0xd1052800, 0x46292300, 0x68e24620, 0xf943f000, 0xb570bd70, 0x460b460c,
Pawel Zarembski 0:01f31e923fe2 32 0x46014606, 0xb084480f, 0x44484615, 0xf8e8f000, 0xd10a2800, 0x90029001, 0x480a2101, 0x462b9100,
Pawel Zarembski 0:01f31e923fe2 33 0x46314622, 0xf0004448, 0xb004f971, 0x0000bd70, 0xd928c520, 0x40052000, 0x0000ffff, 0x4007e000,
Pawel Zarembski 0:01f31e923fe2 34 0x00000004, 0x00000008, 0x6b65666b, 0xd00b2800, 0x68c949dd, 0x0f090109, 0xd007290f, 0x00494adb,
Pawel Zarembski 0:01f31e923fe2 35 0x5a51447a, 0xe0030289, 0x47702004, 0x04892101, 0x2300b430, 0x60416003, 0x02cc2101, 0x608160c4,
Pawel Zarembski 0:01f31e923fe2 36 0x7a0d49d3, 0x40aa158a, 0x7ac96142, 0x61816103, 0x06892105, 0x62016244, 0x2000bc30, 0x28004770,
Pawel Zarembski 0:01f31e923fe2 37 0x6101d002, 0x47702000, 0x47702004, 0x48c94602, 0x210168c0, 0x43080289, 0x60c849c6, 0x48c64770,
Pawel Zarembski 0:01f31e923fe2 38 0x70012170, 0x70012180, 0x06097801, 0x7800d5fc, 0xd5010681, 0x47702067, 0xd50106c1, 0x47702068,
Pawel Zarembski 0:01f31e923fe2 39 0xd0fc07c0, 0x47702069, 0xd1012800, 0x47702004, 0x4604b510, 0x48b94ab8, 0x48b96050, 0xd0014281,
Pawel Zarembski 0:01f31e923fe2 40 0xe000206b, 0x28002000, 0x4620d107, 0xffd7f7ff, 0x46204603, 0xffcaf7ff, 0xbd104618, 0xd1012800,
Pawel Zarembski 0:01f31e923fe2 41 0x47702004, 0x4614b510, 0x60622200, 0x60e260a2, 0x61626122, 0x61e261a2, 0x68c16021, 0x68816061,
Pawel Zarembski 0:01f31e923fe2 42 0xf0006840, 0x60a0f953, 0x60e02008, 0x61606120, 0x200461a0, 0x200061e0, 0xb5ffbd10, 0x4615b089,
Pawel Zarembski 0:01f31e923fe2 43 0x466a460c, 0xf7ff9809, 0x462affd9, 0x9b044621, 0xf0009809, 0x0007f90c, 0x9c00d130, 0x19659e01,
Pawel Zarembski 0:01f31e923fe2 44 0x46311e6d, 0xf0004628, 0x2900f931, 0x1c40d002, 0x1e454370, 0xd81d42ac, 0x20090221, 0x06000a09,
Pawel Zarembski 0:01f31e923fe2 45 0x488d1809, 0x498e6041, 0x4288980c, 0x206bd001, 0x2000e000, 0xd1112800, 0xf7ff9809, 0x4607ff80,
Pawel Zarembski 0:01f31e923fe2 46 0x69009809, 0xd0002800, 0x2f004780, 0x19a4d102, 0xd9e142ac, 0xf7ff9809, 0x4638ff69, 0xbdf0b00d,
Pawel Zarembski 0:01f31e923fe2 47 0xd1012a00, 0x47702004, 0xb089b5ff, 0x461e4614, 0x466a460d, 0xf7ff9809, 0x4632ff91, 0x9b034629,
Pawel Zarembski 0:01f31e923fe2 48 0xf0009809, 0x0007f8c4, 0x9d00d12d, 0xd0262e00, 0x4871cc02, 0x99036081, 0xd0022904, 0xd0072908,
Pawel Zarembski 0:01f31e923fe2 49 0x022ae00e, 0x0a122103, 0x18510649, 0xe0076041, 0x60c1cc02, 0x2107022a, 0x06090a12, 0x60411851,
Pawel Zarembski 0:01f31e923fe2 50 0xf7ff9809, 0x4607ff3c, 0x69009809, 0xd0002800, 0x2f004780, 0x9803d103, 0x1a361945, 0x9809d1d8,
Pawel Zarembski 0:01f31e923fe2 51 0xff24f7ff, 0xb00d4638, 0x2800bdf0, 0x4a5dd005, 0x18890409, 0x60514a58, 0x2004e721, 0xb5ff4770,
Pawel Zarembski 0:01f31e923fe2 52 0x4614b08b, 0x460d461e, 0x980b466a, 0xff46f7ff, 0x46294622, 0x980b9b05, 0xf879f000, 0xd1332800,
Pawel Zarembski 0:01f31e923fe2 53 0x4629466a, 0xf7ff980b, 0x9d00ff39, 0x90089802, 0x42404269, 0x424f4001, 0xd10142af, 0x183f9808,
Pawel Zarembski 0:01f31e923fe2 54 0xd0202c00, 0x90090230, 0x42a61b7e, 0x4626d900, 0x99054630, 0xf88af000, 0x2101022a, 0x06090a12,
Pawel Zarembski 0:01f31e923fe2 55 0x493d1852, 0x9a09604a, 0x43100400, 0x608830ff, 0xf7ff980b, 0x2800fee4, 0x9808d106, 0x19ad1ba4,
Pawel Zarembski 0:01f31e923fe2 56 0x2c00183f, 0x2000d1e0, 0xbdf0b00f, 0xd1012b00, 0x47702004, 0xb089b5ff, 0x461d4616, 0x466a460c,
Pawel Zarembski 0:01f31e923fe2 57 0x98099f12, 0xfefaf7ff, 0x46214632, 0x98099b07, 0xf82df000, 0xd11d2800, 0x2e009c00, 0x492ad01a,
Pawel Zarembski 0:01f31e923fe2 58 0x18470638, 0x20010221, 0x06400a09, 0x48221809, 0x60876041, 0x60c16829, 0xf7ff9809, 0x2800feb0,
Pawel Zarembski 0:01f31e923fe2 59 0x9913d00a, 0xd0002900, 0x9914600c, 0xd0012900, 0x600a2200, 0xbdf0b00d, 0x1a769907, 0x00890889,
Pawel Zarembski 0:01f31e923fe2 60 0x9907194d, 0x2e00190c, 0xb00dd1dc, 0x2800bdf0, 0x2004d101, 0xb4104770, 0x460c1e5b, 0xd101421c,
Pawel Zarembski 0:01f31e923fe2 61 0xd002421a, 0x2065bc10, 0x68034770, 0xd804428b, 0x18896840, 0x42881818, 0xbc10d202, 0x47702066,
Pawel Zarembski 0:01f31e923fe2 62 0x2000bc10, 0x00004770, 0x40048040, 0x000003bc, 0x40020020, 0xf0003000, 0x40020000, 0x44ffffff,
Pawel Zarembski 0:01f31e923fe2 63 0x6b65666b, 0x4000ffff, 0x00ffffff, 0x460bb530, 0x20004601, 0x24012220, 0x460de009, 0x429d40d5,
Pawel Zarembski 0:01f31e923fe2 64 0x461dd305, 0x1b494095, 0x40954625, 0x46151940, 0x2d001e52, 0xbd30dcf1, 0x40020004, 0x40020010,
Pawel Zarembski 0:01f31e923fe2 65 0x00100008, 0x00200018, 0x00400030, 0x00800060, 0x010000c0, 0x02000180, 0x04000300, 0x00000600,
Pawel Zarembski 0:01f31e923fe2 66 0x00000000, 0x00000000,
Pawel Zarembski 0:01f31e923fe2 67 };
Pawel Zarembski 0:01f31e923fe2 68
Pawel Zarembski 0:01f31e923fe2 69 /**
Pawel Zarembski 0:01f31e923fe2 70 * List of start and size for each size of flash sector
Pawel Zarembski 0:01f31e923fe2 71 * The size will apply to all sectors between the listed address and the next address
Pawel Zarembski 0:01f31e923fe2 72 * in the list.
Pawel Zarembski 0:01f31e923fe2 73 * The last pair in the list will have sectors starting at that address and ending
Pawel Zarembski 0:01f31e923fe2 74 * at address start + size.
Pawel Zarembski 0:01f31e923fe2 75 */
Pawel Zarembski 0:01f31e923fe2 76 static const sector_info_t sectors_info[] = {
Pawel Zarembski 0:01f31e923fe2 77 {0, 2048},
Pawel Zarembski 0:01f31e923fe2 78 };
Pawel Zarembski 0:01f31e923fe2 79
Pawel Zarembski 0:01f31e923fe2 80 static const program_target_t flash = {
Pawel Zarembski 0:01f31e923fe2 81 0x20000021, // Init
Pawel Zarembski 0:01f31e923fe2 82 0x20000075, // UnInit
Pawel Zarembski 0:01f31e923fe2 83 0x20000099, // EraseChip
Pawel Zarembski 0:01f31e923fe2 84 0x200000B5, // EraseSector
Pawel Zarembski 0:01f31e923fe2 85 0x200000DB, // ProgramPage
Pawel Zarembski 0:01f31e923fe2 86 0x0, // Verify
Pawel Zarembski 0:01f31e923fe2 87
Pawel Zarembski 0:01f31e923fe2 88 // BKPT : start of blob + 1
Pawel Zarembski 0:01f31e923fe2 89 // RSB : blob start + header + rw data offset
Pawel Zarembski 0:01f31e923fe2 90 // RSP : stack pointer
Pawel Zarembski 0:01f31e923fe2 91 {
Pawel Zarembski 0:01f31e923fe2 92 0x20000000 + 0x00000001,
Pawel Zarembski 0:01f31e923fe2 93 0x20000000 + 0x00000020 + 0x00000500,
Pawel Zarembski 0:01f31e923fe2 94 0x20000800
Pawel Zarembski 0:01f31e923fe2 95 },
Pawel Zarembski 0:01f31e923fe2 96
Pawel Zarembski 0:01f31e923fe2 97 0x20000000 + 0x00000A00, // mem buffer location
Pawel Zarembski 0:01f31e923fe2 98 0x20000000, // location to write prog_blob in target RAM
Pawel Zarembski 0:01f31e923fe2 99 sizeof(mke15z7_flash_prog_blob), // prog_blob size
Pawel Zarembski 0:01f31e923fe2 100 mke15z7_flash_prog_blob, // address of prog_blob
Pawel Zarembski 0:01f31e923fe2 101 0x00000200 // ram_to_flash_bytes_to_be_written
Pawel Zarembski 0:01f31e923fe2 102 };