Support » Pololu P-Star User’s Guide » 5. Getting started »
5.4. Programming using p-load
The previous sections cover how to install Pololu USB Bootloader Utility (p-load) and the drivers for the P-Star (Section 5.1), how to get the P-Star into bootloader mode (Section 5.2), and how to compile a simple program for the P-Star (Section 5.3). Once all these steps are complete, you are ready to use p-load to write the program to your P-Star.
To do so, open a new command prompt and run a command of the form:
p-load -w HEXFILE
where HEXFILE is the full or relative path to the HEX file you compiled. When you run this command, the output should look something like:
Device: Pololu P-Star 45K50 Bootloader Serial number: 00203525 Erasing flash... Progress: |##########################################################| Done. Erasing EEPROM... Progress: |##########################################################| Done. Writing flash... Progress: |##########################################################| Done. Sent command to restart device.
The -w
option tells p-load to write the flash and EEPROM memories with the values specified in the HEX file, and then restart the device so that the application can run. The Pololu USB Bootloader Utility has many other options available, and you can see them by running p-load
with no arguments.
The p-load utility automatically looks for a supported bootloader connected to the computer via USB and will operate on that bootloader. If you have multiple devices supported by p-load connected to your computer, you must use the -d
option followed by the serial number of the device to specify which device you want to write to.
To write to EEPROM, data should be placed in the HEX file starting at address 0xF00000 (0xF00000 corresponds to the first byte of EEPROM). This is compatible with the way XC8 treats EEPROM.