I'm trying to iterate through a list of functions and I'm running into a
couple issues.
here is a sample:
typedef void (*example_handler)();
typedef struct {
BYTE code;
example_handler handler;
} handlers_t;
void func1() {}
void func2() {}
void func3() {}
handlers_t handlers[] = {
{0x01, func1},
{0x02, func2},
{0x03, func3}
};
The first issue I run into is that the handlers[] begins to encroach
into IRAM data as I add more handlers and I get a message about not
being able to allocate enough data for the OSEG/Overlay variables. I
suspect this has to do something with spill locations as was mentioned a
few emails back but I'm not sure a better way to handle the situation.
My initial reaction is to redefine the array like this:
handlers_t xdata handlers[] = {
....}
but I then start having problems with other areas of the firmware not
functioning correctly. I haven't been able to trace this to a specific
area that doesn't work, but if I don't define the handlers array in
xdata storage, and allocate a minimal enough number of handlers that I
don't get the data allocation problem at link time, The firmware does
work correctly.
Does anyone have any suggestions for either a better way to handle this
type of logic or a better way to allocate the function pointers.
Thanks
Dennis
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user