191
|
1 To recompile the OSTC code you will need to install the following:
|
|
2 ------------------------------------------------------------------
|
|
3
|
|
4 - A Mercurial client, to download the source code and updates easily.
|
|
5 TortoiseHg is free, and works well.
|
|
6
|
|
7 - The Microchip MPLab IDE. This is free, and enable to recompile
|
|
8 all the assembly code, link, and produce a .hex file.
|
|
9
|
|
10 - If you want to modify the decompression algorithm, you will also
|
|
11 need the MPLab C18 compiler. There is a demo free for the first
|
|
12 30 days.
|
|
13 If you don't modify p2_deco.c, you don't need the C18 compiler,
|
|
14 see below.
|
|
15
|
|
16 - The Tiny bootloader for windows, see the HW site.
|
|
17
|
|
18
|
|
19 Creating a working project:
|
|
20 ---------------------------
|
|
21
|
|
22 - Launch the MPLab IDE.
|
|
23
|
|
24 - Create a new project (Project > Project Wizard...)
|
|
25 - Choose device PIC18F4685
|
|
26 - Select Microchip C18 Toolsuite (if you installed the C18 compiler)
|
|
27 or Microchip MPASM Toolsuite (if not)
|
|
28 --> Make sure the paths are corect.
|
|
29 - Choose a name and a directoty.
|
|
30
|
|
31 - Add the following files:
|
|
32 <my_source_path>/code_part1/OSTC_code_asm_part1/18f4685_ostc_mkII.lkr
|
|
33 <my_source_path>/code_part1/OSTC_code_asm_part1/MAIN.ASM
|
|
34 <my_source_path>/code_part1/OSTC_code_c_part2/p2_deco.o
|
|
35
|
|
36 (or use the .c instead of the .o if you have the C18 compiler)
|
|
37
|
|
38 - If you want to compile C code, configure it:
|
|
39 Project > Build Options... > Project > MPLab C18
|
|
40 General: Default storage = Overlay (-sco)
|
|
41 Optimization: Enable all
|
|
42
|
|
43 - Hit F10 to recompile everything.
|
|
44 --> You should get a .hex file where you saved your project.
|
|
45
|
|
46
|
|
47 Installing the new firmware
|
|
48 ---------------------------
|
|
49
|
|
50 - Get the .hew file you want to flash onto the OSTC.
|
|
51
|
|
52 - Connect the OSTC, wake it up.
|
|
53
|
|
54 - Launch the Tiny bootloader. It should work for some time, trying to open
|
|
55 the communication port.
|
|
56
|
|
57 - Once it is ready, Click Browse to select the .hex file
|
|
58 ==> DO NOT HIT Write Flash YET !
|
|
59
|
|
60 - On the OSTC, go to the reset menu, select Reboot OSTC
|
|
61 ==> DO NOT CONFIRM YET !
|
|
62
|
|
63 - Click "Write Flash" button. Now you have 10sec to confirm on OSTC too.
|
|
64
|
192
|
65 - The bootloader should say it found a 18F6485 device, and start uploading.
|
191
|
66 The OSTC should have the blue and red led blinking rapidly.
|
192
|
67 The upload time is ~ 20 secondes.
|
191
|
68
|
|
69 - Once done, the OSTC finishes its reboot.
|
|
70
|
|
71 - If you OSTC is stuck in some bad code, you can do the magic magnet reset
|
|
72 instead of choosing the reboot menu, during the 10sec timeslot after
|
|
73 starting bootloader write flash.
|
|
74
|
|
75
|
|
76
|