4D SYSTEMS FORUM

Register New Posts
 
 
 


Reply
 
Author Comment
 
dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #1 
Hi !

I've a strange thing : a prog .4XE running correctly when I load it from 4D-Systems workshop, and not completely correct when I run it from the "file_Run" command...

I send to this prog character strings to create touches with text on them using Hyper Terminal.

Once the prog downloaded (into Ram or flash), what I send is correctly shown (touches, position, colour, text inside).

So, I copy the 4XE file on a SD-Card, and run it via a bootloader using file_Run statement.
When I "file_run" this same prog, what I send is correctly shown (touches, position, colour) EXCEPT the text which is not displayed...

I tried some things as "#STACK 500", I tried to improve the size of the serial buffer without any success.
The size of this program is 8834 bytes.

Because this type of problem, it's very difficult to fix it.

Any idea ?
Thanks a lot.
Best regards.
Joel

ipaq3115

Avatar / Picture

Registered: 12/11/11
Posts: 139
Reply with quote #2 
In my experience the most common problem is running out of ram space and things not running properly, but that depends on if you are loading any files, images or stuff like that. 

That being said, the first thing the 4d guys will tell you is to post your code, which is probably a good idea for the best help  
dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #3 

Hum !

 

I tried to decrease the amount of used RAM by decreasing the serial buffer without any success.

 

I'm afraid this development is almost big.

But I don't know where I can go now !

So, I join the files :

  • _0_main.zip (with all the files in the same directory, in order to split big file; including the "technic files"), _0_main.4xe copied to SD-Card
  • Include_folder.zip (these files are in the include directory of the workshop)
  • _0_boot.4dg (the boot loader in flash)

 

100_1867.jpg and 100_1868.jpg : 2 screen shots showing the differences between the same prog

  • 100_1867.jpg : the prog running by bootloader (texts are missing)
  • 100_1868.jpg : the same prog directly loaded in Ram or flash by the worshop (texts are OK)

I included a function called by "main" which avoid to use Hyper Terminal to send commands to the display.

 
I know it's difficult to read soft written by other peoples. So, I hope mine is easy to read !
Thanks for your help.
 
Joel

Attached Images:
Click image for larger version - Name: 100_1867.JPG, Views: 23, Size: 92.45 KB   Click image for larger version - Name: 100_1868.JPG, Views: 16, Size: 110.83 KB  

 
Attached Files:
zip _0_MAIN.ZIP (116.04 KB, 11 views)
zip Include_folder.zip (3.29 KB, 5 views)
4dg _0_BOOT.4DG (1.52 KB, 11 views)

4DSysFan

Registered: 19/01/08
Posts: 502
Reply with quote #4 
Not sure if it makes a difference.....But in one you have:

func APPLI_InitSystem ()
    gfx_Set       (SCREEN_MODE, LANDSCAPE);
    txt_FGcolour  (LIGHTGREEN);
    txt_BGcolour  (BLACK);
    touch_Set     (TOUCH_ENABLE);                    // enable écran tactile
    touch_Set     (TOUCH_REGIONDEFAULT);             // écran tactile sur toute la surface
endfunc

and the other is:

func APPLI_InitSystem ()
   gfx_Set     (SCREEN_MODE, LANDSCAPE);
   txt_Set     (TEXT_COLOUR, GREEN);
   touch_Set   (TOUCH_ENABLE);               // enable écran tactile
   touch_Set   (TOUCH_REGIONDEFAULT);        // écran tactile sur toute la surface

   COM0_Init    ();
endfunc


__________________
_______________
Best Regards,
Howard
ipaq3115

Avatar / Picture

Registered: 12/11/11
Posts: 139
Reply with quote #5 
Looks like you want to declare no_appli in your boot program as a global variable.

I think this has something to do with file_Run dumping the local variables when it runs, but a 4D guy may be able to explain this better.

I only figured this out by commenting out all your stuff except for that file_Run command and I saw it worked fine. Then after some playing around I saw that it had something to do with that variable so I moved it Hope this helps.

I uploaded your boot program again. You can see where I just moved var no_appli; out of your main function.

 
Attached Files:
4dg _0_BOOT.4DG (1.52 KB, 11 views)

dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #6 

Hi, ipaq3115 and 4DSysFan !

 

OK !

If I put in my Bootloader "no_appli" as global variable, it's OK...

I see I didn't use correctly file_Run.

I kept in my mind the precedent display uLCD32031, where these kind of softs runs OK. I thinked file_Run destroyed all code and data just before to load the new process. OK, I understand now how file_Run process.

 

For the differencies between the 2 main functions,

- the bootloader doesn't need any access to serial port.

- the other one needs it.

 

So, sure, this help me !!!

All is OK now !!!

Great !!!

 

Thanks a lot.

Best regards

 

Joel

ipaq3115

Avatar / Picture

Registered: 12/11/11
Posts: 139
Reply with quote #7 
You are correct, file_Run does respect global variables. When "no_appli" is defined in "main()" it is a local variable, when it is outside of the "main()" it is a global variable. That's why "no_appli" was discarded when file_Run was called.
dieseinfo

Registered: 09/10/09
Posts: 29
Reply with quote #8 
OK, I understand.

I kept in my mind my precedent display uLCD-32032-P1T and the documentation of 4DGL I downloaded a couple of years before (october 2009).
About file_Run :
"... The current program is dumped and the new program takes over all ressources..."
And after :
"When the program return, control is gained by whatever program is running in flash memory"

This was true for the display I used, not for the new display uLCD-32PT.
This was why my old programs run OK, with some "file_Run" somewhere in functions.

Thanks again for your help !


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.