Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Padding problem in Code Composer studio

Status
Not open for further replies.

suryakant

Member level 5
Joined
Mar 10, 2005
Messages
90
Helped
6
Reputation
12
Reaction score
0
Trophy points
1,286
Location
India
Activity points
2,171
code composer structures

I am working on Code composer for TMS320.
I ve structure in the code similar to following:
Code:
typedef struct _abc
{ 
	unsigned int x;		// 1 Word
	long int y;			// 2 Words
}ABC;


ABC myStruct;

For TMS320, compiler aligns long int to next even address. So to above structure it pads one more integer so that long int variable gets even address. (structure starts at even address)

This variable i am sending on serial port to other controller (freescale MC9S12C128) who has same declaration at its side. The application is developed in code warrior where long can be accessed at odd addresses also.

In communication, padded word gets transferred to other controller, which goes into lower Word of unsigned long of freescale controller..

What can i do is add dummy word in the declaration itself, but I am limitation on memory (RAM), so can't do that.. :cry:

How to handle this situation?

I ve found work around by splitting long into two unsigned ints and accessing long by using long pointer... but thats not encouraging.... is it?

new definition is
Code:
typedef struct _abc
{ 
	unsigned int x;
	
	unsigned int y;  // lower word of long int
                unsigned int z;  // higher word of long int
}ABC;


Use of stucture - union did not help :cry:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top