AVR Development - AVR Simulator (AVR101) - Development Record

Version: AVR101 (v1.0.1)   Date: 20261130   Designed: Jesse Carpenter and Claude (Anthropic)

This page keeps the development record of the AVR Simulator (AVR100, now AVR101), the successor of the Uno Breadboard Simulator (UB90). AVR100 keeps UB90's bench and engines and replaces the inside of the chip: the sketch is compiled by avr-gcc in the browser and runs on a simulated ATmega328P (avr8js). AVR100 is on the Tools page; UB90 stays on the Robotics page until AVR100 is fully functional and replaces it (Jesse Carpenter). UB90's own record stays on the UB Development page. New entries go at the top of their sections.

Back to Webmaster UB Development UB90

On this page: Test Plan AVR101 · Report a Bug · Bench Tests · Claude's Tests · Bug Record · TODO · Strategy · The Toolchain · Revisions

Test Plan AVR101 (for Jesse Carpenter)

AVR101 (v1.0.1, 20261130) is the first fix release of AVR100: the compiler now prepares a sketch as the Arduino IDE does, compiles .cpp files, and checks RAM, and the layout no longer cuts off the bench at 1920 pixels. Test on the live site (carpentersoftware.com, Tools, AVR101 Simulator). Each test: do the steps, write the raw values first, then mark PASS or FAIL. A FAIL goes into Report a Bug with the Output's text. Claude ran every test in Chrome first (Claude's Tests).

A. The compiler (new in AVR101)

No.TestStepsExpected (raw values first)Result
A1Functions in any order (prototypes)New. Type: void setup() { pinMode(13, OUTPUT); blinkTwice(); } void loop() {} void blinkTwice() { digitalWrite(13, HIGH); delay(200); digitalWrite(13, LOW); }. Upload.Output: Done, ____ bytes of flash, and the Global variables line; no error. The pin 13 LED flashes once.____ PASS / FAIL
A2No #include <Arduino.h>Load Blink; delete its line #include <Arduino.h>; Upload.Done, no error; the LED blinks once a second (before AVR101: 'pinMode' was not declared).____ PASS / FAIL
A3A .cpp fileNew. Press + and add Helper.h with int twice(int x); inside its guards; press + and add Helper.cpp with #include "Helper.h" int twice(int x) { return 2 * x; }. In the sketch: #include "Helper.h", setup(): Serial.begin(9600); Serial.println(twice(21));. Upload.Serial Monitor: 42. Before AVR101: a link error.____ PASS / FAIL
A4A missing setup()Load Blink; rename setup to setup2; Upload.Output (red): Build failed: undefined reference to setup (every sketch needs setup() and loop()).____ PASS / FAIL
A5RAM: too much, then near the limitNew. Global: byte big[3000]; setup(): big[5] = 1; Serial.begin(9600); Serial.println(big[5]);. Upload. Then change 3000 to 1500 and Upload.3000: Build failed: not enough memory. Global variables use ____ bytes (___%); the ATmega328P has 2048 bytes. 1500: Done, Global variables use ____ bytes (___%), and the red warning: low memory available, stability problems may occur.____ PASS / FAIL
A6attachInterruptBench test 6 below.As bench test 6.____ PASS / FAIL
A7An error in the sketch and in a headerLoad Blink; delete the ; after delay(1000) on the first delay line; Build. Then open JoystickDrive, open ace.h, make a typing error in it, Build.The line turns red, the Output names sketch.ino and its line; for ace.h the editor opens ace.h at the line.____ PASS / FAIL
A8The first build of a visitOpen the page in a private window (nothing kept). Press Upload.Output: Loading the compiler (about 13 MB, the first build of a visit) ... then Done in ____ ms (raw). The second Upload: ____ ms.____ PASS / FAIL
A9A missing libraryAdd #include <LiquidCrystal.h> to Blink; Build.Build failed: sketch.ino line ___: LiquidCrystal.h: No such file or directory.____ PASS / FAIL
A10Double clicksChange Blink slightly; click Build five times quickly; then Upload twice quickly.One build (one Done line), no error; the sketch runs once.____ PASS / FAIL

B. The editor

No.TestStepsExpected (raw values first)Result
B1Find, replace, go to lineIn Blink: Ctrl+F (Cmd+F) find delay; Ctrl+H replace 1000 with 500; Ctrl+G line 12.Each panel opens; the replace changes both delays; the cursor goes to line 12.____ PASS / FAIL
B2Comments and indentSelect lines 12 to 15; Ctrl+/ twice; Tab, then Shift+Tab.The lines become comments and back; they move in by two spaces and back.____ PASS / FAIL
B3Several cursorsAlt+click at the start of three lines; type //.// appears on all three lines.____ PASS / FAIL
B4CompletionIn loop(), type digi.A list offers digitalRead and digitalWrite; Enter completes.____ PASS / FAIL
B5Uno and Chip tabsLoad MasterWriter; open the Chip tab, then the Uno tab.Each tab shows its own sketch; neither changes the other.____ PASS / FAIL
B6Save, Open, Export, Open folderSave JoystickDrive; New; Open the saved file. Export it; Open folder on the unzipped folder.The sketch, ace.h, and the circuit come back each time.____ PASS / FAIL

C. The layout and padding (new in AVR101)

No.TestStepsExpected (raw values first)Result
C1A 1280 to 1440 pixel windowMake the browser window about 1280 pixels wide; scroll down the page.The editor sits under the bench, 28 lines tall; nothing on the bench is cut off; the line numbers line up with the code.____ PASS / FAIL
C2A 1920 pixel window (full screen on a 1920 monitor)Full screen on a 1920 pixel monitor.The editor sits under the bench; the whole bench shows: the Robot and L298N ON switches and the C and D bus ends at the right (before AVR101 they were cut off).____ PASS / FAIL
C3A 2560 pixel windowFull screen on a large monitor, if you have one.The bench and the editor side by side, equal widths; the editor as tall as the bench.____ PASS / FAIL
C4The editor barLook at the bar above the editor.Row 1: Build, Upload, the Run LED, Examples, Wire it for me, Help, Reference, and Uno: state at the right. Row 2: New, Open, Save, Export, Open folder, Reset Page.____ PASS / FAIL

D. The circuits: the Bench Tests below, one by one, moving parts, wires, and the probes

E. The protocols between the Uno and the ATmega328P

No.TestStepsExpected (raw values first)Result
E1SerialToChipExamples, Protocols, SerialToChip; Chip tab Upload; put the Uno's chip back; Uno tab Upload. Probe the TX wire (red) and GND (black), meter on V.Serial Monitor: #1, then   from the chip: chip got 1, #2, ... (raw lines); the chip's LED lights on odd counts; the scope on TX reads UART 9600 0x__ '_' (the byte).____ PASS / FAIL
E2SerialCallResponseAs E1; turn the Uno's knob or move the chip's inputs if wired.Serial Monitor: lines of a0 ___ a1 ___ count ___ (raw); the count rises by one each line.____ PASS / FAIL
E3MasterWriter, pull SDAAs E1; then pull the SDA wire, then put it back.Serial Monitor: sent 0 err 0, ...; without SDA: result 2; back: result 0. Scope on SDA: I2C SDA 0x08 ACK.____ PASS / FAIL
E4MasterReader, pull SCLAs E1; then pull SCL, then put it back.Serial Monitor: hello; without SCL: nothing; back: hello.____ PASS / FAIL
E5SPIMaster, pull MISOAs E1; then pull MISO, then put it back.Serial Monitor: sent 1 got 100, ...; without MISO: got 255; back: 105, 106, ... Scope on MOSI: SPI MOSI: MOSI 0x__ MISO 0x__.____ PASS / FAIL

F. Break it

No.TestStepsExpected (raw values first)Result
F1Break it while it runsRun any example; pull wires and parts at random, press the buttons, turn the knob, unplug and plug the USB.No page error, no frozen page; burned parts show a red X; Reset Breadboard restores them.____ PASS / FAIL
F2Power supply limitsRun SupplyBlink; raise Bus A past the LED's rating.The LED burns (red X) at the rating, as Help's Mistakes and Burned Parts says.____ PASS / FAIL

G. The live site

No.TestStepsExpected (raw values first)Result
L1The compiler files (once per new toolchain)On the Mac: curl -sI https://carpentersoftware.com/pages/projects/tools/uno/avr/tools/cc1plus.wasmcontent-type: application/wasm (checked by Claude on 20261129: correct).____ PASS / FAIL
L2The source pageCredits on the simulator page: AVR-Simulator-Toolchain.avr/SOURCE.html opens; its links open the repo at v1.0.0 and the release.____ PASS / FAIL

Report a Bug (for Jesse Carpenter)

Write what you did and copy the Output or Serial Monitor text as it is (raw). Send it to Claude; the bug goes into the Bug Record with its fix.

No.DateTestWhat I didRaw output (copied)ExpectedBug ID
1________________________________________________
2________________________________________________
3________________________________________________
4________________________________________________
5________________________________________________

Strategy

One current strategy, updated as development goes on (earlier versions are not kept). Its purpose is the UML of the system (Image-1 to Image-4, and Image-7 for the compiler), drawn with The Engine section; the Directive below tests the system along it.

AVR100 (v1.0.0), 20261127

No.ItemDetail
1The real chipThe sketch the student writes is the code that runs: avr-gcc compiles it to the same machine code a real Uno runs, and avr8js runs that code instruction by instruction (its timers, ports, USART, and ADC). No subset of C or C++: anything the Arduino IDE compiles, AVR100 compiles.
2The focus: the editor and the protocolsSet by Jesse Carpenter: the editor uses the compiler (gcc's messages, the flash and RAM report, folders in file names, the libraries), and the protocols (Serial, I2C, SPI) between the Uno and the ATmega328P, with new sketches for each.
3Circuits first, as in UB90The breadboard, the Uno, the components, and the instruments come before every new feature; Kirchhoff, the Electronics Lab, and the instruments are UB90's, tested the same way (the SPICE judge, the bench tests, the break tests).
4The bridgeOne file (unoAvr.js) joins the chip to the bench: the chip's port, PWM (timer COM bits and OCR), and USART registers become the pins Kirchhoff reads; Kirchhoff's node volts become the chip's pin inputs (HIGH above 2.5 V) and ADC readings. A pin the timers drive is PWM; a pin toggled by tone() is a tone, its pitch measured from its toggles.
5Two pages until the switchSet by Jesse Carpenter: UB90 stays on the Robotics page, frozen as released (its own folder, robotics/ub90); AVR100 develops on the Tools page (tools/uno). Each keeps its own session in the browser. Once AVR100 is fully functional, it replaces UB90.
6Nothing leaves the browserThe compiler runs in the browser (WebAssembly in a Web Worker); its files come from this site; sketches and readings are never sent anywhere. The page's security policy adds only 'wasm-unsafe-eval' (WebAssembly may compile; JavaScript eval stays blocked).
7Licensesavr8js and CodeMirror 6 are MIT (each license ships beside it: avr/avr8js-LICENSE.txt, editor/codemirror-LICENSE.txt). avr-gcc and binutils are GPL: the site offers their source on avr/SOURCE.html (the AVR-Simulator-Toolchain repository, release v1.0.0), and the credits name all three.
8SpeedThe one risk found by the feasibility test: on a slow computer the chip falls behind real time. Roadmap step 1 moves the chip into its own thread and solves Kirchhoff only when a pin changes.
9Robust when someone tries to break itAs in UB90 (Jesse Carpenter): testers pull wires and parts out and type anything into the editor; no page error, no frozen page, no impossible number, whatever they do.
10Raw values first, record, and approvalEvery test and bug gives the raw reading first; each bug gets an ID and a test; nothing in Jesse Carpenter's code changes without his approval, and a proposal is shown first (an image, as Image-5).
11Two chips, joined only by wiresThe Uno and the ATmega328P on the breadboard each run on their own avr8js core, side by side in one scheduler. The protocols pass a byte from one chip to the other only when the wires join the right pins on the bench (Serial TX to RX, I2C A4 to A4 and A5 to A5, SPI pins 10 to 13), as Kirchhoff's wire groups show; a wire pulled ends the link. The scope draws each byte on the wire it used (Image-4, Image-8).
12The compiler, with its sourceDecided by Jesse Carpenter (20261129): AVR100 keeps avr-gcc in the browser, so every sketch runs on the real chip, and meets the GPL v3 with its own toolchain repo (MageMCU/AVR-Simulator-Toolchain, release v1.0.0, 20261129), built from source by GitHub Actions and linked from avr/SOURCE.html; everything else stays MIT (The Compiler Decision, Image-7; The Toolchain).
13UB90 stays as releasedSet by Jesse Carpenter: while AVR100 is under development, UB90 (Robotics) gets bug fixes only; everything new goes into AVR100 (Tools), which replaces UB90 once it is fully functional.
14Keep this page currentEvery change is recorded here as it is made; the Strategy and the Directive are one current version each, the other sections keep their history, newest at the top.

Image-1

UML component diagram of the AVR100 Simulator: twelve components; the IDE hands sketch.ino to the avr-gcc compiler, which hands Intel HEX to the ATmega328P core (avr8js); the AVR bridge joins the core's registers to Kirchhoff and the Output; the UB compiler and runner serves the Chip tab until roadmap step 3
UML component diagram of the AVR100 Simulator: each component is an engine of The Engine section; each dashed arrow is what one engine hands to the next.

Image-2

UML sequence diagram: the student uploads Blink; avr-gcc returns Intel HEX; the AVR bridge loads it into the ATmega328P core and moves the state machine to Running; then in a loop the bridge hands the pin volts in, runs 1 ms of cycles, reads PORTB, and hands Kirchhoff the D13 source; Kirchhoff solves the nets for the meter and the LED
UML sequence diagram (AVR100): Blink compiled and uploaded, then one slice of the chip read on the meter, engine by engine.

Image-3

UML state machine diagram of the sketch's run states: NO_SKETCH, STOPPED, RUNNING, and FINISHED, with the events upload, run, stop, finish, and fault
UML state machine diagram: the sketch's run states, unchanged from UB90 (unoFsm.js).

Image-4

UML sequence diagram of MasterWriter: the Uno core's Wire sends START, the Bus checks the A4 and A5 wires and the slave address, raises the breadboard chip's TWI interrupt with status 0x60, waits for the chip's Wire interrupt to finish with ACK, completes the Uno's step, logs the byte for the scope, and repeats for each byte; STOP gives status 0xA0 and the chip's receiveEvent runs
UML sequence diagram (AVR100): MasterWriter, the Uno writing to slave 8 on the breadboard chip over I2C, through component 12 (the Bus).

How AVR100 Fits UB90

AVR100 is UB90 with the inside of the chips replaced. The bench (engines 6 to 10) is UB90's, unchanged; the sketch now goes through a real compiler to two real chip cores, and the chips talk through the wires. UB90's Image-1 is on the UB Development page.

No.UB90 engineAVR100Change
1IDE and filesIDE and files, with the real editor (CodeMirror 6)Changed: the code editor, gcc's messages in the code
2Sketch compiler (UB's own C and C++ front end)Compiler (avr-gcc in the browser) for the Uno and Chip tabsReplaced
3State machineState machineSame
4Sketch runner (UB's interpreter)Two ATmega328P cores (avr8js): the Uno's and the breadboard chip'sReplaced
5Microcontroller (pins, PWM, ADC, the breadboard chip)AVR bridge and pins: each core's registers to its pins and back; the schedulerChanged: registers in place of UB's host calls
6 to 10Kirchhoff, Electronics Lab, Instruments, Output, Layout and drawingThe same enginesSame, but the scope draws protocol bytes
11Start upStart up, with the compiler's loaderChanged
12(none)Links: Serial, I2C, and SPI between the two chips, through the wiresNew

Directive (Claude's Instructions for Testing the Simulator)

One current directive: the instructions Claude follows to test AVR100 along the UML (Image-1 to Image-4, and Image-7 for the compiler). UB90's suites run here too, adapted to the real compiler (Build and Upload wait for the compiler; gcc writes the messages). A failure becomes a bug in the Bug Record and a new test.

AVR100 (v1.0.0), 20261127

No.Component (Image-1)What Claude tests
1IDE and filesEvery example loads its exact code with #include <Arduino.h>; typing, Add file, headers, Uno and Chip tabs, New, Save, Export, Open, Open folder, and the session after a reload (its own key, apart from UB90).
2Compiler (avr-gcc)Every example builds (flash bytes and time, raw); a typed mistake gives gcc's message with its file and line, and the editor goes to that line; an unchanged sketch is not compiled again; headers in folders (claude/ace.h) are found.
3State machineEvery state with every event against Image-3 (20 cases); USB unplugged pauses without a state change.
4ATmega328P coreTiming (delay(500) by millis(), millis() against the real clock); C types (an int wraps at 32,767); the timers' PWM on pins 3, 5, 6, 9, 10, 11; tone() pitch; the USART text; the ADC from the knob and the light sensor.
5AVR bridge and UnoRegisters to pins and back, every frame: a PWM pin is never taken for a tone; inputs follow Kirchhoff's volts; the Serial Monitor shows println() as the Arduino IDE does.
6 to 10Kirchhoff, Lab, Instruments, Output, DrawingUB90's suites on AVR100: the SPICE judge on every example and every single fault; the wiring of every example against the four Wiring Rules; the bench, drive, and MMC tests.
12Links (Serial, I2C, SPI)Each protocol pair run as the student runs it (Chip tab Upload with the Uno's chip pulled, the chip put back, Uno tab Upload): the bytes sent equal the bytes received (raw, from the Serial Monitor); a protocol wire pulled ends the link (I2C: endTransmission() 2); the scope on each line shows the byte and its value; Programmer and ChipJoystickDrive on the chip's core.
AllSomeone trying to break itEvery wire and part pulled out at random while the sketch runs (three seeds); endless loops, deep recursion, a huge array, divide by zero, a print flood, garbage text, markup in a string or a file name, a damaged saved file.
AllSpeedThe chip's time against the real clock on a slowed processor (4 and 6 times), Blink and JoystickDrive.

TODO (for Jesse Carpenter)

No.ItemStatus
1The editor layout (Image-5): the editor right of the simulator, a white page with C/C++ colors (the Arduino IDE 2 colors), the Plotter, Output, and Serial Monitor under the simulator. Approved by Jesse Carpenter with one change: the editor as wide as the simulator. Everything else stays as UB90; the editor page is worked on together over time.Done (Image-6)
2Bench test AVR100 on the Tools page (the same bench tests as UB90) and report any reading that differs from UB90.Moved to TODO 9 (20261130): the Test Plan AVR101 holds these tests
3A slow computer (a Chromebook or an older laptop): does Blink keep time?Open
4Optional courtesy since 20261129 (our own build makes it unnecessary): ask the compiler package's author for its GPL source: open a GitHub issue at github.com/horang-corp/avr-gcc-wasm (Issues, New issue) with the message Claude drafted (20261127, under this table): the exact GCC, binutils, and avr-libc versions, any patches, the build scripts and Emscripten settings, and a license for its JavaScript. If Issues are off there, tell Claude.Closed (20261129): our own build, from source, replaced the package's files
5Push the toolchain repo (MageMCU/AVR-Simulator-Toolchain, from Claude's zip): GitHub Actions builds GCC 7.3.0 and binutils 2.42 to WebAssembly and the Arduino objects, and posts them as a release; send Claude the build log if it fails. The repo is the GPL source that the site's source page links to.Done (20261129): five runs, the fifth green; tag and release v1.0.0 (The Toolchain)
6The AVR100 site release: our own compiler tools from that release, the source page (avr/SOURCE.html) linked to the repo's tag, Help and Reference, the Webmaster entry, the full tests. AVR100 does not go live before its GPL source is offered.Done (20261129): deployed by Jesse Carpenter that evening; Claude checked it live (the compiler files and their types, a build on the live page, the pages)
7Move the Firebase project to the Blaze plan and set a budget alert (for example $5 a month), so the compiler download cannot stop the site (The Compiler Decision, On Firebase Hosting)Blaze: done (Jesse Carpenter uses its Cloud Shell); the budget alert: open
8Firebase Hosting: keep only the last few deployed versions (Hosting, Release history settings)Open (Jesse Carpenter)
9Test AVR101 on the live site with the Test Plan AVR101; report each FAIL in Report a BugOpen (Jesse Carpenter), from 20261130
10The Reference as one page per entry (description, syntax, parameters and returns, how to use, an example that opens in the simulator, what it does on the ATmega328P, see also): approve the plan and the Phase 1 list of about 30 entries (Future, item 5)Open (Jesse Carpenter: approval; Claude: the pages)
11Deploy AVR101 (site-v1.0.1-20261130, Website Update procedure, Part B)Open (Jesse Carpenter)

TODO 4: the message to the author (a GitHub issue at github.com/horang-corp/avr-gcc-wasm, Issues, New issue; the first line is the title), drafted by Claude, 20261127

Title: Build scripts and patches for the WebAssembly GCC and binutils (GPL source), and a license for the JavaScript

Hello,

Thank you for avr-gcc-wasm. It compiles Arduino sketches for the ATmega328P entirely in the browser, which is exactly what I need for an educational Arduino Uno simulator I am building for students (carpentersoftware.com).

I would like to use the WebAssembly builds in tools/ (cc1plus, avr-as, avr-ld, avr-objcopy) and the precompiled Arduino objects in assets/. Because GCC and binutils are licensed under the GNU GPL v3, anyone who distributes these builds must also offer the Corresponding Source, which includes the scripts and any patches used to build them. THIRD_PARTY_NOTICES.md says the same. I could not find these in the repository.

Could you please share:

1. The exact source versions used (GCC 7.3.0 and binutils 2.42, as far as I can tell; Atmel patched or plain upstream?) and the avr-libc version.
2. Any patches applied to them.
3. The build scripts and the Emscripten version and settings used to produce tools/*.wasm and tools/*.mjs (for example, the configure options and the emcc link flags).

It would be ideal if these could be added to the repository, so that everyone who uses the package can meet the GPL.

Also, the package's license field reads "SEE LICENSE IN THIRD_PARTY_NOTICES.md", which covers only the toolchain. Could you state a license for your own JavaScript (index.js, worker.js, firmware-builder.js, scripts/)? I have written my own runner for now, so this is not urgent, but a license would help others.

Thank you for your work and for any help.

Jesse Carpenter
Carpenter Software
carpentersoftware.com

Proposals

Image-5

Proposed AVR100 layout: the bench on the left with the Serial Plotter, Output, and Serial Monitor under it; the editor on the right with its toolbar, the Uno and Chip tabs, and a white page with the code in color
Proposed editor layout (a working mockup): AnalogReadSerial running, the editor at the right, the Serial Monitor under the simulator.

Image-6

AVR100 as built: the bench and the editor side by side at equal widths, the Plotter and Serial Monitor under the bench, the code page white with the code in color
As built in AVR100 (a window 2000 pixels wide): the editor as wide as the simulator. In a window under 1900 pixels the editor sits under the bench, again as wide as it.

The Editor: CodeMirror 6

Set by Jesse Carpenter: as a coder, the editor has to be real; CodeMirror 6 chosen over Monaco (the editor of VS Code and the Arduino IDE 2) for its size and because it runs under the page's security policy unchanged. The editor page is worked on together over time.

No.ItemDetail
1The packagescodemirror 6.0.2, @codemirror/view 6.44.2, state 6.7.6, lang-cpp 6.0.3 (the C and C++ language, @lezer/cpp 1.1.6), language 6.13.1, commands 6.11.2, search 6.7.3, autocomplete 6.20.4, lint 6.9.8; all MIT (Marijn Haverbeke and others).
2The fileOne bundle, editor/codemirror.js: 525,862 bytes raw, 171,410 compressed, served from this site (nothing loads from outside); the global CM6.
3SecurityThe page allows no inline styles. CodeMirror's style-mod writes its styles into a <style> element, which that blocks; the bundle's style-mod is patched to use a constructed style sheet (adoptedStyleSheets) for the document too, so the security policy stays as it is. No security policy block in the tests.
4How it joins the IDEunoEditor.js (class CodeEditor) builds the editor in the sketch panel and is used as the textarea was (value, selectionStart, selectionEnd, setSelectionRange, focus, scrollTop, and an input event for the student's typing), so the IDE, the file tabs, Save, Open, and the session work as before. A file opened gets its own undo history.
5The pageWhite, Menlo 14 pixels, the Arduino IDE 2 colors: keywords and preprocessor lines olive (#728e00), types and Arduino names teal (#00979d), functions orange (#d35400), numbers brown (#8a7b52), strings dark teal (#005c5f), comments gray italic (#95a5a6); line numbers and fold markers in a light gray gutter.
6The keysUndo and redo by edit (Ctrl+Z, Ctrl+Shift+Z); auto indent; Tab and Shift+Tab on lines; brackets matched and closed, quotes closed; Ctrl+/ comments; Ctrl+F find and replace (Ctrl+H too); Ctrl+G go to line; Alt+click several cursors; Shift+Alt and drag a column; folding; completion of C++ and Arduino names and the sketch's own words. Cmd in place of Ctrl on a Mac.
7gcc's messages in the codeEach error and warning underlined at its line and column with gcc's text on hover, in the file it belongs to; the error line marked; an error in a header opens that header at its line. Typing clears the marks until the next Build.
8TestsThe real editor 13 of 13 (Claude's Tests); the editor suite 11 of 11.

Credits and Licenses

Jesse Carpenter: every added technology with a license gets its credit. The same credits are on the AVR100 page, under the simulator.

No.TechnologyWhat it does in AVR100License and creditWhere
1avr8js 0.21.1The two simulated ATmega328P chips (CPU, timers, ports, USART, ADC, TWI, SPI)MIT; Uri Shaked and contributors (Wokwi)avr/avr8js.js, avr/avr8js-LICENSE.txt
2CodeMirror 6The code editor (The Editor section)MIT; Marijn Haverbeke and otherseditor/codemirror.js, editor/codemirror-LICENSE.txt
3GCC (avr-gcc, cc1plus) and GNU binutils (as, ld, objcopy)The compiler, in WebAssemblyGNU GPL v3 or later; Free Software Foundation. GCC 7.3.0 and binutils 2.42, built from source; the source offered on avr/SOURCE.html (AVR-Simulator-Toolchain v1.0.0)avr/tools, avr/COPYING, avr/SOURCE.html
4avr-libc 2.1.0The C library and start up code for the ATmega328P (and EEPROM, libatmega328p.a)BSD style (avr-libc project)avr/assets/libs
5Arduino AVR core 1.8.6 with Wire and SPI; Servo 1.2.2Arduino.h, Serial, Wire, SPI, Servo, and the rest (with WInterrupts: attachInterrupt), precompiled by the toolchain repoGNU LGPL 2.1 or later (avr/COPYING.LIB); Arduino and contributors (Wire: Nicholas Zambetti)avr/assets
6Adafruit libraries (BMP085, BusIO, GFX, SSD1306), DHT sensor library, VL53L0X, FirmataWere in the compiler package; no longer served (20261129): our build carries only Wire, SPI, and Servo(not served)(none)
7The compiler runner (avrc.js, avrc-worker.js, loader.js)Runs the four GNU tools in a Web Worker: cc1plus, avr-as, avr-ld, avr-objcopyMIT; Carpenter Software, written for AVR100 (Jesse Carpenter chose this over the package's own JavaScript, which states no license; those three files are removed)avr/avrc.js, avr/avrc-worker.js, avr/loader.js, avr/NOTICES.md
8AVR-Simulator-Toolchain v1.0.0 (MageMCU, ours)Builds GCC and binutils to WebAssembly and the Arduino objects from source on GitHub Actions; its repo and release are their GPL source. Replaced the package @horang-corp/avr-gcc-wasm 0.2.0 (20261129), whose files are no longer servedBuild scripts MIT (Carpenter Software); the parts keep their own licenses (avr/TOOLCHAIN-SOURCE.md)avr/tools, avr/assets, avr/SOURCE.html

The Compiler Decision (20261129)

Decided by Jesse Carpenter, 20261129: the compiler (avr-gcc in the browser) stays, and AVR100 meets the GPL with its own toolchain repo. The options weighed, the paths of a sketch with and without a compiler (Image-7), what the GPL asks, the order of the work, and how it sits on Firebase Hosting.

The options weighed

No.OptionGPL on the site?Real chip for edited sketches?Verdict
1Our own GCC build, its source in a public repoYes, met by the repoYesChosen
2Clang and LLVM (Apache 2.0)NoNot reliably: open LLVM bugs with Arduino sketches (Serial, link time optimization); no browser buildNot ready
3Compile on our own server (Cloud Run)No (running is not distributing)YesRejected: sketches leave the browser (privacy first), a server to secure, cost and outages
4Open .hex from the student's own Arduino IDE or PlatformIONoBuilt outside the pageKept as an addition
5Precompiled examples onlyNoExamples onlyPart of option 6
6No compiler: 4 and 5 with UB's checker and interpreter for editsNo (MIT, one LGPL credit)No: edits run on UB's interpreter, no protocolsRunner up (Image-7, right)
7A Linux distribution's avr-gcc in a browser PC emulatorYes, met by the distribution's sourceYesRejected: a large download and slow
8Load the package from a public CDNNot by usYesRejected: no source exists for its builds, a third party sees every visitor

Image-7

UML activity diagram: with a compiler, the student's sketch goes from the CodeMirror 6 editor (MIT) to avr-gcc (GPL v3), to a hex program with the Arduino core (LGPL 2.1, BSD), to the real chip avr8js (MIT), at the cost of publishing a GPL source repo. Without a compiler, an unchanged example runs its precompiled hex on the real chip, an edited sketch that fits UB's C++ runs on UB's interpreter (MIT) without protocols, and anything else is built in the Arduino IDE and opened as a hex file.
UML activity diagram: what runs a sketch, with a compiler (chosen, left) and without one (right), each part with its license. With a compiler there is one path, every sketch on the real chip; without one, three.

What the GPL v3 asks (and what it does not)

No.The GPL v3What AVR100 does
1Section 2: the permission is in the license itself ("This License explicitly affirms your unlimited permission to run the unmodified Program."); no one has to approve itNo permission to wait for; the conditions apply only when the site serves the compiler
2Section 6: object code may be conveyed with its machine readable Corresponding Source; 6(d): from a designated place, with clear directions next to it saying where the source is; on a network server, the source may be on a different serveravr/SOURCE.html beside the compiler, linking to the repo's release tag on GitHub
3Section 1: the Corresponding Source is all the source needed to generate, install, and run the work, including the scripts to control those activitiesThe repo: GCC 7.3.0, binutils 2.42, avr-libc (pinned, the tarballs in its release), the patches, the build scripts, the GitHub Actions workflow, the Emscripten version
4Section 4: keep the notices and give the license textCOPYING (GPL v3) in the repo and on the site; the credits name GCC and binutils
5Keep the source available as long as the compiler is servedA public repo, never deleted while AVR100 serves that version
6Section 5: an aggregate (separate, independent works together) does not bring the other parts under the GPLThe simulator stays MIT: it runs the compiler as separate programs and only passes files to them
7Section 9: no one has to accept the license to receive or run a copyStudents who compile on the page owe nothing; the duty is the site's
8The GCC Runtime Library ExceptionStudents' compiled programs are free of the GPL
9LGPL 2.1 (the Arduino core and libraries in the precompiled objects)A link to their source at the version used, and the objects shipped so anyone can relink

Why the present compiler files cannot stay: they are the package's builds (Horang Corp), and its public repository has no scripts or patches for them, so their Corresponding Source cannot be given. Our own build gives it. The license text: gnu.org/licenses/gpl-3.0.html; the FAQ: gnu.org/licenses/gpl-faq.html.

The order of the work (no chicken and egg: building and testing in private owes nothing)

StepWhatWho
1Create the public repo MageMCU/AVR-Simulator-Toolchain (github.com/new) and push Claude's zipJesse Carpenter (Claude: the zip). Done 20261129
2GitHub Actions builds the four tools to WebAssembly and the Arduino objects; a failed run's log goes to Claude, who fixes the scriptsGitHub; Claude. Done 20261129: five runs, four fixes (The Toolchain)
3Every test suite with the tools from the repo's buildClaude. Done 20261129 (Claude's Tests)
4Tag the release (v1.0.0): the source frozen at a fixed addressJesse Carpenter (Claude: title and description). Done 20261129: v1.0.0 at commit 0cb195c
5Deploy the site with those tools and avr/SOURCE.html linking to that tag; the source is public no later than the compilerJesse Carpenter (Claude: the site zip). The zip: 20261129

What each part is written in

PartWritten inRuns as
The simulator (bench, Kirchhoff, Lab, instruments, IDE, bridge, Links, scheduler)JavaScript (ours, MIT), HTML, CSSJavaScript in the browser
The editor (CodeMirror 6), the chip (avr8js)TypeScript, shipped as JavaScriptJavaScript in the browser
The compiler (cc1plus, as, ld, objcopy)C and C++ (GNU)WebAssembly, built by Emscripten; started by generated JavaScript loaders (tools/*.mjs)
Our compiler runner (avrc.js, avrc-worker.js)JavaScript (ours, MIT)A Web Worker beside the page
The Arduino core and librariesC and C++AVR machine code (precompiled objects)
The student's sketchC and C++AVR machine code (Intel HEX), run by avr8js
The toolchain repo (AVR-Simulator-Toolchain)Shell scripts, a GitHub Actions workflow (YAML), a Node.js self test, and the GNU sourceOn GitHub's servers, making the WebAssembly files

On Firebase Hosting (a static site; no server)

No.ItemDetail
1The filesAll static: the page, the JavaScript, avr/tools (*.wasm, *.mjs) and avr/assets from the repo's release, avr/SOURCE.html, NOTICES.md, COPYING; deployed from Cloud Shell as usual
2firebase.json.wasm as application/wasm and .mjs as JavaScript; the compiler in a versioned folder with a long cache (a year), the HTML with a short one; the page's security policy (with 'wasm-unsafe-eval')
3Download allowanceEach visitor's first Build downloads about 12 MB (compressed). The no cost Spark plan allows 360 MB a day of Hosting transfer, about 30 first builds a day, and over it the whole site stops until the next day. On the Blaze plan over the no cost part costs $0.15 a GB, about $0.0018 a first build ($1.80 for 1,000 students)
4StorageAbout 55 MB a deploy against 10 GB; keep only the last few deployed versions
5RecommendedThe Blaze plan with a budget alert (for example $5 a month) before AVR100 goes live; a public CDN for the compiler would save transfer but shows every visitor to a third party

UB70 and AVR100 (what changed, in short)

AreaUB70 (v0.7.0, 20261125)AVR100 (v1.0.0)
The sketch runs onUB's interpreterReal AVR machine code on avr8js
Compiler and C++UB's own part of C and C++avr-gcc 7.3.0: what the Arduino IDE compiles
EditorA textarea with line numbersCodeMirror 6, beside the bench, gcc's messages in the code
Second ATmega328PIn the Electronics Lab, run by UBOn the breadboard (Rule 4), its own avr8js core
ProtocolsNoneSerial, I2C, SPI through the wires, on the scope
Bench (from UB71 to UB90)The six slot lab, Kirchhoff unnamedThe square lab, the L298N as on the bench, Kirchhoff checked against SPICE, ohms, the final layout
LicensesOurs (MIT)Ours, avr8js, CodeMirror 6 (MIT); GCC and binutils (GPL v3, met by the repo); avr-libc (BSD); the Arduino core (LGPL 2.1)

The Toolchain: AVR-Simulator-Toolchain (20261129)

The compiler AVR100 serves is built from source by our own repository, github.com/MageMCU/AVR-Simulator-Toolchain (public; build scripts MIT), on GitHub Actions. Its repo and release are the GPL source that avr/SOURCE.html links to. Jesse Carpenter: the repo's name carries no simulator version, and the toolchain keeps its own version (MAJOR: a new GCC or binutils; MINOR: a new Arduino core or an added library; FIXES: a build fix that leaves the tools the same), since many site releases use the same toolchain. A tag is never moved or deleted while the site serves it.

SimulatorToolchain (tag)GCCbinutilsavr-libcArduino coreServoEmscripten
AVR100 (v1.0.0)v1.0.0 (commit 0cb195c)7.3.02.422.1.01.8.61.2.23.1.74

The build steps (build/ in the repo), each run on GitHub's servers

StepWhatTime (run 5)
0Fetch every source archive from its home; SHA256SUMSabout 1 min
1, 2A native avr-gcc and binutils; avr-libcabout 13 min
3binutils to WebAssembly: avr-as, avr-ld, avr-objcopyabout 3 min
4GMP, MPFR, MPC, then cc1plus to WebAssembly (only cc1plus is made)about 4 min
5The Arduino core (with WInterrupts), Wire, SPI, Servo; avr-libc for the ATmega328P only; manifest.jsonunder 1 min
6, 7Package the release; the self test compiles three sketches with the new tools (Blink; Wire, SPI, Servo, attachInterrupt, tone, EEPROM; math and String)about 1 min

The runs (20261129), raw messages first

RunCommitStopped atRaw messageCause and fix
6tag v1.0.0(green)The release published: avr-toolchain-1.0.0.zip (13,606,475 bytes; SHA256 b565a7a0...148d, as SHA256SUMS), avr-toolchain-1.0.0-source.tar, SHA256SUMSThe site's compiler (avr/tools, avr/assets) is this zip
5v1.0.0.d(green, 21 min 45 s)Self test: 3 of 3 passedEvery step passed
4v1.0.0.c4. cc1pluswasm-ld: error: libgcov-util.o: undefined symbol: ftwmake all-gcc also links gcov-tool, which needs ftw (absent in Emscripten). Fix: make all-gcc TARGET-gcc=cc1plus; checked by Claude with a native build of GCC 7.3.0
3v1.0.0.b3. binutilsstrsignal.c:554:1: error: conflicting types for 'psignal'libiberty defined its own psignal beside Emscripten's. Fix: configure is told psignal exists (ac_cv_func_psignal=yes), steps 3 and 4; reproduced and checked by Claude
2build update0. The sourcescurl: (22) The requested URL returned error: 404avr-libc 2.1.0 is not on GitHub's releases (they begin at 2.2.0). Fix: fetched from download.savannah.gnu.org
1Create build.yml(at once)Failurebuild.yml made on GitHub held one line; the full file came with run 2 (first placed in .git by mistake, moved to .github)

Security

Jesse Carpenter: secure the simulator from hacking; the Privacy Policy updated (20261127): AVR100's storage, the compiler download, and an AVR100 paragraph under Security of Our Tools.

No.WhereSafeguard
1The pageContent Security Policy: code only from this site and Google Analytics; no inline scripts or styles; 'wasm-unsafe-eval' lets WebAssembly compile while JavaScript eval stays blocked. CodeMirror's styles go in a constructed style sheet, so no inline style is needed.
2The compilerRuns in a Web Worker, apart from the page; loads only from this site; refuses a sketch over 2 MB; stops a build over 60 s (the Worker restarted); its file system holds only the sketch and the compiler's own headers, so #include can reach no file on the computer and no web address; a compiler crash (memory) is said plainly.
3The programRefused above 32,256 bytes of flash; runs only inside avr8js, which has no way to the page, the files, or the network; a jump into nowhere, a stack overflow, or a watchdog reset stays inside the simulated chip.
4Text on the pageSerial text and gcc's messages are written as text (never as markup); a file opened is read as text; the file checks of UB90 (names, sizes, parts, modules) stay.
5StorageAVR100 keeps its own session (avrSim.v1), apart from UB90's.

Wiring Rules

RuleWiring
1Always populate the wiring around the Uno first, then work outward.
2When modules are used, populate their circuits under or near the module (Rule 1 still applies first).
3Use the Uno GND to connect the breadboard to all four buses' − rails, and the modules' GND too when feasible.
4Place the ATmega328P chip on the breadboard between the Uno and the Electronics Lab.

Bench Tests (for Jesse Carpenter)

Each test is named by its sketch pair. For every pair: choose it in Examples (Wire it for me on), open the Chip tab and press Upload (the Uno's chip is pulled), click the empty socket to put the Uno's chip back, open the Uno tab and press Upload. Raw values first.

No.TestStepsExpected (raw values first)Result
1MasterWriterRun the pair; then pull the blue SDA wire; put it back. Scope probes: red on the A4 strip (b37), black on a − rail; 20 us per division.Serial Monitor: sent x = 0, result 0; sent x = 1, result 0; … The chip's LED about 12 mA on odd x. SDA pulled: result 2 (no slave answered), the LED stays. Scope: the byte bit by bit, readout I2C SDA 0x.. ACK (Image-8).____ PASS / FAIL
2MasterReaderRun the pair; pull the orange SCL wire; put it back. Scope on the A5 strip.hello each half second; SCL pulled: empty lines; back: hello again. Scope: I2C SCL with nine clock pulses per byte.____ PASS / FAIL
3SPIMasterRun the pair; pull the purple MISO wire (D12); put it back. Scope on the D11 strip (MOSI), 1 us per division.sent 1, got 100; sent 2, got 101; … MISO pulled: got 255; back: the count again. Scope: SPI MOSI with the sent byte, the MISO byte in the readout.____ PASS / FAIL
4SerialToChipThe serial wires come crossed: press Upload on the Chip tab first and read the message; put the two wires back as it says, Upload, cross them again, chip back, Uno Upload. Scope on Uno pin 1's strip, 0.2 ms per division.The message names the crossed wires. Then #0, #1, … with from the chip: chip got 0, 1, …; the chip's LED on for odd numbers. Scope: UART 9615 with each character.____ PASS / FAIL
5SerialCallResponseAs test 4; then wire the knob's wiper to the chip's A0 (pin 23).R a0 0 a1 0 count 0, 1, …; with the knob: a0 follows it (0 to 255).____ PASS / FAIL
6attachInterrupt (new, 20261129)Load Button; in the editor, replace the sketch with: volatile int n = 0; void hit() { n++; } setup(): Serial.begin(9600); pinMode(2, INPUT); attachInterrupt(digitalPinToInterrupt(2), hit, RISING); loop(): Serial.println(n); delay(200); wire the button to D2 as in Button (pin 2); Upload; press the button five times.Output: Done, about 3,040 bytes of flash, no errors (before this release: a link error, undefined reference to attachInterrupt). Serial Monitor: 0, then the count rises by one with each press (a bouncing button may add more, as on a real Uno).____ PASS / FAIL

Image-8

The scope on the I2C SDA line during MasterWriter at 20 microseconds per division: the bits of one byte, the ACK bit LOW, readout I2C SDA 0x05 ACK
The scope on SDA during MasterWriter (20 us per division): the byte 0x05 bit by bit, then the ACK.

Claude's Tests

AVR101 (v1.0.1), 20261130: the live review, then every suite with the AVR101 fixes, raw values first

No.SuiteResult (raw)Verdict
1The compiler, 14 cases (before: the live AVR100; after: AVR101)A function used above it: before 'blinkTwice' was not declared, after Done 2048 bytes; no Arduino.h: before 'pinMode' was not declared, after Done 2180 bytes; Helper.h with Helper.cpp: before a link error, after Done 2750 bytes; no setup(): before [avr-ld] ... in function `main':, after undefined reference to setup (every sketch needs setup() and loop()); a 3,000 byte array: before Done 2060 bytes, after not enough memory, Global variables use 3197 bytes (156%); a template without end: before Maximum call stack size exceeded, after the compiler ran out of room; a path or a web address in #include, a missing library: refused, as before; CRLF and Unicode: Done; Blink after a failure: Done; five Build clicks: one build; two Upload clicks: one upload. 0 page errors.PASS
2The prototype maker, 6 casesUsed above its definition: a prototype; not used above: none; a name only in a comment or a string: ignored; struct and const types, static: kept; a template, a default value: left as written; an array with braces: skipped.PASS
3The layout, 1280 to 2560 pixelsBefore (live): from 1900 to 2000 pixels the bench had 771 to 817 pixels for its 820 (cut off). After: 1280 986, 1600 to 2000 1008, 2100 863, 2200 909, 2300 955, 2560 1075 pixels, nothing hidden. The editor 560 pixels tall under the bench; the bar in two rows. The line numbers: 14 pixels while the editor is off screen, 19.6 pixels (the code's) once it is in view (the editor measures only what is visible; no change needed).PASS
4Every example (Chrome)43 of 45 by plain Upload, 0 page errors (the 2 serial pairs by design, suite 6); each Done line followed by its Global variables line, for example Blink 2,402 bytes, 197 bytes of RAM.PASS
5Editor13 of 13 and 11 of 11 (the editor test now reads the Done line, which the RAM line follows, as in the Arduino IDE).PASS
6Protocols, pulled wires, the chipSerial: echo:1 …; I2C read: hello; SPI: sent 1 got 100 …; SDA pulled: result 2, back result 0; SCL pulled: nothing, back hello; MISO pulled: got 255, back 105, 106. ChipJoystickDrive runs.PASS
7Abuse, flood, and break testsabuse (AVR) and abuse (markup) all pass; flood: the Serial Monitor keeps up; break tests, 3 seeds: 1,240, 1,241, 1,243 actions, 0 problems.PASS
8The pagesThe simulator, Help, Reference, source page, Tools, Privacy Policy, and this page: 0 page errors, no dead links, no missing anchors; the title bar reads AVR101 Simulator.PASS

AVR100 (v1.0.0) with the toolchain v1.0.0, 20261129: every suite again with our own compiler, raw values first

No.SuiteResult (raw)Verdict
1Every example (Chrome, the real page)43 of 45 build and run, 0 page errors; the 2 serial pairs stop at a plain Upload by design (their wires come crossed; suite 4). Blink 2,402 bytes of flash; builds 54 to 271 ms (the first, 1,181 ms, compiles the WebAssembly once). Serial as before: the knob 511, ReadAnalogVoltage 2.50, LineFit 200 99.80 99.84 -0.04.PASS
2The new toolchainattachInterrupt(digitalPinToInterrupt(2), hit, RISING): 3,040 bytes (could not link before); EEPROM (avr/eeprom.h): 2,662 bytes; Wire, SPI, Servo, attachInterrupt, tone, EEPROM in one sketch: 7,316 bytes; math and String: 7,228 bytes; a typed mistake: [cc1plus] /sketch.cpp:2:15: error: 'undefinedThing' was not declared in this scope.PASS
3Editor13 of 13 (the real editor) and 11 of 11 (editor and code): an error in a header opens it at the line (Bad.h line 3), Uno and Chip tabs each keep their sketch, no security policy blocks.PASS
4Protocols, pulled wires, the chipI2C write: sent 0 err 0 …; I2C read: hello; Serial: echo:1 …; SPI: sent 1 got 100 …. Pulled: SDA gives result 2, back result 0; SCL gives nothing, back hello; MISO gives 255, back 105, 106. ChipJoystickDrive runs on the breadboard chip.PASS
5Abuse and break testsabuse (AVR) all pass (stack overflow, watchdog reset, …); abuse (markup in names and files) all pass, no markup ran; flood: the Serial Monitor keeps up; break tests, 3 seeds: 1,240, 1,241, 1,243 actions, 0 problems.PASS

AVR100 (v1.0.0), 20261127: every suite of the Directive with the real compiler, raw values first

No.SuiteResult (raw)Verdict
1Every example40 of 40 build and run, 0 page errors; the title bar reads AVR100 Simulator. Serial: the knob 511, ReadAnalogVoltage 2.50, ASCIITable as the Arduino IDE shows it.PASS
2Editor and code11 of 11: every example exact, with #include <Arduino.h>, builds (Chip tab too); a typed mistake: Build failed: sketch.ino line 20: expected primary-expression before ';' token, the editor on line 20; fixed: 5,292 bytes of flash, 1,336 ms; Add file, a bad name refused, #include "Motor.h" builds; Upload Running; New.PASS
3State, timing, file34 of 34: the 20 state cases match Image-3; delay(500) steps 501, 500, 500, 500, 501 ms by millis(); millis() 3,001 ms after 6 loops in 3,304 ms of real time (counted from the end of the build); int wrap -32768; Save, Export (.zip), Open, and the session after a reload.PASS
4Wiring, four rulesEvery example: Rules 1 to 3 with 0 faults, Rule 4 where a chip is used, 0 wires crossed.PASS
5SPICE judge (ngspice)40 examples, 653 cases (as wired and every single fault), 23,042 net voltages and 737 LED currents compared: 0 disagreements.PASS
6Break testsThree seeds (90, 7, 2026): 1,022, 1,022, and 1,023 random actions, 0 problems; code and file abuse: all pass (endless loops, recursion, a huge array, divide by zero, a print flood, garbage text, markup in a string and a name, a damaged file); no markup ran.PASS
7Serial floodThe Monitor keeps the newest text and the page stays Running (1,414 to 2,839 characters at half second reads).PASS
8Tones and PWMtoneMelody on pin 8: 263, 197, 220, 197, 247, 263 Hz (the notes C4, G3, A3, G3, B3, C4; the rests read none); Fade on pin 9: PWM 15 to 225, no tone.PASS
9Both pagesFrom their cards: UB90 (Robotics) runs Blink with UB's engine and its session unoSim.v2; AVR100 (Tools) runs Blink on avr8js with its session avrSim.v1; 0 page errors, 0 missing files.PASS
10Both chips on avr8jsEvery example 40 of 40 and the 5 protocol pairs; Programmer (6,148 bytes) prints Hello from the breadboard chip 1, 2, …; ChipJoystickDrive (7,746 bytes) raw motor volts (left, right): forward 11.95, 11.95; turn 11.95, 5.91; pivot 11.95, −11.95; center 0.00, 0.00; back −11.95, −11.95.PASS
11The protocol pairsSerialToChip: #0, #1, … and from the chip: chip got 0, 1, 2, 3, 4; the chip's LED 12.1 mA on odd numbers. SerialCallResponse: a0 0 a1 0 count 0 to 4 (nothing on the chip's A0 and A1). MasterWriter: sent x = 0 to 5, result 0; the chip's LED 12.1 mA on odd x. MasterReader: hello (6 bytes) each half second. SPIMaster: sent 0, got 0; sent 1, got 100; … sent 5, got 104. Crossed serial wires at the chip's Upload: the message asks to put them back. Raw scope readouts: I2C SDA 0x05 ACK (Image-8), I2C SCL 0x20 NACK, UART 9615 0x0A, SPI MOSI: MOSI 0x07 MISO 0x6A; two levels only (0 and 5 V).PASS
12Wiring of the protocol pairsSerialToChip, SerialCallResponse, MasterWriter, MasterReader, SPIMaster: Rules 1 to 3 with 0 faults, Rule 4 between (pin 1 at f36), 0 wires crossed.PASS
13The real editor13 of 13: auto indent and closing bracket; undo by edit; redo; Tab and Shift+Tab on lines; Ctrl+/; Ctrl+F (with replace); Ctrl+G; completion (Seri gives Serial); folding; Alt+click cursors; an error in Bad.h line 3 opens Bad.h at line 3, marked; no page error and no security policy block.PASS
14Our own compiler runnerEvery example builds (45 of 45) and runs; raw flash bytes: Blink 2,246 (was 5,292 when every library was linked), AnalogReadSerial 2,838, MasterWriter chip 3,526, SPIMaster chip 2,064, JoystickDrive 4,926, Step2_JUL 6,730; a second build 117 to 433 ms (the tools stay compiled). The Arduino IDE reports 924 bytes for Blink (it links the core from an archive with link time optimization); AVR100 links the core's objects, unused sections dropped.PASS
15Trying to break the compiler and the chip10 of 10: #include "/etc/passwd", a path into the site, a web address: No such file or directory; 36,610 bytes: refused (the ATmega328P holds 32,256); a template without end: the compiler ran out of memory, said plainly; a macro flood: gcc's error; markup printed on Serial: shown as text, no element made, no dialog; a jump into nowhere, a stack overflow, a watchdog reset: the page alive; 0 page errors.PASS
16Speed (from the feasibility test)Processor slowed 4 times: Blink 53 percent of real time, JoystickDrive 40 percent; 6 times: Blink 36 percent.To solve (roadmap step 1)

Roadmap

Set by Jesse Carpenter: the focus is the editor, where the editor uses the compiler, and the protocols, with new sketches.

No.StepWhatStatus
1The foundation: speedThe chip in its own thread (a Web Worker) beside the drawing; Kirchhoff solved only when a pin changes; measured again on a slowed processor.Next
2The editor uses the compilerBuild and Upload by avr-gcc (done); gcc's messages for every file, each a link to its line; the flash and RAM report; folders in file names (a PlatformIO project opens as it is); the libraries listed in Help; the editor layout and the code colors (Image-6, done).Started
3Both chips on avr8jsThe ATmega328P on the breadboard on avr8js too, the Uno as its programmer, with UB90's wiring checks.Done
4The protocolsSerial between the chips through the wires; I2C with Wire (the slave side written for avr8js); SPI master and slave; each byte on the scope. Next: pull ups checked by Kirchhoff, the bit timing on the wires for SoftwareSerial.Started (Serial, I2C, SPI work)
5New sketchesExamples in pairs (one for each chip), placed by the four Wiring Rules: SerialToChip, SerialCallResponse, MasterWriter, MasterReader, SPIMaster (done); SoftPair (SoftwareSerial, after the bit timing) and MasterJoystick with SlaveDrive (the robot over I2C) next.Started (5 pairs)
6The switchEvery suite of the Directive and the speed test pass; then AVR100 replaces UB90 (Jesse Carpenter).Last

Feasibility Test

AVR feasibility test, 20261127 (on UB90): raw values first

No.QuestionResult (raw)Verdict
1The piecesavr8js 0.21.1 (the ATmega328P's processor and peripherals; MIT license), bundled to one script of 54 KB. avr-gcc in the browser: the package @horang-corp/avr-gcc-wasm 0.2.0 (a proof of concept; GCC and binutils under the GPL, so the site must offer their source), 54 MB in 556 files, the Arduino core and Servo, Wire, SPI, and other libraries precompiled.Feasible
2The pageA test page (since removed): UB90's bench, layout, and engines unchanged, plus one new file, js/unoAvr.js (the AVR core). The page's security policy adds only 'wasm-unsafe-eval' (WebAssembly may compile; JavaScript eval stays blocked); the page is noindex. The Uno runs on avr8js; the ATmega328P on the breadboard stays on UB's engine for now.Built
3Where they meetThe Uno's pins: avr8js's DDR, PORT, and timer registers (OCR and COM bits for PWM) become the pins Kirchhoff reads; Kirchhoff's node volts become avr8js's pin inputs (HIGH above 2.5 V) and ADC readings; USART bytes go to the Serial Monitor.Works
4BuildBlink 1,547 ms (first) and about 1,200 ms after, 5,292 bytes of flash; AnalogReadSerial 5,884 bytes; Step2_JUL (simplified, 5 headers) 9,776 bytes in 2.3 s; JoystickDrive (Code-JUL's ace.h) 7,972 bytes in 2.4 s. A typed mistake gives gcc's own message and line (line 3, column 11: expected primary-expression before ';' token).Works
5Real codeThe real Step2_JUL from the Joystick-Uno-L298N repository, unchanged (main.cpp, ten headers, and the numerics library: 6,485 lines joined), compiled in 2.6 s to 14,766 bytes and ran on the bench. Its serial: bit-order(3210): 1101 val: 13 (the value the MMC check finds for Circuit-1). Raw motor volts (left, right): forward 11.95, 11.95; right 11.95, −11.95; corner 0.00, −11.95; back −11.95, −11.95; center 0.00, 0.00. Methods written outside their class and operator+ compile and run (a test class printed 13).Works
6The circuitBlink's LED 12.1 mA and 0 mA, a second each, through Kirchhoff; the knob at half reads 511 and at 0.2 reads 204 on the ADC; Fade's LED follows Timer1's PWM (1.7, 5.4, 9.0 mA).Works
7Timingavr8js alone: 3.1 times real time on this machine. On the bench: the chip's clock kept to real time (5.00 s of chip time in 5.01 s), delay(1000) measured 1000.0 ms.Works
8Speed on a slow computer (the one risk)Chrome's processor slowed 4 times: Blink ran at 53 percent of real time, JoystickDrive 40 percent; slowed 6 times: Blink 36 percent. On a slow Chromebook a sketch would run at half speed or less. Next: avr8js in its own thread (a Web Worker) and Kirchhoff solved only when a pin changes; measured again.To solve
9What the real compiler foundJoystickDrive's line 93 includes "claude/ace.h" with its folder; the editor keeps the tab as ace.h (folders in file names are not allowed yet). UB ignored the folder; the AVR core now finds the tab by its own name, as UB does. Folders in the editor's file names would let projects like Code-JUL load as they are.Noted

Bug Record

IDBugFoundSeverityStatusFixed in
A12Found by Claude reviewing the live site: from 1900 to about 2010 pixels wide (a 1920 monitor), the bench was cut off at its right (raw: 771 to 817 pixels of room for the bench's 820): the Robot and L298N ON switches and the C and D bus ends were hidden. Fix: the bench and the editor side by side only from 2100 pixels.Live review, 20261130HighFixed, testedAVR101 (v1.0.1)
A11Found by Claude testing the compiler: global variables over the ATmega328P's 2,048 bytes of RAM built without a word (raw: a 3,000 byte array, Done: 2060 bytes of flash). Fix: the RAM is read from the program and reported as the Arduino IDE reports it; over 2,048 bytes is refused, over 75% warned.Live review, 20261130HighFixed, testedAVR101 (v1.0.1)
A10Found by Claude: a linker error showed only its first line (raw: [avr-ld] ./this.program: /objects/core_main.o: in function `main':), never the missing name. Fix: undefined references and multiple definitions are named, with a hint for setup() and loop().Live review, 20261130MediumFixed, testedAVR101 (v1.0.1)
A9Found by Claude: a .cpp file of the sketch was never compiled (raw: a link error for Helper.h with Helper.cpp). Fix: each .cpp file not included by the sketch is compiled as its own unit and linked, as in the Arduino IDE.Live review, 20261130HighFixed, testedAVR101 (v1.0.1)
A8Found by Claude: a sketch without #include <Arduino.h>, or with a function used above its definition, failed (raw: 'pinMode' was not declared in this scope; 'blinkTwice' was not declared in this scope), though the Arduino IDE builds both and Help said it built. Fix: the sketch is prepared as the Arduino IDE prepares it (Arduino.h added, prototypes before the first function).Live review, 20261130HighFixed, testedAVR101 (v1.0.1)
A7Found by Claude: a template without end stopped the compiler with the browser's own words (raw: Maximum call stack size exceeded). Fix: said plainly (the compiler ran out of room). Also: a second click while a build runs joins it.Live review, 20261130LowFixed, testedAVR101 (v1.0.1)
A6Found by Claude building SPI: the slave answered only the first byte (raw: sent 1, got 255). Cause: the slave's SS was read from Kirchhoff, which sees the master's digitalWrite(10, LOW) only after the slice, so the transfer in the same slice found SS HIGH. Fix: when SS is wired to the master's pin 10, it follows that pin's register at once.AVR100 work, 20261127HighFixed, tested: sent 1, got 100; sent 5, got 104AVR100 (v1.0.0)
A5Found by Claude with Jesse Carpenter's split: UB90 and AVR100 kept their sessions under one browser key, so opening one page would replace the other's sketch and circuit. Fix: AVR100 keeps its own key (avrSim.v1).AVR100 work, 20261127MediumFixed, testedAVR100 (v1.0.0)
A4Found by Claude with the state test: the int wrap line read "wrap -32768" followed by a carriage return. Cause: println() sends a carriage return and a new line, as on a real Uno, and the Serial Monitor showed both. Fix: the Monitor shows nothing for the carriage return, as the Arduino IDE's does.AVR100 work, 20261127LowFixed, testedAVR100 (v1.0.0)
A3Found by Claude running every example: Fade and AnalogInOutSerial reported a tone on pin 9 (raw: 491 and 493 Hz). Cause: Timer1's PWM toggles pin 9 about 490 times a second, which the tone finder counted as a tone. Fix: a pin the timers drive is PWM, never a tone; a tone's pitch is measured from the time between its first and last toggle.AVR100 work, 20261127MediumFixed, tested: Fade PWM only; toneMelody 263, 197, 220, 247 HzAVR100 (v1.0.0)
A2Found by Claude with the real Step2_JUL: gcc's "fatal error" was not shown, and a header included from a header was not found. Fix: fatal errors are shown as errors; headers are joined in order at any depth (up to 8), each marked with its file and line.Feasibility test, 20261127HighFixed, testedAVR100 (v1.0.0)
A1Found by Claude with JoystickDrive: #include "claude/ace.h" was not found, as the editor's tab is named ace.h. Fix: a header is found by its own name; folders in file names come with roadmap step 2.Feasibility test, 20261127MediumFixed, testedAVR100 (v1.0.0)

Future Updates and Testing

No.ItemWho
1Before the first AVR100 release: the source offer for the compiler (avr/SOURCE.html); the Privacy Policy; the Webmaster entry with the button to this page (done 20261129). Help and Reference: a short fix (20261129); Help rewritten for AVR101 (20261130: the compiler, gcc's messages, the protocols, the scope on a protocol); the Reference, one page per entry: item 5.Claude
2The editor page, worked on together over time (Jesse Carpenter).Jesse Carpenter and Claude
3Roadmap step 1, speed, and the speed test again.Claude
4Scripts loaded when first needed (proposed, set aside for now by Jesse Carpenter: testing comes first): the examples' code and wiring when chosen, the UB compiler and runner with the Chip tab, avr8js with the first Upload; about 280 KB raw (90 KB compressed) less when the page opens.Later
5The Reference, one page per entry (Jesse Carpenter, 20261130): an index of categories; each entry its own page with a full description, syntax, parameters and returns, how to use it (notes and common mistakes), a complete example sketch with an Open in the simulator button (loading only the page's own example, never code from the address), what it does on the ATmega328P (the registers behind it), and see also. Written new, not copied. Phase 1: the template and about 30 entries the examples use (pinMode, digitalWrite, digitalRead, analogRead, analogWrite, delay, millis, micros, Serial.begin, print, println, available, read, map, constrain, tone, noTone, attachInterrupt, Wire, SPI, Servo, and others); later phases: the rest by category.Claude, after approval (TODO 10)

The Engine: What Runs Underneath

AVR100 (v1.0.0), 20261127: the engines, numbered as in Image-1

Engines 1, 3, and 6 to 11 are UB90's; engines 2, 4, and 5 are new or changed; engine 12 (the Links) is new. UB90's compiler and runner (unoTokens, unoParser, unoCheck, unoNames, unoMachine, unoBuiltins, unoHost) are still loaded but no longer used: they go with the cleanup before the switch. Everything runs in the browser; the page, as every page of the site, carries the site's Google Analytics tag (page visits).

No.EngineWhat it doesFiles
1IDE and filesThe code editor (CodeMirror 6 with C and C++, in the Arduino IDE 2 colors), Build and Upload, the Examples menu, and the session saved in this browser (key avrSim.v1).unoEditor.js, editor/codemirror.js, unoIde.js, unoFiles.js, unoMenu.js, unoExamples.js
2Compiler (avr-gcc)Joins the sketch and its headers (with #line marks), then compiles it with avr-gcc in a Web Worker (-Os, gnu++11, the ATmega328P) to Intel HEX; gcc's errors and warnings go to the Output with their file and line. The Arduino core and its libraries (Servo, Wire, SPI, and more) come precompiled.unoAvr.js (build), avr/loader.js, avr/index.js, avr/worker.js, avr/assets
3State machineThe sketch's run states (Image-3).unoFsm.js
4Two ATmega328P coresavr8js 0.21.1 (MIT), one core for the Uno and one for the ATmega328P on the breadboard: the AVR processor, 32 KB flash, timers 0, 1, and 2, ports B, C, and D, the USART, the ADC, TWI, and SPI, run at 16 MHz side by side, in 1 ms slices up to the real clock (50 microseconds while an I2C byte waits).avr/avr8js.js
5AVR bridge and UnoEach core (class Core) joins its chip's registers to its pins (DDR, PORT, PWM from the timers' COM bits and OCR, tones from the toggles) and back (pin inputs, ADC volts); the Scheduler runs the cores; USART bytes to the Serial Monitor; the Uno's pin model and the breadboard chip's checks (power, crystal, RESET) as in UB90.unoAvr.js, unoMcu.js, unoChip.js
6Circuit engine (Kirchhoff)As in UB90.unoCircuit.js, unoParts.js, unoExtras.js, unoDamage.js
7Electronics LabAs in UB90.unoLab.js
8InstrumentsAs in UB90.unoMeter.js, unoScope.js, unoSupply.js
9OutputThe Serial Plotter and the buzzer's sound.unoPlotter.js, unoSound.js
10Layout and drawingAs in UB90; the title bar reads AVR100 Simulator.unoLayout.js, unoBoard.js, unoPieces.js
11Start upStarts every engine and the compiler's loader.unoMain.js, avr/loader.js
12Links (Serial, I2C, SPI)Serial: a byte on one chip's TX reaches the other's RX when the wires join them (a different baud rate gives a wrong byte). I2C: the Bus acts out the slave side, which avr8js lacks, on the slave chip's TWI registers and interrupt (status 0x60, 0x80, 0xA0, 0xA8, 0xB8, 0xC0), the master waiting until the slave's interrupt finishes. SPI: the master's byte reaches a slave whose SS is LOW; the slave's loaded SPDR comes back. Every byte is logged for the scope (Uno.Protocols.trace).unoAvr.js (Links, Bus, Scope), unoScope.js

Milestones, the newest at the top

NameVersionDateEnginesMilestone
AVR100v1.0.0202611271, 2, 4, 5, 8, 10, 12In progress. avr-gcc in the browser; both chips on avr8js; Serial, I2C, and SPI between them through the wires, on the scope; five protocol pairs; the real editor (CodeMirror 6); its own page on Tools (UB90 frozen on Robotics); bugs A1 to A6.

Revisions

DateChange
20261130AVR101 (v1.0.1), after Claude's review of the live AVR100 (Jesse Carpenter approved all fixes): the sketch prepared as the Arduino IDE prepares it (Arduino.h added, prototypes); .cpp files compiled and linked; RAM read from the program, reported in the Arduino IDE's words, over 2,048 bytes refused and over 75% warned; linker messages named; a stack overflow said plainly; the first build says it loads the compiler; a second click joins a build. The layout: side by side from 2100 pixels (the bench was cut off from 1900 to 2010), the editor 560 pixels tall under the bench, the bar in two rows. The name AVR101 (title bar, page, Tools card, Help, Reference); the Privacy Policy and the source page say AVR Simulator, so they need no change with each version. Help rewritten for AVR101 (Build and Upload, the editor, examples and files, two new sections: Errors and What They Mean, and Serial, I2C, and SPI between the Chips); the Reference's name and limits. This page: the Test Plan AVR101 and Report a Bug at the top, a contents line, bugs A7 to A12, TODO 9 and 10, Future 5 (the Reference, one page per entry), Claude's Tests.
20261129The toolchain built and in place (Jesse Carpenter: the repo pushed, five runs, the tag v1.0.0, the release): MageMCU/AVR-Simulator-Toolchain (renamed from AVR100-Toolchain: no simulator version in its name; its own version line); The Toolchain section (the versions, the steps, the runs and their four fixes); avr/tools and avr/assets are now the release v1.0.0, built from source, in place of the package's files; the worker reads the core, libraries, and link list from assets/manifest.json (attachInterrupt and EEPROM now link); every compiler address carries a version, so a browser never mixes kept files; avr/SOURCE.html (the GPL source), avr/COPYING, COPYING.LIB, COPYING.RUNTIME, TOOLCHAIN-SOURCE.md, and a new avr/NOTICES.md; the credits; Claude's Tests (every suite again: PASS); bench test 6 (attachInterrupt); the Privacy Policy's download size (about 30 MB, about 13 MB compressed); TODO 4 closed, 5 done, 6 done by Claude, 7 Blaze done. Help and Reference, a short fix (Jesse Carpenter's choice): retitled AVR100, the interpreter statements replaced (Build compiles with GCC; Wire, SPI, and Servo included; attachInterrupt, String, pointers, inheritance, virtual, and EEPROM work; Limits in place of Not supported; the timing section for the simulated chip); the full rewrite follows in the next release.
20261129The Compiler Decision (Jesse Carpenter: keep the compiler, no permission needed, the GPL met by our own toolchain repo): the eight options weighed, Image-7 (UML activity diagram of a sketch with and without a compiler, with licenses), what the GPL v3 asks (sections 1, 2, 4, 5, 6, 9, the Runtime Library Exception, the LGPL), the order of the work, what each part is written in, Firebase Hosting (files, firebase.json, the download allowance: Spark 360 MB a day, Blaze $0.15 a GB), and UB70 against AVR100. Strategy item 12; TODO 4 optional, TODO 7 (the Blaze plan and a budget alert) and 8 (keep the last few deployed versions); Credits row 8.
20261127TODO 4 to 6 (Jesse Carpenter): ask the compiler package's author for its GPL source (a GitHub issue, drafted by Claude), the toolchain repo built by GitHub Actions (MageMCU/AVR100-Toolchain), and the AVR100 site release after it. The package's public repository was checked: it has no build scripts or patches for the compiler.
20261127Our own compiler runner (Jesse Carpenter chose it over the package's JavaScript, which states no license): avr/avrc.js, avrc-worker.js, and loader.js (MIT), written for AVR100; the package's index.js, worker.js, firmware-builder.js, and its notice removed; our own avr/NOTICES.md; only the libraries a sketch includes are read and linked. Security (Jesse Carpenter): the compiler's limits (2 MB, this site only, 60 s), programs over 32,256 bytes refused, compiler crashes said plainly; new section Security; the Privacy Policy updated. Credits: rows 7 and 8. Claude's Tests (our own runner; trying to break the compiler and the chip).
20261127The protocols (Jesse Carpenter: the Uno and the ATmega328P on the breadboard for the protocols, a start to be tested; the scope comes into play): both chips on avr8js (roadmap step 3 done); Serial, I2C, and SPI between them through the wires (engine 12, Links); each byte drawn on the scope; five protocol pairs (SerialToChip, SerialCallResponse, MasterWriter, MasterReader, SPIMaster) with the wiring pieces chipSerial, chipI2C, and chipSPI; bug A6. The UML: Image-1 redrawn (two cores, the Links), Image-4 the I2C sequence; new section How AVR100 Fits UB90; Bench Tests for the pairs; Image-8 the scope on SDA; the editor images renumbered (the proposal Image-5, as built Image-6). Strategy items 11 (two chips, joined only by wires) and 12 (UB90 gets bug fixes only, Jesse Carpenter). New section: Credits and Licenses (Jesse Carpenter: credit every added technology with a license), with the same credits on the AVR100 page; the compiler package's own JavaScript has no stated license (to settle before the release). New section: The Editor: CodeMirror 6 (Jesse Carpenter: add CodeMirror 6 to this page), with its packages, size, security patch, keys, and tests; Strategy item 7 names its license.
20261127A real editor (Jesse Carpenter: as a coder, the editor has to be real; CodeMirror 6 approved): unoEditor.js with CodeMirror 6 (MIT, editor/codemirror.js, 525,862 bytes, 171,410 compressed) in place of the textarea and unoHighlight.js. Undo and redo by edit, auto indent, Tab and Shift+Tab on lines, bracket matching, closing brackets and quotes, Ctrl+/ comments, find and replace (Ctrl+F, Ctrl+H), go to line (Ctrl+G), several cursors (Alt+click), a column selection (Shift+Alt and drag), folding, completion of C++ and Arduino names and the sketch's own words, gcc's errors and warnings marked in the code, and an error in a header opens that header at its line. The security policy is unchanged (the bundle uses a constructed style sheet, not inline styles). Tests: the real editor 13 of 13, editor 11 of 11, state, timing, file 34 of 34, abuse all pass, every example 40 of 40.
20261127Hide Plotter (Jesse Carpenter): a button on the Output and Serial Monitor bar hides the Serial Plotter, and Output and the Serial Monitor take its room (raw: 200 to 405 pixels tall); Show Plotter brings it back; the plotter keeps collecting while hidden.
20261127The editor (Jesse Carpenter approved Image-5 with the editor as wide as the simulator): the code page white in the Arduino IDE 2 colors (new file unoHighlight.js, a color layer under the textarea); the editor beside the bench at equal widths in windows 1900 pixels and wider, under it otherwise; the Plotter, Output, and Serial Monitor under the bench. Editor tests 11 of 11 again. Image-6.
20261127Page created (Jesse Carpenter: the AVR Simulator has its own AVR Development page). From the UB Development page: the AVR100 roadmap and the Feasibility Test. New: the Strategy and the Directive for AVR100, the UML (Image-1 components and Image-2 sequence for AVR100; Image-3 the run states), the TODO, the editor proposal (Image-5), the Wiring Rules, Claude's Tests (10 suites), bugs A1 to A5, The Engine (12 engines), and the AVR100 milestone.