Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Marc Kleine-Budde
Nicolas TOUCHARD wrote:
 I'm working with PXA270 and ptxdist 0.10.4 ( gcc 4.0.2).
 
 In my soft I use, global structure. In using, some of them are destroyed.
 I verify all my size declaration, and all seem to be good.
 
 to resolv it, sometime I've to declar the global static and sometimes 
 not .. not very rigorous !!
 The most strange is when it's working with static global structure, if I 
 pass it to non static , it's not working !!

Please give us the code, so that we can look into it. (We're not 
telephatic :)

 I really think of a linker or compiler problem My compiler command 
 is : arm-softfloat-linux-gcc -wall -O3 -msoftoat.

Have you tested your Programm on your linux developement host with your 
distributions compiler?

Marc

-- 
  Dipl.-Ing. Marc Kleine-Budde | http://www.pengutronix.de
   Pengutronix - Linux Solutions for Science and Industry
 Handelsregister: Amtsgericht Hildesheim, HRA 2686
   Hannoversche Str. 2, 31134 Hildesheim, Germany
 Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Tom St

 PEBCAC? ;-)
   
I had to look that up :-)

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Nicolas TOUCHARD
Marc Kleine-Budde a écrit :
 Nicolas TOUCHARD wrote:
   
 I'm working with PXA270 and ptxdist 0.10.4 ( gcc 4.0.2).

 In my soft I use, global structure. In using, some of them are destroyed.
 I verify all my size declaration, and all seem to be good.

 to resolv it, sometime I've to declar the global static and sometimes 
 not .. not very rigorous !!
 The most strange is when it's working with static global structure, if I 
 pass it to non static , it's not working !!
 

 Please give us the code, so that we can look into it. (We're not 
 telephatic :)
   

it's big soft, with many files ... see below for  the structure 
declaration.


   
 I really think of a linker or compiler problem My compiler command 
 is : arm-softfloat-linux-gcc -wall -O3 -msoftoat.
 

 Have you tested your Programm on your linux developement host with your 
 distributions compiler?
   

good remark ! Yes I've tested it , and it's working well on my host PC !


  Nicolas


###
structure declaration
###


// Objet utilisé pour l'émission des trames maître
typedef struct
{
unsigned char ucMaster;  
 unsigned char ucFonction;   
 unsigned char ucAdresse;   
 unsigned char tucData[aMAC_BUFSIZE_DATA]; 
 union
 {
 unsigned char tucCRC[2];
 unsigned short int uiCRC;
 } uIntegrity;   
 unsigned char ucSize; 
} T_MACMasterFrame;

// Objet utilisé pour la réception des trames esclaves
typedef struct
{
 unsigned char ucError;   
 unsigned char ucAdresse;  
 unsigned char ucFonction; 
 unsigned char ucSize;
 unsigned char tucData[aMAC_BUFSIZE_DATA];
  union
 {
 unsigned char tucCRC[2];
 unsigned short  int uiCRC;
 } uIntegrity;   
} T_MACSlaveFrame;

typedef struct
{
unsigned char ucState;
 T_MACMasterFrame tAsk;
 T_MACSlaveFrame tAnswer;
unsigned char ucTimeOutSec;
 TDateTimeObject tDateTimeout;
unsigned char ucCptTentative;
} T_SYTGEOBusManager;

static T_SYTGEOBusManager tSytgeoBus;


-- 

Nicolas Touchard
NKE electronics
Rue Gutenberg Z.I. de Kerandré
56700 HENNEBONT - FRANCE
Email : [EMAIL PROTECTED]
Tél. : (33) 2-97-36-10-12
Fax : (33) 2-97-36-55-17 


-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Marc Kleine-Budde
Nicolas TOUCHARD wrote:
 The most strange is when it's working with static global structure, if I
 pass it to non static , it's not working !!
 
 ? pass to no static?
   
 no problem with static T_SYTGEOBusManager tSytgeoBus;
 but memory problem with T_SYTGEOBusManager tSytgeoBus;

what is a memory problem?

Marc

-- 
  Dipl.-Ing. Marc Kleine-Budde | http://www.pengutronix.de
   Pengutronix - Linux Solutions for Science and Industry
 Handelsregister: Amtsgericht Hildesheim, HRA 2686
   Hannoversche Str. 2, 31134 Hildesheim, Germany
 Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Juergen Beisert
Nicolas,

On Wednesday 11 July 2007 11:53, Nicolas TOUCHARD wrote:
  The most strange is when it's working with static global structure, if I
  pass it to non static , it's not working !!
 
  ? pass to no static?

 no problem with static T_SYTGEOBusManager tSytgeoBus;
 but memory problem with T_SYTGEOBusManager tSytgeoBus;

All right, its unitialised common variable. Do you are using anywhere else in 
your sources a variable also called tSytgeoBus with a different size?

For global common variables the linker combines them into one variable.

So:

source1.c
 [...]
  int var;
 [...]

source2.c
 [...]
 char var;
 [...]

source3.c
 [...]
 long var;
 [...]

...all different var will be combined into one variable var by the linker. 
Try to add the --warn-common parameter to your linker. This will help to 
find such an failure.

Hope it helps

Juergen

-- 
Dipl.-Ing. Juergen Beisert | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
    Handelsregister: Amtsgericht Hildesheim, HRA 2686
     Vertretung Sued/Muenchen, Germany
   Phone: +49-8766-939 228 |  Fax: +49-5121-206917-9

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] memory problem with my soft

2007-07-11 Thread Nicolas TOUCHARD
the memory problem is that the ucState variable in the global structure 
can be bad ( the max value should be 6 and I found 80 or 254 or 16 ) !



Marc Kleine-Budde a écrit :
 Nicolas TOUCHARD wrote:
   
 The most strange is when it's working with static global structure, if I
 pass it to non static , it's not working !!
 
 
 ? pass to no static?
   
   
 no problem with static T_SYTGEOBusManager tSytgeoBus;
 but memory problem with T_SYTGEOBusManager tSytgeoBus;
 

 what is a memory problem?

 Marc

   


-- 

Nicolas Touchard
NKE electronics
Rue Gutenberg Z.I. de Kerandré
56700 HENNEBONT - FRANCE
Email : [EMAIL PROTECTED]
Tél. : (33) 2-97-36-10-12
Fax : (33) 2-97-36-55-17 


-- 
ptxdist mailing list
ptxdist@pengutronix.de