nintendoswitch: support outputting .nro files directly

By modifying the linker script a bit and adding the NRO0 header directly
in the assembly, it's possible to craft an ELF file that can be
converted straight to a binary (using objcopy or similar) that is a NRO
file. This avoids custom code for NRO files or an extra build step.

With another change, .nro files are recognized by TinyGo so that this
will create a ready-to-run NRO file:

    tinygo build -o test.nro -target=nintendoswitch examples/serial
This commit is contained in:
Ayke van Laethem
2020-09-08 22:44:05 +02:00
committed by Ron Evans
parent 81e325205f
commit 9e599bac49
4 changed files with 64 additions and 30 deletions
+1 -1
View File
@@ -243,7 +243,7 @@ func (c *Config) Debug() bool {
// extension and the configured binary format in the target JSON file.
func (c *Config) BinaryFormat(ext string) string {
switch ext {
case ".bin", ".gba":
case ".bin", ".gba", ".nro":
// The simplest format possible: dump everything in a raw binary file.
if c.Target.BinaryFormat != "" {
return c.Target.BinaryFormat