I've been beating my head against the wall for a week. I'm trying to integrate a driver into my code, and keep coming across the same problem:
1) Add code
2) Get DSEG error
3) Declare more variables as xdata
4) Code then links but dies in the initialization code prior to even getting to main().
Has anyone ever come across this?
I have tried using the large model, but it does the same thing.
My code only fills 35% of the internal flash of a C8051F340.
Also, there are structures that are made up of simple uint8 and arrays of uint8 that break this very easily. Is there a recommended way of putting structures into xdata?
I have experimentally pulled out the arrays, and the structure still gives me trouble, but the arrays don't. I'd like to understand better why that is, too.
Thanks!
- Tones
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, how about that?! It worked.
You'd think the default would be to let the user handle the enabling of the watchdog. Oh well, I'm off and… running.
The link you gave shows that adding
void _sdcc_external_startup (void)
{
PCA0MD &= ~0x40;
}
can fix this, which I did. But then I wonder if this routine already existed elsewhere, such as in the library, and may contain other things I still need, which I will no longer have.
I have been using SEG_XDATA which translates to __xdata, it's just that I thought somehow that was part of my problem, which it wasn't.
Thanks,
- Tones
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you had read the whole thread in the link, you would have noticed that _sdcc_external_startup() needs to return a value. It's behaviour is also ducumented in the manual.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've been beating my head against the wall for a week. I'm trying to integrate a driver into my code, and keep coming across the same problem:
1) Add code
2) Get DSEG error
3) Declare more variables as xdata
4) Code then links but dies in the initialization code prior to even getting to main().
Has anyone ever come across this?
I have tried using the large model, but it does the same thing.
My code only fills 35% of the internal flash of a C8051F340.
Also, there are structures that are made up of simple uint8 and arrays of uint8 that break this very easily. Is there a recommended way of putting structures into xdata?
e.g.)
typedef struct _CtrlStruct_t {
uint8_t aBuff;
uint8_t bBuff;
uint16_t a16;
uint8_t b8;
uint8_t c8;
} CtrlStruct_t;
I have experimentally pulled out the arrays, and the structure still gives me trouble, but the arrays don't. I'd like to understand better why that is, too.
Thanks!
- Tones
4) Code then links but dies in the initialization code prior to even getting to main().
Most likely you don't feed the watchdog, see f.e. here:
http://www.cygnal.org/ubb/Forum10/HTML/000093.html
> Is there a recommended way of putting structures into xdata?
__xdata
Well, how about that?! It worked.
You'd think the default would be to let the user handle the enabling of the watchdog. Oh well, I'm off and… running.
The link you gave shows that adding
void _sdcc_external_startup (void)
{
PCA0MD &= ~0x40;
}
can fix this, which I did. But then I wonder if this routine already existed elsewhere, such as in the library, and may contain other things I still need, which I will no longer have.
I have been using SEG_XDATA which translates to __xdata, it's just that I thought somehow that was part of my problem, which it wasn't.
Thanks,
- Tones
If you had read the whole thread in the link, you would have noticed that _sdcc_external_startup() needs to return a value. It's behaviour is also ducumented in the manual.
Gotcha. Thanks again!
- Tones