lobotics - VexOS (C framework for EasyC)

Sometimes I find things on the internet and wonder why we didn’t know about them, this is one of those things.

An object-based development environment for the Vex Cortex Microcontroller based on WPILib for FRC (requires the easyC runtime).


I didn’t try it out yet, it does need the EasyC runtime, and I think it actually creates a library for EasyC in the same way as I did in this thread. The makefile does seem to replace the default EasyC linker script so be careful.

Looks quite comprehensive, perhaps one of the EasyC gurus could try it and report back.

1 Like

What exactly is this? Is it a separate executable? Something to be run through Eclipse? More functions to use in EasyC?

Why would I use this over EasyC or RobotC?

It appears to be a form of a struct-based object-oriented C library written on top of the WPILib and glued onto the EasyC IDE which makes sense, the whole point of using the WPILib is to strap on jet-pack like high-level functionality onto EasyC.

While I don’t have any first hand experience with WPILib directly, I have heard of it and looking over the documentation it seems to provide a lot of the current day ROBOTC-like functionality, only difference is that this library is old, dated 2005ish.

The general idea behind this VexOS library is to setup a pseudo object datatype, like the command “class” he has setup here…

struct CommandClass {
    bool         initialized;
    String const name;
    Command**    selfPtr;
    size_t       fieldSize;
    unsigned int lastInstanceId;
    // Command methods //
    void (*constructor)(va_list);
    void (*destructor)();
    void (*initialize)();
    void (*execute)();
    bool (*isFinished)();
    void (*end)();
    void (*interrupted)();
    // CommandGroup extension members //
    void (*groupConstructor)(va_list);
    Command** groupSelfPtr;

… using a struct to organize the memory and function pointers to wire up the otherwise loose functions together into something that sort of acts like an object.

The rest of this lib seems to use this pseudo-object format to group the normal functionality you would have. I’m sure it does more but that’s all I have time to look through.

It’s a lot like OGRE, everyone else uses plain old C to do something, but that’s messy so someone has used objects to provide a slightly cleaner implementation - which usually comes at the cost of performance (all those pointer look-ups aren’t free).

Now keep in mind, I might be entirely off. I’ve never used a structured-object approach so this code is a bit tricky to read. That and I rarely use function pointers and the syntax for creating them is strange to say the least. But I have read about this stuff and found the topic to be extremely interesting.

This is sort of the way C++ got it’s start, it was originally implemented in C until it became powerful enough to compile itself, at which point C++ started compiling newer versions of C++. Which is a completely mind-blowing idea when you think about the traditional chicken and egg paradox in the context of evolution. It actually solves the problem given a lesser developed creature (or programming language if you must) as a base.

Really cool find James!

This is known as bootstrapping. If you’re interested in seeing how this works have a look at gcc internals since it’s a self-hosting compiler. Most serious compilers are self-hosting now.

Here’s a fun picture http://www.aistudy.com/program/images/programming_language_family_tree.gif

It’s an add on library (and associated header files) for EasyC.

It presumably allows code written for the FRC control system (cRIO) to be easily ported and run on the cortex.

It provides some object orientated programing and it looks like a scheduler and event based control.

Wow that is a fun picture :smiley: