Bricxcc and firmware test versions

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Bricxcc and firmware test versions

Post by afanofosc »

I have made a change to the way BricxCC tries to find and load the hhctrl library which is used to launch HTML help. If you can replace your BricxCC executable with the one from the zip at the link below and try launching help I would appreciate it.

http://sourceforge.net/projects/bricxcc ... p/download

If it still does not work then I would ask that you install a debug viewer from Microsoft and have it running when you launch BricxCC and try the help system. Then send me the logs that it collects. The debug viewer is at this link:

http://download.sysinternals.com/Files/DebugView.zip

This build of BricxCC includes a new compiler version as well. It reports 1.2.1.r4 as the NBC compiler version. It is not yet the official release of this compiler version, which will include a number of API additions and changes that I haven't made yet. One thing it includes that requires the firmware image I posted yesterday is a new system call function called MemoryManager. It lets you force a compact operation and returns the status of that call along with the PoolSize and the DataspaceSize values from the firmware. There is a constant called POOL_MAX_SIZE in NBCCommon.h which is 32768. If the PoolSize reaches that value you have run out of RAM. I ran some tests with this new function yesterday and I was getting confusing results so I am not 100% sure what is going on in the firmware. You can call this function via SysMemoryManager or GetMemoryInfo.

Code: Select all


task main() {
  byte data[];
  byte data2[];
  int data3[];
  int ps, ds;
  char result = GetMemoryInfo(false, ps, ds);
  NumOut(0, LCD_LINE1, ps);
  NumOut(0, LCD_LINE2, ds);
  Wait(SEC_5);
  ClearScreen();
  Wait(SEC_1);
/*
  result = GetMemoryInfo(true, ps, ds);
  NumOut(0, LCD_LINE1, ps);
  NumOut(0, LCD_LINE2, ds);
  Wait(SEC_5);
  ClearScreen();
  Wait(SEC_1);
*/
  ArrayInit(data, 10, 3000);
  data[10]++;
  ps = data[10];
  data2 = data;
  ArrayBuild(data3, ps, ds, ps, ds, ps, ds, ps, ds);
  result = GetMemoryInfo(false, ps, ds);
  NumOut(0, LCD_LINE1, ps);
  NumOut(0, LCD_LINE2, ds);
  NumOut(0, LCD_LINE8, data[10]);
  Wait(SEC_5);
  ClearScreen();
  Wait(SEC_1);
  result = GetMemoryInfo(true, ps, ds);
  NumOut(0, LCD_LINE1, ps);
  NumOut(0, LCD_LINE2, ds);
  NumOut(0, LCD_LINE8, data2[10]);
  Wait(SEC_5);
  ClearScreen();
  Wait(SEC_1);
//  while(true);
}
I would appreciate some help testing out the behavior of this function in order to better understand the values that it reports back for PoolSize and DataspaceSize as you allocate and resize arrays or copy data around from string to string with concatenation, or anything which should make an array longer or shorter than it used to be. Passing false as the first parameter will not force a compact operation and in that case the function call should always return NO_ERR (aka 0).

The firmware zip has been uploaded to this URL:

http://sourceforge.net/projects/bricxcc ... p/download

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Bricxcc and firmware test versions

Post by spillerrec »

I have waited long for a function like this : D
There was only the BCC exe in the zip, is it possible to get a command line version of the compiler? I will try it out anyway (tomorrow), but I just prefer to do the coding outside BCC...

Btw, if any of you guys want to do any serious testing with arrays/strings and their effect on memory usage, remember to look at the compiled NBC code. Otherwise I'm sure those temporary arrays that are automatically added will result in rather confusing results...
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricxcc and firmware test versions

Post by mattallen37 »

afanofosc wrote:I have made a change to the way BricxCC tries to find and load the hhctrl library which is used to launch HTML help. If you can replace your BricxCC executable with the one from the zip at the link below and try launching help I would appreciate it...

If it still does not work then I would ask that you install a debug viewer from Microsoft and have it running when you launch BricxCC and try the help system. Then send me the logs that it collects. The debug viewer is at this link...

