chipKIT® Development Platform

Inspired by Arduino™

Programming Fubarino SD In Assembly

Created Tue, 26 Nov 2013 07:26:51 +0000 by mdombro


mdombro

Tue, 26 Nov 2013 07:26:51 +0000

Hello all,

I recently got the Fubarino SD Development board, which can be connected to a computer with a USB cable (there is a mini USB plug directly on the board) and programmed with MPIDE. While that works just fine, out of curiosity I was wondering if there is any way to write and upload an assembly program or minimalist C program ( i.e. not using the MPIDE coding structure with the void setup() or void loop() ) to the Fubarino board directly over the USB cable. So far I have seen it only able to be done through a separate programmer such as the PICKit programmer. It would be excellent if a program like MPLABX or MPIDE could be used for the writing and uploading, but I am open to any particular method that uses the USB cable to upload a program.

I am interested in learning how to program PIC microcontrollers, and microcontrollers in general, at a more basic level but I have so far not found a way to program the Fubarino board specifically in assembly or a basic C program over the USB cable.

Thanks for the feedback.


EmbeddedMan

Tue, 26 Nov 2013 14:46:13 +0000

Yes, there is. The exact details of it - I'm not sure. But the general idea would be to use MPLAB X (or even the C compiler that's included with MPIDE) and create a C or assembly program, compile it to a HEX file, and then use the AVRDUDE.EXE application (included with MPIDE) to upload that HEX file to the Fubarino SD over USB (just like MPIDE does).

*Brian


majenko

Tue, 26 Nov 2013 16:13:01 +0000

Personally I wouldn't start learning microcontroller assembly programming with a PIC32. It's an incredibly complex system.

You'd be much better off starting with a "lighter" chip, like a PIC16.

But yes, for that you'd be using an external programmer (but it could be a cheap picKIT 2 clone from eBay). MPLAB-X and XC8 / MPASM would be the environment of choice there, but I have had problems with MPLAB-X working with cheap picKIT 2 clones, and usually use the pk2cmd command line program with them.

If you want a half-way house, you could try UECIDE which should allow you to craft your own main() function and not use the setup() and loop() at all (which will stop things like millis() and delay() working), and you don't have to use the Arduino-like functions if you don't want to.


les1943

Tue, 26 Nov 2013 20:10:13 +0000

Having grown up with PIC16, asm my preference would be to start with PIC24 or PIC32 MPLABX, PicKit 3 and C. You can even stick the PIC (SDIP version) on a breadboard with minimal components to get started.


caroper

Wed, 27 Nov 2013 04:15:57 +0000

I have requested information from Microchip via the Forums, Support Ticket and verbally, via my Local Microchip Rep, with regards to supporting the Bootloader in MPLAB and have not received a reply on any channel. So as Brian said, it is technically possible, but you are on your own.

We are wandering away from your original question regarding the bootloader, but if you wanted to try the PIC32 on a breadboard, with MPLAB you may find my introductory posts over on EEVBlog Forum useful. It is the forerunner of my BB32 system and so requires a PICKit 3, rather than the bootloader, but introduces the PIC32 architecture from a non MPIDE perspective,

http://www.eevblog.com/forum/microcontrollers/pic32mx-quickstart/

Cheers Chris


EmbeddedMan

Wed, 27 Nov 2013 05:18:53 +0000

You won't get any support from Microchip, I don't think. MPLAB X doesn't normally use a bootloader to transfer HEX files to a board. I don't think there's any support for it.

But it's really pretty simple. You use MPLAB X to generate a HEX file like normal. Then use the command line AVRDUDE.EXE to transfer that HEX file to your board over USB. Not much to it. Just get the command line parameters of AVRDUDE.EXE correct (which you can extract from an MPIDE build/upload).

*Brian


majenko

Wed, 27 Nov 2013 10:21:37 +0000

... and modify the Makefile to give you a "make install" option from the command line to make your life easier.

A shame that MPLAB-X doesn't support running Make targets from within the IDE (as far as I have seen), like normal IDEs (e.g., Anjuta) do.


guymc

Wed, 27 Nov 2013 22:43:18 +0000

There's always more than one way to do things. MPLAB X can support what you want to do a few different ways; some are quite easy. More on that in a moment.

Chris: I apologize for the lack of response to your queries. Usually that means the question was difficult or unfamiliar, got passed from one engineer to another, and was set aside until "time permits." If you write to me via PM, or by email to third_party_support@microchip.com, I guarantee that you will receive an answer. Likewise for the MPLAB X Developer's Forum, which is monitored by our top engineers. (That's a private forum, but anyone can contact me and get registered.)

The easiest way to program a target via bootloader in X, is to use a "post build-step command." Look in Project Properties:Conf:Building. You can specify a command to run after build, and insert macros such as ${ImagePath} to specify the output file.

Another way is to import a Makefile project, and specify different commands (with Make targets) for various operations in Project Properties:Conf:Makefile. Incidentally, in these examples "Conf" refers to the current Configuration. Adding additional configurations is easy, and allows you to specify different types of build operations for the same project.

The best way (in terms of integration and capability) is to write a programmer tool plug-in using the MPLAB X SDK. There are some examples to follow, and we're adding more with each release. The SDK is updated every two months or so, to match new releases of MPLAB X.

If you need help with any of these approaches, I will personally make sure that you receive it.

Cheers,

Guy