Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/family/freescale/kl28z/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 kl46z |
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 KL28Z_FLM[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 25 | 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, |
Pawel Zarembski |
0:01f31e923fe2 | 26 | 0x4832b510, 0x60414930, 0x60814931, 0x22806801, 0x22204391, 0x60014311, 0x4448482e, 0xf860f000, |
Pawel Zarembski |
0:01f31e923fe2 | 27 | 0xd0002800, 0xbd102001, 0x47702000, 0xb5104829, 0x44484929, 0xf922f000, 0xd1042800, 0x21004825, |
Pawel Zarembski |
0:01f31e923fe2 | 28 | 0xf0004448, 0x4a25f9c3, 0x230168d1, 0x4319029b, 0xbd1060d1, 0x4c1fb570, 0x444c4605, 0x4b1e4601, |
Pawel Zarembski |
0:01f31e923fe2 | 29 | 0x68e24620, 0xf89ef000, 0xd1052800, 0x46292300, 0x68e24620, 0xf916f000, 0x68ca4918, 0x029b2301, |
Pawel Zarembski |
0:01f31e923fe2 | 30 | 0x60ca431a, 0xb570bd70, 0x460b460c, 0x46014606, 0xb0844810, 0x44484615, 0xf8bef000, 0xd10a2800, |
Pawel Zarembski |
0:01f31e923fe2 | 31 | 0x90029001, 0x480b2101, 0x462b9100, 0x46314622, 0xf0004448, 0x4909f957, 0x230168ca, 0x431a029b, |
Pawel Zarembski |
0:01f31e923fe2 | 32 | 0xb00460ca, 0x0000bd70, 0xd928c520, 0x40076000, 0x0000ffff, 0x00000004, 0x6b65666b, 0xf0003000, |
Pawel Zarembski |
0:01f31e923fe2 | 33 | 0xd00a2800, 0x68c9492b, 0x0e094a2b, 0x447a0049, 0x03095a51, 0x2064d103, 0x20044770, 0xb4104770, |
Pawel Zarembski |
0:01f31e923fe2 | 34 | 0x60032300, 0x21026041, 0x02896081, 0x492360c1, 0x158a7a0c, 0x610240a2, 0x61837ac9, 0xbc106141, |
Pawel Zarembski |
0:01f31e923fe2 | 35 | 0x47704618, 0xd0022800, 0x20006181, 0x20044770, 0x28004770, 0x2004d101, 0xb4104770, 0x42191e5b, |
Pawel Zarembski |
0:01f31e923fe2 | 36 | 0x421ad101, 0xbc10d002, 0x47702065, 0x428b6803, 0x6840d804, 0x18181889, 0xd2024288, 0x2066bc10, |
Pawel Zarembski |
0:01f31e923fe2 | 37 | 0xbc104770, 0x47702000, 0x4288490d, 0x206bd001, 0x20004770, 0x28004770, 0x290fd008, 0x2a04d802, |
Pawel Zarembski |
0:01f31e923fe2 | 38 | 0xe005d104, 0xd8012913, 0xd0012a08, 0x47702004, 0x47702000, 0x40075040, 0x00000512, 0x40020020, |
Pawel Zarembski |
0:01f31e923fe2 | 39 | 0x6b65666b, 0x4605b5f8, 0x460c4616, 0xf7ff4618, 0x2800ffdb, 0x2308d12b, 0x46214632, 0xf7ff4628, |
Pawel Zarembski |
0:01f31e923fe2 | 40 | 0x0007ffb8, 0x19a6d123, 0x1e7668e9, 0x91004630, 0xf922f000, 0xd0032900, 0x1c409e00, 0x1e764346, |
Pawel Zarembski |
0:01f31e923fe2 | 41 | 0xd81342b4, 0x4478480a, 0x60046800, 0x20094909, 0xf00071c8, 0x4607f8f9, 0x280069a8, 0x4780d000, |
Pawel Zarembski |
0:01f31e923fe2 | 42 | 0xd1032f00, 0x190468e8, 0xd9eb42b4, 0xbdf84638, 0x00000416, 0x40020000, 0xd1012a00, 0x47702004, |
Pawel Zarembski |
0:01f31e923fe2 | 43 | 0x461cb5ff, 0x4615b081, 0x2304460e, 0x98014622, 0xff7ff7ff, 0xd11a0007, 0xd0172c00, 0x4478480d, |
Pawel Zarembski |
0:01f31e923fe2 | 44 | 0x600e6801, 0x6800cd02, 0x490b6041, 0x71c82006, 0xf8caf000, 0x98014607, 0x28006980, 0x4780d000, |
Pawel Zarembski |
0:01f31e923fe2 | 45 | 0xd1032f00, 0x1d361f24, 0xd1e72c00, 0xb0054638, 0x0000bdf0, 0x000003be, 0x40020000, 0x4604b510, |
Pawel Zarembski |
0:01f31e923fe2 | 46 | 0xf7ff4608, 0x2800ff71, 0x2c00d106, 0x4904d005, 0x71c82044, 0xf8a8f000, 0x2004bd10, 0x0000bd10, |
Pawel Zarembski |
0:01f31e923fe2 | 47 | 0x40020000, 0xb081b5ff, 0x460e4614, 0x23084605, 0xff3ff7ff, 0xd12a2800, 0x686868a9, 0xf8acf000, |
Pawel Zarembski |
0:01f31e923fe2 | 48 | 0x42719000, 0x40014240, 0x42b7424f, 0x9800d101, 0x2c00183f, 0x1bbdd01a, 0xd90042a5, 0x490d4625, |
Pawel Zarembski |
0:01f31e923fe2 | 49 | 0x447908e8, 0x600e6809, 0x2201490b, 0x0a0271ca, 0x728872ca, 0x72489804, 0xf876f000, 0xd1062800, |
Pawel Zarembski |
0:01f31e923fe2 | 50 | 0x1b649800, 0x183f1976, 0xd1e42c00, 0xb0052000, 0x0000bdf0, 0x0000031a, 0x40020000, 0xd00c2800, |
Pawel Zarembski |
0:01f31e923fe2 | 51 | 0xd00a2a00, 0xd21a2908, 0x447b000b, 0x18db791b, 0x0705449f, 0x0d0b0907, 0x2004110f, 0x68c04770, |
Pawel Zarembski |
0:01f31e923fe2 | 52 | 0x6840e00a, 0x6880e008, 0x6800e006, 0x2001e004, 0x6900e002, 0x6940e000, 0x20006010, 0x206a4770, |
Pawel Zarembski |
0:01f31e923fe2 | 53 | 0x00004770, 0xd1012b00, 0x47702004, 0x461cb5f8, 0x460e4615, 0x9f082304, 0xfedbf7ff, 0xd1192800, |
Pawel Zarembski |
0:01f31e923fe2 | 54 | 0xd0172d00, 0x447a4a0f, 0x60066810, 0x2102480e, 0x990671c1, 0x681172c1, 0x60886820, 0xf824f000, |
Pawel Zarembski |
0:01f31e923fe2 | 55 | 0xd0082800, 0x29009907, 0x600ed000, 0xd0012f00, 0x60392100, 0x1d24bdf8, 0x1d361f2d, 0xd1e12d00, |
Pawel Zarembski |
0:01f31e923fe2 | 56 | 0x0000bdf8, 0x00000276, 0x40020000, 0xd1012800, 0x47702004, 0x4803b510, 0x71c22240, 0xf0007181, |
Pawel Zarembski |
0:01f31e923fe2 | 57 | 0xbd10f803, 0x40020000, 0x2170480a, 0x21807001, 0x78017001, 0xd5fc0609, 0x06817800, 0x2067d501, |
Pawel Zarembski |
0:01f31e923fe2 | 58 | 0x06c14770, 0x2068d501, 0x07c04770, 0x2069d0fc, 0x00004770, 0x40020000, 0x09032200, 0xd373428b, |
Pawel Zarembski |
0:01f31e923fe2 | 59 | 0x428b0a03, 0x0b03d358, 0xd33c428b, 0x428b0c03, 0xe012d321, 0x430b4603, 0x2200d47f, 0x428b0843, |
Pawel Zarembski |
0:01f31e923fe2 | 60 | 0x0903d374, 0xd35f428b, 0x428b0a03, 0x0b03d344, 0xd328428b, 0x428b0c03, 0x22ffd30d, 0xba120209, |
Pawel Zarembski |
0:01f31e923fe2 | 61 | 0x428b0c03, 0x1212d302, 0xd0650209, 0x428b0b03, 0xe000d319, 0x0bc30a09, 0xd301428b, 0x1ac003cb, |
Pawel Zarembski |
0:01f31e923fe2 | 62 | 0x0b834152, 0xd301428b, 0x1ac0038b, 0x0b434152, 0xd301428b, 0x1ac0034b, 0x0b034152, 0xd301428b, |
Pawel Zarembski |
0:01f31e923fe2 | 63 | 0x1ac0030b, 0x0ac34152, 0xd301428b, 0x1ac002cb, 0x0a834152, 0xd301428b, 0x1ac0028b, 0x0a434152, |
Pawel Zarembski |
0:01f31e923fe2 | 64 | 0xd301428b, 0x1ac0024b, 0x0a034152, 0xd301428b, 0x1ac0020b, 0xd2cd4152, 0x428b09c3, 0x01cbd301, |
Pawel Zarembski |
0:01f31e923fe2 | 65 | 0x41521ac0, 0x428b0983, 0x018bd301, 0x41521ac0, 0x428b0943, 0x014bd301, 0x41521ac0, 0x428b0903, |
Pawel Zarembski |
0:01f31e923fe2 | 66 | 0x010bd301, 0x41521ac0, 0x428b08c3, 0x00cbd301, 0x41521ac0, 0x428b0883, 0x008bd301, 0x41521ac0, |
Pawel Zarembski |
0:01f31e923fe2 | 67 | 0x428b0843, 0x004bd301, 0x41521ac0, 0xd2001a41, 0x41524601, 0x47704610, 0x0fcae05d, 0x4249d000, |
Pawel Zarembski |
0:01f31e923fe2 | 68 | 0xd3001003, 0x40534240, 0x469c2200, 0x428b0903, 0x0a03d32d, 0xd312428b, 0x018922fc, 0x0a03ba12, |
Pawel Zarembski |
0:01f31e923fe2 | 69 | 0xd30c428b, 0x11920189, 0xd308428b, 0x11920189, 0xd304428b, 0xd03a0189, 0xe0001192, 0x09c30989, |
Pawel Zarembski |
0:01f31e923fe2 | 70 | 0xd301428b, 0x1ac001cb, 0x09834152, 0xd301428b, 0x1ac0018b, 0x09434152, 0xd301428b, 0x1ac0014b, |
Pawel Zarembski |
0:01f31e923fe2 | 71 | 0x09034152, 0xd301428b, 0x1ac0010b, 0x08c34152, 0xd301428b, 0x1ac000cb, 0x08834152, 0xd301428b, |
Pawel Zarembski |
0:01f31e923fe2 | 72 | 0x1ac0008b, 0xd2d94152, 0x428b0843, 0x004bd301, 0x41521ac0, 0xd2001a41, 0x46634601, 0x105b4152, |
Pawel Zarembski |
0:01f31e923fe2 | 73 | 0xd3014610, 0x2b004240, 0x4249d500, 0x46634770, 0xd300105b, 0xb5014240, 0x46c02000, 0xbd0246c0, |
Pawel Zarembski |
0:01f31e923fe2 | 74 | 0x40020004, 0x00000000, 0x00000000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, 0x00000000, |
Pawel Zarembski |
0:01f31e923fe2 | 75 | 0x00800000, 0x00000000, |
Pawel Zarembski |
0:01f31e923fe2 | 76 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 77 | |
Pawel Zarembski |
0:01f31e923fe2 | 78 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 79 | * List of start and size for each size of flash sector |
Pawel Zarembski |
0:01f31e923fe2 | 80 | * The size will apply to all sectors between the listed address and the next address |
Pawel Zarembski |
0:01f31e923fe2 | 81 | * in the list. |
Pawel Zarembski |
0:01f31e923fe2 | 82 | * The last pair in the list will have sectors starting at that address and ending |
Pawel Zarembski |
0:01f31e923fe2 | 83 | * at address start + size. |
Pawel Zarembski |
0:01f31e923fe2 | 84 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 85 | static const sector_info_t sectors_info[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 86 | {0, 1024}, |
Pawel Zarembski |
0:01f31e923fe2 | 87 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 88 | |
Pawel Zarembski |
0:01f31e923fe2 | 89 | static const program_target_t flash = { |
Pawel Zarembski |
0:01f31e923fe2 | 90 | 0x20000021, // Init |
Pawel Zarembski |
0:01f31e923fe2 | 91 | 0x20000049, // UnInit |
Pawel Zarembski |
0:01f31e923fe2 | 92 | 0x2000004D, // EraseChip |
Pawel Zarembski |
0:01f31e923fe2 | 93 | 0x20000075, // EraseSector |
Pawel Zarembski |
0:01f31e923fe2 | 94 | 0x200000A7, // ProgramPage |
Pawel Zarembski |
0:01f31e923fe2 | 95 | 0x0, // Verify |
Pawel Zarembski |
0:01f31e923fe2 | 96 | |
Pawel Zarembski |
0:01f31e923fe2 | 97 | // breakpoint = RAM start + 1 |
Pawel Zarembski |
0:01f31e923fe2 | 98 | // RSB : base address is address of Execution Region PrgData in map file |
Pawel Zarembski |
0:01f31e923fe2 | 99 | // to access global/static data |
Pawel Zarembski |
0:01f31e923fe2 | 100 | // RSP : Initial stack pointer |
Pawel Zarembski |
0:01f31e923fe2 | 101 | { |
Pawel Zarembski |
0:01f31e923fe2 | 102 | 0x20000001, // breakpoint instruction address |
Pawel Zarembski |
0:01f31e923fe2 | 103 | 0x20000000 + 0x20 + 0x624, // static base register value (image start + header + static base offset) |
Pawel Zarembski |
0:01f31e923fe2 | 104 | 0x20000800 // initial stack pointer |
Pawel Zarembski |
0:01f31e923fe2 | 105 | }, |
Pawel Zarembski |
0:01f31e923fe2 | 106 | |
Pawel Zarembski |
0:01f31e923fe2 | 107 | 0x20000a00, // program_buffer, any valid RAM location with +512 bytes of headroom |
Pawel Zarembski |
0:01f31e923fe2 | 108 | 0x20000000, // algo_start, start of RAM |
Pawel Zarembski |
0:01f31e923fe2 | 109 | sizeof(KL28Z_FLM), // algo_size, size of array above |
Pawel Zarembski |
0:01f31e923fe2 | 110 | KL28Z_FLM, // image, flash algo instruction array |
Pawel Zarembski |
0:01f31e923fe2 | 111 | 512 // program_buffer_size, largest size that can be written in a single call to program page |
Pawel Zarembski |
0:01f31e923fe2 | 112 | }; |