CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help for Bootloader USB

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
microlo75



Joined: 13 Apr 2010
Posts: 23

View user's profile Send private message

Help for Bootloader USB
PostPosted: Thu Apr 05, 2012 3:25 am     Reply with quote

H forum,
use PIC24FJ256GB110 Compiler V. 4.131

I reserved the beginning of the program to use the USB bootloader
But a strange thing happens in "usb_gets and other...",
when I make changes in the program vary the size of the routines in the bootloader!
example:

program code before the change:
main...
Code:

  if(BUTTON_1)
    {


     LED_TX_RADIO;   
     BLOCCO_RADAR(TRUE);
     PTT(TRUE);               
     .....
     etc. etc.

usb_gets START 0x01662 END 0x016EC
Code:

 2866  01662     200004  usb_gets                           mov.w #0x0,w4                         
  2867  01664     899834                                     mov.w w4,0x3306                       
  2868  01666     8197F0                                     mov.w 0x32fe,w0                       
  2869  01668     EF6001                                     clr.b 0x0001                           
  2870  0166A     DD0041                                     sl w0,#1,w0                           
  2871  0166C     020262                                     call @const197                         
  2872  0166E     000000                                     nop                                   
  2873  01670     899860                                     mov.w w0,0x330c                       
  2874  01672     819860                                     mov.w 0x330c,w0                       
  2875  01674     819814                                     mov.w 0x3302,w4                       
  2876  01676     E12000                                     cp.w w4,w0                             
  2877  01678     360004                                     bra leu, 0x001682                     
  2878  0167A     F8330C                                     push.w 0x330c                         
  2879  0167C     F9330E                                     pop.w 0x330e                           
  2880  0167E     041686                                     goto 0x001686                         
  2881  01680     000000                                     nop                                   
  2882  01682     F83302                                     push.w 0x3302                         
  2883  01684     F9330E                                     pop.w 0x330e                           
  2884  01686     200004                                     mov.w #0x0,w4                         
  2885  01688     899844                                     mov.w w4,0x3308                       
  2886  0168A     8197F0                                     mov.w 0x32fe,w0                       
  2887  0168C     F83318                                     push.w 0x3318                         
  2888  0168E     9FFFE0                                     mov.b w0,[w15-2]                       
  2889  01690     F93318                                     pop.w 0x3318                           
  2890  01692     020410                                     call usb_kbhit                         
  2891  01694     000000                                     nop                                   
  2892  01696     E00400                                     cp0.b w0                               
  2893  01698     32001B                                     bra z, 0x0016d0                       
  2894  0169A     8197F0                                     mov.w 0x32fe,w0                       
  2895  0169C     F83318                                     push.w 0x3318                         
  2896  0169E     9FFFE0                                     mov.b w0,[w15-2]                       
  2897  016A0     F93318                                     pop.w 0x3318                           
  2898  016A2     F83300                                     push.w 0x3300                         
  2899  016A4     F9331A                                     pop.w 0x331a                           
  2900  016A6     F8330E                                     push.w 0x330e                         
  2901  016A8     F9331C                                     pop.w 0x331c                           
  2902  016AA     0207E4                                     call usb_get_packet                   
  2903  016AC     000000                                     nop                                   
  2904  016AE     899850                                     mov.w w0,0x330a                       
  2905  016B0     819800                                     mov.w 0x3300,w0                       
  2906  016B2     819854                                     mov.w 0x330a,w4                       
  2907  016B4     400004                                     add.w w0,w4,w0                         
  2908  016B6     899800                                     mov.w w0,0x3300                       
  2909  016B8     819810                                     mov.w 0x3302,w0                       
  2910  016BA     819854                                     mov.w 0x330a,w4                       
  2911  016BC     500004                                     sub.w w0,w4,w0                         
  2912  016BE     899810                                     mov.w w0,0x3302                       
  2913  016C0     819830                                     mov.w 0x3306,w0                       
  2914  016C2     819854                                     mov.w 0x330a,w4                       
  2915  016C4     400004                                     add.w w0,w4,w0                         
  2916  016C6     899830                                     mov.w w0,0x3306                       
  2917  016C8     0416E2                                     goto 0x0016e2                         
  2918  016CA     000000                                     nop                                   
  2919  016CC     0416DA                                     goto 0x0016da                         
  2920  016CE     000000                                     nop                                   
  2921  016D0     819840                                     mov.w 0x3308,w0                       
  2922  016D2     E80000                                     inc.w w0,w0                           
  2923  016D4     899840                                     mov.w w0,0x3308                       
  2924  016D6     093E7E                                     repeat #15998                         
  2925  016D8     000000                                     nop                                   
  2926  016DA     819840                                     mov.w 0x3308,w0                       
  2927  016DC     819824                                     mov.w 0x3304,w4                       
  2928  016DE     E12000                                     cp.w w4,w0                             
  2929  016E0     3AFFD4                                     bra nz, 0x00168a                       
  2930  016E2     819850                                     mov.w 0x330a,w0                       
  2931  016E4     819864                                     mov.w 0x330c,w4                       
  2932  016E6     E12000                                     cp.w w4,w0                             
  2933  016E8     3A000A                                     bra nz, 0x0016fe                       
  2934  016EA     819820                                     mov.w 0x3304,w0                       
  2935  016EC     E00000                                     cp0.w w0                               
             



program code after the change:
main...
Code:

  if(BUTTON_1)
    {
     char Buffer_USB[]="ciao";
     if(strncmp(USB_firmware,Buffer_USB,4)==0)
       pippo=1;


     LED_TX_RADIO;   
     BLOCCO_RADAR(TRUE);
     PTT(TRUE);               
     .....
     etc. etc.


[b]usb_gets    START 0x01662    END 0x01700[/b]


 2866  01662     200004  usb_gets                           mov.w #0x0,w4                         
  2867  01664     899834                                     mov.w w4,0x3306                       
  2868  01666     8197F0                                     mov.w 0x32fe,w0                       
  2869  01668     EF6001                                     clr.b 0x0001                           
  2870  0166A     DD0041                                     sl w0,#1,w0                           
  2871  0166C     020262                                     call @const197                         
  2872  0166E     000000                                     nop                                   
  2873  01670     899860                                     mov.w w0,0x330c                       
  2874  01672     819860                                     mov.w 0x330c,w0                       
  2875  01674     819814                                     mov.w 0x3302,w4                       
  2876  01676     E12000                                     cp.w w4,w0                             
  2877  01678     360004                                     bra leu, 0x001682                     
  2878  0167A     F8330C                                     push.w 0x330c                         
  2879  0167C     F9330E                                     pop.w 0x330e                           
  2880  0167E     041686                                     goto 0x001686                         
  2881  01680     000000                                     nop                                   
  2882  01682     F83302                                     push.w 0x3302                         
  2883  01684     F9330E                                     pop.w 0x330e                           
  2884  01686     200004                                     mov.w #0x0,w4                         
  2885  01688     899844                                     mov.w w4,0x3308                       
  2886  0168A     8197F0                                     mov.w 0x32fe,w0                       
  2887  0168C     F83318                                     push.w 0x3318                         
  2888  0168E     9FFFE0                                     mov.b w0,[w15-2]                       
  2889  01690     F93318                                     pop.w 0x3318                           
  2890  01692     020410                                     call usb_kbhit                         
  2891  01694     000000                                     nop                                   
  2892  01696     E00400                                     cp0.b w0                               
  2893  01698     32001B                                     bra z, 0x0016d0                       
  2894  0169A     8197F0                                     mov.w 0x32fe,w0                       
  2895  0169C     F83318                                     push.w 0x3318                         
  2896  0169E     9FFFE0                                     mov.b w0,[w15-2]                       
  2897  016A0     F93318                                     pop.w 0x3318                           
  2898  016A2     F83300                                     push.w 0x3300                         
  2899  016A4     F9331A                                     pop.w 0x331a                           
  2900  016A6     F8330E                                     push.w 0x330e                         
  2901  016A8     F9331C                                     pop.w 0x331c                           
  2902  016AA     0207E4                                     call usb_get_packet                   
  2903  016AC     000000                                     nop                                   
  2904  016AE     899850                                     mov.w w0,0x330a                       
  2905  016B0     819800                                     mov.w 0x3300,w0                       
  2906  016B2     819854                                     mov.w 0x330a,w4                       
  2907  016B4     400004                                     add.w w0,w4,w0                         
  2908  016B6     899800                                     mov.w w0,0x3300                       
  2909  016B8     819810                                     mov.w 0x3302,w0                       
  2910  016BA     819854                                     mov.w 0x330a,w4                       
  2911  016BC     500004                                     sub.w w0,w4,w0                         
  2912  016BE     899810                                     mov.w w0,0x3302                       
  2913  016C0     819830                                     mov.w 0x3306,w0                       
  2914  016C2     819854                                     mov.w 0x330a,w4                       
  2915  016C4     400004                                     add.w w0,w4,w0                         
  2916  016C6     899830                                     mov.w w0,0x3306                       
  2917  016C8     0416E2                                     goto 0x0016e2                         
  2918  016CA     000000                                     nop                                   
  2919  016CC     0416DA                                     goto 0x0016da                         
  2920  016CE     000000                                     nop                                   
  2921  016D0     819840                                     mov.w 0x3308,w0                       
  2922  016D2     E80000                                     inc.w w0,w0                           
  2923  016D4     899840                                     mov.w w0,0x3308                       
  2924  016D6     093E7E                                     repeat #15998                         
  2925  016D8     000000                                     nop                                   
  2926  016DA     819840                                     mov.w 0x3308,w0                       
  2927  016DC     819824                                     mov.w 0x3304,w4                       
  2928  016DE     E12000                                     cp.w w4,w0                             
  2929  016E0     3AFFD4                                     bra nz, 0x00168a                       
  2930  016E2     819850                                     mov.w 0x330a,w0                       
  2931  016E4     819864                                     mov.w 0x330c,w4                       
  2932  016E6     E12000                                     cp.w w4,w0                             
  2933  016E8     3A000A                                     bra nz, 0x0016fe                       
  2934  016EA     819820                                     mov.w 0x3304,w0                       
  2935  016EC     E00000                                     cp0.w w0                               
  2936  016EE     320004                                     bra z, 0x0016f8                       
  2937  016F0     819840                                     mov.w 0x3308,w0                       
  2938  016F2     819824                                     mov.w 0x3304,w4                       
  2939  016F4     E12000                                     cp.w w4,w0                             
  2940  016F6     320003                                     bra z, 0x0016fe                       
  2941  016F8     819810                                     mov.w 0x3302,w0                       
  2942  016FA     E00000                                     cp0.w w0                               
  2943  016FC     3AFFBA                                     bra nz, 0x001672                       
  2944  016FE     F83306                                     push.w 0x3306                         
  2945  01700     F90000                                     pop.w w0                               

Why change??

This causes me problems after updating bootloader!

Thanks for help.
Alex
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group