Download tools/dbg.mjs from HelloSun/esp32emu: direct link, hf CLI and curl.
- Browser
- Download file 829 Bytes
-
https://huggingface.co/spaces/HelloSun/esp32emu/resolve/main/tools/dbg.mjs
- Command line
-
hf download hf://spaces/HelloSun/esp32emu/tools/dbg.mjs
-
curl -L -o dbg.mjs https://huggingface.co/spaces/HelloSun/esp32emu/resolve/main/tools/dbg.mjs
829 Bytes
| import fs from 'fs'; | |
| import { ESP32 } from '../web/js/soc.js'; | |
| const romDir = new URL('../web/rom/', import.meta.url).pathname; | |
| const soc = new ESP32({}); | |
| soc.loadRoms(fs.readFileSync(romDir + 'esp32-v3-rom.bin'), fs.readFileSync(romDir + 'esp32-v3-rom-app.bin')); | |
| soc.setFlash(fs.readFileSync(process.argv[2])); | |
| soc.enablePsram(false); | |
| soc.onUart = (n, b) => process.stdout.write(String.fromCharCode(b)); | |
| soc.reset('power'); | |
| const c = soc.cpus[0]; | |
| c.trace = []; | |
| for (let i = 0; i < parseInt(process.argv[3] || '20'); i++) { soc.run(1); } | |
| console.log(c.trace.slice(-60).map(x => (x >>> 0).toString(16)).join(' ')); | |
| console.log('pc', (c.pc>>>0).toString(16), 'time', soc.timeNs); | |
| const i = c.trace.indexOf(0x4000fdc7); | |
| console.log('first fail idx', i, c.trace.slice(Math.max(0,i-40), i+1).map(x=>(x>>>0).toString(16)).join(' ')); | |