How can I resolve "The flash row is not valid for the selected array" error in the Bootloader Host for PSoC® 3, PSoC 4, or PSoC 5LP bootloader designs?
This error appears when the Bootloader Host application attempts to bootload the .cyacd file to the bootloader area of flash or portions of memory that are write-protected. Unless specified, a bootloadable application occupies flash starting from the next empty flash row to the bootloader application. If there is a conflict with a bootloader flash row or due to protection settings, bootloading to the next flash row will not be allowed.
For example, consider a product with a bootloader programmed (say, Bootloader A). Assume you are updating the build with the latest version of PSoC Creator Components. Let us call the updated bootloader as Bootloader B. Now, if a new bootloadable is built with the .hex and .elf dependency files corresponding to Bootloader B, you may face the invalid flash row error when bootloading the new application. This may be because of these reasons:
- Bootlader B may consume less flash rows, but the preprogrammed Bootloader A consumed more flash rows. So, the new .cyacd file is attempting to bootload the preprogrammed bootloader rows of Bootlader A, which is not allowed.
- This is an implicit issue due to the reason stated above. More rows of Booloader A may have been “Write Protected” compared to the actual number of rows used by Booltoader B. In that case, the new .cyacd file is attempting to bootload protected rows.
Note that any functional modifications in Bootloader B (compared to A) will not be reflected in the actual application even if Bootloader B is set as a dependency. This is because Booltoader B is not reprogrammed to the device.
Figure 1: PSoC Creator Projects and Flash Memory Usage
To address this issue, you can manually place the bootloadable application to the flash row above the bootloader image and below the metadata area of flash as shown in Figure 1. This approach can be used to avoid discrepancies of flash sizes between an older/newer revision of dependency files and in the presence of field protection settings. The steps are as follows:
- In the Bootloadable configuration settings (Configure dialog), enable the Manual application image placement option. Unless enabled,thePlacement address option will be grayed out. See Figure 2.
- Specify the address in the Placement address field such that the address is above the bootloader image and below the metadata area. To determine the placement address, multiply the flash row number starting from which the image can be placed with the flash row size and add the result to the flash base address. Align the placement address to the flash row size. See the Flash and EEPROM chapter of the System Reference Guide for details about flash memory organization.
Figure 2: Manual Application Placement Option in Bootloadable Configuration