aboutsummaryrefslogtreecommitdiffhomepage
path: root/compileopts/config.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-04-22 18:57:40 +0200
committerRon Evans <[email protected]>2022-04-28 07:50:03 +0200
commit8568d4f6255be5bed52c20c184d10b8f38444c54 (patch)
tree647612f3c44554e7ac074b335e0adc840e5f3463 /compileopts/config.go
parentbd56636d5802cdeb323851ec2431bb3f78f94eed (diff)
downloadtinygo-8568d4f6255be5bed52c20c184d10b8f38444c54.tar.gz
tinygo-8568d4f6255be5bed52c20c184d10b8f38444c54.zip
esp32: add support for running and debuggin using qemu-esp32
Diffstat (limited to 'compileopts/config.go')
-rw-r--r--compileopts/config.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/compileopts/config.go b/compileopts/config.go
index d7dbb41c3..b30e653e3 100644
--- a/compileopts/config.go
+++ b/compileopts/config.go
@@ -395,6 +395,13 @@ func (c *Config) BinaryFormat(ext string) string {
return c.Target.BinaryFormat
}
return "bin"
+ case ".img":
+ // Image file. Only defined for the ESP32 at the moment, where it is a
+ // full (runnable) image that can be used in the Espressif QEMU fork.
+ if c.Target.BinaryFormat != "" {
+ return c.Target.BinaryFormat + "-img"
+ }
+ return "bin"
case ".hex":
// Similar to bin, but includes the start address and is thus usually a
// better format.
@@ -507,9 +514,14 @@ func (c *Config) EmulatorName() string {
// EmulatorFormat returns the binary format for the emulator and the associated
// file extension. An empty string means to pass directly whatever the linker
-// produces directly without conversion.
+// produces directly without conversion (usually ELF format).
func (c *Config) EmulatorFormat() (format, fileExt string) {
- return "", ""
+ switch {
+ case strings.Contains(c.Target.Emulator, "{img}"):
+ return "img", ".img"
+ default:
+ return "", ""
+ }
}
// Emulator returns a ready-to-run command to run the given binary in an