Extra I2CWRITE opcode at beginning of *.hex file


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2011
    Posts
    2

    Default Extra I2CWRITE opcode at beginning of *.hex file

    Some background
    I'm in the process of writing an I2C bootloader for a PIC18F2520 in assembly which is set to reside in the last part of program memory. The bootloader is accessed with a GOTO "bootloader label" statement which occupies the first two program memory locations.

    The application code arrives via I2C in packets of 32 bytes (16 opcodes split in two) and is written to a buffer in RAM. I've determined that I need to move the GOTO INIT opcodes for the application code out of the RAM slots that would put the opcodes in the first two flash memory locations and move them into the slots for the third and fourth locations before I write the first packet to flash in order to maintain access to the bootloader on power-up or reset. I'm using DEFINE LOADER_USED 1 to keep the first 4 memory locations in the application code reserved for GOTOs so I don't overwrite any code when I move the opcodes in the bootloader.


    The Problem
    I've noticed that every time I include either an I2CWRITE or I2CREAD statement in the application code, a 0x6A00 (clrf 0) opcode shows up in the first program memory location, bumping the normal GOTO INIT down to the second and third memory locations. When the bootloader tries to move the GOTO INIT opcodes up, it won't get both of the GOTO opcodes that are needed to access the application later.

    How can I keep the I2C statements from inserting that opcode at the beginning? Alternatively, what's a good work around?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Extra I2CWRITE opcode at beginning of *.hex file

    Relocate all of the 1st 4 words, not just the first 2.

    The instruction is clearing the FLAGS system variable.
    It gets added for I2C or LCDOUT commands.
    It's automatic, and can't be suppressed.
    DT

  3. #3
    Join Date
    Feb 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Extra I2CWRITE opcode at beginning of *.hex file

    Awesome. Thanks for the information Darrel!

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts