Solved

Borland C V3.1 embedded design

Posted on 2002-07-03
4
241 Views
Last Modified: 2010-04-15
Can anyone assist with a Borland C V3.1 problem. I am using battery backed up ram in an embedded system and have some variables I do not want initialized on reset or power up. How do I overcome this problem ?

Thank you
CarlB
0
Comment
Question by:carlbeck
4 Comments
 
LVL 4

Expert Comment

by:havman56
ID: 7126440
declare those variables as local in stack.. dont initialise it!

see if it is global then it will be in .bss section  so during ur startup routine dont initailse to zero.
0
 
LVL 11

Accepted Solution

by:
dimitry earned 50 total points
ID: 7130298
If it is your embedded system maybe you can simply use some constant physical address for your variables that is not part of DATA segment. In order to access some physical address in real mode you can do next:
#include <dos.h>
#define MY_VAR_SEG    0xHHHH
#define MY_VAR_OFF    0xOOOO

/* for "int" variable */
int far *myVar = (int far *)MK_FP(MY_VAR_SEG,MY_VAR_OFF);

int foo()
{
  *myVar = 25; /* Set 25 to address [0xHHHH:0xOOOO] */
}

0
 
LVL 20

Expert Comment

by:jmcg
ID: 10052530
Nothing has happened on this question in more than 18 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by dimitr [grade B] (only partial answer).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
posix semaphore deadlock 13 108
Where is my core dump file in Ubuntu? 12 428
How to get time_t value that is a week old 6 155
Need example 5 100
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now