Hi, Recently, I've got a new toy, CY8CKIT-059, which is a PSoC 5LP based dev kit. Naturally, I've launched the latest openocd with "interface kitprog" to see how well it works.
It sort of works. I can see CPU registers, read/write memories and flash memory. Unfortunately, it doesn't seem to "program" a PSoC Creator generated .hex file. OpenOCD probes Flash, EEPROM and NV Latch flash. But It fails with the following error message: ,---- | ** Programming Started ** | Warn : no flash bank found for address 0x80000000 | Warn : There is no erase operation for NV Latches | Error: failed erasing sectors 0 to 0 | ** Programming Failed ** `---- The first warning is about accessing 0x8000_0000. 0x8000_0000 seems to be the Flash ECC region. A quote from "PSoC 5LP Device Programming Specifications". During the programming process, if the ECC feature is enabled, the row latch needs to be loaded with all the 256 bytes of data. In this scenario, the 256 code bytes should be fetched from main flash data region of hex file at address 0x0000 0000. If ECC is disabled, the 32 ECC bytes should be fetched from the configuration data region of hex file at address 0x8000 0000. The programmer software should concatenate these 32 bytes with the 256 bytes to form the 288 byte row data that needs to be loaded into the row latch. This step needs to be done to program all flash rows. The HEX file has a section starting with ,---- | :0200000480007A | :400000000252004003640040010901405C0A0140400B0140520C014044.... | :400040000248014001490140024C0140054D014003500140100214018A.... `---- But I can move this section to the flash memory by unchecking the "Store Configuration Data in ECC Memory" option in the System tab, then the section in the HEX file will be all zero. And I can remove it. The second warning: "Warn : There is no erase operation for NV Latches" is that `psoc5lp_nvl_erase()` returns `ERROR_FLASH_OPER_UNSUPPORTED`, which is a good thing. But this means, we never succeed in programming. ,---- | diff --git a/src/flash/nor/psoc5lp.c b/src/flash/nor/psoc5lp.c | index f383213ba..2d12cec65 100644 | --- a/src/flash/nor/psoc5lp.c | +++ b/src/flash/nor/psoc5lp.c | @@ -661,7 +661,7 @@ static int psoc5lp_nvl_erase(struct flash_bank *bank, unsigned int first, | unsigned int last) | { | LOG_WARNING("There is no erase operation for NV Latches"); | - return ERROR_FLASH_OPER_UNSUPPORTED; | + return ERROR_OK; | } | | static int psoc5lp_nvl_erase_check(struct flash_bank *bank) `---- This makes erasing skip at least. With this, if you don't specify `verify` to the "program" command, it finishes. But if you tell OpenOCD to verify the iamge, it failed with: ,---- | ** Verify Started ** | Error: checksum mismatch - attempting binary compare | ** Verify Failed ** `---- "verify_image" command shows you that the NV flash is the one that failed. ,---- | Error: verify failed in bank at 0x90000000 starting at 0x00000000 `---- At this point, I'm wondering if there is anyone using OpenOCD to program PSoC 5LP at all? If there is, what am I doing wrong? Best, -- yashi