4D SYSTEMS FORUM

Register New Posts
 
 
 


Reply
 
Author Comment
 
skatouch

Registered: 02/05/12
Posts: 66
Reply with quote #1 
My main program is 13639 byte, and my program for user touch calibration is 1808 byte, i can't load both in the flash memory. I want use the function file_Run(..,..) or file_Exec(..,..) for load the program at run time, in both cases the system crashes or touch  does not display the text properly(using the standard font).

My main program uses this directives:
##MODE RUNFLASH
#STACK 1000
My Touch has this Pmmc:
uLCD-32PTGFX-R28.PmmC

Thanks


ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,262
Reply with quote #2 

Any program that is the target of file_run or file_exec must, by definition, run from RAM.

 

Hope that helps you make sense of what is going on

skatouch

Registered: 02/05/12
Posts: 66
Reply with quote #3 
I compile my main program with directive #MODE RUNFLASH .
If i run my program with this code it works

#MODE RUNFLASH
#STACK 400

func main()
 
    file_Run("TCalib.4XE",0);


    repeat forever

endfunc

If i run my program in my main program it not works

Have you a idea?
meldavia

Registered: 18/03/07
Posts: 900
Reply with quote #4 
Quote:

If i run my program in my main program it not works



if you show us the code that wont work, we may be able to help.......

or preferably,
show a simple example that shows where you are having the problem...


__________________
Regards,
Dave
skatouch

Registered: 02/05/12
Posts: 66
Reply with quote #5 
My program is very complex ... 
Can you tell me some of this behavior?
If I use the same program (TCalib.4XE) in a main code so simple:
#MODE RUNFLASH
#STACK 400

func main()
 
    file_Run("TCalib.4XE",0);


    repeat forever

endfunc

 it works.

In my main program when   file_Run ("TCalib.4XE", 0)  is invoked my display crashed or the text appears bad, unreadable.

Thanks for the help


Terentius

Registered: 15/06/12
Posts: 2
Reply with quote #6 

Hi, I have some problem with error 15 in my program. I'm using 32 PT GFX. I only press the touchscreen buttons for 12 times, to go to another loop, and it write me error 15 - stack is increasing by 11 for one change to another loop. If I'm not using a functions but subs (gosub...endsub), EVE stack is increasing by "only" one. So I ask that, is in my program fault, or it's normal? And how can I decrease or stop increase this stack? Cause if I can't, it means that I have to turn of the display after some (if I use sub, it's for cca 130 touches) display touches?

Here are these two func. :

func Pocitadlo()
   // ClearArea 1.0 generated 14.6.2012 17:08:05
   gfx_OutlineColour(BLACK) ;
   gfx_LinePattern(LPFINE) ;
   gfx_RectangleFilled(60, 41, 319, 240, BLACK) ;
   gfx_OutlineColour(BLACK) ;
   gfx_LinePattern(LPSOLID) ;

   // Angularmeter1 1.0 generated 12.6.2012 13:51:13
   img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, numx) ;

   // where frame is 0 to 100 (for a displayed 400 to 500)
   img_Show(hndl,iAngularmeter1) ;
   pause(100);
   numx := numx +10;
   img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, numx);

   gfx_MoveTo(70, 50);
   print("\n""STACK:",EVE_SP());

   // Meter generated 3.4.2012 19:01:40
   img_Show(hndl,iMeter);

   gfx_MoveTo(70, 65);
   print("\n""STACK:",EVE_SP());
   touch_Set(TOUCH_ENABLE);
   repeat
     if (touch_Get(0) == 1)
       x := touch_Get(1);
       y := touch_Get(2);
       if (y > 200 & x < 60)
         touch_Set(TOUCH_DISABLE);
         pause(100);
         Help();
       endif
     endif
     pause(10);
   forever
endfunc
func Help()
   // ClearArea 1.0 generated 14.6.2012 17:08:46
   gfx_OutlineColour(BLACK) ;
   gfx_LinePattern(LPFINE) ;
   gfx_RectangleFilled(60, 41, 319, 240, BLACK) ;
   gfx_OutlineColour(BLACK) ;
   gfx_LinePattern(LPSOLID) ;
   gfx_MoveTo(70, 165);
   print("\n""STACK:",EVE_SP());

   // Statictext1 1.0 generated 12.6.2012 13:50:40
   img_Show(hndl,iStatictext1) ;
   gfx_MoveTo(70, 50);
   print("Hello everyone");
   gfx_MoveTo(70, 80);
   print("I'm the new screen");
   print("\n""STACK:",EVE_SP());

   touch_Set(TOUCH_ENABLE);
   repeat

     gfx_MoveTo(70, 95);
     print("\n""STACK:",EVE_SP());

     if (touch_Get(0) == 1)
       x := touch_Get(1);
       y := touch_Get(2);

       if (y > 40 && y < 80 && x < 60)
         touch_Set(TOUCH_DISABLE);
         pause(100);
         Pocitadlo();
       endif
     endif
     pause(10);
forever
endfunc

ESPsupport

Moderator
Registered: 27/01/09
Posts: 4,262
Reply with quote #7 

The two routines call each other, you will eventually run out of stack space no matter how much stack you have.

Terentius

Registered: 15/06/12
Posts: 2
Reply with quote #8 
I've solved it already, it's a terrible fault, but thank you for reply :-)
dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #9 
Hi,

I've problems about the file_Run command, on uLCD32PT.
I use a little program as "Boot loader" in flash, which allows me to put the programs I need on SD card, and allows better update system.

So, if my bootloader run prog "A", under "A" I can run prog "B" by
file_Run ("B", 0);
So Bootloader -> A -> B is OK

If my bootloader run prog "B", under "B" I can run prog "A" by the same way.
So Bootloader -> B -> A is OK

BUT, for example, if my bootloader run prog A :
I can run "B" prog
But now I can't run "A" from "B" : the message is
"error 15 PC=7710, v1=0, v2=0"
I saw this error is "EVE stack overflow".

So Bootloader -> A -> B -> A crashes.
Same problem with Booloader -> B -> A  -> B

The sizeof of "A" is 8226 bytes, "B" is 7339 bytes.
The bootloader in flash is 2014 bytes size.

How ! These progs run OK before on the "old" uLCD32032P1T (with some change due to the differencies between theses displays).

Any idea ?

Thanks a lot.
Joel
ipaq3115

Avatar / Picture

Registered: 12/11/11
Posts: 139
Reply with quote #10 
Here is a simple version of what I'm doing.

Code:
#platform "uLCD-28PT_GFX2"
#MODE RUNFLASH

var page;

func main()

    repeat

        if (page==1)

            page:=file_Run("runprog.4fn",0);

        else if (page==7)

            page:=file_Run("runprog2.4fn",0);

        endif

    forever

endfunc



Then in the main function of the program you called, return the next address you want like this. return 7;
dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #11 
Thank you, ipaq3115 !

I'll try your solution tomorrow, that means for me the called process returns a code number to the bootloader.

I understand now with my system, there is recursive process, because A call B, and B call A without main function exits.
With your system, main function of the called process exits.
Fine !!!
Okkkkkkkkkkk !!!

Best regards !

... Tomorrow is now today.
And it runs !
Thanks a lot !
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Powered by Website Toolbox - Create a Website Forum Hosting, Guestbook Hosting, or Website Chat Room for your website.