• AVR Freaks

Hot!Bootloader Not Generating Reset Code

Author
crosland
Super Member
  • Total Posts : 1673
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Warks, UK
  • Status: offline
2019/10/18 05:15:08 (permalink)
0

Bootloader Not Generating Reset Code

I don't like auto code generation so I'm doing this the hard way. It's the first time I've used XC8 for a bootloader. The "Linking PIC18 Bootloaders and Applications" presentation seems to be out of date.
 
In my bootloader I have

#define APP_START 0x1000 // application offset
asm("PSECT intcode");
asm("GOTO " ___mkstr(APP_START+0x8));
asm("PSECT intcodelo");
asm("GOTO " ___mkstr(APP_START+0x18));

 
And, at the end of the bootloader

// Jump to application
asm("GOTO " ___mkstr(APP_START));

 
I have reserved 0-fff for the bootloader in the Linker settings.
 
In the application I have set the CODEOFFSET to 0x1000
 
Looking at the .map and .lst files for both projects, all of the interrupt relocating looks good, but there is no code to handle the reset vector at 0, nor at APP_START in the application.
 
E.g., in the bootloader .lst

49 0000 
50 psect intcode
51 000008 EF04 F008 goto 4104 ;#
52
53 psect intcodelo
54 000018 EF0C F008 goto 4120 ;#

 
There is an entry for the reset_vec section in the .map, just no code anywhere.
 
What am i doing wrong?
 
 
post edited by crosland - 2019/10/18 05:16:19
#1

8 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17942
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Bootloader Not Generating Reset Code 2019/10/18 06:07:52 (permalink)
    0
    You do not have anything to tell the compiler where you want the code.
    You can add that, or place it in the interrupt functions.
     
    Nevermind
    post edited by NKurzman - 2019/10/18 08:17:41
    #2
    crosland
    Super Member
    • Total Posts : 1673
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/18 06:15:02 (permalink)
    0
    NKurzman
    You do not have anything to tell the compiler where you want the code.
    You can add that, or place it in the interrupt functions.

    I don't understand.
     
    As I said, all of the interrupt stuff is fine. The vectors in the bootloader redirect to the expected offsets in the app and my ISRs are linked correctly.
     
    Surely the compiler should be generating the code for the reset vector in the bootloader, and the relocated reset vector at APP_START.
    #3
    crosland
    Super Member
    • Total Posts : 1673
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/18 06:33:48 (permalink)
    0
    Hmmm. It turns out that NONE of my XC8 projects have any code at the reset vector, in the .lst file. The .hex files look OK, I can see a goto instruction at 0.
     
    Is the .lst produced before some final linker stage that adds the reset vector code?
     
    How do I get a disassembly listing of the final output? The toolbar button is greyed out. Is it only available if I debug in hardware?
     
     
    #4
    1and0
    Access is Denied
    • Total Posts : 9900
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/18 07:26:04 (permalink)
    +1 (1)
    You have asked and got the answer at the beginning of this year over here:  https://www.microchip.com/forums/m1083170.aspx
     
    You might have to check "Keep generated startup.as" in the linker runtime options.
    #5
    crosland
    Super Member
    • Total Posts : 1673
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/18 07:42:13 (permalink)
    0
    1and0
    You have asked and got the answer at the beginning of this year over

     
    Thank you! I wish my memory were as good as yours :)
     
     
    #6
    1and0
    Access is Denied
    • Total Posts : 9900
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/18 07:44:44 (permalink)
    0
    Another way in MPLAB X, click Window > Debugging > Output > Disassembly Listing File.
     
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 17942
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Bootloader Not Generating Reset Code 2019/10/18 08:17:09 (permalink)
    0
    crosland
    I don't understand.
     
    As I said, all of the interrupt stuff is fine. The vectors in the bootloader redirect to the expected offsets in the app and my ISRs are linked correctly.
     
    Surely the compiler should be generating the code for the reset vector in the bootloader, and the relocated reset vector at APP_START.



    Sorry you are correct, I misread your code.
    #8
    mad_c
    Super Member
    • Total Posts : 1203
    • Reward points : 0
    • Joined: 2010/12/12 17:48:27
    • Location: Brisbane, Australia
    • Status: offline
    Re: Bootloader Not Generating Reset Code 2019/10/20 13:41:36 (permalink)
    +1 (1)
    Hi,
     
    To see the list file of the assembly module that forms part of the runtime startup code, look for startup.lst (or you can see the actual source by looking for startup.s). Select the Linker>runtime option in the IDE to keep the generated startup, as this file is otherwise deleted with each build. As the startup code is assembly code, it does not combine with the C parts of the program, and hence does not show up in the C source list file.
     
    Jeff.
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5