Forums

porting USB drivers to Crossworks

Started by William Sell May 19, 2011
OK, so I posted about __no_init and __data16 last week, but now I need to
know how to locate variables into an absolute address. The TI CCS has an
additional linker file which is used to locate variables for the USB data
structures at an absolute address:

/************************************************************
* USB linker cmd file
************************************************************/

tSetupPacket = 0x2380;
tEndPoint0DescriptorBlock = 0x0920;
....etc....

The corresponding variable is initialized in the CCS as

extern __no_init tDEVICE_REQUEST tSetupPacket;
extern __no_init tEDB0 tEndPoint0DescriptorBlock;
...etc...

so I looked at the 5529 memory map in Crossworks and there are descriptors
for these addresses, so I wondered if something like this would work:

ptDEVICE_REQUEST tSetupPacket __at "NO_INIT" = (volatile
ptDEVICE_REQUEST)&USBSUBLK; //USBSUBLK is 0x2380
tpEDB0 tEndPoint0DescriptorBlock __at "NO_INIT" = (volatile tEDB0
*)&USBIEPCNF_0;

it compiles, (though I get a warning about the dropping of the volatile),
but I do not think it is quite right. So before I change a whole bunch of
code, wondered if anyone knew the way to code this (of course I know Paul
knows!!). BTW, I have the rest of the port done, works great on
the experimenter board. I will post this on the forum when I wrap up the
USB stuff. Doesn't feel like I did very much, but sure took awhile...!

-Bill


Beginning Microcontrollers with the MSP430

If you want to locate at an absolute address, just say so:

Int x __at 0x1234;

Done. X is at that address. Don't even bother with the no-init stuff, it is assumed.

Sent from my iPad

On 19 May 2011, at 19:09, William Sell wrote:

> OK, so I posted about __no_init and __data16 last week, but now I need to
> know how to locate variables into an absolute address. The TI CCS has an
> additional linker file which is used to locate variables for the USB data
> structures at an absolute address:
>
> /************************************************************
> * USB linker cmd file
> ************************************************************/
>
> tSetupPacket = 0x2380;
> tEndPoint0DescriptorBlock = 0x0920;
> ....etc....
>
> The corresponding variable is initialized in the CCS as
>
> extern __no_init tDEVICE_REQUEST tSetupPacket;
> extern __no_init tEDB0 tEndPoint0DescriptorBlock;
> ...etc...
>
> so I looked at the 5529 memory map in Crossworks and there are descriptors
> for these addresses, so I wondered if something like this would work:
>
> ptDEVICE_REQUEST tSetupPacket __at "NO_INIT" = (volatile
> ptDEVICE_REQUEST)&USBSUBLK; //USBSUBLK is 0x2380
> tpEDB0 tEndPoint0DescriptorBlock __at "NO_INIT" = (volatile tEDB0
> *)&USBIEPCNF_0;
>
> it compiles, (though I get a warning about the dropping of the volatile),
> but I do not think it is quite right. So before I change a whole bunch of
> code, wondered if anyone knew the way to code this (of course I know Paul
> knows!!). BTW, I have the rest of the port done, works great on
> the experimenter board. I will post this on the forum when I wrap up the
> USB stuff. Doesn't feel like I did very much, but sure took awhile...!
>
> -Bill
>
>
>
I suggest you try the USB code that was ported to crossworks already and
is added to this newsgroup.
This is what I have in my code:

