This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en:examples:setup:codeblocksmanual [2015/12/07 17:43] – artica | en:examples:setup:codeblocksmanual [2020/07/20 12:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== IDE CodeBlocks manual setup ====== | ||
| + | The following guide describes the AVR development environment setup, if not used HomeLab precompiled installing package. | ||
| + | |||
| + | ===== Installing software ===== | ||
| + | |||
| + | It is necessary to install the following software bundle: | ||
| + | |||
| + | **1. CodeBlocks ** | ||
| + | CodeBlocks IDE (Integrated Development Environment), | ||
| + | |||
| + | **2. ATMEL AVR Toolchain** | ||
| + | |||
| + | AVR Toolchain is GNU-GCC compiler for AVR microcontrollers. This is a freeware which can be found on Atmel' | ||
| + | |||
| + | **3. HomeLab library** | ||
| + | |||
| + | HomeLab library contains a various functsions to make AVR and HomeLab kit programming simpler. The last versions for this library can be found on HomeLab website. | ||
| + | |||
| + | **4. DFU-Programmer** | ||
| + | |||
| + | DFU-Programmer is for programming HomeLab III series controller and using its bootloader | ||
| + | |||
| + | ---- | ||
| + | |||
| + | === CodeBlocks installation === | ||
| + | |||
| + | Following guide describes HomeLab III (Controller v1 - ATxmega128A1U) development enviroment setup and use in Windows operating system. | ||
| + | |||
| + | First install CodeBlocks software. | ||
| + | No need to install CodeBlocks plugis. | ||
| + | {{ : | ||
| + | |||
| + | Next choose correct location for CodeBlocks. All examples are in default location // | ||
| + | {{ : | ||
| + | Then CodeBlocks software install on the computers. | ||
| + | |||
| + | === Adding Homelabs extras === | ||
| + | When CodeBlocks are installed, then add: AVR Toolchain, HomeLab library, DFU-Programmer | ||
| + | |||
| + | First of all, you should choose the folder where you installed the CodeBlocks, because of all the extras installed in the same folder. | ||
| + | {{ : | ||
| + | |||
| + | ===== CodeBlocks setup ===== | ||
| + | The first launch prompted compiler location. May be select //*No Compiler*//, | ||
| + | {{ : | ||
| + | |||
| + | Then, the compiler should be set. Enter the menu //Settings -> Compiler...// | ||
| + | Observe that would be selected **GNU GCC Compiler for AVR** and show where to install the software. If the installed sowtware location is not C: | ||
| + | {{ : | ||
| + | {{ : | ||
| + | {{ : | ||
| + | {{ : | ||
| + | |||
| + | Then configure the programmer to be able to download the code directly from CodeBlocks environment. In order to find the menu //Tools -> Configure tools...// and choose //Add//. In the opened windows write the following rows dependent HomeLabs generation: | ||
| + | |||
| + | ** HomeLab III ** | ||
| + | * Homelab III | ||
| + | * C: | ||
| + | * " | ||
| + | * ${TARGET_OUTPUT_DIR} | ||
| + | {{ : | ||
| + | |||
| + | ** HomeLab II (Atmega2561) ** | ||
| + | * Homelab 2561 | ||
| + | * C: | ||
| + | * ${TARGET_OUTPUT_BASENAME}.hex | ||
| + | * ${TARGET_OUTPUT_DIR} | ||
| + | {{ : | ||
| + | |||
| + | ===== Linux/ | ||
| + | |||
| + | Install Codeblocks extras: | ||
| + | sudo apt-get install codeblocks-contrib | ||
| + | |||
| + | To run dfu-programmer with a normal user privileges, create under /etc/udev/ folder a ruled.d file with following content: | ||
| + | < | ||
| + | SUBSYSTEM==" | ||
| + | </ | ||
| + | It is also necessary to install the library. | ||
| + | Typically AVR libraries are located in the folder / | ||
| + | It is necessary to own administrator rights to add a folder for the new library. | ||
| + | |||
| + | If the AVR Toolchain repositorys not yet been updated, you may receive an error message for ADC function. To correct this replace manually in the avr folder iox128a1u.h file (included in the library). | ||
| + | |||
| + | To make programming simpler create a following batch file: | ||
| + | sudo nano / | ||
| + | | ||
| + | copy the content of the file: | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | dfu-programmer atxmega128a1u erase | ||
| + | dfu-programmer atxmega128a1u flash $1 | ||
| + | dfu-programmer atxmega128a1u start | ||
| + | </ | ||
| + | |||
| + | crant execution permission: | ||
| + | |||
| + | sudo chmod 775 / | ||
| + | |||
| + | Codeblocks // | ||
| + | Set the programmer is as follows. | ||
| + | {{ : | ||
| + | |||
| + | Add library support | ||
| + | //Settings -> Compiler ...// | ||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | ===== CodeBlocks creating a project ===== | ||
| + | Go to menu // | ||
| + | |||
| + | First, choose the name and location of the project. **Avoid the use of umlauts.** | ||
| + | {{ : | ||
| + | Then select the project compiling folder. It is recommended to not change it. | ||
| + | {{ : | ||
| + | Then choose a microcontroller and used frequency. | ||
| + | {{ : | ||
| + | Lastly, //AVR Toolchain// installation folder should be set. | ||
| + | {{ : | ||
| + | |||
| + | ===== Using the CodeBlocks ===== | ||
| + | Once the project is created, then the new project appears in the left tree with example code. To compile press the gear icon in the toolbar. If the compilation succeeds then in the bottom //Build Log// window the user program memory count are displayed or if not, then error messages in the event of failure. | ||
| + | |||
| + | {{ : | ||
| + | When loading the program into the microcontroller, | ||
| + | |||
| + | {{ : | ||