How to reference a pointer to pdata or idata without using generic pointer?

216 Views Asked by At

Using Keil C51 on an 8051 target. I have a set of functions that take a pointer to a structure. The structure will only live in pdata or idata. Due to size constraints and memory mapping magic, I can't condense all structures into the same memory space.

When I declare my set of functions with a generic pointer, code size grows substantially. As a test, I declared these functions with a pointer to a struct in pdata. When I do this, my code size returns to normal, but of course I get mspace warnings and I'll be pointing to the wrong memory space whenever I reference a struct from idata into the function.

Assuming the premise of my approach is sound, how can allow these functions to take pointers to pdata or idata without code size explosion?

Given that I may be going about this all wrong, am I overlooking a more traditional solution to this problem?

1

There are 1 best solutions below

0
On

It sounds like you do need generic pointers.

Maybe you should attack the code size problem from another direction. Which compiler/linker optimization settings are you using?