Go to Post Can't we also care about and celebrate the processes, the professionalism, the experience of healing? - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-04-2006, 01:18
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Possible bug in memory initialization?

In ifi_startup.c, the routine _do_cinit() has some static variables defined with:
<<<<<<<<<<<<
_do_cinit (void)
{
/* we'll make the assumption in the following code that these statics
* will be allocated into the same bank.
*/
static short long prom;
static unsigned short curr_byte;
static unsigned short curr_entry;
static short long data_ptr;
>>>>>>>>>>>>

This is followed by a bunch of asm statements that are used to initialize static/extern memory locations. Since we have had lots of problems with static memory not behaving like it was initialized properly, I am wondering if the stated assumption in the comment, that the four static variables are allocated in the same bank, might not be valid, depending on just how much static memory is allocated in other files.

Can anyone shed some light on this issue?

Last edited by eugenebrooks : 08-04-2006 at 01:22.
  #2   Spotlight this post!  
Unread 08-04-2006, 02:38
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Possible bug in memory initialization?

Doc,

Are you saying that explicit or implicit initializations are corrupted?

I have seen no issues with explicit initializations and have strongly advised everyone who cares to listen to avoid them.

JMHO.

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 08-04-2006, 03:40
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Possible bug in memory initialization?

Quote:
Originally Posted by Mike Betts
Doc,

Are you saying that explicit or implicit initializations are corrupted?

I have seen no issues with explicit initializations and have strongly advised everyone who cares to listen to avoid them.

JMHO.

Mike
Mike, I don't think that there is any need to re-visit the thread you point to here, I don't disagree with the view you posted there. My question is whether or not the assumption that the variables in the routine in question are allocated in the same section can ever be violated...
  #4   Spotlight this post!  
Unread 08-04-2006, 09:22
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: Possible bug in memory initialization?

I have never seen a problem with variable initialization that wasn't my own fault (mainly not recognizing how the compiler will sometimes cast constants). But as for your question, I would say that the assumption is true. Since the compiler places all static uninitilized variables within a file in the same UDATA section (assuming you don't use a #pragma statement to change that) the compiler/linker would generate a section error if it overflows a single DATABANK since a single UDATA section must fit within a single DATABANK. That being said, if you've modified the linker file so that a single DATABANK spans multiple memory banks, then I suppose it would be possible for the same bank assumption to be false.

You should also be able to check the .map file to verify that all the variables have been placed in the same bank.

Mike

Last edited by Mike Bortfeldt : 08-04-2006 at 09:28.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Older computer memory trouble sanddrag IT / Communications 9 02-12-2005 21:43
Nasty Compiler Bug Matt Leese Programming 5 18-02-2005 18:44
initialization program and speed controllers rosebud Programming 15 05-10-2004 03:35
printf bug - beware! WizardOfAz Programming 8 10-03-2004 09:50
Whacky C Complier behavior Larry Barello Programming 12 26-01-2004 22:15


All times are GMT -5. The time now is 03:12.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi