Home Forum Software Tutorial: How to compile and flash KIT1 firmware

This topic contains 2 replies, has 2 voices, and was last updated by  Radu 1 year, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4766

    Wolferl
    Moderator

    This tutorial shows how you can compile and flash the KIT1 firmware on Windows (at least Windows 2000) without going through all the hassle installing Cygwin and Eclipse.
    There are several incompatible “make” implementations for Windows, so I decided to avoid “make”.
    I have tested all the steps described here on a Windows2000 and a Windows7/64 machine.

    You need:

    Installation:

    • Run the AVR GNU toolchain installer. Specify any directory you like it to reside.
      Hint: for Windows Vista and later, it is better to install it into your home directory.
    • Unzip the contents of the AVRdude GUI for Win32 archive into a directory of your choice.
      For convenience, I simply put them in the AVR\BIN subdirectory where I installed the AVR GNU toolchain.
    • You need to add the BIN and AVR\BIN of the AVR GNU toolchain installation directory to the system’s PATH environment variable.
      If your installation directory is C:\TEMP you need to add:
      C:\TEMP\AVR8-GNU-TOOLCHAIN\AVR\BIN and
      C:\TEMP\AVR8-GNU-TOOLCHAIN\BIN
    • If you decided to put the AVRdude files NOT in one of the above directories, you’ll need to add that directory too.
    • Unpack LibUSB archive to a temporary directory and start libusb-win32-bin-<version>\bin\<yourarch>\install-filter-win.exe
      Note: Do not plug in the USBasp dongle before you did that!
    • You’ll need to restart your computer to activate all the stuff.
      Yes, I know, that’s not always necessary….but better safe than sorry 🙂
    • Now unpack the Github master.zip archive to any directory you like. Be sure to keep the directory structure.
    • New unpack the KIT1scripts.zip into the CODE subdirectory.

    You’re done.

    Setting up for your unit:
    If you have a user id and key (you can check it on the dashboard) for your KIT1 unit, put them in the config.h file (located in the CODE subdirectory).
    Find the lines:

    #define				USER_ID					""
    #define				USER_KEY				""
    

    and change them to (use YOUR key here):

    #define				USER_ID					"708"
    #define				USER_KEY				"1234abcdxxxxxxxxxxxx"
    

    Note: You can change other #defines too (e.g. BME280 and stuff)
    Don’t forget to save the file.

    Compiling:

    • Open a command line console via “cmd /v” (use Windows-Key and “R”)
      The “/v” thing is important. It enables some shell extensions needed for compilation.
    • Change to directory where your C.BAT is located (CODE directory)
    • Enter “c”
    • There will be some warnings, which can safely be ignored.
      Check if the last lines look something like this:

          Linking...
           text    data     bss     dec     hex filename
          27432     216    1197   28845    70ad Release\uradmonitor-KIT1-self.elf
      
        Creating HEX file...
      

      Congratulations! You just created your first selfmade KIT1 HEX file.

    • You’ll find it in the CODE\RELEASE subdirectory as Release\uradmonitor-KIT1-self.hex

    Note: The size of your selfmade HEX file’s size will differ a little bit to the original HEX file sizes. Nothing to worry about.

    Flashing:
    My KIT1 already came with a USBasp programmer. Hats off to Radu 🙂

    If you have a KIT1 with the original firmware on it, you may wish to save a copy of the flash and eeprom contents.
    Doing so, you can always put the AVR back to the original state.
    You can do this with the script READORIG.BAT

    To flash your newly compiled firmware into the processor chip, you connect the USBasp to the 10 pin socket. The red strip on the cable should point to the PCBs border.
    Then execute the P.BAT script to flash it (takes a few seconds)

    Happy compiling!
    Wolferl

    #4772

    Radu
    Keymaster

    This is amazing work, promoted to sticky!

    I will popularize it together with the KIT1 with credit to you.

    BTW, your account has been granted blog access, please post this as a new article on the blog! It certainly deserves to be there. Add a few pics too, if you may.

    Radu

    #4799

    Radu
    Keymaster
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.