• AVR Freaks

USB Device Bootloader problem

Author
RoyMiller
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2010/04/29 21:38:56
  • Location: 0
  • Status: offline
2015/09/01 23:32:19 (permalink)
0

USB Device Bootloader problem

Hello I am having trouble getting my USB Device Bootloader working properly.
I am using Harmony v1.06 and compiling with XC32 v1.40
I have made a new BSP for my target system and modified the bootloader basic example to work on the target board.
The program works on the new hardware and I have loaded the test dma_led_pattern application using the PIC32 Bootloader ApplicationV1.2 and that runs correctly on my target system.
I then tried to download my application to the board and it doesn't work.
I set the Configurator Bootload Libary to Use Bootloader Libray and checked the Build an Application Linker Script before compiling the application.
The bti_mz.ld file seems to be identical for both the dma_led_pattern and my target.
The map files for the two applications have the same kseg1 Boot-Memory Usage.
kseg1 Boot-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.reset                  0x9d001000          0x1fc         508  Reset handler
         Total kseg1_boot_mem used  :       0x1fc         508  44.1% of 0x480
        --------------------------------------------------------------------------
         Total Program Memory used  :      0x150c        5388  0.3% of 0x1ff000

The kseg0 Program-Memory Usage starts on the same address 0x9d001480 with the dma_led_pattern last address 0x9d00278c and my application 0x9d00adbc.
 
The only differences other than size are these entries: I don't know if that is significant.
 
Led_pattern
.text._on_reset         0x9d00277c            0x8           8   
.text._on_bootstrap     0x9d002784            0x8           8   


my app
.text._on_reset         0x9d00adb4            0x8           8   
.text._on_bootstrap     0x9d00adbc            0x8           8  
 
If anyone has any suggestions I would be really grateful.
 
 
#1

5 Replies Related Threads

    Larry.Standage
    Moderator
    • Total Posts : 927
    • Reward points : 0
    • Joined: 2011/12/30 09:50:47
    • Location: 0
    • Status: offline
    Re: USB Device Bootloader problem 2015/09/02 20:23:33 (permalink)
    0
    The two entries shouldn't be a problem. As long as the very first code (crt0.s) is in the 0x9d001000 area, then it should be fine. That's because the linker puts things in from largest to smallest, other than the first thing that is run, which is crt0.s.
     
    Have you been able to debug the application at all? By having the bootloader project as a loadable to your application project, you should be able to go through the bootloader and debug from there.
    #2
    RoyMiller
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2010/04/29 21:38:56
    • Location: 0
    • Status: offline
    Re: USB Device Bootloader problem 2015/09/03 00:37:26 (permalink)
    4 (1)
    Hi Thanks
    I have progressed, I couldn't find any problems with the program addresses and I have put the bootloader and the application together using the Loadables feature and loaded them together in the  debugger.
    It did everything correctly and jumped to the application which also ran OK. However compiled separately it still didn't work.
    Just to check things I have another project being designed on another board and I tried out the bootloader on that and had some success, The application runs in two separate modes 1) If a USB cable is connected it runs code to update configuration download data etc. 2) If no USB connected it runs a data logger function.
    If I load the bootloader into the board and load the program with the PC application and click on Run Application it works and disconnects from the bootload USB HID and reconnects to my application HID and I can change the configuration and download data.
    However if I try to power it off and on again without the USB connected it doesn't run the program.
    I am now looking to see the difference between the two modes to see if I can find anything.
    It does look like the Bootloader works OK the Linker puts everything in the correct place but there is a difference between the CPU state when jumping to the application rather than directly from the hardware reset.
     
    #3
    adamfolts
    Super Member
    • Total Posts : 218
    • Reward points : 0
    • Joined: 2010/10/19 08:32:20
    • Location: Prescott
    • Status: offline
    Re: USB Device Bootloader problem 2015/09/03 14:24:21 (permalink)
    0
    Make sure any interrupts that were enabled in the bootloader are disabled before jumping to the application. This may be causing the frustration.
    #4
    RoyMiller
    New Member
    • Total Posts : 21
    • Reward points : 0
    • Joined: 2010/04/29 21:38:56
    • Location: 0
    • Status: offline
    Re: USB Device Bootloader problem 2015/09/04 15:02:48 (permalink)
    0
    Yes I thought of that, in the file bootloader.c I found this.
     
                DATASTREAM_Close();
                
                /* Disable Global Interrupts */
                PLIB_INT_Disable(INT_ID_0);
                
                fptr = (void (*)(void))BOOTLOADER_RESET_ADDRESS;
                fptr();
                break;
     
    Global interrupts are disabled before the jump.
    I have to go on site for the next week so I will get back to it when I return
    Thanks
    Roy
     
    #5
    DominusT
    Super Member
    • Total Posts : 1401
    • Reward points : 0
    • Joined: 2005/07/22 08:31:18
    • Status: offline
    Re: USB Device Bootloader problem 2019/04/27 12:46:37 (permalink)
    0
    RoyMiller
    Hi Thanks
    I have progressed, I couldn't find any problems with the program addresses and I have put the bootloader and the application together using the Loadables feature and loaded them together in the  debugger.
    It did everything correctly and jumped to the application which also ran OK. However compiled separately it still didn't work.
    Just to check things I have another project being designed on another board and I tried out the bootloader on that and had some success, The application runs in two separate modes 1) If a USB cable is connected it runs code to update configuration download data etc. 2) If no USB connected it runs a data logger function.
    If I load the bootloader into the board and load the program with the PC application and click on Run Application it works and disconnects from the bootload USB HID and reconnects to my application HID and I can change the configuration and download data.
    However if I try to power it off and on again without the USB connected it doesn't run the program.
    I am now looking to see the difference between the two modes to see if I can find anything.
    It does look like the Bootloader works OK the Linker puts everything in the correct place but there is a difference between the CPU state when jumping to the application rather than directly from the hardware reset.
     


    Hi.
    I have a similar problem
    Do you want to solve the problem?
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5