John Hansen
I downloaded the executable from there, and I replaced the one on the computer, but no change.

I ran that debugger, and when I opened BCC, it gave the following error:

[4360] LookupHHCtrlPath: HTML help library path = 'C:\Windows\System32\hhctrl.ocx'

It looks to my untrained eyes like the program is trying to find the HTML file in "System32", but I am running a 64 bit system.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Bricxcc and firmware test versions

Post by afanofosc »

Matt,

The changes I made to the way BricxCC loads the hhctrl.ocx library involve reading its path from the registry. If that is not correct then for some very strange reason your operating system is badly configured. Can you find this file on your system? On my Windows 7 Home Premium 64 bit system hhctrl.ocx is in c:\windows\system32.

Do you see either of these messages?

_HtmlHelpSetup: Attempting to load the HTML help library
_HtmlHelpSetup: Unable to load the HTML help library (hhctrl.ocx)

If neither of these messages show in the debug viewer then BricxCC is never trying to use the HTML help API.

I have uploaded a new bricxcc.zip with more logging. It should indicate whether UseHTMLHelp is true or false and whether it is calling WinHelp or DoNewHelp (which results in the HTML help API being called).

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Bricxcc and firmware test versions

Post by afanofosc »

spillerrec wrote: Btw, if any of you guys want to do any serious testing with arrays/strings and their effect on memory usage, remember to look at the compiled NBC code. Otherwise I'm sure those temporary arrays that are automatically added will result in rather confusing results...
The thing (or one of the things) I found confusing was that calling ArrayInit(data, 10, 1000) on a byte array that was previously empty did not result in the PoolSize going up by ~1000 and when I copied it to another byte array that was previously empty it didn't go up further.

I have uploaded a nbc.zip to the same testrelease folder on sourceforge:

http://sourceforge.net/projects/bricxcc ... p/download

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricxcc and firmware test versions

Post by mattallen37 »

Ok, I searched for "hhctrl.ocx", and it found it, and it was right in the proper place (c:\windows\system32).

I hit F1 while cursor on "task" while the debugger was open, and it returned the following errors:

[4360] HelpALink: UseHTMLHelp = F
[4360] TMainForm.HandleOnHelp: UseHTMLHelp = F
[4360] TMainForm.HandleOnHelp: Calling WinHelp

Starting very recently, this message has been popping up when I attempt to open help (from BCC).
BCC help error.jpg
BCC help error.jpg (17.34 KiB) Viewed 11585 times
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Bricxcc and firmware test versions

Post by afanofosc »

Sounds like UseHTMLHelp is false. The only way that can happen is if UseHTMLHelp is 0 in the registry. It that value isn't in the registry at all then with 3.3.8.8 UseHTMLHelp has to be true. Try this (carefully):

1. click Start
2. type "regedit" into the edit box right above the start button then press enter. OK the question about making changes to the computer.
3. expand HKEY_CURRENT_USER
4. expand Software
5. expand BricxCC
6. expand 3.3
7. select General
8. scroll to the bottom of the list on the right looking for UseHTMLHelp
reg.jpg
(186.04 KiB) Downloaded 251 times
It seems certain that your registry has 0 for this value. You might also try searching the entire registry for UseHTMLHelp. In any case, you can just delete this value and it should be changed to 1 the next time you run BricxCC.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricxcc and firmware test versions

Post by mattallen37 »

Indeed, it is 0, as you say. So, I should just remove that, and BCC will replace it with the proper one?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricxcc and firmware test versions

Post by mattallen37 »

Here is a picture of it.
Registery info.jpg
(233.25 KiB) Downloaded 249 times
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Bricxcc and firmware test versions

Post by afanofosc »

In theory you could delete it or you could double click on it and change the value to 1. But deleting that key is what the /reset was supposed to do and changing its value to 1 was what running that .reg file was supposed to do. Try both options (one at a time, of course) and see if either makes BricxCC start using HTML help. I'm just about at my wits end on this one.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests