Personal tools
You are here: Home Forums R8C/Tiny Stack, IStack, Heap sizes

Stack, IStack, Heap sizes

Up to R8C/Tiny

Stack, IStack, Heap sizes

Posted by RicoB at August 20. 2008

Where in the nrct0.a30 file do I set stack, istack, heap sizes. Or do I have to set them into the HEW, but where?

Im puzzled at the moment,  one routine does work when I use a global instaead of a local variable. With the local variable I'll get 'Illegal instruction'.

Code Sample: (Whith eTemp as global this works as local not) this function is called from a main subroutine

// Treatment31 ausführen
void runTreatment31(void) {
    unsigned char res;

    if(keyFlag) {
        if(key.Flag.Mu) {
            res = read_eeprom(DCU1,&eTemp);           (this is the routine for the virtuell eeprom)
            uSpgMin = eTemp;   
            newMenu = 30;
            cursPosY = lastSubCursY;
        }
       
        key.AllFlags = 0;
        keyFlag = 0;
    }
}

And very strange the same routine in an other place works with local eTemp

Re: Stack, IStack, Heap sizes

Posted by Calvin Grier at August 20. 2008

If you have a recent version of HEW and the M16C/R8C compiler (v 5.43 or 5.44) , I'd suggest starting with an empty "C Source Startup Application". HEW will generate an empty project for you and you can drop you code into the new project.

This gives you a project where there's initialization and configuration in .C and .H files. You'll also be able to use updated syntax for defining interrupts like this:

#pragma INTERRUPT _input_key (vect=13)

It's much easier to read the stack configuration and the other project options in the .H files.

(Don't forget to exclude intprg.c from the build, unless you plan to put all of your ISR code inside of it.)

Re: Stack, IStack, Heap sizes

Posted by George Patsilaras at August 25. 2008

To answer your question regarding stack/heap etc size:

Look in the ncrt0.a30 file you should find somewhere a region with your Stack information that should look like this:


;---------------------------------------------------------------------
; STACK SIZE definition
;---------------------------------------------------------------------
.if    __USTACKSIZE__ == 0
.if    __R8C__ != 1
STACKSIZE    .equ    300h
.else
STACKSIZE    .equ    100h
.endif
.else
STACKSIZE    .equ    __USTACKSIZE__
.endif


Or you can go to HEW : Build > H8 standard Toolchain and check there the USTACKSIZE variable etc

If you think you need to look at your stack usage etc you can use the Call Walker tool http://www.renesasrulz.com/downloads/tips-tricks/tool-cheats/additional-tools/NC30_CallWalker_M16C.doc/view?searchterm=call+wa which is a stack size calculation utility tool.

Powered by Ploneboard