I am trying to live upgrade the firmware i.e. download firmware in bank 2 of flash memory while bank 1 is still executing the code and vice versa. I need to give starting address of flash memory where the new firmware should be downloaded, now the starting address would be different when code is executing from bank 1 and when in bank 2. therefore the code should be able to check which bank its executing from and from that knowledge calculate the appropriate staring address. I need to know how can the code figure out which bank its running in? Is there a bit or a register i can check?