Shortly after the release of the PIC18F family, Microchip released a bootloader compatible with the new devices. There were several attributes that I liked about this bootloader. It was built to fit in the PIC18F boot code block and could be code protected separately from the user code. It also supported a wide range of PIC devices and clock speed, which I hadn't found in other bootloaders. Best of all, it was free!
However, there were some things I didn't find in this bootloader. I wanted the PIC to stay in boot mode after reset for a short time and then jump to user code if the bootloader was not invoked. I also wanted to be able to program new code in one operation (Microchip's bootloader application forced you to first erase the whole code space, then program the chip). Finally, I wanted a way for the bootloader to change Config bits and EEPROM data.
For these reasons, I decided to create the Jolt bootloader. The Jolt bootloader is a combination of a bootloader application that runs on a PC or Unix workstation and a bootloader firmware that runs on the PIC18 devices.
August 25, 2005: Released version 1.2 of the bootloader application. Added ability to bootload a file from the command line.
March 12, 2005: Released version 1.1 of the bootloader application and version 0.12 of PIC18F firmware for models that have 2 kb boot block. Fixed problem with loading of Configuration bits from HEX file generated by HI-TECH compiler.
August 17, 2004: Released version 1.0 of the bootloader application and version 0.12 of PIC18F1X20 firmware. Added support for numerous new devices, including configurable support of Configuration bits.
May 14, 2004: Released version 0.1 of the Colt bootloader application. This version is a stand-alone compact version that does not require Java Runtime Environment. See the Colt Web page.
November 18, 2003: Released version 0.9 of the bootloader application. Fixed port lock up problem (for real). Implemented better support for PIC18FXX39 devices. Revisited support of Config bit configuration for all new devices.
September 18, 2003: Released version 0.8 of the bootloader application. Fixed loading of EEPROM data. Fixed port lock up problem. Added support for French language. Added support for several new devices.
August 30, 2003: Released version 0.7 of the bootloader application. Fixed problem that prevented bootloading of PIC18FXX20. Adjusted Config settings for all models of PIC18FXX20.
July 23, 2003: Added hardware schematics to show how to connect microcontroller with bootloader firmware to a PC.
July 20, 2003: Released version 0.6 of the bootloader application. Support for recent files access. Fixed open dialog file filter problem. Support for PIC device configuration file. Added installer functionality for Windows.
January 27, 2003: Released version 0.5 of the bootloader application. Fixes a port lock up problem on Linux and a Device ID issue for PIC18FXX8 family.
December 10, 2002: Released version 0.4 of the bootloader application. The bootloader application now contains a help section.
December 2, 2002: Released version 0.12 of the bootloader firmware. Minor change that fixes interaction problem with motor controller (CCP1) during bootloading.
November 22, 2002: Released version 0.3 of bootloader application. Fixed problem with autoload and port in use. Tested Linux support. Added help on mousover in Edit Config dialog. Added documentation for Linux and code relocation.
November 16, 2002: Added a Menu Description section.
November 15, 2002: Released version 0.2 of bootloader application and version 0.11 of the bootloader firmware. Added two second startup delay. Added autoload, autoreset and autoprogram.
November 8, 2002: First version released.
The Jolt bootloader firmware is based on Microchip PIC16F/18F bootloader firmware. The bootloader firmware can be written to the boot section of the PIC18F chips. This boot section can be independently boot protected. A nice feature of this bootloader is that it automatically detects the baud rate at which it should run. This means that you do not require a .hex file for different baud rate or clock speed. Also, I have modified the firmware to allow for a two seconds delay on startup to trigger bootloading operations.
The Jolt bootloader application that works with the Jolt firmware streamlines the loading process and supports the following new features:
Here are a few screenshots of the Jolt bootloader application:
Starting with version 1.1, Jolt requires JRE/J2SE 1.5 or later.
The Jolt bootloader application is a Java application. To be able to run it, you
first need to install Sun's JRE or J2SDK and the Java Communications API library. You can
find JRE and JDSK on the
Java 2 Platform Standard Edition Download page. If you don't plan to write Java applications yourself, I recommend that you install
the JRE instead of the J2SDK.
Sun has released in Nvembre 2005 version 3.0 of the Java Communications API. However,
to my demise, a Windows download of the Java Communications API is not available to date.
Click here for the Windows download of version 2.0 of
the Java Communications API. The Java Communications API for Linux and Solaris is available on Sun's
Java Communications API page. If you install the J2SDK, you must install the Java
Communications API in the JRE directory in the J2SDK distribution.
For Linux, you will also need the RXTX package available on the
RXTX Web site.
Here are the installation instructions for the Java Communications
API (it doesn't come with an installer):
Sun provides a Linux version of the Java Communications API. But it doesn't work with
all Linux distros, only RedHat AS 3.0 and Java Desktop System 3.0. For the rest of us,
it is possible to get the Java Communications API to work by installing Trent Jarvi's RXTX driver along with SPARC Solaris comm.jar JAR file.
Here are the instructions to install the Java Communications API and the RXTX package
for Linux:
For RXTX version 2.0, you might have to compile the latest
2.0 snapshots (unless the binaries are available for Linux). You must have the
J2SDK or JRE installed on your machine prior to compiling RXTX package. Here are the
steps to install RXTX 2.0 :
Note that version 2.1 of RXTX is not compatible with Jolt bootloader.
If the Linux version of the Java Communications API is installed, there is no need
to install the RXTX package.
Once the JRE and the Communications API and/or RXTX packages are installed, you can
install the bootloader application. For Windows, you can run the
JoltSetup.exe installer. For Linux, you
can extract the Bootloader.jar and bootload.hex
files from the Bootloader.zip archive somewhere on your disk.
To start the Jolt bootloader application, execute the following command: For Windows: For Linux with RXTX 2.0: from the directory where the Bootloader.jar file was installed.
For all operating systems, you can bootload a file from command line by executing the
following command:
Option -r resets PIC after download. Option -s forces PIC to stay in boot after
download. Use option -h to get a full list of options.
To use the Jolt bootloader, here are the steps you need to follow:
If you select the Delayed boot mode, the bootloader kicks in on startup for two
seconds. If it does not receive any bootloader commands, it automatically transfers
to the user application (jumps to address 0x0200 or 0x0800 depending on the firmware used).
If you select the User boot mode, you need to provide a way in your application
code to drop back to boot mode by writing hex code 0xFF on last EEPROM address
(address 0xff). Otherwise, you will not be able to enter boot mode again.
I have included a test HEX file (blink-led.hex) in the Bootloader.zip archive.
If you download this file using the bootloader application, LEDs connected to
pin B0 to B3 should start blinking after the bootloader gives control to the user
application code.
I intend to support the Jolt bootloader application. So, if there are additional devices
you would like to support, or have suggestions on new features, send me a mail.
User code must be relocated at address 0x0200 or 0x0800 depending on the model and
firmware used. The start of user space depends on the size of the boot block. Originally,
the boot block for PIC18F devices was 256 bytes. Lately, most new models have a boot block
of 2048 bytes. To determine the size of the boot block for your device, you may look at the
PicDevices.properties file.
If you are not concerned about protecting the boot block, you
can still relocate the user code to address 0x0200 even if your device boot block is 2048
bytes, but you must change the appropriate entry in the PicDevices.properties file and you
must use the appropriate bootloader firmware (bootloader.hex).
Add the following directives in you .c file:
Replace 0x200 and 0x208 with 0x800 and 0x808 for PIC devices using a 2 kb boot block.
Use the compiler directive --ivt-loc 0x200.
In the link phase, use the linker directive -a200h.
Edit the Linker script 18f452_c.lkr to protect the boot
block, and rebuild the C18 startup objects c018.o and
c018i.o. The Linker script 18f4620_c.lkr
must be used for models that use a 2048 boot block.
Also be certain you have not defined absolute code
sections in the source code to start in the boot block. For
instance:
must be changed to
or for models that use 2048 bytes boot block:
The 18F452.inc file (or the appropriate include file) also needs to be modified. In the
first '__config' line, the "XT" needs to change to "HS" unless the Configuration bits are changed on the PIC.
File
Open Hex File... Save Hex File Save Hex File As... Edit
Config EEPROM Data Command
Read All Program Program Config Program EEPROM Data Verify Run Settings
Boot Mode Reload before Program Reset after Program Enable Program EEPROM Data Enable Program Config Note that the CTRL-Home, CTRL-End, Page Up and Page Down keys can be used in the
memory buffer area to navigate the the beginning, end, next page and previous page
of the program memory, EEPROM Data and Config bits.
The bootloader firmware is based on Microchip's bootloader firmware written by
Ross Fosler. Microchip's firmware and bootloader application can be found on the
AN851 application note page.
The bootloader firmware and bootloader application are described in the application
note AN851. The source code is available in the zip archive.
The Jolt bootloader firmware is very generic and should work with all PIC18F models.
Over sixty models have been programmed in Jolt. Support for new PIC microcontrollers
can be added by adding new entries in the PicDevices.properties file. Each entry has the
following format:
<DEVICE_NAME>=<DEVICE_ID>,<LO_PROGRAM>,<HI_PROGRAM>,<LO_EEPROM>,<HI_EEPROM>,<CONFIG_BITS>
where the DEVICE_NAME field specifies the device name, the DEVICE_ID field is used
to identify the Device ID, LO_PROGRAM and HI_PROGRAM fields define the program code space
(low and high addresses) excluding the boot sector. The LO_EEPROM and HI_EEPROM fields
specify the low and high EEPROM data addresses. DEVICE_NAME is a decimal number and
all other numeric fields are in hexadecimal format.
For instance, the following entry is used to describe the PIC18F458:
PIC18F458=67,200,7fff,0,ff,OSCSEN,FOSC20,BORV,BOREN,PWRTEN,WDTPS20,WDTEN,CCP2MX,DEBUG,LVP,STVREN, This entry tells the bootloader application that the PIC microcontroller with
Device ID 67 is a PIC18F458 with program space starting at address 0x0200 and ending
at 0x7FFF. The EEPROM data starts at 0 and ends at address 0xFF. The Configuration bits
implemented for that device and stored between address 0x300000 and 0x30000D are:
OSCSEN, FOSC20, BORV, BOREN, PWRTEN, WDTPS20, WDTEN, CCP2MX, DEBUG, LVP, STVREN, CP3,
CP2, CP1, CP0, CPD, CPB, WRT3, WRT2, WRT1, WRT0, WRTD, WRTB, WRTC, EBTR3, EBTR2, EBTR1,
EBTR0, EBTRB.
To contact me, mail to user mdubuc at freeshell.org domain
Windows
SET CLASSPATH=C:\PROGRA~1\JAVA\JRE1.5.0_06\LIB\EXT\COMM.JAR
(change the path to match your directory structure).
On other Windows versions (NT, 2000, etc.), the CLASSPATH environment variable can be set using the System utility in the Control Panel.
(change the path to match your directory structure).
On other Windows versions (NT, 2000, etc.), the PATH environment variable can be set using the System utility in the Control Panel.
Linux
Launch Jolt executable or launch "Jolt PIC18F Bootloader" from the Start menu if you have
not selected "Do not create shortcut" option during installation.
java -cp Bootloader.jar Bootloader
java -cp Bootloader.jar Bootloader [-r | -s] [-b<baud rate>] [filename]
Usage
How to Relocate User Code
CCS
#build(reset=0x200)
#build(interrupt=0x208)
#org 0x0000,0x01ff
void bootloader() {
#asm
nop
#endasm
} // Reserve space for the bootloader
SDCC
HI-TECH PICC-18
Microchip C18
#pragma code InterruptVectorHigh = 0x08
#pragma code InterruptVectorHigh = 0x208
#pragma code InterruptVectorHigh = 0x808
PIC Basic Pro
Had the following line:
DEFINE RESET_ORG 200h
or
DEFINE RESET_ORG 800h
Menu Description
Load a hex file in the memory buffer. If the Reload before Program option is
selected, the specified hex file is reloaded before every Program command is executed.
Save the content of the memory buffer in the filename shown on the window title.
Save the content of the memory buffer in the specified file.
Edit the Config bits. The changes are saved in the memory buffer and can be applied by
executing the Program Config command. Note that when the checkbox are selected, it
means that the value for the related config bit is set to 1. For instance, if CPB is
selected, the CPB value is set to 1 which means that the boot block is not code protected.
Edit the EEPROM Data. The changes are saved in the memory buffer and can be applied by
executing the Program EEPROM Data command.
Read program memory, EEPROM data and Config bits and copy content into memory buffer. You
can view the results in the memory buffer area of the PIC18F Bootloader window.
Program device using content of memory buffer. If the Reload before Program
option is selected, the memory buffer is filled with the latest version of the file
shown in the window title. If the Reset after Program is selected, after the
program is loaded, the device is reset.
Program the Config bits according to content of memory buffer. The
Reload before Program and Reset after Program have no effect on this command.
Program the EEPROM Data according to content of memory buffer. The
Reload before Program and Reset after Program have no effect on this
command.
Compare device with content of memory buffer.
Reset device. It is not necessary to execute this command after Program if the
Reset after Program option is selected.
Indicates which boot mode is used. Delayed means that the device goes in boot
on startup for two seconds. User means that the device jumps to user code automatically
on startup. If User boot mode is selected, the application must be able to drop back
to boot mode by writing value 0xff at address 0xff of EEPROM data.
When this option is selected, the Jolt bootloader application reloads the file shown
on the windows title before every Program command is executed.
When this option is selected, the Jolt bootloader application resets the device after the Program operation is completed.
When this option is selected, the Jolt bootloader application also programs the EEPROM
Data along with the program memory when a Program command is executed.
When this option is selected, the Jolt bootloader application also programs the Config bits
along with the program memory when a Program command is executed.
Background Information on the Jolt PIC18F Bootloader
Devices Tested
Here is a list of PIC devices tested against the Jolt bootloader.
CP3,CP2,CP1,CP0,CPD,CPB,WRT3,WRT2,WRT1,WRT0,WRTD,WRTB,WRTC,EBTR3,EBTR2,EBTR1,EBTR0,EBTRB
Contact Info
Number of hits: 73168
Last updated: October 16, 2006
PIC is a registered trademark of Microchip Technology Inc.