May I ask question for below SDK.

  1. What is the purpose of WRITE_OTA_ADDR ?
  2. Why below code is set default address ota_addr to 0x80000 ?
uint32_t update_ota_prepare_addr(void){
	uint32_t Img2Len = 0;
	uint32_t IMAGE_x = 0, ImgxLen = 0, ImgxAddr = 0;
	uint32_t NewImg2Addr = 0; 
	uint32_t ota_addr = 0x80000;


1 Like

hi @ruanjanc

You can refer to [AN0033] for information on the OTA update process, and [UM0034] Chapter 5 for information on how flash memory space is allocated.

  1. the macro WRITE_OTA_ADDR determines the inclusion of the function write_ota_addr_to_system_data, which seems to write the updated OTA image address into flash at 0x9000. This image address at 0x9000 acts as a offset at boot, controlling which image in flash is booted. If WRITE_OTA_ADDR is disabled, the updated OTA image can still be written into flash, but will not be booted, since the image address at 0x9000 is not updated to point at the new OTA image.

  2. Assuming a 1MB flash size, and since the first application image starts at 0xB000, the default OTA address is set to 0x80000 to give both images roughly equal flash space, while leaving some space at the end for application and user data.

1 Like

Thank you for your support.
Got it, this is because of SDK is consider as 1MB flash size using, then OTA address is set to 0x80000.