Hi,
I am now working on embeded system project with external flash SST39VF1601. (CPU: lpc22xx). Since the OpenOCD now doesn’t support this type of flash, I am trying to make it. SST39VF1601, whose vendor is silicon storage technology, is CFI compatible, but uses some different commands. Now, I can read the CFI query table and erase the chip. I am not sure how to write the cfi_sst_write_block() function(I named it according to cfi_intel_write_block()).
I don’t know the functions of the following arrays. I think they are some codes, and can be created with GCC. I also refered to another pacth supporting atmel flash, and there are some differences between them. My question is which registers I shall use. Would someone explain more to me please?
I think they are copying(or writing) some data from one place to another, but I don’t know what are the source and destination.
Original version:
u32 word_32_code = {
0xe4904004, /* loop: ldr r4, [r0], #4 */
0xe5813000, /* str r3, [r1] */
0xe5814000, /* str r4, [r1] */
0xe5914000, /* busy ldr r4, [r1] */
0xe3140080, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe314007f, /* tst r4, #0x7f */
0x1a000003, /* bne done */
0xe2522001, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2811004, /* add r1, r1 #4 */
0xeafffff3, /* b loop */
0xeafffffe, /* done: b -2 */
};
u32 word_16_code = {
0xe0d040b2, /* loop: ldrh r4, [r0], #2 */
0xe1c130b0, /* strh r3, [r1] */
0xe1c140b0, /* strh r4, [r1] */
0xe1d140b0, /* busy ldrh r4, [r1] */
0xe3140080, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe314007f, /* tst r4, #0x7f */
0x1a000003, /* bne done */
0xe2522001, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2811002, /* add r1, r1 #2 */
0xeafffff3, /* b loop */
0xeafffffe, /* done: b -2 */
};
u32 word_8_code = {
0xe4d04001, /* loop: ldrb r4, [r0], #1 */
0xe5c13000, /* strb r3, [r1] */
0xe5c14000, /* strb r4, [r1] */
0xe5d14000, /* busy ldrb r4, [r1] */
0xe3140080, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe314007f, /* tst r4, #0x7f */
0x1a000003, /* bne done */
0xe2522001, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2811001, /* add r1, r1 #1 */
0xeafffff3, /* b loop */
0xeafffffe, /* done: b -2 */
};
Atmel Flash supported version:
u32 word_32_code = {
0xe7085076, /* loop: str r5, [r7,r6] /* base+0x555=0xaa */
0xe1aa5005, /* mov r5, r5, lsr #1 /* r5=0x55 */
0xe18a6006, /* mov r6, r6, lsl #1 /* r6=0xaaa */
0xe7085076, /* str r5, [r7,r6] /* base+0xaaa=0x55 */
0xe18a5005, /* mov r5, r5, lsl #1 /* r5=0xaa */
0xe1aa6006, /* mov r6, r6, lsr #1 /* r6=0x555 */
0xe7083076, /* str r3, [r7,r6] /* base+0x555=0xa0 */
0xe4094004, /* ldr r4, [r0], #4 */
0xe5084010, /* str r4, [r1] */
0xe5094010, /* busy ldr r4, [r1] */
0xe3810040, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe3210048, /* tst r4, #0x28 */
0x1a000003, /* bne done */
0xe2052021, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2081014, /* add r1, r1 #4 */
0xeaffffed, /* b loop */
0xeafffffe, /* done: b -2 */
};
u32 word_16_code = {
0xe18750b6, /* loop: strh r5, [r7,r6] /* base+0x555=0xaa */
0xe1a050a5, /* mov r5, r5, lsr #1 /* r5=0x55 */
0xe1a06086, /* mov r6, r6, lsl #1 /* r6=0xaaa */
0xe18750b6, /* strh r5, [r7,r6] /* base+0xaaa=0x55 */
0xe1a05085, /* mov r5, r5, lsl #1 /* r5=0xaa */
0xe1a060a6, /* mov r6, r6, lsr #1 /* r6=0x555 */
0xe18730b6, /* strh r3, [r7,r6] /* base+0x555=0xa0 */
0xe0d040b2, /* ldrh r4, [r0], #2 */
0xe1c140b0, /* strh r4, [r1] */
0xe1d140b0, /* busy ldrh r4, [r1] */
0xe3140080, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe3140028, /* tst r4, #0x28 */
0x1a000003, /* bne done */
0xe2522001, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2811002, /* add r1, r1 #2 */
0xeaffffed, /* b loop */
0xeafffffe, /* done: b -2 */
};
u32 word_8_code = {
0xe7c75006, /* loop: strb r5, [r7,r6] /* base+0x555=0xaa */
0xe1a050a5, /* mov r5, r5, lsr #1 /* r5=0x55 */
0xe1a06086, /* mov r6, r6, lsl #1 /* r6=0xaaa */
0xe7c75006, /* strb r5, [r7,r6] /* base+0xaaa=0x55 */
0xe1a05085, /* mov r5, r5, lsl #1 /* r5=0xaa */
0xe1a060a6, /* mov r6, r6, lsr #1 /* r6=0x555 */
0xe7c73006, /* strb r3, [r7,r6] /* base+0x555=0xa0 */
0xe4d04001, /* ldrb r4, [r0], #1 */
0xe5c14000, /* strb r4, [r1] */
0xe5d14000, /* busy ldrb r4, [r1] */
0xe3140080, /* tst r4, #0x80 */
0x0afffffc, /* beq busy */
0xe3140028, /* tst r4, #0x28 */
0x1a000003, /* bne done */
0xe2522001, /* subs r2, r2, #1 */
0x0a000001, /* beq done */
0xe2811001, /* add r1, r1 #1 */
0xeaffffed, /* b loop */
0xeafffffe, /* done: b -2 */
};
Thanks and regards,
Kevin