Bricx - Sorosy Debugger question

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
katamapah
Posts: 11
Joined: 03 Jun 2011, 21:54

Bricx - Sorosy Debugger question

Post by katamapah »

Hi guys,

It is my first time here, since i just recently bought the NXT2 system and build my first robot.

It is based on a Race Car http://www.nxtprograms.com/NXT2/race_car/steps.html with the following modifications:
- Only 2 motors are used to rotate the wheels. The third motor has been removed and is being used to rotate the (well known deal extreme's) wireless camera.
- In order to have more power to rotate the wheels (now i have one motor rotating both rear wheels) the order of chain wheels have been reversed.
It also gives the ability to more precisely control the robot, since the car will drive slowly in such configuration.

The idea is to use a brick and its CPU as sort of robot controller, while using laptop for some kind of real time image processing (getting a video from wireless camera) and sending the commands (or sort of a model) back to the robot using Blue-tooth. This is the framework. Some fusion with other sensors is also a possibly on a later stage.


Anyway...
After some checking on the net (RobotC vs NBC-NXC vs NXT OS-ARM7 Native) i decided to start from the most "default" system
and went with NBC/NXC and Enhanced 1.28 firmware. Thanks to John Hansen.

I have recently installed both BricX IDE and Sorosy Debugger.

BricX version is 3.3.8.8, while Debugger is 1.0 Beta 3
I am running them on Apple MacBook Pro with Windows 7 (boot camp) using compatibility mode for Windows XP SP2 and "run as administrator".
I am using Enhanced 1.28 firmware.

First i installed the phantom driver (and NXT-G package), then BricX and finally the debugger.

For some reason i just could not start working with the debugger.
The IDE works fine, it communicates with the robot, compiles simple NXC/NBC sources i took from the example's .pdf and runs them on target.
Then, while trying to "Compile and Debug" this same NBC code, it just doesn't compile.

For example, the following NBC code compiles and runs perfectly.

thread main
OnFwd(OUT_B,100)
OnFwd(OUT_C,100)
wait 4000
OnRev(OUT_BC,100)
wait 4000
Off(OUT_BC)
exit
endt

Then, when trying to "compile and debug" while transferring to debugger the notepad opens and following errors appear

# Error: Duplicate variable declaration (__constVal1)
File "D:\Ctac\Lego MindStorm 2\Documentation\NBC (ASM)\tutorial-0.02\1-simple.dbg" ; line 140
# __constVal1 sbyte 1
#----------------------------------------------------------
# Error: Duplicate variable declaration (__constVal0)
File "D:\Ctac\Lego MindStorm 2\Documentation\NBC (ASM)\tutorial-0.02\1-simple.dbg" ; line 142
# __constVal0 sbyte
#----------------------------------------------------------
2 errors during compilation


Again, this same code was perfectly compiled and ran just before that while using "compile", "download and run".

Then, i thought it might be some sort of constant declaration/definition problem, so i just left with the wait.
thread main
//OnFwd(OUT_B,100)
//OnFwd(OUT_C,100)
//wait 4000
//OnRev(OUT_BC,100)
wait 4000
//Off(OUT_BC)
exit
endt

This code could be compiled using "Compile and Debug" and i finally got into debugger with the source window showing the code, but
i couldn't set any breakpoint or do anything. When i right clicked the mouse i could see the "enable/add breakpoint" etc, but whatever i choose
i couldn't see any breakpoint being added or set. Of course i connected to the brick before that. Basically i just saw my source code in a source window of a debugger but could do nothing with it. Every option was either gray, or simply did nothing. Only Source->thread/routing showed me the only thread i have.

Same, when i tried to add a hardcoded breakpoint using #pragma debugbreak the code would compile under "compile", but wouldn't compile
under "compile and debug".


Is anyone here had something similar running under Windows 7 or using this particular Bricx version with the debugger ?
Is there are some configuration or ini files to look at ?
I wish it has been more information on a debugger site regarding the problems people encounter.



P.S. I hope i came to the right place to ask all sort of technical questions.


Thanks,
CTAC
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Bricx - Sorosy Debugger question

Post by afanofosc »

Sadly, it has been a long time since I have tried using the Sorosy NBC debugger. It was written for a very early version of the compiler and I have not done anything to make sure that newer versions of the compiler still work with the debugger. This is primarily since very few people used the debugger or even NBC - at least to my knowledge. Most people using BricxCC with the NXT seem to be using Not eXactly C (NXC) and there is not a separate debugger like the Sorosy NBC debugger for NXC. BricxCC does, however, provide some amount of support for debugging NXC code (and NBC code) without the Sorosy debugger. With the enhanced NBC/NXC firmware running on your NXT you can pause a running program and single step through the code and, of course, you can watch variable values and use other BricxCC tool windows to interact with your NXT while your program is running or paused.

I can walk you through some of these capabilities either here on the forums or via email if you would prefer. One thing that I have not yet implemented is support for breakpoints. I have code in the enhanced firmware to support breakpoints but I just have not yet gotten around to adding the ability in BricxCC to set or clear breakpoints.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
katamapah
Posts: 11
Joined: 03 Jun 2011, 21:54

Re: Bricx - Sorosy Debugger question

Post by katamapah »

Hi, John.
Thanks for the answer and for all the work you do to support your enhanced firmware and Bricx IDE.
I guess there was a lot of work(and fun) involved for you during these years :-)

As for your answer, i do not mind working with NXC, it seems to be very similar in its abilities and API abilites to NBC and the only
real difference as i see it is the more "human" (C style) syntax of NXC while compared to an assembly style syntax of NBC.
I am not sure as for how NXC is truly a "higher level language" to NBC as for example a C or C++ is higher level language to the assembler.
I guess there is some optimization and code translation involved when creating NBC from NXC, but i a don't know what is the magnitude.
What are the main NXC/NBC differences to consider beside the obvious ?

Thanks for the suggestion, I would like to go with you over the debug features of Bricx IDE.
If you find it relevant for all other people, we can do it here in public, otherwise we can do it by mail or private messages.

Another question about the debugger. Is it still good as a standalone debugger for .rxe files ?
I read the Lego software guide explaining the executable format of .rxe files, as well as the virtual machine and memory management.
NBC seems to have very good correspondence to Lego's own virtual machine + have some extended mathematics and task scheduling options (priorities, stop taks). This should still be compatible among the various NBC/Bricx versions, since it is based on the backward compatible firmware.
The question is, can i take some .rxe file running on robot and sort of "reverse engineer" it in the debugger, even without having a source code ?
I couldn't find a way to do it.

Thanks a lot,
CTAC
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricx - Sorosy Debugger question

Post by mattallen37 »

katamapah wrote:...If you find it relevant for all other people, we can do it here in public, otherwise we can do it by mail or private messages...
Please discuss it here, in the forums. I don't read everything posted, but I like to be able to find it when I need it.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
katamapah
Posts: 11
Joined: 03 Jun 2011, 21:54

Re: Bricx - Sorosy Debugger question

Post by katamapah »

It's OK with me.
linusa
Posts: 228
Joined: 16 Oct 2010, 11:44
Location: Aachen, Germany
Contact:

Re: Bricx - Sorosy Debugger question

Post by linusa »

katamapah wrote: I read the Lego software guide explaining the executable format of .rxe files, as well as the virtual machine and memory management.
Cool! This is a very good start, IMO.
katamapah wrote: The question is, can i take some .rxe file running on robot and sort of "reverse engineer" it in the debugger, even without having a source code ?
I couldn't find a way to do it.
On my (old) version of BricxCC, I can just drag an RXE file from the Windows explorer into the main window of BricxCC, and I get the decompiled NBC version.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming
http://www.mindstorms.rwth-aachen.de
MotorControl now also in Python, .net, and Mathematica
katamapah
Posts: 11
Joined: 03 Jun 2011, 21:54

Re: Bricx - Sorosy Debugger question

Post by katamapah »

Hi,
Cool! This is a very good start, IMO.
Yes, it's quite informative. Unfortunately, all i remember now - it is a good reference point :-)
On my (old) version of BricxCC, I can just drag an RXE file from the Windows explorer into the main window of BricxCC, and I get the decompiled NBC version.
What Bricx version are you using ?
Do you manage to debug code with the Sorosy Debugger in there ?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricx - Sorosy Debugger question

Post by mattallen37 »

I am using 3.3.8.10 (the latest test release), and I also have the ability to open .rxe files as NBC code.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
katamapah
Posts: 11
Joined: 03 Jun 2011, 21:54

Re: Bricx - Sorosy Debugger question

Post by katamapah »

Hi,
I am using 3.3.8.10 (the latest test release), and I also have the ability to open .rxe files as NBC code.
Simply File->Open-> *.rxe :?:
The World is still flat for me :-)

Do you run Win7 or XP ?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Bricx - Sorosy Debugger question

Post by mattallen37 »

katamapah wrote:...Simply File->Open-> *.rxe :?:
The World is still flat for me :-)

Do you run Win7 or XP ?
Yep, just like that! Try it. It doesn't have all the fancy names and such (the variables are numbered...), but it is NBC code.

I am using Win7 64-bit on this computer.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 20 guests