BricxCC/NBC test release 2011-07-19

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

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

Post 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.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

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

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

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

Post 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.)
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

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

Post 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".)
Last edited by muntoo on 25 Jul 2011, 06:16, edited 1 time in total.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

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

Post 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);
Attachments
muntoo-nxtfilemanager-103e43bda81f.zip
(34.23 KiB) Downloaded 259 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

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

Post 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);
}
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

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

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

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

Post 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?
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

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

Post 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);
  }

}
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

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

Post 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/).
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests