[comp.sys.atari.st.tech] Deskaccs with GCC

waal@cwi.nl (Peter de Waal) (12/10/90)

Hi there,

Now that I have my Gcc cross compiler up and running on my Sparc station, I
would like to compile the sources for a deskaccessory that I wrote. Standard
compiling:

gcc -o foo.acc foo.c -lgem

does not seem to work, since my ST then just reboots when it tries
to load the accessory. I assume that for accessories I need a different
startup module (?). Can anybody tell how to do this (I don't see accessories
mentioned at all in the GCC docs).

Disclaimer: Despite of this, GCC is still the greatest thing since sliced
bread!

=============================================================================
Peter de Waal,   CWI,   P.O. Box 4079,   1009 AB Amsterdam,   The Netherlands
Tel: +31 - 20 592 4167.                          Electronic Mail: waal@cwi.nl
=============================================================================

sstreep@next.com (Sam Streeper) (12/12/90)

In article <2666@charon.cwi.nl> waal@cwi.nl (Peter de Waal) writes:
>Now that I have my Gcc cross compiler up and running on my Sparc station, I
>would like to compile the sources for a deskaccessory that I wrote. Standard
>compiling:
>
>gcc -o foo.acc foo.c -lgem
>
>does not seem to work, since my ST then just reboots when it tries
>to load the accessory. I assume that for accessories I need a different
>startup module (?). Can anybody tell how to do this (I don't see accessories
>mentioned at all in the GCC docs).

I don't know a lot about atari GNU C, but if there is no accessory startup
code I can help.  I have written startup code for Laser, Mark Williams,
Megamax, and Sozobon compilers that will start regular programs or desk
accessories.  The code for all the compilers except Sozobon is owned by
Antic and was published in October 89 STart magazine.  The sozobon startup
is public domain
and was posted to the Atari sources group; it is conceptually identical to
my own Laser C startup code.

I can mail it to anyone that is interested in porting it to the GNU
compiler.  It is my hope that someday most accessories will be runable
as programs.  (yes, I know about MultiDesk, a fine program that should
not be necessary)

-sam (sam_s@NeXT.com)

bammi@acae127.cadence.com (Jwahar R. Bammi) (12/22/90)

In article <2666@charon.cwi.nl> waal@cwi.nl (Peter de Waal) writes:

> compiling:
> 
> gcc -o foo.acc foo.c -lgem
> 
> does not seem to work, since my ST then just reboots when it tries
> to load the accessory. I assume that for accessories I need a different
> startup module (?). Can anybody tell how to do this (I don't see accessories
> mentioned at all in the GCC docs).

the gcc startup automatically detects if a program is being run as an
ACC, but you have to help it a little bit with its stack+heap area.

the convention is that the user has to set two variables:

  _heapbase  to the botom of the stack+heap area
  _stksize   to the size of this area

here is an example:
 define the following global variables in your file, adjusting the
size as appropriate.

char _stack_heap[1024];
void *_heapbase = (void *)_stack_heap;
long _stksize = sizeof(_stack_heap);

main()
{
  /* whatever */
}

at startup then, the stack will be set at the top of this area, and
the heap at the bottom, and the two grow towards each other. You can
do malloc()'s from this area in your ACC (notice malloc() and not the
tos's Malloc()).

cheers,
--
--
bang:   uunet!cadence!bammi			jwahar r. bammi
domain: bammi@cadence.com
GEnie:	J.Bammi
CIS:    71515,155