-
Notifications
You must be signed in to change notification settings - Fork 47
feat(esp32c3): QEMU emulator support #1536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,10 +84,12 @@ func makeESPFirmareImage(infile, outfile, format string) error { | |
| } | ||
|
|
||
| if makeImage { | ||
| // The bootloader starts at 0x1000, or 4096. | ||
| // TinyGo doesn't use a separate bootloader and runs the entire | ||
| // application in the bootloader location. | ||
| outf.Write(make([]byte, 4096)) | ||
| // For QEMU emulation, we need to place the image at the correct offset. | ||
| // ESP32 (Xtensa): bootloader starts at 0x1000, so we pad 4KB of zeros. | ||
| // ESP32-C3 (RISC-V): bootloader starts at 0x0, so no padding needed. | ||
| if chip == "esp32" { | ||
| outf.Write(make([]byte, 4096)) | ||
|
Comment on lines
+90
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve readability and maintainability, it's good practice to avoid magic values. Consider defining For example: const (
esp32ChipName = "esp32"
esp32BootloaderPadding = 4096
)Then you can use these constants here: if chip == esp32ChipName {
outf.Write(make([]byte, esp32BootloaderPadding))
} |
||
| } | ||
| } | ||
|
|
||
| // Chip IDs. Source: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "inherits": [ | ||
| "riscv32-esp" | ||
| ], | ||
| "features": "+32bit,+c,+m,+zmmul,-a,-b,-d,-e,-experimental-smmpm,-experimental-smnpm,-experimental-ssnpm,-experimental-sspm,-experimental-ssqosid,-experimental-supm,-experimental-zacas,-experimental-zalasr,-experimental-zicfilp,-experimental-zicfiss,-f,-h,-relax,-shcounterenw,-shgatpa,-shtvala,-shvsatpa,-shvstvala,-shvstvecd,-smaia,-smcdeleg,-smcsrind,-smepmp,-smstateen,-ssaia,-ssccfg,-ssccptr,-sscofpmf,-sscounterenw,-sscsrind,-ssstateen,-ssstrict,-sstc,-sstvala,-sstvecd,-ssu64xl,-svade,-svadu,-svbare,-svinval,-svnapot,-svpbmt,-v,-xcvalu,-xcvbi,-xcvbitmanip,-xcvelw,-xcvmac,-xcvmem,-xcvsimd,-xesppie,-xsfcease,-xsfvcp,-xsfvfnrclipxfqf,-xsfvfwmaccqqq,-xsfvqmaccdod,-xsfvqmaccqoq,-xsifivecdiscarddlone,-xsifivecflushdlone,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-xwchc,-za128rs,-za64rs,-zaamo,-zabha,-zalrsc,-zama16b,-zawrs,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zca,-zcb,-zcd,-zce,-zcf,-zcmop,-zcmp,-zcmt,-zdinx,-zfa,-zfbfmin,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zic64b,-zicbom,-zicbop,-zicboz,-ziccamoa,-ziccif,-zicclsm,-ziccrse,-zicntr,-zicond,-zicsr,-zifencei,-zihintntl,-zihintpause,-zihpm,-zimop,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-ztso,-zvbb,-zvbc,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvfbfmin,-zvfbfwma,-zvfh,-zvfhmin,-zvkb,-zvkg,-zvkn,-zvknc,-zvkned,-zvkng,-zvknha,-zvknhb,-zvks,-zvksc,-zvksed,-zvksg,-zvksh,-zvkt,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b", | ||
| "build-tags": [ | ||
| "esp32c3", | ||
| "esp" | ||
| ], | ||
| "serial": "usb", | ||
| "rtlib": "compiler-rt", | ||
| "libc": "newlib-esp32", | ||
| "linkerscript": "targets/esp32c3.memory.ld", | ||
| "binary-format": "esp32c3", | ||
| "flash-command": "esptool.py --chip=esp32c3 --port {port} write_flash 0x0 {bin}", | ||
| "serial-port": [ | ||
| "303a:1001" | ||
| ], | ||
| "openocd-interface": "esp_usb_jtag", | ||
| "openocd-target": "esp32c3", | ||
| "openocd-commands": [ | ||
| "gdb_memory_map disable" | ||
| ], | ||
| "gdb": [ | ||
| "riscv32-esp-elf-gdb" | ||
| ], | ||
| "emulator": "qemu-system-riscv32 -machine esp32c3 -nographic -drive file={img},if=mtd,format=raw -serial mon:stdio" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,8 @@ | ||
| { | ||
| "inherits": [ | ||
| "riscv32-esp" | ||
| "esp32c3-basic" | ||
| ], | ||
| "features": "+32bit,+c,+m,+zmmul,-a,-b,-d,-e,-experimental-smmpm,-experimental-smnpm,-experimental-ssnpm,-experimental-sspm,-experimental-ssqosid,-experimental-supm,-experimental-zacas,-experimental-zalasr,-experimental-zicfilp,-experimental-zicfiss,-f,-h,-relax,-shcounterenw,-shgatpa,-shtvala,-shvsatpa,-shvstvala,-shvstvecd,-smaia,-smcdeleg,-smcsrind,-smepmp,-smstateen,-ssaia,-ssccfg,-ssccptr,-sscofpmf,-sscounterenw,-sscsrind,-ssstateen,-ssstrict,-sstc,-sstvala,-sstvecd,-ssu64xl,-svade,-svadu,-svbare,-svinval,-svnapot,-svpbmt,-v,-xcvalu,-xcvbi,-xcvbitmanip,-xcvelw,-xcvmac,-xcvmem,-xcvsimd,-xesppie,-xsfcease,-xsfvcp,-xsfvfnrclipxfqf,-xsfvfwmaccqqq,-xsfvqmaccdod,-xsfvqmaccqoq,-xsifivecdiscarddlone,-xsifivecflushdlone,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-xwchc,-za128rs,-za64rs,-zaamo,-zabha,-zalrsc,-zama16b,-zawrs,-zba,-zbb,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zca,-zcb,-zcd,-zce,-zcf,-zcmop,-zcmp,-zcmt,-zdinx,-zfa,-zfbfmin,-zfh,-zfhmin,-zfinx,-zhinx,-zhinxmin,-zic64b,-zicbom,-zicbop,-zicboz,-ziccamoa,-ziccif,-zicclsm,-ziccrse,-zicntr,-zicond,-zicsr,-zifencei,-zihintntl,-zihintpause,-zihpm,-zimop,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-ztso,-zvbb,-zvbc,-zve32f,-zve32x,-zve64d,-zve64f,-zve64x,-zvfbfmin,-zvfbfwma,-zvfh,-zvfhmin,-zvkb,-zvkg,-zvkn,-zvknc,-zvkned,-zvkng,-zvknha,-zvknhb,-zvks,-zvksc,-zvksed,-zvksg,-zvksh,-zvkt,-zvl1024b,-zvl128b,-zvl16384b,-zvl2048b,-zvl256b,-zvl32768b,-zvl32b,-zvl4096b,-zvl512b,-zvl64b,-zvl65536b,-zvl8192b", | ||
| "build-tags": [ | ||
| "esp32c3", | ||
| "esp" | ||
| ], | ||
| "serial": "usb", | ||
| "rtlib": "compiler-rt", | ||
| "libc": "newlib-esp32", | ||
| "linkerscript": "targets/esp32c3.memory.ld", | ||
| "extra-files": [ | ||
| "targets/device/esp/esp32c3.c" | ||
| ], | ||
| "binary-format": "esp32c3", | ||
| "flash-command": "esptool.py --chip=esp32c3 --port {port} write_flash 0x0 {bin}", | ||
| "serial-port": [ | ||
| "303a:1001" | ||
| ], | ||
| "openocd-interface": "esp_usb_jtag", | ||
| "openocd-target": "esp32c3", | ||
| "openocd-commands": [ | ||
| "gdb_memory_map disable" | ||
| ], | ||
| "gdb": [ | ||
| "riscv32-esp-elf-gdb" | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.