diff --git a/contrib/loaders/flash/lpcspifi_write.S b/contrib/loaders/flash/lpcspifi_write.S index d47129769..8435a2045 100644 --- a/contrib/loaders/flash/lpcspifi_write.S +++ b/contrib/loaders/flash/lpcspifi_write.S @@ -39,6 +39,17 @@ * r11 - current page end address */ +/* + * This code is embedded within: src/flash/nor/lpcspifi.c as a "C" array. + * + * To rebuild: + * arm-none-eabi-gcc -c lpcspifi_write.S + * arm-none-eabi-objcopy -O binary lpcspifi_write.o lpcspifi_write.bin + * xxd -c 8 -i lpcspifi_write.bin > lpcspifi_write.txt + * + * Then read and edit this result into the "C" source. + */ + #define SSP_BASE_HIGH 0x4008 #define SSP_BASE_LOW 0x3000 #define SSP_CR0_OFFSET 0x00 @@ -204,6 +215,7 @@ error: movs r0, #0 str r0, [r2, #4] /* set rp = 0 on error */ exit: + bl cs_up /* end the command before returning */ mov r0, r6 bkpt #0x00 diff --git a/src/flash/nor/lpcspifi.c b/src/flash/nor/lpcspifi.c index 7355c30a9..3b383ebd9 100644 --- a/src/flash/nor/lpcspifi.c +++ b/src/flash/nor/lpcspifi.c @@ -688,7 +688,8 @@ static int lpcspifi_write(struct flash_bank *bank, const uint8_t *buffer, 0x00, 0xf0, 0x02, 0xb8, 0x4f, 0xf0, 0x00, 0x08, 0x4f, 0xf4, 0x80, 0x4a, 0xc4, 0xf2, 0x0f, 0x0a, 0xca, 0xf8, 0xab, 0x80, 0x70, 0x47, 0x00, 0x20, - 0x50, 0x60, 0x30, 0x46, 0x00, 0xbe, 0xff, 0xff + 0x50, 0x60, 0xff, 0xf7, 0xef, 0xff, 0x30, 0x46, + 0x00, 0xbe, 0xff, 0xff }; if (target_alloc_working_area(target, sizeof(lpcspifi_flash_write_code),