{"id":20951235,"url":"https://github.com/lingdong-/avrlass","last_synced_at":"2025-05-14T03:32:56.707Z","repository":{"id":191739883,"uuid":"685293559","full_name":"LingDong-/avrlass","owner":"LingDong-","description":"AVR Lightweight Assembler (and disassembler)","archived":false,"fork":false,"pushed_at":"2023-08-30T23:54:28.000Z","size":16,"stargazers_count":6,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-30T20:53:52.528Z","etag":null,"topics":["assembly","avr","microcontroller"],"latest_commit_sha":null,"homepage":"https://avr-asm-ide.glitch.me/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LingDong-.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-30T23:19:54.000Z","updated_at":"2024-04-21T09:55:01.000Z","dependencies_parsed_at":"2023-08-31T12:31:27.808Z","dependency_job_id":"712b4347-f85c-4312-9a87-8590e04caec8","html_url":"https://github.com/LingDong-/avrlass","commit_stats":null,"previous_names":["lingdong-/avrlass"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LingDong-%2Favrlass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LingDong-%2Favrlass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LingDong-%2Favrlass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LingDong-%2Favrlass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LingDong-","download_url":"https://codeload.github.com/LingDong-/avrlass/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275690,"owners_count":17448388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","avr","microcontroller"],"created_at":"2024-11-19T00:57:47.563Z","updated_at":"2024-11-19T00:57:48.123Z","avatar_url":"https://github.com/LingDong-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n  ________     ______  ______  ______  ____    ______  ______  ______ \n /      o/|   /      \\/   /  \\/      \\/    \\  /      \\/      \\/      \\\n/_______//   /   /   /   /   /   /   /     / /   /   /    ---/    ---/\n|U-U-U-U|   /       /\\      /      _/     /_/       /---    /---    / \n Y Y Y Y    \\__/___/  \\____/\\__/___/\\______/\\__/___/\\______/\\______/  \n         \n```\n\n*AVRLASS - an AVR Lightweight ASSembler (and disassembler)*\n\nAVRLASS is a minimalistic assembler and dissasembler for [AVR](https://en.wikipedia.org/wiki/AVR_microcontrollers) microcontrollers. It is written in plain JavaScript, and runs on Windows, Mac, Linux and the browser. It is both a command-line utility and a JavaScript library.\n\n[**Here**](https://avr-asm-ide.glitch.me/) you can try AVRLASS in the browser. This online IDE also features [SerialUPDI](https://serupdi.glitch.me/) functionality, so you can write a program and upload it to your board all on a webpage, client-side.\n\nAVRLASS does not have hardcoded device information (e.g. flash/RAM size) for all the AVR's out there, but it will try to read the information from the `.inc` file you include. You can specify the instruction set (AVRe+/AVRrc/AVRxt...) of your device, so it will warn you if an instruction is not available. Individual devices sometimes have additional missing instructions in addition to those of its family's, and for these, you'll need to read your datasheet.\n\nAVRLASS is most tested on old and new ATtiny microcontrollers, especially on the new tinyAVR 0- and 1- families, but should work for all AVR's as long as the appropriate include files are provided.\n\n## Usage\n\n### Command-line\n\nThe command-line executable is `avrlass.cli.js`, you can run it with `node avrlass.cli.js`, or, make a bash alias for it, or, [download a pre-compiled binary](https://github.com/LingDong-/avrlass/releases) if you don't even have node.js.\n\n\n```\n$ avrlass --help\navrlass - AVR Lightweight ASSembler\nusage:\n  avrlass [options] src.asm \noptions:\n  -D \u003cmacro\u003e=\u003cvalue\u003e Define macro\n  -I \u003cdir\u003e           Add directory to search path\n  -o \u003cfile\u003e          Write output to file, extensions: .hex/.bin/.json\n  -t \u003carg\u003e           Instruction Set: AVR/AVRe/AVRe+/AVRrc/AVRxm/AVRxt\n  -d                 Disassemble instead of assemble\n  -h                 Print this message\n```\n\nIf assembly is successful, you'll see a summary of memory usage for your chip, e.g.:\n\n```\n__SEGM_|__CODE_|__DATA_|__USED_|__SIZE_|__USE%_\n .CSEG |    34 |     0 |    34 |  4096 |  0.8% \n .DSEG |     0 |     0 |     0 |   256 |    0% \n .ESEG |     0 |     0 |     0 |   128 |    0% \n```\n\n\n### Library\n\nSimple usage:\n\n```js\n// assembly\nconst {asm_to_hex} = require('./avrlass.js');\n// disassembly\nconst {hex_to_asm} = require(\"./avrdass.js\");\n\nlet hex = asm_to_hex(`\nser r16\nsts 0x401,r16\nsts 0x404,r16\n`);\n\nconsole.log(hex);\n\nconsole.log(hex_to_asm(hex));\n```\n\nAdvanced usage:\n\n```js\nconst {\n  device,new_context,parse,compile,assemble,to_ihex,print_summary\n} = require('./avrlass.js');\n\ndevice.instr_set='AVRxt';\n\nlet context = new_context({});\n\nlet lst = parse(`\nser r16\nsts 0x401,r16\nsts 0x404,r16\n`,pth=\u003efs.readFileSync(pth).toString(),context);\n\nlet ins = compile(lst,context);\nconsole.log(print_summary());\nlet code = assemble(ins);\nlet hex = to_ihex(code);\nconsole.log(hex);\n\n\n//disassembly\nconst {disass, from_ihex} = require(\"./avrdass.js\")\nlet bytes = from_ihex(hex);\nlet out = disass(bytes);\nconsole.log(out);\n```\n\n### Downloading include files\n\nInclude files are not included in this repository. You can download them from Microchip's website: https://packs.download.microchip.com\n\nThese so-called \"DFP packs\" are in fact zip archives. Once extracted, the `.inc` files can usually be found in `avrasm/inc` folder.\n\nThe Makefile includes some scripts to automatically download and snatch the `.inc` files for some common AVR families. e.g.:\n\n```\nmake download_attiny\nmake download_atmega\nmake download_avrdx\n```\n\n## Notes\n\n- Most assembly directives are supported, `.if`, `.else` etc.\n- Most C preprocessor directives are *not* supported, `#if`, `#else` etc, except for those appearing in official `.inc` files. Use assembly counterparts instead, or, perhaps, run it through a C preprocessor first.\n\n## References \u0026 Links\n\n- Instruction set manual https://ww1.microchip.com/downloads/en/devicedoc/atmel-0856-avr-instruction-set-manual.pdf\n- AVRASM2 manual https://ww1.microchip.com/downloads/en/DeviceDoc/40001917A.pdf\n  \nSome other AVR assemblers include:\n\n- AVRASM2 -- Atmel/Microchip's official assembler that comes with their IDE https://microchipdeveloper.com/swtools:avr-asm\n- avr-as -- Assembler that comes with AVR-GCC https://gcc.gnu.org/wiki/avr-gcc\n- AVRA https://github.com/Ro5bert/avra\n- GAVRASM http://www.avr-asm-tutorial.net/gavrasm/index_en.html\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingdong-%2Favrlass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flingdong-%2Favrlass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingdong-%2Favrlass/lists"}