Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/family/nuvoton/m263kiaae/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 | /* Flash OS Routines (Automagically Generated) |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * Copyright (c) 2009-2019 ARM Limited |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * you may not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 15 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 16 | |
Pawel Zarembski |
0:01f31e923fe2 | 17 | static const uint32_t M261_AP_512_flash_prog_blob[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 18 | 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, |
Pawel Zarembski |
0:01f31e923fe2 | 19 | 0xb087b5b0, 0x460c4613, 0x90054605, 0x92039104, 0x94019302, 0xe7ff9500, 0x6800481f, 0x42082101, |
Pawel Zarembski |
0:01f31e923fe2 | 20 | 0xe7ffd001, 0x481de7f8, 0x22406801, 0x60014311, 0x491b9805, 0x98046008, 0x6008491a, 0x28009803, |
Pawel Zarembski |
0:01f31e923fe2 | 21 | 0xe7ffd105, 0x43c02000, 0x60084917, 0x4816e003, 0x60014916, 0x4816e7ff, 0x60012101, 0x8f6ff3bf, |
Pawel Zarembski |
0:01f31e923fe2 | 22 | 0x480de7ff, 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x6800480a, 0x42082140, 0xe7ffd008, 0x68014807, |
Pawel Zarembski |
0:01f31e923fe2 | 23 | 0x43112240, 0x20016001, 0xe0029006, 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x4000c0c0, 0x4000c000, |
Pawel Zarembski |
0:01f31e923fe2 | 24 | 0x4000c00c, 0x4000c004, 0x4000c008, 0x0055aa03, 0x4000c010, 0xb087b5b0, 0x460c4613, 0x90054605, |
Pawel Zarembski |
0:01f31e923fe2 | 25 | 0x92039104, 0x2159481d, 0x21166001, 0x21886001, 0x68006001, 0x42082101, 0x94019302, 0xd1039500, |
Pawel Zarembski |
0:01f31e923fe2 | 26 | 0x2001e7ff, 0xe0269006, 0x68014815, 0x43112204, 0x48146001, 0x43116801, 0xe7ff6001, 0x68004812, |
Pawel Zarembski |
0:01f31e923fe2 | 27 | 0x42082110, 0xe7ffd101, 0x4810e7f8, 0x22016801, 0x60014311, 0x600a490e, 0x42106800, 0xe7ffd103, |
Pawel Zarembski |
0:01f31e923fe2 | 28 | 0x90062001, 0x4809e007, 0x22406801, 0x60014311, 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x40000100, |
Pawel Zarembski |
0:01f31e923fe2 | 29 | 0x40000200, 0x40000204, 0x40000250, 0x4000c000, 0x4000c01c, 0x4601b082, 0x91009001, 0x4809e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 30 | 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x68014806, 0x43912201, 0x48056001, 0x60012100, 0xb0024608, |
Pawel Zarembski |
0:01f31e923fe2 | 31 | 0x46c04770, 0x4000c0c0, 0x4000c000, 0x4000c01c, 0xb084b580, 0x90034601, 0x22019803, 0x43980713, |
Pawel Zarembski |
0:01f31e923fe2 | 32 | 0x98039003, 0x40184b0e, 0x98039003, 0x051b230f, 0x05524018, 0x91014290, 0xe7ffd107, 0x49099803, |
Pawel Zarembski |
0:01f31e923fe2 | 33 | 0x90031840, 0x90022001, 0x2000e002, 0xe7ff9002, 0x9a029903, 0xf7ff2022, 0xb004ff13, 0x46c0bd80, |
Pawel Zarembski |
0:01f31e923fe2 | 34 | 0xfffff800, 0xffe00000, 0xb086b580, 0x4603460a, 0x91039004, 0x90022000, 0x93009201, 0x9802e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 35 | 0x42889903, 0xe7ffd20f, 0x99029804, 0x92021c4a, 0x58400089, 0xffbcf7ff, 0xd0032800, 0x2001e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 36 | 0xe0039005, 0x2000e7eb, 0xe7ff9005, 0xb0069805, 0x46c0bd80, 0xb087b5b0, 0x460c4613, 0x90054605, |
Pawel Zarembski |
0:01f31e923fe2 | 37 | 0x92039104, 0x1cc09804, 0x43882103, 0x98059004, 0x07092101, 0x90054388, 0x94019302, 0xe7ff9500, |
Pawel Zarembski |
0:01f31e923fe2 | 38 | 0x68004822, 0x42082101, 0xe7ffd001, 0x4820e7f8, 0x22406801, 0x60014311, 0x2121481e, 0xe7ff6001, |
Pawel Zarembski |
0:01f31e923fe2 | 39 | 0x28009804, 0xe7ffd02c, 0x491b9805, 0x98036008, 0x491a6800, 0x481a6008, 0x60012101, 0x8f6ff3bf, |
Pawel Zarembski |
0:01f31e923fe2 | 40 | 0x4812e7ff, 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x6800480f, 0x42082140, 0xe7ffd008, 0x6801480c, |
Pawel Zarembski |
0:01f31e923fe2 | 41 | 0x43112240, 0x20016001, 0xe00c9006, 0x1d009805, 0x98039005, 0x90031d00, 0x1f009804, 0xe7cf9004, |
Pawel Zarembski |
0:01f31e923fe2 | 42 | 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x4000c0c0, 0x4000c000, 0x4000c00c, 0x4000c004, 0x4000c008, |
Pawel Zarembski |
0:01f31e923fe2 | 43 | 0x4000c010, 0xb088b5b0, 0x460c4613, 0x90064605, 0x92049105, 0x1cc09805, 0x43882103, 0x98069005, |
Pawel Zarembski |
0:01f31e923fe2 | 44 | 0x07092101, 0x90034008, 0x43889806, 0x93029006, 0x95009401, 0x4826e7ff, 0x21016800, 0xd0014208, |
Pawel Zarembski |
0:01f31e923fe2 | 45 | 0xe7f8e7ff, 0x68014823, 0x43112240, 0x48226001, 0x60012100, 0x9805e7ff, 0xd0322800, 0x9806e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 46 | 0x6008491e, 0x2101481e, 0xf3bf6001, 0xe7ff8f6f, 0x68004817, 0x42082101, 0xe7ffd001, 0x4815e7f8, |
Pawel Zarembski |
0:01f31e923fe2 | 47 | 0x21406800, 0xd0084208, 0x4812e7ff, 0x22406801, 0x60014311, 0x90072001, 0x4812e016, 0x99046800, |
Pawel Zarembski |
0:01f31e923fe2 | 48 | 0x42886809, 0xe7ffd003, 0x90072001, 0x9806e00c, 0x90061d00, 0x1d009804, 0x98059004, 0x90051f00, |
Pawel Zarembski |
0:01f31e923fe2 | 49 | 0x2000e7c9, 0xe7ff9007, 0xb0089807, 0x46c0bdb0, 0x4000c0c0, 0x4000c000, 0x4000c00c, 0x4000c004, |
Pawel Zarembski |
0:01f31e923fe2 | 50 | 0x4000c010, 0x4000c008, 0x00000000 |
Pawel Zarembski |
0:01f31e923fe2 | 51 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 52 | |
Pawel Zarembski |
0:01f31e923fe2 | 53 | static const uint32_t M261_LD_4_flash_prog_blob[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 54 | 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, |
Pawel Zarembski |
0:01f31e923fe2 | 55 | 0xb087b5b0, 0x460c4613, 0x90054605, 0x92039104, 0x94019302, 0xe7ff9500, 0x6800481f, 0x42082101, |
Pawel Zarembski |
0:01f31e923fe2 | 56 | 0xe7ffd001, 0x481de7f8, 0x22406801, 0x60014311, 0x491b9805, 0x98046008, 0x6008491a, 0x28009803, |
Pawel Zarembski |
0:01f31e923fe2 | 57 | 0xe7ffd105, 0x43c02000, 0x60084917, 0x4816e003, 0x60014916, 0x4816e7ff, 0x60012101, 0x8f6ff3bf, |
Pawel Zarembski |
0:01f31e923fe2 | 58 | 0x480de7ff, 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x6800480a, 0x42082140, 0xe7ffd008, 0x68014807, |
Pawel Zarembski |
0:01f31e923fe2 | 59 | 0x43112240, 0x20016001, 0xe0029006, 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x4000c0c0, 0x4000c000, |
Pawel Zarembski |
0:01f31e923fe2 | 60 | 0x4000c00c, 0x4000c004, 0x4000c008, 0x0055aa03, 0x4000c010, 0xb087b5b0, 0x460c4613, 0x90054605, |
Pawel Zarembski |
0:01f31e923fe2 | 61 | 0x92039104, 0x2159481d, 0x21166001, 0x21886001, 0x68006001, 0x42082101, 0x94019302, 0xd1039500, |
Pawel Zarembski |
0:01f31e923fe2 | 62 | 0x2001e7ff, 0xe0269006, 0x68014815, 0x43112204, 0x48146001, 0x43116801, 0xe7ff6001, 0x68004812, |
Pawel Zarembski |
0:01f31e923fe2 | 63 | 0x42082110, 0xe7ffd101, 0x4810e7f8, 0x22016801, 0x60014311, 0x600a490e, 0x42106800, 0xe7ffd103, |
Pawel Zarembski |
0:01f31e923fe2 | 64 | 0x90062001, 0x4809e007, 0x22406801, 0x60014311, 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x40000100, |
Pawel Zarembski |
0:01f31e923fe2 | 65 | 0x40000200, 0x40000204, 0x40000250, 0x4000c000, 0x4000c01c, 0x4601b082, 0x91009001, 0x4809e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 66 | 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x68014806, 0x43912201, 0x48056001, 0x60012100, 0xb0024608, |
Pawel Zarembski |
0:01f31e923fe2 | 67 | 0x46c04770, 0x4000c0c0, 0x4000c000, 0x4000c01c, 0xb084b580, 0x90034601, 0x22019803, 0x43980713, |
Pawel Zarembski |
0:01f31e923fe2 | 68 | 0x98039003, 0x40184b0e, 0x98039003, 0x051b230f, 0x05524018, 0x91014290, 0xe7ffd107, 0x49099803, |
Pawel Zarembski |
0:01f31e923fe2 | 69 | 0x90031840, 0x90022001, 0x2000e002, 0xe7ff9002, 0x9a029903, 0xf7ff2022, 0xb004ff13, 0x46c0bd80, |
Pawel Zarembski |
0:01f31e923fe2 | 70 | 0xfffff800, 0xffe00000, 0xb086b580, 0x4603460a, 0x91039004, 0x90022000, 0x93009201, 0x9802e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 71 | 0x42889903, 0xe7ffd20f, 0x99029804, 0x92021c4a, 0x58400089, 0xffbcf7ff, 0xd0032800, 0x2001e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 72 | 0xe0039005, 0x2000e7eb, 0xe7ff9005, 0xb0069805, 0x46c0bd80, 0xb087b5b0, 0x460c4613, 0x90054605, |
Pawel Zarembski |
0:01f31e923fe2 | 73 | 0x92039104, 0x1cc09804, 0x43882103, 0x98059004, 0x07092101, 0x90054388, 0x94019302, 0xe7ff9500, |
Pawel Zarembski |
0:01f31e923fe2 | 74 | 0x68004822, 0x42082101, 0xe7ffd001, 0x4820e7f8, 0x22406801, 0x60014311, 0x2121481e, 0xe7ff6001, |
Pawel Zarembski |
0:01f31e923fe2 | 75 | 0x28009804, 0xe7ffd02c, 0x491b9805, 0x98036008, 0x491a6800, 0x481a6008, 0x60012101, 0x8f6ff3bf, |
Pawel Zarembski |
0:01f31e923fe2 | 76 | 0x4812e7ff, 0x21016800, 0xd0014208, 0xe7f8e7ff, 0x6800480f, 0x42082140, 0xe7ffd008, 0x6801480c, |
Pawel Zarembski |
0:01f31e923fe2 | 77 | 0x43112240, 0x20016001, 0xe00c9006, 0x1d009805, 0x98039005, 0x90031d00, 0x1f009804, 0xe7cf9004, |
Pawel Zarembski |
0:01f31e923fe2 | 78 | 0x90062000, 0x9806e7ff, 0xbdb0b007, 0x4000c0c0, 0x4000c000, 0x4000c00c, 0x4000c004, 0x4000c008, |
Pawel Zarembski |
0:01f31e923fe2 | 79 | 0x4000c010, 0xb088b5b0, 0x460c4613, 0x90064605, 0x92049105, 0x1cc09805, 0x43882103, 0x98069005, |
Pawel Zarembski |
0:01f31e923fe2 | 80 | 0x07092101, 0x90034008, 0x43889806, 0x93029006, 0x95009401, 0x4826e7ff, 0x21016800, 0xd0014208, |
Pawel Zarembski |
0:01f31e923fe2 | 81 | 0xe7f8e7ff, 0x68014823, 0x43112240, 0x48226001, 0x60012100, 0x9805e7ff, 0xd0322800, 0x9806e7ff, |
Pawel Zarembski |
0:01f31e923fe2 | 82 | 0x6008491e, 0x2101481e, 0xf3bf6001, 0xe7ff8f6f, 0x68004817, 0x42082101, 0xe7ffd001, 0x4815e7f8, |
Pawel Zarembski |
0:01f31e923fe2 | 83 | 0x21406800, 0xd0084208, 0x4812e7ff, 0x22406801, 0x60014311, 0x90072001, 0x4812e016, 0x99046800, |
Pawel Zarembski |
0:01f31e923fe2 | 84 | 0x42886809, 0xe7ffd003, 0x90072001, 0x9806e00c, 0x90061d00, 0x1d009804, 0x98059004, 0x90051f00, |
Pawel Zarembski |
0:01f31e923fe2 | 85 | 0x2000e7c9, 0xe7ff9007, 0xb0089807, 0x46c0bdb0, 0x4000c0c0, 0x4000c000, 0x4000c00c, 0x4000c004, |
Pawel Zarembski |
0:01f31e923fe2 | 86 | 0x4000c010, 0x4000c008, 0x00000000 |
Pawel Zarembski |
0:01f31e923fe2 | 87 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 88 | |
Pawel Zarembski |
0:01f31e923fe2 | 89 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 90 | * List of start and size for each size of flash sector - even indexes are start, odd are size |
Pawel Zarembski |
0:01f31e923fe2 | 91 | * The size will apply to all sectors between the listed address and the next address |
Pawel Zarembski |
0:01f31e923fe2 | 92 | * in the list. |
Pawel Zarembski |
0:01f31e923fe2 | 93 | * The last pair in the list will have sectors starting at that address and ending |
Pawel Zarembski |
0:01f31e923fe2 | 94 | * at address flash_start + flash_size. |
Pawel Zarembski |
0:01f31e923fe2 | 95 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 96 | static const sector_info_t sectors_info[] = { |
Pawel Zarembski |
0:01f31e923fe2 | 97 | { 0x00000000, 0x00000800 }, |
Pawel Zarembski |
0:01f31e923fe2 | 98 | { 0x00100000, 0x00000800 }, |
Pawel Zarembski |
0:01f31e923fe2 | 99 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 100 | |
Pawel Zarembski |
0:01f31e923fe2 | 101 | static const program_target_t M261_AP_512_flash = { |
Pawel Zarembski |
0:01f31e923fe2 | 102 | 0x200000d5, // Init |
Pawel Zarembski |
0:01f31e923fe2 | 103 | 0x20000175, // UnInit |
Pawel Zarembski |
0:01f31e923fe2 | 104 | 0x0, // EraseChip |
Pawel Zarembski |
0:01f31e923fe2 | 105 | 0x200001b1, // EraseSector |
Pawel Zarembski |
0:01f31e923fe2 | 106 | 0x20000255, // ProgramPage |
Pawel Zarembski |
0:01f31e923fe2 | 107 | 0x20000325, // Verify |
Pawel Zarembski |
0:01f31e923fe2 | 108 | |
Pawel Zarembski |
0:01f31e923fe2 | 109 | // BKPT : start of blob + 1 |
Pawel Zarembski |
0:01f31e923fe2 | 110 | // RSB : blob start + header + rw data offset |
Pawel Zarembski |
0:01f31e923fe2 | 111 | // RSP : stack pointer |
Pawel Zarembski |
0:01f31e923fe2 | 112 | { |
Pawel Zarembski |
0:01f31e923fe2 | 113 | 0x20000001, |
Pawel Zarembski |
0:01f31e923fe2 | 114 | 0x20000408, |
Pawel Zarembski |
0:01f31e923fe2 | 115 | 0x20000700 |
Pawel Zarembski |
0:01f31e923fe2 | 116 | }, |
Pawel Zarembski |
0:01f31e923fe2 | 117 | |
Pawel Zarembski |
0:01f31e923fe2 | 118 | 0x20000000 + 0x00000A00, // mem buffer location |
Pawel Zarembski |
0:01f31e923fe2 | 119 | 0x20000000, // location to write prog_blob in target RAM |
Pawel Zarembski |
0:01f31e923fe2 | 120 | sizeof(M261_AP_512_flash_prog_blob), // prog_blob size |
Pawel Zarembski |
0:01f31e923fe2 | 121 | M261_AP_512_flash_prog_blob, // address of prog_blob |
Pawel Zarembski |
0:01f31e923fe2 | 122 | 0x00000800 // ram_to_flash_bytes_to_be_written |
Pawel Zarembski |
0:01f31e923fe2 | 123 | }; |
Pawel Zarembski |
0:01f31e923fe2 | 124 | |
Pawel Zarembski |
0:01f31e923fe2 | 125 | static const program_target_t M261_LD_4_flash = { |
Pawel Zarembski |
0:01f31e923fe2 | 126 | 0x200000d5, // Init |
Pawel Zarembski |
0:01f31e923fe2 | 127 | 0x20000175, // UnInit |
Pawel Zarembski |
0:01f31e923fe2 | 128 | 0x0, // EraseChip |
Pawel Zarembski |
0:01f31e923fe2 | 129 | 0x200001b1, // EraseSector |
Pawel Zarembski |
0:01f31e923fe2 | 130 | 0x20000255, // ProgramPage |
Pawel Zarembski |
0:01f31e923fe2 | 131 | 0x20000325, // Verify |
Pawel Zarembski |
0:01f31e923fe2 | 132 | |
Pawel Zarembski |
0:01f31e923fe2 | 133 | // BKPT : start of blob + 1 |
Pawel Zarembski |
0:01f31e923fe2 | 134 | // RSB : blob start + header + rw data offset |
Pawel Zarembski |
0:01f31e923fe2 | 135 | // RSP : stack pointer |
Pawel Zarembski |
0:01f31e923fe2 | 136 | { |
Pawel Zarembski |
0:01f31e923fe2 | 137 | 0x20000001, |
Pawel Zarembski |
0:01f31e923fe2 | 138 | 0x20000408, |
Pawel Zarembski |
0:01f31e923fe2 | 139 | 0x20000700 |
Pawel Zarembski |
0:01f31e923fe2 | 140 | }, |
Pawel Zarembski |
0:01f31e923fe2 | 141 | |
Pawel Zarembski |
0:01f31e923fe2 | 142 | 0x20000000 + 0x00000A00, // mem buffer location |
Pawel Zarembski |
0:01f31e923fe2 | 143 | 0x20000000, // location to write prog_blob in target RAM |
Pawel Zarembski |
0:01f31e923fe2 | 144 | sizeof(M261_LD_4_flash_prog_blob), // prog_blob size |
Pawel Zarembski |
0:01f31e923fe2 | 145 | M261_LD_4_flash_prog_blob, // address of prog_blob |
Pawel Zarembski |
0:01f31e923fe2 | 146 | 0x00000800 // ram_to_flash_bytes_to_be_written |
Pawel Zarembski |
0:01f31e923fe2 | 147 | }; |