Thank you for contacting Cypress Community Forum. Currently we are reviewing the code. We will get back to you as soon as we find the resolution.
Have a wonderful day
The flash should be mapped to: 0x60000000 to 0x61000000 and not 0x6C000000.
This can be an issue with the controller settings.
“base_addr” and “pa” variables must have the “volatile” descriptor when defined, otherwise the compiler will optimize the write cycles and make one cycle out of them, which is wrong of course.
The unlock cycles address for writing are wrong. These should be:
*( (uint16_t *)base_addr + 0x555) = 0x00AA; /* write unlock cycle 1 */
*( (uint16_t *)base_addr + 0x2AA ) = 0x0055; /* write unlock cycle 2 */
*( (uint16_t *)base_addr + 0x555) = 0x00A0; /* write program setup command */
The polling for operation completion (programming in this case) is also missing. This can be done either using the DQ polling or using the status register. Details are in the datasheet.