I have written my own custom firmware for the GrovePi many times now.
I do it slightly differently, but the end result is the same.
I use Arduino IDE on my iMac because I find it too laggy both VNC-ing into my RasPi and using it directly.
I make changes to the firmware.ino file, just like any other Arduino sketch, then I click Verify to compile into firmware.hex.
In my Arduino IDE settings, I have [x] show verbose output ticked, so in the footer console, it shows me which temp folder the .hex file is generated in.
I then scp the .hex file alone to my RasPi, and run the avrdude command mentioned above. D14 and ISP reset are connected with a jumper wire, as per the instructions on the website.
The red light on the board lights up and the sketch is uploaded.
There might be an easier way, but this is pretty simple, automated and it works for me.
Next, I write some Python scripts which talk to the GrovePi over the I2C bus.
If I had a USB AVR programmer, I might be able to upload a sketch directly to the GrovePi by connecting to the ISP socket and soldering on 2x3 headers. Karan would probably be the man to talk to about this.
The benefit of writing your own firmware is that you can use existing Arduino C libraries to do the heavy lifting.
The GrovePi firmware contains all of the basic I/O functions you would expect with an Arduino but also caches their output so that you can issue I2C commands from the RasPi to retrieve/set their values. The GrovePi acts as a I2C based proxy between the digital RasPi world and analog Arduino world.
The GrovePi is connected to the RasPiās I2C and SPI buses. I2C for I/O commands, which the firmware/sketch listens for. SPI for uploading new firmware/sketches. That avrdude command above is using the SPI bus.
If all you want to do is a digitalRead(), technically you donāt even need a GrovePi. RasPi can read a digital pin. Piece-o-cake. Get a Grove cable that breaks out into 4x male pins and connect them to the GPIO.
If you want to analogRead(), youāre going to need a separate ADC device, as the RasPi is digital only. An Arduino, a GrovePi, a Grove ADC module, or an ADC IC, eg MCP3008.
The GrovePi is basically a stripped down Arduino Uno R3 mixed with a Grove base shield in a smaller form factor and leverages the RasPi GPIO for power and communications.
If you are interesting in writing your own custom sketches, consider looking at the recent changes to the firmware on GitHub. Weāve added support for a bunch of new Grove sensors using existing C libraries. If you compare the changes, youāll see itās pretty straight forward to add your own new functionality without replacing everything that is there.
Adding new functionality also benefits the community. Simply fork the repo, add some changes, commit, push and make a pull request to share your code. I think there is an article on the website that goes into more detail on how to contribute.