Application Note
36 of 45
001-84858 Rev. *N
2021-03-23
PSoC 4 Programming Using an External Microcontroller (HSSP)
Appendix A: Hex File Parser Application
14.2.1
Using the
HexImage.c
,
HexImage.h
Files
for the PSoC 4xxxL/ PSoC
41x8_BLE/ 42x8_BLE/ 41XXS Plus Family Devices:
1.
The HSSP code examples use a PSoC 5LP device as a host programmer to program the target PSoC 4device.
Because the HSSP algorithm in the host PSoC 5LP will consume a portion of its 256 KB Flash memory, the
entire hex file data of larger flash memory devices, like the devices belonging to the 256 KB PSoC
4xxxL/PSoC 41x8_BLE/42x8_BLE families, cannot be stored in the flash memory of the host PSoC 5LP.
2.
In B_HSSP_Pioneer project, the entire 128 KB of PSoC 41xxS Plus device cannot be stored in the onboard
PSoC 5 of CY8CKIT-159 as it uses KitProg2 which has dual application image bootloading.
3.
To meet the code size requirements, the programming data corresponding to the last few flash rows is
deleted from the
HexImage.c
and
HexImage.h
files. The corresponding logic has also been incorporated in
the
HEX_ReadRow
Data(…)
function in the
DataFetch.c
file. The changes done are listed below. See the
project code for viewing the exact changes.
4.
In the
HexImage.h
file, the number of flash rows in the array declaration is reduced by 256 by editing the
array declaration as below:
extern
unsigned
char
const
flashData_HexFile[(NUMBER_OF_FLASH_ROWS_HEX_FILE -
256)][FLASH_ROW_BYTE_SIZE_HEX_FILE];
The choice of 256 rows was arrived so that the code size of the project fits the host PSoC 5LP flash memory
capacity for all target devices.
5.
In the
HexImage.c
file, the last 256 flash rows are deleted from the definition of the array
flashData_HexFile[][]
corresponding to the changes done in the array declaration in the
HexImage.h
file.
6.
In the definition of the function
HEX_ReadRowData (…)
in the DataFetch.c file, the entire flash row data is
loaded with zero in the case of the flash row number being in the last 256 rows of the target device.