• AVR Freaks

HID bootloader based on V2.1 stack

Author
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
2008/05/31 20:11:57 (permalink)
0

HID bootloader based on V2.1 stack

Continued from the bootloader based on V2.1 stack.
http://forum.microchip.com/tm.aspx?m=335536
 
John Dekker has since created an HID bootloader which is based on V2.1 stack. Even though V2.1 stack has an HID bootloader for USB 18J, it is based on old v1.3 stack and not the new V2.1 stack.
 
Here is the firmware from John.
 
 
 
 

  USB_Links and libusb
#1

13 Replies Related Threads

    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/05/31 20:14:06 (permalink)
    0
    Host software using Visual Studio 2008 (C#).
    The project files, source files and the binaries are included. To fit into 200KB limit, some non-essential files are taken out.

      USB_Links and libusb
    #2
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/05/31 20:31:23 (permalink)
    0
    Host project recreated with VS2005:
     

      USB_Links and libusb
    #3
    stefanopod
    Super Member
    • Total Posts : 1285
    • Reward points : 0
    • Joined: 2007/06/25 02:33:59
    • Location: Bologna,Italy
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/05/31 20:56:08 (permalink)
    0
    I too recreated a bootloader based on v2.1  and it works with minimum changes from the old version.
    But unexpectedly it is three times slower  and the memory footprint is larger, and I left untouched the cbuilder app.
    Is the fault mine or of the new stack?.
    Has John Dekkers version the same characteristics?
    #4
    John Dekker
    Junior Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2006/05/27 23:55:54
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/01 00:54:08 (permalink)
    0
    Take a look at my code, I removed the Feature exchange as was done in the 1.3 stack to get it into the first 0x1000. I found the speed to be the same as the Generic 2.1 version I did recently. It may be the way the host application is handling the transfers.
    Regards,
    John.
     
    #5
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/01 01:17:57 (permalink)
    0
    Thanks John. I just tested with a PICDEM FS USB demo board clone and it works very well. I just need to change the switch definition (using RB4 to be consistent with the board) and change the MCU to 18F4550 and the linker script to use 18F4550.
     
    Then I modified the demo firmware and change it to use your HID bootloader to test the host software. The host program is pretty fast as far as I see. Thanks!
     
    Enclosed is a quick and dirty mod of your bootloader for the PICDEM FS USB board. The modified demo hex file is also included.
     
     
     

      USB_Links and libusb
    #6
    anorrie
    Starting Member
    • Total Posts : 70
    • Reward points : 0
    • Joined: 2008/06/10 07:10:56
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/10 07:31:05 (permalink)
    0
    Guys,

    I tried to load both of your projects and had the same build problem with:
    could not find definition of symbol '__zero_memory' in file './c018izMY.o'.

    I'm a relative beginner to PICs which might explain the problem...but can someone tell me where this symbol is defined or what I have to add to the code to keep it happy?
    I tried adding an empty function, it builds fine but the USB does not connect.

    What is the process for debugging the project? Do I need a different .lkr file when building for debug?

    Thanks,
    Andy
    #7
    John Dekker
    Junior Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2006/05/27 23:55:54
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/10 17:52:21 (permalink)
    0
    It is linked in from C:\MCC18\src\traditional\proc\p18F2553.asm.
    You may need to check your paths in Project/Build Options/Project/Directories on the Project menu.
    Also, are you using the same processor.
    Regards,
    John.
     
    #8
    John Dekker
    Junior Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2006/05/27 23:55:54
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/10 17:54:55 (permalink)
    0
    Anothing thing. You will notice that in my linker file I have:
    //FILES c018izMY.o //cant have it here and appearing in Source Files as c018izMY.c
    FILES clib.lib
    FILES p18f2553.lib
     
    That is the c018izMY.o is commented out because I have it showing in the Source Files list so that it is compiled each time. If you do not have it in the Source file list in the IDE then you must uncomment this.
    Regards,
    John.
     
    #9
    anorrie
    Starting Member
    • Total Posts : 70
    • Reward points : 0
    • Joined: 2008/06/10 07:10:56
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/12 07:57:09 (permalink)
    0
    Thanks John,

    I am using the 18F4550 processor. I found the C:\MCC18\src\traditional\proc\p18F4550.asm file but is does not contain any form of label that looks like "__zero_memory" so I was a bit confused.

    I now have it working but only by inserting my own (enpty) function in place of __zero_memory

    Thanks,
    Andy
    #10
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/12 08:07:15 (permalink)
    0
    Just to chime in, I was actually considering that no "zero_memory" function is usually in there...
    So I'm not sure what's going on...

    GENOVA :D :D ! GODO
    #11
    John Dekker
    Junior Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2006/05/27 23:55:54
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/12 14:34:06 (permalink)
    0
    Having the zeromemory is important when you are debugging you user app because otherwise you start a debug sesion with old values in there. Also, if you don't do it you will have to be very sure you initialize correctly in your user code.
    I always use it and it saves much grief and is only a few extra bytes of code.
    Regards,
    John.
     
    #12
    anorrie
    Starting Member
    • Total Posts : 70
    • Reward points : 0
    • Joined: 2008/06/10 07:10:56
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/16 08:52:36 (permalink)
    0
    Hi John,

    Ok, you've convinced me I need it....I still can't find any reference to the function in C:\MCC18\src\traditional\proc\p18F4550.asm though.
    Where is the actual text label that gets picked up by the complier? Failing that could you possible copy me the code if its short?

    Thanks again
    Andy
    #13
    John Dekker
    Junior Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2006/05/27 23:55:54
    • Location: 0
    • Status: offline
    RE: HID bootloader based on V2.1 stack 2008/06/16 16:02:38 (permalink)
    0
    The code below is copied from the Disassembly listing and is the first bit of code after all the symbols.
    I think your issue may be that all the correct environment varables are not set. If you are not using the latest version of C
    then you could run the latest update and check all the boxes that ask if you want to update the IDE and variables, that
    might just fix it. Alternatively reinstall C.
    Regards,
    John
     
    247:   ;*** Set all of memory to zeroes ***/
    248:   ; Use FSR0 to increment through memory from address 0x0
    249:   ; to the end of the last data bank (no sfrs in bank).
    250:  
    251:       CODE
    252:   __zero_memory
      0F66    EE00     LFSR 0, 0                     
    253:       lfsr   0, 0
      0F68    F000     NOP
      0F6A    0E0F     MOVLW 0xf                     
    254:       movlw  0xF
    255:  
    256:   clear_loop
      0F6C    6AEE     CLRF 0xfee, ACCESS            
    257:       clrf   POSTINC0, 0
      0F6E    62EA     CPFSEQ 0xfea, ACCESS          
    258:       cpfseq FSR0H, 0
      0F70    D7FD     BRA 0xf6c                     
    259:       bra    clear_loop
      0F72    0012     RETURN 0                      
    260:       return 0
    #14
    Jump to:
    © 2021 APG vNext Commercial Version 4.5