Skip to content

jmssil/Serial-PIC-Bootloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

0. Contents

  - bootloader.X: MPLABX project for bootloader
  - feb.X: MPLABX project for PIC-specific code
  - loader.cpp: PC-side code for interacting with the bootloader
  - states.h: definitions for PC/PIC synchronization states

1. Caveats

  The bootloader.X project is configured for PIC18F26J50 (using
  library feb2.p1 from feb.X project), but should run on similar PICs
  with minimum changes. The bootloader is restrained to ROM addresses
  0x0000 to 0x0fff. The guest program should be restricted to ROM
  addresses 0x1000 to 0xffff, with code offset 0x1000.

2. Relocating guest program

  See "Linking PIC18 Bootloaders & Applications"
  (http://www.microchip.com/stellent/groups/sitecomm_sg/documents/devicedoc/en558478.pdf).

  Steps:
    1. Project properties
    2. XC8 linker
    3. Memory model: ROM ranges = 1000-ffff
    4. Additional options: code offset = 1000

3. Bootloader

  - make and program bootloader.X project (with Pickit)
  - adjust LED signaling to your development board or remove it

4. Guest program

  Compile your guest program. This produces an Intel HEX file
  (http://en.wikipedia.org/wiki/Intel_HEX) located under
  "dist/default/production".

5. Loader

  The loader uses the TCLAP library. Install it with, e.g.:

    sudo apt-get install libtclap-dev

  Compile the loader with g++, e.g.:

    g++ loader.cpp -o loader

  To upload a new program, run:

    ./loader -f <HEX file> -p <serial port>

  To execute the previously uploaded program, run:

    ./loader -x -p <serial port>

  To reboot the PIC (go back to the bootloader), run:

    ./loader -r -p <serial port>

6. Pitfalls

  Host and guest programs should/must have compatible configuration
  bits, mostly because the UART configuration must be kept.

7. Contact for questions, suggestions, etc.

  João M. S. Silva, joao.m.santos.silva at Gmail

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published