Skip to content

MegaTinyIDE is a Java & GNU-based IDE for the new MegaTiny chips (tinyAVR® 1-series and 0-series), such as the ATtiny212, attiny3217, etc.

License

Notifications You must be signed in to change notification settings

wholder/MegaTinyIDE

Repository files navigation

MegaTinyIDE (for 64 bit macOS, Windows & Linux)

MegaTinyIDE is a simple, GNU-based IDE that's derived from another project of mine called ATTiny10IDE, which I originally wrote to simplify writing code for the ATTiny10 Series Microcontrollers using C. C++ or Assembly language. This new version is intended to support coding for the new MegaTiny chips (tinyAVR® 1-series and 0-series), such as the ATtiny112, which feature 4K of Flash memory and a greatly expanded set of features when compared to the original, Atmel-designed ATTiny series chips.

Note: native release for 64-bit Windows, Linux and MacOs are available in the Releases section to the right of this page. These come with and embedded Java runtime and do not require you to first install a compatible Java runtime on your computer. However, please note, this feature is still experimental.

Project Goals

The tinyAVR® 1-series and 0-series chips introduce a single-pin Unified Program and Debug Interface (UPDI), which makes it possible to do away with the need for a boot loader and still make use of all the I/O pins except RESET, which is the pin used by UPDI. While UPDI is supported by Microchip's development tools, such a MPLAB, I wanted to develop a lightweight, alternative IDE similar to the Arduino IDE, but streamlined to support just this new tinyAVR architecture. In addition, I wanted to add other, special features such as those listed below:

  • Now supports include of user files using #include "file.h" notation
  • Automatically annotate interrupt vectors in listing file (optional)
  • Interleave code and generated asm in listing file (optional)
  • Pop Up Interfaces for:
    • Viewing and Editing FUSE values (see below)
    • Viewing and Editing EEPROM bytes
    • Viewing and Editing USERROW bytes
    • Viewing and Editing Variables in SRAM
    • Identifying Target Chip
    • Hardware Debugging (via the UPDI interface using compatible programmer/debugger):
    • Set a Hardware Breakpoint by selecting the checkbox on an executable line of code in the Listing View
    • Single Step while the highlighted line in the Listing View shows the next line to execute
    • Right click on Registers and Status Flags in debugger pane to change value (I/O ports not currently supported)
    • Watch the I/O ports, Registers and Status Flags change while stepping through code (changed fields are highlighted)
    • Click on Links in Symbol table to view current state of variables
    • Also able to debug externally compiled ELF files (version 1.0.1)
  • Built-in Pinout Reference Diagrams (with pin-level tooltips)
  • Pop up AVR Instruction Guide tooltips in Listing Pane (hover over instruction name)
  • A Console Monitor feature called OCD Messaging that can send text message to the debugger over UPDI
  • Preliminary support for Arduino-style coding using the megaTinyCore library by Spence Konde (aka Dr. Azzy) See: arduino412.c in examples folder
  • Use a #pragma in code to engage special compile time features, such as pop up dialogs that prompt for #define values or select the target chip part number.
  • Native Versions with an embedded JVM are now available (see "Releases")

As this project advances, I hope to add many more features designed to make uisng the tinyAVR 1-series and 0-series as easy as possible, such as:

  • Improving the built-in documentation
  • More example code for the tinyAVR® 1-series and 0-series chips
  • Support for other UPDI-based programmers (and possibly debugging)
  • Support for additional tabs to allow opening additional source or header files

Project status

While more testing is needed, I am declaring the code as operational (Beta status) on Mac, Windows 10 and Linux. However, MegaTinyIDE is still in development and likely has more than a few bugs, or rough edges. As this is a one man project, I sometimes struggle to do adequate testing (especially on Windows and Linux) when I release a new version. If you a spot a problem, please post in Issue so I can investigate. If you have questions, or suggestions, please post in Discussions

Releases

- 1.0.0 - initial release.
- 1.0.1 - Refactor toolchain loading and add ELF file debugging
- 1.0.2 - Rework ELF file debugging to load from menu rather than from the command line
- 1.0.3 - Fixed cosmetic regression
- 1.0.4 - Fixed a few more cosmetic regressions
- 1.0.5 - Fixed build process (builds 1.0.1 - 1.0.4 did not package proper jar file)
- 1.0.6 - Added document table for multiplexed pins and peripheral address map
- 1.0.7 - Bug and Documentation fixes and enhancements
- 1.0.8 - Regression fix for #include problem in Linux version
- 1.0.9 - Added code examples embedded in markup-type documentation
- 1.0.10 - Added support for using UBB/Serial adapters as programmers
- 1.0.11 - Regression fixes for Flash programming functions and other changes

