This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IAP Programming

Hi all

I have to add an In-Application Programming feature to my program. I'm using 89c51rc2 with no external memory and keil.

I've read several threads about IAP but not found exactly the thing itself.

At the moment, I
- I have a 'boot' program, which looks if there is a new program on the high part of the flash (previously written there by the application or normal program), by means of an absolute addressable variable. If there is a new program, boot copies the program at the low part of the flash.
- After that, it is supposed that boot must jump to the application program.


But I guess I'm getting in trouble with interrupt vectors or some other conflict. I'd appreciate an example or a link.

Thanks in advance

Parents
  • Ok thanks for the reply.

    I'm using the 89c51rc2 by Atmel. To write to the code memory I use the APIs provided by Atmel.

    I think I'm done with the part of writting the new program that comes from the uart, but don't know how to handle interrupts or conflict between 'bootloader' and application program. Also don't know if I'm doing the jumps properly

    I'll try to resume what my project is expected to do:

    I think that a good memory map is the following:

    From 0x0000 to 0x01F3 --> 'bootloader'
    From 0x01F4 to 0x3FFF --> application program
    From 0x4000 to 0x41F3 --> Not used
    From 0x41F4 to 0x7FFF --> just the place to put the incoming program.



    1- Assumming normal operation. The micro receives a new program to update himself via UART and writes it to an unused part of the flash, ie from 0x3FFF
    2- When the new program has been copied, the program set an absolute addressable variable to 1 (kind of flag to know if there is new program available).
    3- Jumps to bootloader (LJMP 0000H) Don't know if it works.
    4- Then bootloader looks for the flag. If there is new program, then writes it to the low part of the code memory (from 0x01F4, after the bootloader)
    5- When this is accomplished, bootloader makes a jump to the new application program (0x01F4).

    Thanks again.

Reply
  • Ok thanks for the reply.

    I'm using the 89c51rc2 by Atmel. To write to the code memory I use the APIs provided by Atmel.

    I think I'm done with the part of writting the new program that comes from the uart, but don't know how to handle interrupts or conflict between 'bootloader' and application program. Also don't know if I'm doing the jumps properly

    I'll try to resume what my project is expected to do:

    I think that a good memory map is the following:

    From 0x0000 to 0x01F3 --> 'bootloader'
    From 0x01F4 to 0x3FFF --> application program
    From 0x4000 to 0x41F3 --> Not used
    From 0x41F4 to 0x7FFF --> just the place to put the incoming program.



    1- Assumming normal operation. The micro receives a new program to update himself via UART and writes it to an unused part of the flash, ie from 0x3FFF
    2- When the new program has been copied, the program set an absolute addressable variable to 1 (kind of flag to know if there is new program available).
    3- Jumps to bootloader (LJMP 0000H) Don't know if it works.
    4- Then bootloader looks for the flag. If there is new program, then writes it to the low part of the code memory (from 0x01F4, after the bootloader)
    5- When this is accomplished, bootloader makes a jump to the new application program (0x01F4).

    Thanks again.

Children