Shop OBEX P1 Docs P2 Docs Learn Events
Your program is too big for the memory model selected in the project. — Parallax Forums

Your program is too big for the memory model selected in the project.

cbarrett27cbarrett27 Posts: 3
edited 2014-04-28 13:16 in Learn with BlocklyProp
Hello experts.
I've got a "simple" program that is 'single-cog' that is unable to compile and I need your help.
I'm pretty new to parallax boards and the SimpleIDE.
I've been familiar with Arduino for several years now.

the summary of the program:
1. runs on activity bot / activity board
2. listens for new characters coming in from Xbee using a multiple "IF" statements.

The error I receiving is "Your program is too big for the memory model selected in the project."

Basically, It WILL compile with the following lines commented out.
As soon as I uncomment one of the "drive" lines, it fails to compile with the following message:

c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld.exe: cmm/Xbee_CARL.elf section `.bss' will not fit in region `hub' c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld.exe: region `hub' overflowed by 824 bytes

collect2: ld returned 1 exit status

Done. Build Failed!


Any and every help is very much appreciated!!


CODE:


int look(int dir);

#include "simpletools.h"
#include "abdrive.h"
#include "ping.h"
#include "servo.h"
#include "fdserial.h"
#include "wavplayer.h"




int xbeeDOpin = 10,xbeeDIpin = 9,pingPin = 17,touretPin = 16; // Pins
int leftHd = 1600,left = 1200,fwd = 900,right = 600,rightHd = 200; // Angles
int baud = 9600, speed = 64, distCm = 25; // Inits
int DO = 22, CLK = 23, DI = 24, CS = 25; // SDcard
fdserial *xbee;


int main() {
print("[Initializng C.A.R.L.]");
freqout(4, 1000, 2500);
sd_mount(DO, CLK, DI, CS);
wav_volume(7);


xbee = fdserial_open(xbeeDOpin, xbeeDIpin, 0, baud);
char* xb;


while(1)
{
xb = (char*)fdserial_rxCheck(xbee);
if(xb == -1) continue;
print("xb: %c\n",xb);


if(xb == '1'){ wav_play("9.wav"); }
if(xb == '2'){ wav_play("10.wav"); }
if(xb == '3'){ wav_play("14.wav"); }
if(xb == '4'){ wav_play("8.wav"); }
if(xb == '6'){ speed = 40; }
if(xb == '7'){ speed = 64; }
if(xb == '8'){ speed = 80; }
if(xb == '9'){ speed = 94; }



//if(xb == 'l'){ if (look(left)){drive_ramp(speed-30, speed); }}
//if(xb == 'L'){ if (look(left)){drive_ramp(0,speed); }}
//if(xb == 'r'){ if (look(right)){drive_ramp(speed, speed-30); }}
//if(xb == 'R'){ if (look(right)){drive_ramp(speed,0); }}
//if(xb == 'f'){ if (look(fwd)){drive_ramp(speed, speed); }}
//if(xb == 'b'){ look(fwd); drive_ramp(-speed, -speed);}}
//if(xb == 's'){ look(fwd); drive_ramp(0,0); }
//if(xb == 'c'){ look(fwd); drive_ramp(0,0); }
}
}


int look(int dir){
servo_angle(touretPin, dir);
pause(300);
return (ping_cm( pingPin ) > distCm); // dont crash into wall
}

