Tool/software: TI-RTOS
Hi,
I am implementing a bootloader and made a simple project to validate everything.
In that simple project I used the following verifications before writing to flash:
/* Check overall boundaries */ Assert_isTrue((uint32_t)destAddr >= FLASH_APPLICATION_ADDR, 0); Assert_isTrue(((uint32_t)destAddr + nBytes) < (FLASH_APPLICATION_ADDR + FLASH_APPLICATION_SIZE), 1); /* Check that we do not cross a page boundary when FLASH_DATA_SIZE is more than one page */ Assert_isTrue(((uint32_t)destAddr - pageStartAddr + nBytes) <= FLASH_PAGE_SIZE, 2); /* Make sure that the flash functions from driverlib are either located in ROM or SRAM, but not in FLASH. This is the normal case in TI-RTOS. */ Assert_isTrue((uint32_t)&FlashProgram > (FLASH_BASE_ADDR + FLASH_SIZE), 3);
Now, I would like to keep that bootloader as smallest as possible. One of the modifications is remove the assert module.
I replaced the verifications as follows:
/* Check overall boundaries */ if((uint32_t)destAddr < FLASH_APPLICATION_ADDR) { while(1); } if(((uint32_t)destAddr + nBytes) > (FLASH_APPLICATION_ADDR + FLASH_APPLICATION_SIZE)) { while(1); } /* Check that we do not cross a page boundary when FLASH_DATA_SIZE is more than one page */ if(((uint32_t)destAddr - pageStartAddr + nBytes) > FLASH_PAGE_SIZE) { while(1); } /* Make sure that the flash functions from driverlib are either located in ROM or SRAM, but not in FLASH. This is the normal case in TI-RTOS. */ if((uint32_t)&FlashProgram < (FLASH_BASE_ADDR + FLASH_SIZE)) { while(1); <= THE PROGRAM STOPS HERE! }
The verification is failing in the point marked above.
What is the difference between "Assert_isTrue((uint32_t)&FlashProgram > (FLASH_BASE_ADDR + FLASH_SIZE), 3);" and "if((uint32_t)&FlashProgram < (FLASH_BASE_ADDR + FLASH_SIZE))"?
Best regards,