xiaofan
Super Member
- Total Posts : 6247
- Reward points : 0
- Joined: 2005/04/14 07:05:25
- Location: Singapore
- Status: offline
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.
|
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)
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.
|
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)
Host project recreated with VS2005:
|
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)
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?
|
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)
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.
|
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)
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.
|
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)
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
|
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)
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.
|
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)
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.
|
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)
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
|
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)
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...
|
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)
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.
|
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)
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
|
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)
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
|