Comments

  • jazzedjazzed Posts: 11,803
    edited 2014-04-20 22:23
    Hi.

    The print() function includes support for floating point. If you don't need floating point, it is reasonable to use another option. In the future we are adding a printi() function that will be smaller to the Simple Library. Meanwhile, I recommend in this case instead of using print(), that the smaller functions can be used.

    For example, instead of A replace with B as follows ....

    A. print("[Initializng C.A.R.L.]");
    replace with:
    B. putStr("[Initializng C.A.R.L.]");

    A. print("xb: %c\n",xb);
    replace with:
    B. printStr("xb: "); putChar(xb);

    Doing the above steps should free about 2KB of memory.


    cbarrett27 wrote: »
    Hello experts.
    I've got a "simple" program that is 'single-cog' that is unable to compile and I need your help.
    I'm pretty new to parallax boards and the SimpleIDE.
    I've been familiar with Arduino for several years now.

    the summary of the program:
    1. runs on activity bot / activity board
    2. listens for new characters coming in from Xbee using a multiple "IF" statements.

    The error I receiving is "Your program is too big for the memory model selected in the project."

    Basically, It WILL compile with the following lines commented out.
    As soon as I uncomment one of the "drive" lines, it fails to compile with the following message:

    c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld.exe: cmm/Xbee_CARL.elf section `.bss' will not fit in region `hub' c:/program files (x86)/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld.exe: region `hub' overflowed by 824 bytes

    collect2: ld returned 1 exit status

    Done. Build Failed!


    Any and every help is very much appreciated!!


    CODE:


    int look(int dir);

    #include "simpletools.h"
    #include "abdrive.h"
    #include "ping.h"
    #include "servo.h"
    #include "fdserial.h"
    #include "wavplayer.h"




    int xbeeDOpin = 10,xbeeDIpin = 9,pingPin = 17,touretPin = 16; // Pins
    int leftHd = 1600,left = 1200,fwd = 900,right = 600,rightHd = 200; // Angles
    int baud = 9600, speed = 64, distCm = 25; // Inits
    int DO = 22, CLK = 23, DI = 24, CS = 25; // SDcard
    fdserial *xbee;


    int main() {
    print("[Initializng C.A.R.L.]");
    freqout(4, 1000, 2500);
    sd_mount(DO, CLK, DI, CS);
    wav_volume(7);


    xbee = fdserial_open(xbeeDOpin, xbeeDIpin, 0, baud);
    char* xb;


    while(1)
    {
    xb = (char*)fdserial_rxCheck(xbee);
    if(xb == -1) continue;
    print("xb: %c\n",xb);


    if(xb == '1'){ wav_play("9.wav"); }
    if(xb == '2'){ wav_play("10.wav"); }
    if(xb == '3'){ wav_play("14.wav"); }
    if(xb == '4'){ wav_play("8.wav"); }
    if(xb == '6'){ speed = 40; }
    if(xb == '7'){ speed = 64; }
    if(xb == '8'){ speed = 80; }
    if(xb == '9'){ speed = 94; }



    //if(xb == 'l'){ if (look(left)){drive_ramp(speed-30, speed); }}
    //if(xb == 'L'){ if (look(left)){drive_ramp(0,speed); }}
    //if(xb == 'r'){ if (look(right)){drive_ramp(speed, speed-30); }}
    //if(xb == 'R'){ if (look(right)){drive_ramp(speed,0); }}
    //if(xb == 'f'){ if (look(fwd)){drive_ramp(speed, speed); }}
    //if(xb == 'b'){ look(fwd); drive_ramp(-speed, -speed);}}
    //if(xb == 's'){ look(fwd); drive_ramp(0,0); }
    //if(xb == 'c'){ look(fwd); drive_ramp(0,0); }
    }
    }


    int look(int dir){
    servo_angle(touretPin, dir);
    pause(300);
    return (ping_cm( pingPin ) > distCm); // dont crash into wall
    }
  • cbarrett27cbarrett27 Posts: 3
    edited 2014-04-24 10:26
    Thank you so much for your reply. I would have never guessed it was in my print statement.
  • cbarrett27cbarrett27 Posts: 3
    edited 2014-04-28 13:07
    Ok, new problem with same symptom.
    Currently I use fdserial_rxcheck to receive data via XBee, but now I am trying to send data out via XBee and the only examples I've seen uses dprint
    As soon as I try to compile this, I get the same error as my original post.
    I'm guessing the reason is the same. but, what can I use as an alternative for this?

    http://learn.parallax.com/propeller-c-simple-protocols/full-duplex-serial
  • jazzedjazzed Posts: 11,803
    edited 2014-04-28 13:16
    Hi,

    There are two versions of the little output functions. put*() and write*().

    For example, where ever you see dprint(fds,"%d", value), you can replace it with writeDec(fds, value);
Sign In or Register to comment.