#ifdef __CROSSWORKS_MSP430
extern tDEVICE_REQUEST tSetupPacket __at 0x2380;
extern tEDB0 tEndPoint0DescriptorBlock __at 0x0920;
extern tEDB tInputEndPointDescriptorBlock[7] __at 0x23C8;
extern tEDB tOutputEndPointDescriptorBlock[7] __at 0x2388;
extern BYTE abIEP0Buffer[EP0_MAX_PACKET_SIZE] __at 0x2378;
extern BYTE abOEP0Buffer[EP0_MAX_PACKET_SIZE] __at 0x2370;
extern BYTE pbXBufferAddressEp1[EP_MAX_PACKET_SIZE] __at
OEP1_X_BUFFER_ADDRESS;
extern BYTE pbYBufferAddressEp1[EP_MAX_PACKET_SIZE] __at
OEP1_Y_BUFFER_ADDRESS;
extern BYTE pbXBufferAddressEp81[EP_MAX_PACKET_SIZE] __at
IEP1_X_BUFFER_ADDRESS;
extern BYTE pbYBufferAddressEp81[EP_MAX_PACKET_SIZE] __at
IEP1_Y_BUFFER_ADDRESS;
extern BYTE pbXBufferAddressEp2[EP_MAX_PACKET_SIZE] __at
OEP2_X_BUFFER_ADDRESS;
extern BYTE pbYBufferAddressEp2[EP_MAX_PACKET_SIZE] __at
OEP2_Y_BUFFER_ADDRESS;
extern BYTE pbXBufferAddressEp82[EP_MAX_PACKET_SIZE] __at
IEP2_X_BUFFER_ADDRESS;
extern BYTE pbYBufferAddressEp82[EP_MAX_PACKET_SIZE] __at
IEP2_Y_BUFFER_ADDRESS;
extern BYTE pbXBufferAddressEp3[EP_MAX_PACKET_SIZE] __at
OEP3_X_BUFFER_ADDRESS;
#endif

From:
William Sell
To:
Msp430
Date:
05/19/2011 01:10 PM
Subject:
[msp430] porting USB drivers to Crossworks
Sent by:


OK, so I posted about __no_init and __data16 last week, but now I need to
know how to locate variables into an absolute address. The TI CCS has an
additional linker file which is used to locate variables for the USB data
structures at an absolute address:

/************************************************************
* USB linker cmd file
************************************************************/

tSetupPacket = 0x2380;
tEndPoint0DescriptorBlock = 0x0920;
....etc....

The corresponding variable is initialized in the CCS as

extern __no_init tDEVICE_REQUEST tSetupPacket;
extern __no_init tEDB0 tEndPoint0DescriptorBlock;
...etc...

so I looked at the 5529 memory map in Crossworks and there are descriptors
for these addresses, so I wondered if something like this would work:

ptDEVICE_REQUEST tSetupPacket __at "NO_INIT" = (volatile
ptDEVICE_REQUEST)&USBSUBLK; //USBSUBLK is 0x2380
tpEDB0 tEndPoint0DescriptorBlock __at "NO_INIT" = (volatile tEDB0
*)&USBIEPCNF_0;

it compiles, (though I get a warning about the dropping of the volatile),
but I do not think it is quite right. So before I change a whole bunch of
code, wondered if anyone knew the way to code this (of course I know Paul
knows!!). BTW, I have the rest of the port done, works great on
the experimenter board. I will post this on the forum when I wrap up the
USB stuff. Doesn't feel like I did very much, but sure took awhile...!

-Bill





Hi William,

the name of the TI USB example file for Crossworks is "SLAC285 for
Crossworks.zip". It's in the files section of the group under Member
contributions. Your endpoints will be located correctly if you use that.

Have a good day,
Mario

From:
William Sell
To:
Msp430
Date:
05/19/2011 01:10 PM
Subject:
[msp430] porting USB drivers to Crossworks
Sent by:


OK, so I posted about __no_init and __data16 last week, but now I need to
know how to locate variables into an absolute address. The TI CCS has an
additional linker file which is used to locate variables for the USB data
structures at an absolute address:

/************************************************************
* USB linker cmd file
************************************************************/

tSetupPacket = 0x2380;
tEndPoint0DescriptorBlock = 0x0920;
....etc....

The corresponding variable is initialized in the CCS as

extern __no_init tDEVICE_REQUEST tSetupPacket;
extern __no_init tEDB0 tEndPoint0DescriptorBlock;
...etc...

so I looked at the 5529 memory map in Crossworks and there are descriptors
for these addresses, so I wondered if something like this would work:

ptDEVICE_REQUEST tSetupPacket __at "NO_INIT" = (volatile
ptDEVICE_REQUEST)&USBSUBLK; //USBSUBLK is 0x2380
tpEDB0 tEndPoint0DescriptorBlock __at "NO_INIT" = (volatile tEDB0
*)&USBIEPCNF_0;

it compiles, (though I get a warning about the dropping of the volatile),
but I do not think it is quite right. So before I change a whole bunch of
code, wondered if anyone knew the way to code this (of course I know Paul
knows!!). BTW, I have the rest of the port done, works great on
the experimenter board. I will post this on the forum when I wrap up the
USB stuff. Doesn't feel like I did very much, but sure took awhile...!

-Bill