view code_part1/OSTC_code_asm_part1/docu/README.txt @ 209:cdba979821ee

frame around logbook scale, some more speed improvements new WIN_FRAME_COLOR macro
author heinrichsweikamp
date Sun, 20 Feb 2011 10:59:03 +0100
parents 652e17b6267a
children ba5309c01dd7
line wrap: on
line source

To recompile the OSTC code you will need to install the following:
------------------------------------------------------------------

 - A Mercurial client, to download the source code and updates easily.
   TortoiseHg is free, and works well.

 - The Microchip MPLab IDE. This is free, and enable to recompile
   all the assembly code, link, and produce a .hex file.

 - If you want to modify the decompression algorithm, you will also
   need the MPLab C18 compiler. There is a demo free for the first
   30 days.
   If you don't modify p2_deco.c, you don't need the C18 compiler,
   see below.

 - The Tiny bootloader for windows, see the HW site.


Creating a working project:
---------------------------

 - Launch the MPLab IDE.

 - Create a new project (Project > Project Wizard...)
   - Choose device PIC18F4685
   - Select Microchip C18 Toolsuite   (if you installed the C18 compiler)
     or     Microchip MPASM Toolsuite (if not)
     --> Make sure the paths are corect.
   - Choose a name and a directoty.

   - Add the following files:
     <my_source_path>/code_part1/OSTC_code_asm_part1/18f4685_ostc_mkII.lkr
     <my_source_path>/code_part1/OSTC_code_asm_part1/MAIN.ASM
     <my_source_path>/code_part1/OSTC_code_c_part2/p2_deco.o

     (or use the .c instead of the .o if you have the C18 compiler)

   - If you want to compile C code, configure it:
     Menu: Project > Build Options... > Project > MPLab C18
         General: Default storage = Overlay (-sco)
         Optimization: Enable all

   - Make sure the IDE is configured to find the clib.lib file
     (needed even with pé_deco.o)
     Menu : Project > Build Options ... > Project > Directories
         Set «Search Directories» for : «Library Seach Path» to the path of the 
             “clib.lib” file (in c:\Program Files\Microship\MCC18\lib in my case)
         Set «Build Directory Policy» to «Assemble/Compile in source-file directory, link in output directory»

 - Hit F10 to recompile everything.
   --> You should get a .hex file where you saved your project.


Installing the new firmware
---------------------------

 - Get the .hew file you want to flash onto the OSTC.

 - Connect the OSTC, wake it up.

 - Launch the Tiny bootloader. It should work for some time, trying to open
   the communication port.

 - Once it is ready, Click Browse to select the .hex file
   ==> DO NOT HIT Write Flash YET !

 - On the OSTC, go to the reset menu, select Reboot OSTC
   ==> DO NOT CONFIRM YET !

 - Click "Write Flash" button. Now you have 10sec to confirm on OSTC too.

 - The bootloader should say it found a 18F6485 device, and start uploading.
   The OSTC should have the blue and red led blinking rapidly.
   The upload time is ~ 20 secondes.

 - Once done, the OSTC finishes its reboot.

 - If you OSTC is stuck in some bad code, you can do the magic magnet reset
   instead of choosing the reboot menu, during the 10sec timeslot after
   starting bootloader write flash.