Page 3 of 5

Re: BricxCC/NBC test release 2011-07-19

Posted: 23 Jul 2011, 18:19
by HaWe
thx for your reply, but I doubt that the mistake is in my program(s), because

file error -1 is only at level 0, not at level 1, 2, 3 or 4

file error -5 is only with your new version and only at level 1, not at 2 and not and 3, while all levels in your old version always have been fine.

Re: BricxCC/NBC test release 2011-07-19

Posted: 23 Jul 2011, 18:22
by afanofosc
I didn't say there was a mistake in your programs. But if only your programs show a bug in the compiler then I need you to help me dig in deep to figure out what it is about your programs that is triggering a compiler bug. Or you can change your program so that it doesn't trigger the compiler bug and forget about it.

John Hansen

Re: BricxCC/NBC test release 2011-07-19

Posted: 23 Jul 2011, 18:32
by HaWe
I certainly would help you if I could, but I can't read NBC code, I don't get compiler errors, and I can't use a NXC debugger because I never did before.
All I could do is give you the code itself so that you might see and find out what happens, so you already have all that I have and all I could give you.
(You may consider my programs to be just test programs I gave you to use for testing the NXC compiler if it works and optimizes correctly.)

Re: BricxCC/NBC test release 2011-07-19

Posted: 24 Jul 2011, 04:03
by muntoo
I tested ~10 of my programs, and they all seem to be working fine on optimization level 3.

My bezier curve program's 4th degree curve drawing routine performance went up by ~40%! (Comparing between the compiler last year, and the compiler this year.)

Furthermore, one two!! of my [old] programs that weren't working previously (due to a compiler bug) is working fine now. (I think it was because of the "ArrayLen DUI0 problem".)

Re: BricxCC/NBC test release 2011-07-19

Posted: 25 Jul 2011, 05:41
by muntoo
With optimization level 2 or above, my NXTFileManager freezes randomly when navigating through the list.

Previously, it was giving me File Error -5, but then I reflashed the firmware. I think the "file table" got corrupted. (One of the files wasn't opening.)

It works on any OptLevel if I comment out line 242:

Code: Select all

// FileTaskOpen(fname);

Re: BricxCC/NBC test release 2011-07-19

Posted: 26 Jul 2011, 11:06
by timpattinson
My very slow series approximation pi program:
261.889s, test release 2/07 (o2)
Just about to test with the latest version.

Code: Select all

task main()
{

    int i=3;
    float pi = 4.0;
    float term;
    float elapsed;
    float divisor;
    unsigned long startTime;
    unsigned long endTime;
    float lastPi = 0;
    bool add = false;
    
   /* float testVals[] = {(1/3),(2/3),(100/3)};
    for(int i = 0; i<ArrayLen(testVals);i++){
            ClearLine(LCD_LINE5);
            NumOut(0,LCD_LINE5,testVals[i]);
            Wait(3000);
    } */
    
    ClearScreen();
    TextOut(20,LCD_LINE1,"--NXT-Pi--",DRAW_OPT_INVERT);
    TextOut(10,LCD_LINE8,"Calculating...",DRAW_OPT_INVERT);
    startTime = CurrentTick();
    for(int cnt = 0;cnt < 100;cnt++){
        pi = 4;
        i = 3;
        while (abs(pi - lastPi) > 0.0002){
          lastPi = pi;
          divisor = i;
          term = 4.0/divisor;
          if(add){
               pi += term;
          }
          else{
               pi -= term;
          }
          add = !add;
          i+=2;
        }
    }
    endTime = CurrentTick();
    elapsed = (endTime-startTime)/1000 ;
    TextOut(5,LCD_LINE2, StrCat("Loops: ",NumToStr( (i-3) /2) ));
    TextOut(5,LCD_LINE3, StrCat("Time: ",NumToStr(elapsed),"s"));
    TextOut(5,LCD_LINE4,StrCat("PI = ",NumToStr(pi)),DRAW_OPT_INVERT);
    PlayTone(440, MS_500);
    while(1);
}

Re: BricxCC/NBC test release 2011-07-19

Posted: 26 Jul 2011, 23:45
by afanofosc
I could use a few volunteers to try out my new firmware changes and NXC API changes in support of fast I2C and direct control of digital pins on the input ports. Please contact me if you are interested. I really need help from someone with a scope who can check out the digital pin control options for me.

John Hansen

Re: BricxCC/NBC test release 2011-07-19

Posted: 30 Jul 2011, 19:32
by schodet
afanofosc wrote:I could use a few volunteers to try out my new firmware changes and NXC API changes in support of fast I2C and direct control of digital pins on the input ports. Please contact me if you are interested. I really need help from someone with a scope who can check out the digital pin control options for me.
I have a scope, how could I help?

Re: BricxCC/NBC test release 2011-07-19

Posted: 01 Aug 2011, 16:58
by afanofosc
schodet wrote:I have a scope, how could I help?
What I would like to do is find out using a scope or some other gadget how long it typically takes to execute a new system call function that lets you control the digital pins on the input ports. I need to know how far off and if it is mostly consistently far off from the specified number of microseconds of wait time that I am adding to the Set and Clear commands.

You will need a new firmware image to try this out. I will upload a new test release zip later today.

John Hansen

Code: Select all


#define OLD_COMPILER // comment this line out if you have a compiler with these values already defined.

#ifdef OLD_COMPILER

struct InputPinFunctionType {
  unsigned int Result; // The function call result. Possible return values are ERR_INVALID_PORT or NO_ERR.
  byte Cmd;            // The command to execute. See \ref InputPinFuncConstants.  You can add a microsecond wait after the command by ORing INPUT_PINCMD_WAIT(usec) with the command Value. Wait times can range from 1 to 63 microseconds.
  byte Port;           // The input port. See \ref InPorts.
  byte Pin;            // The digital pin(s). See \ref InputDigiPinConstants. When setting pin direction you must OR the desired direction constant into this field.  See                    INPUT_PINDIR_INPUT and INPUT_PINDIR_OUTPUT from the \ref InputPinFuncConstants group. You can OR together the digital pin constants to operate on both in a single call.
  byte Data;           // The pin value(s). This field is only used by the INPUT_PINCMD_READ command.
};

#define INPUT_PINCMD_DIR    0x00 // Set digital pin(s) direction
#define INPUT_PINCMD_SET    0x01 // Set digital pin(s)
#define INPUT_PINCMD_CLEAR  0x02 // Clear digital pin(s)
#define INPUT_PINCMD_READ   0x03 // Read digital pin(s)
#define INPUT_PINCMD_MASK   0x03 // Mask for the two bits used by pin function commands
#define INPUT_PINCMD_WAIT(_usec) ((_usec)<<2) // A wait value in microseconds that can be added after one of the above commands by ORing with the command
#define INPUT_PINDIR_OUTPUT 0x00 // Use with the direction command to set direction to input.  OR this with the pin value.
#define INPUT_PINDIR_INPUT  0x04 // Use with the direction command to set direction to output.  OR this with the pin value.

#define InputPinFunction 77

#endif

task main()
{
  InputPinFunctionType pftSet, pftClear, pftDir;

  // use these parameters to set the pin direction
  pftDir.Port = S1;
  pftDir.Pin = INPUT_DIGI0|INPUT_PINDIR_OUTPUT;
  pftDir.Cmd = INPUT_PINCMD_DIR;

  // use these parameters to SET the pin
  pftSet.Port = S1;
  pftSet.Pin = INPUT_DIGI0;
  pftSet.Cmd = INPUT_PINCMD_SET|INPUT_PINCMD_WAIT(2);

  // use these parameters to CLEAR the pin
  pftClear.Port = S1;
  pftClear.Pin = INPUT_DIGI0;
  pftClear.Cmd = INPUT_PINCMD_CLEAR|INPUT_PINCMD_WAIT(30);

  SysCall(InputPinFunction, pftDir); // set the direction to output

  while(true)
  {
    SysCall(InputPinFunction, pftSet);
    SysCall(InputPinFunction, pftClear);
  }

}

Re: BricxCC/NBC test release 2011-07-19

Posted: 03 Aug 2011, 20:02
by schodet
afanofosc wrote:What I would like to do is find out using a scope or some other gadget how long it typically takes to execute a new system call function that lets you control the digital pins on the input ports. I need to know how far off and if it is mostly consistently far off from the specified number of microseconds of wait time that I am adding to the Set and Clear commands.
You will need a new firmware image to try this out. I will upload a new test release zip later today.
OK, but, I did not see the new image yet (here? http://bricxcc.sourceforge.net/test_releases/).