I got a few Wixels to replace a old project that used to run on some ZigBee AVRs. I’m extremely familiar with GCC for AVR and ARM but 8051 is not something I work with often.
I am reading through SDCC’s manual explaining XDATA, PDATA, and CODE. So far I know the following
- PDATA starts at the same address as XDATA except only up to one page before needing a write to a SFR to change the page
- PDATA is 256 bytes long
- CC2511 is a medium memory model device, so stack default to PDATA
- SDCC with place parameters on external memory by default for medium memory model devices, unsure if they mean XDATA or PDATA
My questions are:
- what is the behavior of the compiler if I pass a buffer declared as XDATA into a function that expects a char pointer without any memory space attributes? will standard memcpy or strcpy care? is the memory paging for PDATA automatic?
- is the compiler smart enough to put constant strings into CODE for me? Or is each printf going to chew up RAM? if so, is there a way to avoid this? AVR GCC has the PSTR macro to help with this.
- is it safe to modify the makefile to just say --model-large and avoid the headache of putting XDATA on everything?
and one more… say I make a lookup table like this
#define KRF_HOP_MAP 75, 163, 250, 43, 13, 184, 128, 210
static const uint8_t CODE krf_chanMap[] = { KRF_HOP_MAP };
is the data stored in flash or is the data stored in RAM?
Thanks