Over the last couple of days, prompted by some of Foster’s remarks, the question of open source code for the cortex has come up again. So I want to throw this question out for debate.
Should we develop an open source development platform for the cortex?
I’m going to say right at the start of this post that my opinion is no we should not, I will explain my opinion at the end but wanted to take a quick look at the development needed as a hypothetical exercise.
First, lets recap what we know about the hardware architecture of the cortex. We know the cortex contains two micro-controllers, the STM32 which we currently program using ROBOTC or EasyC and know as the user processor, in addition to this is a LPC2458, an ARM7 based processor that acts in a supervisory role and therefore is known as the supervisor processor.
The tasks as I understand them (and I have spent a lot of time researching this) are divided between these two processors as follows.
Supervisor
USB
PWM motors 2-9
Power management
Status LED’s
User
Digital ports 1-12
Analog ports 1-8
Speaker port (DAC)
UART1 & UART2 (Serial ports)
I2C port
Motor ports 1 & 10
Rx1 & Rx2
The user processor communicates with the supervisor processor in at least two ways. The first is SPI communication that sends parameters such as motor pwm values and receives such things as joystick position. This also has some digital handshaking associated with it that I don’t yet understand. Secondly is an asynchronous serial channel that is used to program the user processor as well as send debugging information back to the development system.
The supervisor processor is running the master firmware provided by IFI. This controls the USB port in both client mode when connected using a cable to a PC or joystick as well as host mode when connected to the VEXnet WiFI adapter. The 8 RC servo motors are also controlled from this processor and it plays a significant role (although also not completely understood) in competition control.
A new development environment would have several components that would have to be developed.
An IDE which the user interacts with. This could probably be an adaptation of something like Eclipse that we have mentioned before. Eclipse would have the added benefit of being cross platform so the Mac users among us would be happy. An ARM toolchain (compiler, linker etc.) would also be needed but these are also available.
Software to send compiled code to the cortex would be needed, the equivalent of the EasyC download dialog. Again, not a huge problem as the protocol for communicating with the STM32 is well known and IFI has made our lives easier but standardizing on using COM ports for both the programming cable and USB connections.
A runtime library, this is where the real work starts. Think of all the functions currently available, these would all need duplicating in a runtime library. This would include, for example, code to interface to the following sensors.
Ultrasonic
Quad Encoder
Switches (and any other simple digital IO)
Gyro
Accelerometer
Other Analog inputs such as the potentiometer and line sensors.
Code would need to be developed for communicating with the supervisor CPU as I outlined above. Code for the serial ports to drive the LCD display and of course the infamous I2C port for the IMEs. Motors 1 & 10 need pwm code to control their speeds and direction. Although achievable, this is a lot of work made all the more difficult without supporting documentation from IFI.
Now that I’ve laid out the scope of this type of project let me give you the reasons that I would not want to tackle it.
-
CMU and Intelitek have invested time and money into creating two reasonable development environments for us already. They are in business to hopefully make a profit and I would not want to create something that would have an impact on that.
-
When there is currently an issue we can call on tech support and hopefully the issue will be addressed. With a homebrew development system there will probably be no tech support beyond what the developers are willing to do for free. This would be a bad situation for teams using this software.
-
An alternative environment that was not endorsed by IFI, and could potentially cause damage to the cortex due to unforeseen changes made by IFI, would be a liability for the developers. In other words, I don’t want to be responsible for breaking your cortex.
-
After all this work I’m not sure it would be a better system for the average user.
-
I want to build and program robots not make the tools used to do that.
So there are my thoughts I would love to hear from others.