CODE analysis

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CODE analysis

422 Views
usbdmjm60
Contributor I

 HI ... i have tryed to analysed  code of usbdm V4.6 for jm60 but i am not able to understand some of them please help me in this the codes sentance which i have not understood are  #pragma DATA_SEG DEFAULT

 

 

#if (DEBUG&RESET_DEBUG)---------------------------------------------------------not understood
   DEBUG_PIN   = 1;
   DEBUG_PIN   = 0;
#endif---------------------------------------------------------not understood

   if (RESET_IN==0)      // RESET failed to rise
      return(BDM_RC_RESET_TIMEOUT_RISE);

   CLEAR_RESET_SENSE_FLAG(); // Clear RESET IC Event
   ENABLE_RESET_SENSE_INT(); // Enable RESET IC interrupts

   return(BDM_RC_OK);
}

#endif //(HW_CAPABILITY&CAP_RST_IO)---------------------------------------------------------not understood

 

 


#if (DEBUG&SYNC_DEBUG))---------------------------------------------------------not understood
   DEBUG_PIN   = 1;
   DEBUG_PIN   = 0;
#end)---------------------------------------------------------not understood

 

 

 

 

#pragma MESSAGE DEFAULT C4003

 

 

Tags (2)
0 Kudos
1 Reply

244 Views
pgo
Senior Contributor V

Hi,

 

Some description:

#if (DEBUG&RESET_DEBUG)-

There is a #defined constant DEBUG which is used to control various debug features in the code.  It is a bit vector with each bit representing a different debug feature.  These are used to control condition code generation and would usually be disabled in the release version (by setting DEBUG to 0)

 

HW_CAPABILITY&CAP_RST_IO

The same code is used to build for various versions of the hardware.  These have different features which are controlled by

 HW_CAPABILITY bit vector in a similar fashion to above.

 

If you are having trouble understanding #if in general you would be advised to have a look at almost any C programming book for a discussion of preprocessing macros etc.

 

#pragma DATA_SEG  ....

This controls in which segment data are allocated.  This is specific to the Codewarrior C compiler.  More information can be found in the Codewarrior help files.  The USBDM uses it mostly to control BOOT area code & data along with making sure some critical data is allocated in the near segment for fast access.

 

bye

 

0 Kudos