Debugging Interface

MegaTinyIDE supports on-chip debugging of using the one pin UPDI interface. Currently, this requires using a UPDI programmer/debugger, such as the Atmel-ICE or PICKit-4, but MegaTinyIDE can also talk to the built-in debugger chips on the ATTiny3217-Curiosity-Nano, ATTiny416-Xplained-Nano and ATTiny817-XPlained-Mini and the ATTiny3217-Curiosity-Nano board can also be adapted to function as inexpensive programmer/debugger.

Debugger Limitations: The debugger can only set a breakpoint on assembly language instructions, not lines of C/C++ language code. And, because modern compilers perform a lot of optimization on the code to reduce the number of assembly language instructions needed to implement a statement in C/C++, it can sometimes be hard to tell which assembly instructions correspond to a given C statement, especially if you are not familiar with assembly language code generated by the compiler. There is an option (on by default) that tells the compiler to interleave the C/C++ statements with the generated assembly, but this can sometimes be more confusing than helpful, especially as modern compilers will sometimes reorder the code, such as to move invariant operations outside a loop.

Pinout Reference Diagrams

MegaTinyIDE's built-in documentation pages include a complete set of pinout diagrams along with the basic specifications for each Chip. Note: this is a work in prograam, so some diagrams may be incomplete (currently, secondary I/O units are not listed), or incorrect.

Fuse Editor

MegaTinyIDE's built-in Fuse Editor lets you read the current fuse setting from a target device using the UPDI interface, change as needed and then write back the changed values. Note: changing the value of these fuses can alter the behavior of the target in unexpected ways and even "brick" it if you are not careful. Please be sure you consult the appropriate datasheet and know what you are doing before making any changes.

Universal JAR File supports 64-bit Mac, Windows and Linux

The Native code releases of MegaTinyIDE, which include an OpenJDM JVM are recommended (see "Releases" near the top right of this page.) However, I also maintain a pre-built, executable universal JAR file in the out/artifacts/MegaTinyIDE_jar folder. This version is designed to run on 64 bit versions of macOs, Windows 10 and Linux as long as you have Java 8, or later installed on your system.

To use the universal version on a Mac, simply double click the MegaTinyIDE.jar file to run it once you've downloaded it, although you'll probably have to right click and select "Open" the first time you run MegaTinyIDE due to the Mac OS X security check and the fact that I'm currently unable to digitally sign the JAR file. You should also be able to double click and run using Windows, but some versions of Windows may require you to enable this ability first. You'll need to give the .jar file RUN permission to execute on Linux and using a USB-based device programmer, such as the AVRISP MkII, may also require you to create an install a rules file. The needed GNU-based AVR toolchains are built into MegaTinyIDE and the appropriate toolchain will be automatically installed when you run the MegaTinyIDE JAR file.

Requirements

I suggest using Java 8 JRE or JDK, or later for MegaTinyIDE, but the code also seems to run fine under the OpenJDK Java. Note: I wrote MegaTinyIDE on a Mac Pro using the Community version of IntelliJ IDEA from JetBrains and OS X is the only environment where I have extensively tested and used MegaTinyIDE . I've included GNU/AVR toolchains for Mac and 64 bit Windows and 64 bit Linux, but have not extensively tested the code under Windows or Linux. Feel free to report any issues you discover. I'll do my best, when time permits, to investigate them, but I cannot guarantee fixes, timely or otherwise.

Note: MegaTinyIDE for macOs seems to run fine on the new Mac Mini with Apple Silicon and Rosetta 2, but more testing is needed.

Using MegaTinyIDE

MegaTinyIDE supports coding for the AvrXMega3 Series of Microcontrollers in C and C++ using the GNU AVR-C++ compiler to generate code. The file extension you choose for your code file tells MegaTinyIDE how to process the code:

.c   - Compile as C file using avr-gcc
.cpp - Compile as C++ file using avr-g++
.s   - Assemble using avr-as and link with avr-ld

So, this means you'll have to save your source file with the appropriate extension before you can compile, or assemble it. In addition, you can also write inline assembly code in a C/C++ (.c) file. You'll find a few examples of these different approaches to writing code in the examples folder but these a pretty basic at the moment.

Credit and Thanks

This project would have been much harder and much less cool without help from the following open source projects, or freely available software.

MIT License

Copyright 2014-2023 Wayne Holder

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

MegaTinyIDE is a Java & GNU-based IDE for the new MegaTiny chips (tinyAVR® 1-series and 0-series), such as the ATtiny212, attiny3217, etc.

Topics

Resources

License

Stars

Watchers

Forks

Packages