Jump to content
43oh

USB dev (CCS code to GCC) issues


Recommended Posts

I am having errors compiling some USB code on mspgcc,

 

the code that I am having issues with is

 

#ifdef __REGISTER_MODEL__
/* for IAR */
#   if __REGISTER_MODEL__ == __REGISTER_MODEL_REG20__
#       define __DMA_ACCESS_REG__ (void __data20 *)
#   else
#       define __DMA_ACCESS_REG__ (unsigned short)
#   endif
#else
/* for CCS */
#   define __DMA_ACCESS_REG__ (__SFR_FARPTR)(unsigned long)
#endif

 

It affects how

    DMA0DA = __DMA_ACCESS_REG__ dest;                       //set destination for DMAx
   DMA0SA = __DMA_ACCESS_REG__ source;                     //set source for DMAx

 

is there a suitable replacement for gcc that I can use?

no amount of googling has helped. All I know is that SFR__FARPTR is a builtin but not sure what it does, or how it affects the code.

 

If need be I can post the errors from compiling later today

Link to post
Share on other sites

From IRC -- Rickta

 

__SFR_FARPTR is not jsut a function pointer. It' sprimary purpose is to represent a monolithic 20 bit value, as opposed to a long int value that is represented as 2*16 bit on assembly level. When stored to 'normal' memory, both are 4 byte size. But a normal long int will be put into 2*16 bit registers while an __SFR_FARPTR will be stored in a single register in a special 20 bit mode. Only this way, a 20 bit address can be properly

Link to post
Share on other sites

FWIW, DMA0DA and DMA0SA are declared so that the compiler knows they're 20-bit values (at least if you're using the mspgcc that's 20-bit aware). No particular cast should be necessary for mspgcc. In fact passing the value through (unsigned long) might result in an unnecessary (and very expensive) up-cast to a 32-bit value before truncating back down to the 20-bit value that will be stored.

 

See also http://sourceforge.net/apps/mediawiki/m ... te___a20__

Link to post
Share on other sites
Thanks pabigot for the info!

You're welcome.

is the f5510 a 20 bit msp?

All 5xx/6xx/FR5xx MCUs are CPUX architecture, meaning they support the 20-bit aware instructions. However, the 5510 has only 32kiB of flash, so there is no far memory for which 20-bit pointers would be useful. The 5529, on the other hand, has 81kiB of flash above the 64 kiB boundary (48 kiB below it).

pabigot, is mspgcc-20120406, 20bit aware?

No. The 4.7 development series, currently 20120911, is the only one that supports 20-bit code and data. 20120406 will, however, use CPUX instructions for other things (such as multi-register push/pop, enhanced bit rotate, etc.) If you're targeting the 5510, there's no particular value in updating.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...