information about setting up C / BCC for EV3

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
endojo
Posts: 12
Joined: 06 Oct 2013, 16:48

Re: information about setting up C / BCC for EV3

Post by endojo »

Oh, right, I already knew that but I forgot :D
But thank you for remembering me!
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: information about setting up C / BCC for EV3

Post by HaWe »

totokan wrote: While I understand the desire for a simpler programming environment, and I see how much trouble trying to grapple with 'real code' is causing, personally, I am glad to be able to program and compile in C....
These are how I expected things to go with the NXT, this is the platform I hoped the NXT would be
there actually was a platform (at least 1) for the NXT to work with gnu c++ /eclipse: it was working with the OS nxtOSEK.
Unfortunately the developer threw it into the community but there was neither a good tutorial nor any support by the developer actually after that, he left the matter to the community and progressed to other projects. So it extincted somehow in the oblivion.

A good idea thus has been wasted, and it's the way it had happened and surely will happen to other platforms (either for NXT or for EV3).
A programming platform for hobby programmers (IMO) will only survive
- if it's easy to approach and to understand, self-evident, intuitive to handle
- if it's free of charge and open source
- if it keeps to standards which already are established (C, Java, Basic, Pascal...)
- if it's widely distributed in the community by frequently used multilingual forums
- if (possibly many) professional developers extensively provide help in exactly these forums and their knowledge is spread from one to other countries.

That's the long success story of NQC/NXC and e.g., LeJos.

The crux of the matter is the balancing act between e.g., obfuscations of the underlying C code and the intuitiveness of the C API syntax.
Last edited by HaWe on 08 Oct 2013, 10:07, edited 1 time in total.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: information about setting up C / BCC for EV3

Post by afanofosc »

totokan wrote:There is a bug with BricxCC Project Manager, it does not include with relative paths.
Technically, this is just a "not yet implemented" feature rather than a bug. I would recommend for the time being just keeping all your source files in the same folder as the library files, though you don't need to do that if you modify your makefile to link to libev3.so. I need to dig up the instructions for how to do that properly. David Gilday got it to work and I just haven't implemented it in BricxCC automatically yet.

What does the generated makefile look like when you put relative or absolute paths into the .prj file? You can tell BricxCC not to delete the makefile and have a look at it using notepad. This option is on the Compiler -> General tab.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
tcwan
Posts: 186
Joined: 30 Sep 2010, 07:39

Re: information about setting up C / BCC for EV3

Post by tcwan »

afanofosc wrote:
totokan wrote:There is a bug with BricxCC Project Manager, it does not include with relative paths.
Technically, this is just a "not yet implemented" feature rather than a bug. I would recommend for the time being just keeping all your source files in the same folder as the library files, though you don't need to do that if you modify your makefile to link to libev3.so. I need to dig up the instructions for how to do that properly. David Gilday got it to work and I just haven't implemented it in BricxCC automatically yet.

What does the generated makefile look like when you put relative or absolute paths into the .prj file? You can tell BricxCC not to delete the makefile and have a look at it using notepad. This option is on the Compiler -> General tab.

John Hansen
To use relative #include paths with the gcc toolset, it is a matter of specifying -I <path-to-include-dir> (and for linking with libraries, add -L <path-to-library-dir>) as arguments to gcc. I think it would be trivial to edit the Makefile to do so, if BricxCC does not currently add them.

NB: I have not played with BricxCC yet so I don't know when it generates the Makefiles or if it overwrites the Makefile on every compile.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: information about setting up C / BCC for EV3

Post by h-g-t »

Apologies if I am in the wrong thread but, as a non-programmer, I am totally confused by what I read about coding the EV3.

I have only one project which is written in NXC.

Can I just download the latest bricxcc and find a newer version of NXC into which I can load my existing program?

Or do I have to load everything detailed in this thread and learn C instead?
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
tcwan
Posts: 186
Joined: 30 Sep 2010, 07:39

Re: information about setting up C / BCC for EV3

Post by tcwan »

h-g-t wrote:Apologies if I am in the wrong thread but, as a non-programmer, I am totally confused by what I read about coding the EV3.

I have only one project which is written in NXC.

Can I just download the latest bricxcc and find a newer version of NXC into which I can load my existing program?

Or do I have to load everything detailed in this thread and learn C instead?
You should be able to recompile your existing project in the new bricxcc and download it (barring any NXT specific issues).
Bricxcc (test versions) now supports compiling both NXC code as well as native C code, for those who wish to bypass the LEGO Virtual Machine altogether.
The discussion has to do with compiling and running the native C code using the test versions of bricxcc.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: information about setting up C / BCC for EV3

Post by h-g-t »

Thank you, that is just what I wanted.

If I ever decide to use C later on, is there a guide anywhere about EV3-specific commands?
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: information about setting up C / BCC for EV3

Post by HaWe »

for using EV3 and NXC sensors by EV3-C:
what header(s) do I have to include?

to be used: all sensors of EV3 retail + edu + NXC sensors: ultrasonic, Color-NXT2.0, Light-NXT1.0, Sound-NXT1.0 (I suppose that NXT and EV3 Touch Sensors have the same internal resistors);

Mindsensors TouchJMux, Mindsensors SensorMux, PCF8574 (for homebrewed touch mux) and Mindsensors RCX style motormux
are probably not already available I guess...?
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: information about setting up C / BCC for EV3

Post by gloomyandy »

The NXT and EV3 touch sensors are different (they actually use different pins to detect the open close of the switch). So for instance you can't use an EV3 touch sensor connected to the touch mux.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: information about setting up C / BCC for EV3

Post by HaWe »

ah, ok, thx, so to plug single sensors directly one could use probably both types alternatively,
and for the touch mux it's just reading NXT style ADC values with NXT sensors plugged in...

but again about my question about EV3 and NXC sensors by EV3-C:
what header(s) do I have to include?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests