-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
67 lines (42 loc) · 1.82 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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