NXC/NBC command line compiling
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
NXC/NBC command line compiling
I would like to be able to compile and download programs to an NXT from a command line (so that I can download using a batch file). I seem to be able to compile .nxc programs, but I can't figure out how to download the output to the NXT.
I tried using -S=usb -d and it didn't work (the last line the compiler spit out was "Download failed", and the NXT didn't beep). I tried several combinations of things, but so far I always get the same result.
I tried using -S=usb -d and it didn't work (the last line the compiler spit out was "Download failed", and the NXT didn't beep). I tried several combinations of things, but so far I always get the same result.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC/NBC command line compiling
Are you on Linux?mattallen37 wrote:I would like to be able to compile and download programs to an NXT from a command line (so that I can download using a batch file). I seem to be able to compile .nxc programs, but I can't figure out how to download the output to the NXT.
I tried using -S=usb -d and it didn't work (the last line the compiler spit out was "Download failed", and the NXT didn't beep). I tried several combinations of things, but so far I always get the same result.
http://arbitrarycreations.co.uk/lego/nx ... tions/#nbc has the basic instructions which uses the command line switches you specify.
The gotcha is usually device permissions on Linux. By default, they're owned by root, so a normal user account can't access. You can try as root first to see it it works.
You'll need to define custom udev entries for it, and add your user account to the correct group; logout and login again, check your group entries using 'id'.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC/NBC command line compiling
Sorry I forgot to specify, I am using Windows 7 64-bit.
Edit: and I am using the admin account.
Edit: and I am using the admin account.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC/NBC command line compiling
Sorry, I don't know the answer to this for Windows 7.mattallen37 wrote:Sorry I forgot to specify, I am using Windows 7 64-bit.
Edit: and I am using the admin account.
-
- Posts: 358
- Joined: 01 Oct 2010, 06:37
- Location: Denmark
- Contact:
Re: NXC/NBC command line compiling
You don't even need to specify -S=usb iirc. Just make sure the NXT is connected and recognized by your system. So make sure you have the NXT driver installed, either by installing NXT-G, or by just installing the driver update from the Lego Mindstorms support page.
I wrote a bit about how to use nbc.exe with Notepad++, but it is a year old and a few things changed since then:
http://spillerrec.dk/2011/03/05/writing ... n-notepad/
I wrote a bit about how to use nbc.exe with Notepad++, but it is a year old and a few things changed since then:
http://spillerrec.dk/2011/03/05/writing ... n-notepad/
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC/NBC command line compiling
I tried it without the -S=usb but it didn't seem to make any difference.
I referred to your blog while researching, but it didn't get me any farther than any other information source I found.
The NXT is recognized by the computer, as BCC is able to connect to it (and works perfectly).
My goal is to be able to program in NXC using Programmer's Notepad (and download the program from there).
I referred to your blog while researching, but it didn't get me any farther than any other information source I found.
The NXT is recognized by the computer, as BCC is able to connect to it (and works perfectly).
My goal is to be able to program in NXC using Programmer's Notepad (and download the program from there).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 358
- Joined: 01 Oct 2010, 06:37
- Location: Denmark
- Contact:
Re: NXC/NBC command line compiling
If you are running the commands in that editor, try using the command prompt first, it might behave slightly different.
One thing to note though, you can not access the NXT if BCC or any other programs are currently connected to the NXT. Other than that I have really no idea why you can't download, but I don't think the issue lies with the parameters you pass.
If you really have no success, if you can get another program to download files to the NXT, you could make nbc.exe output it as a file and then use that other program to transfer it. I don't if NeXTExplorer has a CLI, but perhaps.
This is the parameters I'm currently using for compiling and it has worked flawlessly:
One thing to note though, you can not access the NXT if BCC or any other programs are currently connected to the NXT. Other than that I have really no idea why you can't download, but I don't think the issue lies with the parameters you pass.
If you really have no success, if you can get another program to download files to the NXT, you could make nbc.exe output it as a file and then use that other program to transfer it. I don't if NeXTExplorer has a CLI, but perhaps.
This is the parameters I'm currently using for compiling and it has worked flawlessly:
Code: Select all
D:\Programmer\Lego\BricxCC\nbc.exe "filepath" -d -r -v=128 -EF -Z3 -L="D:\nxccodelist.txt" -Y="D:\nxcsymbollist.txt" -sm- -ER=5
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
Re: NXC/NBC command line compiling
Can you try other builds of nbc.exe to see if you get different results? Are you for sure using the latest test release of nbc.exe?
D:\NXT\nxt\BricxCC>nbc
Next Byte Codes Compiler version 1.2 (1.2.1.5, built Thu Oct 11 22:32:57 CDT 201
2)
Copyright (c) 2006-2012, John Hansen
Use "nbc -help" for more information.
I have no trouble on my Win 7 64-bit OS to compile and download to my NXT via USB.
D:\NXT\nxt\BricxCC>nbc -d test.nxc -sm-
It output nothing but the brick beeped and the program downloaded without problems.
John Hansen
D:\NXT\nxt\BricxCC>nbc
Next Byte Codes Compiler version 1.2 (1.2.1.5, built Thu Oct 11 22:32:57 CDT 201
2)
Copyright (c) 2006-2012, John Hansen
Use "nbc -help" for more information.
I have no trouble on my Win 7 64-bit OS to compile and download to my NXT via USB.
D:\NXT\nxt\BricxCC>nbc -d test.nxc -sm-
It output nothing but the brick beeped and the program downloaded without problems.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC/NBC command line compiling
Thanks for your help. It turns out I did have BCC connected to the brick at the same time, and that was causing the problem. I hadn't realized BCC was open at the time, because it was in a different desktop workspace (and multiple workspaces are new for me).
So I think it's all working great now
So I think it's all working great now
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Who is online
Users browsing this forum: No registered users and 5 guests