- Published: Friday, 01 October 2010
- Written by Graham Mitchell
- Hits: 11103
The ds30 bootloader supports over 300 PICs and is completely open source. Here are some of the features that it includes:
- Extensive device support (PIC16/PIC18/PIC24/dsPIC30/dsPIC33)
- Fully open source
- Checksum control
- Write verification
- Bootloader protection
- EEPROM/Config write
- Located in lower ROM
When selecting the which file to download for the ds30 Loader - I find its good to use the Windows Install Package as it will auto update and provide a permanent path for console linking (more on that later).
A bootloader is like any other program, just that it typically resides in high program memory (ROM). The bootloader must be configured to operate on the target PIC, and once it has been you write the compiled HEX machine code like any other program. From there, the PIC has a bootloader ready-to-go.
Upon the application of power, the first instruction of the PIC tells it to go all the way to the end of the program memory where the bootloader resides. The bootloader provides an interface to the outside world to program the PIC in-situ. The ds30 Loader utilises the UART hardware on the PIC, which means you either need a USB-UART converter, or an RS232-UART converter (find them cheap on eBay, or make your own).
On the right is the basic operation of the ds30 Bootloader when the PIC is first powered. Note that the bootloader is only called once, and then the main program is free to operate indefinitely.
ds30 Development Software
Another feature that makes the ds30 Loader standout is the quality of the software that supports it. There are two programs, a GUI Loader and a Console (or 'Script') Loader. The first provides a direct interface with the target device via a graphic user interface, as shown on the right (click to enlarge).
In addition to the GUI, there is a Console Loader (I tend to call them Script Loaders). This program allows command scripts to be passed and automation of the programming sequence. Why is this handy? You can link the Console Loader from in your favorite programming software (like Swordfish, or Proton), and when you compile your program it will write the new code to the PIC straight away. Handy. More of that in the video example later.
Configure the Bootloader
Before flashing the bootloader to the PIC, ensure you have made the appropriate changes for your particular device. There is ample documentation with the ds30 Loader, you specifically want to read the "ds30 Loader - Firmware Manual". The changes are actually quite minimal as each family of PICs has its own MPLAB project file ready for minor edits.
Programming with the ds30 Loader
The advantages of using a bootloader are very application specific. As the video will display, the use of a bootloader with a development board such as the Amicus or TAP-28 is invaluable. The Amicus (and equivalents) require a single cable (USB) to integrate the complete integrated development environment from software through to hardware.
As mentioned in the above video, there are minor changes made for the device that I selected. To create a custom loader script - click on the menu items as mentioned in the video. The loader name is "ds30LoaderConsole.exe" and path is "C:\Program Files\ds30 Loader\bin". The Loader script as mentioned in the video (change port as required):
--file=$hex-filename$ --device=PIC$target-device$ --port=COM21 --baudrate=115200 --write-program --non-interactive
A Revised Memory Map
Through a recent discussion with Mikael (the ds30 Loader developer), he was interested in using the basic ds30 memory map that I made in the article. He went on to make two versions of the memory map which would add some clarity for those new to bootloaders:
As always, feel free to post questions in the forum/comments below. Full guides/downloads can be found on the ds30 site.