1.5.5.3 Configuring The Library

The PRIME Firmware Upgrade service library is configured to work in conjunction with the MEMORY driver to easily add any non-volatile memory to store the downloaded images.

In the PIC32CX MT device, the SEFC0 driver is configured as the download area, although other areas can be selected as long as the Bootloader application is also modified accordingly (refer to its documentation in the smartenergy_prime_apps repository).

Figure 1-31. PRIME Firmware Upgrade configuration

The parameters to configure are:

  • Firmware Upgrade Region Size: It is in hexadecimal, the reserved space in memory for file downloading. This size must be equal to or less than the size of the chosen memory
  • Buffer to write in flash: The size of the write buffer must be at least the size of the write block size of the chosen memory in bytes
  • Buffer to read in flash: The size of the read buffer must be at least the size of the read block size of the chosen memory in bytes.
Figure 1-32. Configuration of SEFC0 in PIC32CX MT

In the applications provided by Microchip for the PIC32CX MT device, SEFC0 is used as the associated memory. However, the parameters to configure will be the same for all memories.

  • NVM Media Start Address: Starting address of the memory area where the downloaded files will be stored
  • NVM Media Size (KB): Length of the Firmware Upgrade Region size. the value should be the same as the one specified in the Firmware Upgrade PRIME service configuration.
To configure the cryptographic algorithms required for the signature verification, the following must be selected in the wolfCrypt module:
Figure 1-33. Crypto configuration