DEFINE RESET_ORG and DT Instant Interrupt


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: DEFINE RESET_ORG and DT Instant Interrupt

    Hi Pedja, thanks for your confirmation.
    Yes, I was trying as you say placing the bootloader in the high memory, but then I faced with a "limit" of PBP that requires the library routines (assembly language for high-level commands like HSEROUT) be in memory below 64K.

    Here I was asking help to Melabs http://support.melabs.com/forum/picb...modifier-issue

    It can works if the code is very basilar, but not for instructions like Hserout, ArrayRead etc (and I need them).

  2. #2
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: DEFINE RESET_ORG and DT Instant Interrupt

    I'm experimenting this method:

    Bootloader code uses DEFINE RESET_ORG 80h and Main program uses DEFINE RESET_ORG 3000h

    When the main app need to call bootloader, I disable Interrupt, then remap vectrors, then @ RESET:

    Code:
    	Madr=$EF40: WriteCode 0,Madr		' --> GoTo $80 at address 0	
    	Madr=$F000: WriteCode 2,Madr		
    	Madr=$EF42: WriteCode 4,Madr		' --> GoTo $84 at address 4
    	Madr=$F000: WriteCode 6,Madr		
    	Madr=$EF44: WriteCode 8,Madr		' --> GoTo $88 at address 8
    	Madr=$F000: WriteCode 10,Madr
    	For Madr=12 to 126 step 2			' fill 128 bytes block for PIC18 to complete WriteCode
    		WriteCode Madr,$FF
    	Next Madr
    When the bootloader has finished, same logic above to restore vector at 3000, 3004, 3008, then @ RESET

    Not sure if it is a smart solution, but in my mind it should works .....

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: DEFINE RESET_ORG and DT Instant Interrupt

    Code for bootloader, generally need to be very basic. Then there is little space to make mistake.
    My biggest bootloader is around 1,2K, smalest 278B.
    I usually use 64K+ to store received HEX. So when I verify download in main code, check checksum, etc. Then I call bootloader, just to copy from 64K+ to 0-64K.
    I also used I2C, and SPI flash to store hex.
    Comm is handled by main code, sometimes I download hex from FTP, sometimes is over serial, or bluetooth(same as serial)...

  4. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: DEFINE RESET_ORG and DT Instant Interrupt

    Not good solution at all. Because you need to erase FLASH before writing.
    That code need to be in bootloader, as I explained in few post above.
    GOTO need to be placed in while assembling, not at runtime.
    EDIT:
    Try this in bootloader
    Code:
    DEFINE RESET_ORG 80h
    @ ORG 0
    	@ GOTO 80h
    @ ORG 8
    	@ GOTO 3008h
    @ ORG 4
    	@ GOTO 3004h
    Last edited by pedja089; - 3rd February 2021 at 14:05.

  5. #5
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: DEFINE RESET_ORG and DT Instant Interrupt

    Yes, I have to erase just a 128 byte block before.
    Well, you are right, but I have not enough resources to use your method. My main program is around 80K, I have not enough space in the external EEprom so I have to manage FTP communication to download the new HEX in the bootloader code. Get a block, flash, Get a block, flash .... no crc controll at all.
    I agree there is much risk something goes wrong this way, but if it works I can try remotely update a firmware without having the device back to my lab from the customer as I'm doing now.

    Anyway I have space in the GSM module to save a copy of the actual firmware before starting update and manage a restore if some check fails during the update process. It is a heavy bootloader, I know.....

Similar Threads

  1. DEFINE RESET_ORG and DEC modifier issue
    By Marcick in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 5th February 2021, 07:21
  2. DT Instant Interrupt and Bootloader
    By mikebar in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd September 2014, 08:26
  3. Define Interrupt Label Problem
    By Junkman55 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 14th June 2011, 17:41
  4. Instant Interrupt and USART
    By sirvo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd July 2008, 03:08
  5. DT Instant Interrupt counting
    By jderson in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 9th March 2008, 22:47

Members who have read this thread : 0

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

Posting Permissions

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