No announcement yet.

My program has reached the __MAXPROG limit. What do I do?

  • Filter
  • Time
  • Show
Clear All
new posts

  • My program has reached the __MAXPROG limit. What do I do?


    I have been using 4D.Visi to create screens and logic using 4DGL. My project has about 20 screens and there is a need to develop at least a couple more.
    My platform is the Gen4 uLCD 32DT display board and I am using the Visi environment.

    At this time I am getting the following message after compilation:

    Error: maximum program size of 32750 for device has been exceeded (code size required 33979)
    1 error
    0 warnings
    83 notices

    Is there something I can do about it?
    In the aux file generated after compilation, __MAXPROG is 32750
    I believe that Diablo16 has 6 Flash Banks, each 32KB. Is it possible to use second or further banks to keep program code and load it from there to RAM as needed?
    Ideally, I would love to store all constant data in another bank and read it from there. How do I achieve this?

    I am frantically searching for some type of complete guide on how to use parent and child programs.

    I did come across AN 55, but that uses the uSD card and not flash banks.

    How to write a program so that it gets compiled and then downloaded to a particular flashbank?

    How to read that program from the flash and run it? (Ok, this is easy... flash_Run(FLASHBANK_1)

    If I wish to copy data to a given flash bank, and retrieve it from there as and when needed, so that data is not stored all the time in flashbank0, How do I do that?

    Is it possible to use pre-processor statement, which specifies the location of the data? In that case, it can be prepended to the #DATA--#END blocks to ensure that these get written to a particular flash bank.

    So many questions, and no clear answers or documentation. 4D folks, Please help me out.

    Please find my project zipped and attached here.

    Best Regards,
    Vishal Sapre
    Attached Files
    Last edited by vsapre; 15 May 2020, 07:12 AM.

  • #2
    Hi Vishal

    I've managed to free up about 5k of flash space by bunching some repetitive code into a function. I've placed the function at the end of the code and I hope it's use is self explanatory. There may be other areas of repetitive code that may benefit being put in a function and reduce code space.

    Best regards

    Attached Files


    • #3
      Hello Paul,

      Thanks for that insight. It was all auto-generated code, (using paste code button from object inspector), and so maybe I did not think it out.
      Your help was Great.

      Can you provide me pointers, as to where I can learn more about moving a particular program, to a particular flash bank. I am unable to find any code references.
      How do I put the data (program etc) into a flash bank of my choice, in the first place?

      Best Regards,