コメントはC:/Keil/ARM/Flash/LPC_IAP/FlashPrg.c に合わせました。
・セクター0を書き込むときにはベクターテーブルのチェックサムを再計算している。
・Code Read Protectionのコードは書き込まないようにしている。
pc_program_page 0x100000EC B5F8 PUSH {r3-r7,lr} 0x100000EE 0006 MOVS r6,r0 0x100000F0 4614 MOV r4,r2 0x100000F2 D11E BNE 0x10000132 0x100000F4 200B MOVS r0,#0x0B 0x100000F6 0180 LSLS r0,r0,#6 0x100000F8 1820 ADDS r0,r4,r0 0x100000FA 6BC1 LDR r1,[r0,#0x3C] ; 0x000002fc Code Read Protection 0x100000FC 4823 LDR r0,[pc,#140] ; @0x1000018C =0x4e697370 =NO_ISP 0x100000FE 4281 CMP r1,r0 0x10000100 D038 BEQ 0x10000174 0x10000102 4823 LDR r0,[pc,#140] ; @0x10000190 =0x12345678 =CRP1 0x10000104 4281 CMP r1,r0 0x10000106 D035 BEQ 0x10000174 0x10000108 4822 LDR r0,[pc,#136] ; @0x10000194 =0x87654321 =CRP2 0x1000010A 4281 CMP r1,r0 0x1000010C D032 BEQ 0x10000174 0x1000010E 4822 LDR r0,[pc,#136] ; @0x10000198 =0x43218765 =CRP3 0x10000110 4281 CMP r1,r0 0x10000112 D02F BEQ 0x10000174 0x10000114 6861 LDR r1,[r4,#0x04] 0x10000116 6820 LDR r0,[r4,#0x00] 0x10000118 68E2 LDR r2,[r4,#0x0C] 0x1000011A 1840 ADDS r0,r0,r1 0x1000011C 68A1 LDR r1,[r4,#0x08] 0x1000011E 1889 ADDS r1,r1,r2 0x10000120 1840 ADDS r0,r0,r1 0x10000122 6921 LDR r1,[r4,#0x10] 0x10000124 1840 ADDS r0,r0,r1 0x10000126 6961 LDR r1,[r4,#0x14] 0x10000128 1840 ADDS r0,r0,r1 0x1000012A 69A1 LDR r1,[r4,#0x18] 0x1000012C 1840 ADDS r0,r0,r1 0x1000012E 4240 RSBS r0,r0,#0 0x10000130 61E0 STR r0,[r4,#0x1C] 0x10000132 4D14 LDR r5,[pc,#80] ; @0x10000184 =8 0x10000134 0B30 LSRS r0,r6,#12 0x10000136 444D ADD r5,r5,r9 0x10000138 2132 MOVS r1,#0x32 ; Prepare Sector for Write 0x1000013A 6068 STR r0,[r5,#0x04]; Start Sector 0x1000013C 6029 STR r1,[r5,#0x00] 0x1000013E 60A8 STR r0,[r5,#0x08]; End Sector 0x10000140 4629 MOV r1,r5 0x10000142 3114 ADDS r1,r1,#0x14 0x10000144 4F10 LDR r7,[pc,#64] ; @0x10000188 =0x1fff1ff1 0x10000146 4628 MOV r0,r5 0x10000148 9100 STR r1,[sp,#0x00] 0x1000014A 47B8 BLX r7 ; Call IAP Command 0x1000014C 6968 LDR r0,[r5,#0x14]; IAP.stat 0x1000014E 2800 CMP r0,#0x00 ; Command Failed ? 0x10000150 D110 BNE 0x10000174 0x10000152 606E STR r6,[r5,#0x04] 0x10000154 2033 MOVS r0,#0x33 ; Copy RAM to Flash 0x10000156 60AC STR r4,[r5,#0x08] 0x10000158 6028 STR r0,[r5,#0x00] 0x1000015A 2001 MOVS r0,#0x01 0x1000015C 0280 LSLS r0,r0,#10 0x1000015E 60E8 STR r0,[r5,#0x0C] 0x10000160 4806 LDR r0,[pc,#24] ; @0x1000017C =4 0x10000162 4448 ADD r0,r0,r9 0x10000164 6800 LDR r0,[r0,#0x00] 0x10000166 6128 STR r0,[r5,#0x10]; CCLK in kHz 0x10000168 4628 MOV r0,r5 ; &IAP.cmd 0x1000016A 9900 LDR r1,[sp,#0x00]; &IAP.stat 0x1000016C 47B8 BLX r7 ; Call IAP Command 0x1000016E 6968 LDR r0,[r5,#0x14] 0x10000170 2800 CMP r0,#0x00 0x10000172 D000 BEQ 0x10000176 0x10000174 2001 MOVS r0,#0x01 0x10000176 BDF8 POP {r3-r7,pc}
(2013/8/22)
---
0 件のコメント:
コメントを投稿