I'm trying to port contiki to the pic18f67j60, but I'm running into some
problems with sdcc that I can't figure out a way around.

Specifically, there's a set of macros to define processes (protothread),
and one that creates a list of these that should be automatically
started when the chip boots:

----------
struct process {
  struct process *next;
  const char *name;
  PT_THREAD((* thread)(struct pt *, process_event_t, process_data_t));
};

#define PROCESS(name, strname)                          \
  PROCESS_THREAD(name, ev, pdata);                      \
  struct process name = { NULL, strname,                \
                          process_thread_##name }

#define AUTOSTART_PROCESSES(...)                        \
struct process * const autostart_processes[] = {__VA_ARGS__, NULL}
-----------

When used in the application, these produce (straight from sdcc -E):

-----------
static char process_thread_hello_world_process(struct pt *process_pt,
process_event_t ev, process_data_t pdata);

struct process hello_world_process = {
  0,
  "Hello world process",
  process_thread_hello_world_process
};

struct process * const autostart_processes[] = {
  &hello_world_process,         // ERROR!!!!
  0
};

static char process_thread_hello_world_process(struct pt *process_pt,
process_event_t ev, process_data_t pdata) {
  ...
}
-----------

The above code compiles just fine with GCC, but returns "error 129:
pointer types incompatible: on the line reading "&hello_world_process".

The array itself is supposed to be a constant table containing pointers
to the volatile per-process structures, but sdcc isn't seeing it this way.

Is this a known issue, and if so are there plans to fix it?  In the
meantime, can anybody think of a workaround?  I'm going to try a fairly
radical restructuring that does the autostart very differently, but it
seems that if GCC and other compilers (even supposedly SDCC-z80) can
handle it, it would have to be a bug...

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to