Skip to content

Commit

Permalink
Fill out rom_image a bit more, wire it into cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
trhodeos committed Feb 25, 2018
1 parent 5ccc2d4 commit 55baba2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
18 changes: 18 additions & 0 deletions bin/spicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import (
"flag"
"bufio"
"os"
"fmt"
"github.com/trhodeos/spicy"
)
const (
Expand Down Expand Up @@ -71,4 +72,21 @@ func main() {
if err != nil { panic(err) }
err = spicy.LinkSpec(spec, *ld_command)
if err != nil { panic(err) }

var romheader *os.File
var bootstrap *os.File
var font *os.File
var entry *os.File
var code *os.File
var raw *os.File
name := spec.Waves[0].Name
out, err := os.OpenFile(fmt.Sprintf("%s.n64", name), os.O_CREATE|os.O_RDWR, 0755)
if err != nil {
panic(err)
}
err = spicy.WriteRomImage(out, romheader, bootstrap, font, entry, code, raw)
if err != nil {
panic(err)
}

}
9 changes: 4 additions & 5 deletions entry_source.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package spicy

import (
"os"
"os"
)


func generateEntrySource() (string, error) {
return "", nil
return "", nil
}

func CreateEntrySourceBinary() (*os.File, error) {
return nil, nil
return nil, nil
}

27 changes: 13 additions & 14 deletions ld.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package spicy

import (
"bytes"
"fmt"
"github.com/golang/glog"
"io/ioutil"
"os/exec"
"path/filepath"
"text/template"
"bytes"
)

func createLdScript(s *Spec) (string, error) {
Expand Down Expand Up @@ -76,7 +76,7 @@ SECTIONS {
if err != nil {
return "", err
}
b := &bytes.Buffer{}
b := &bytes.Buffer{}
err = tmpl.Execute(b, s)
return b.String(), err
}
Expand Down Expand Up @@ -112,17 +112,16 @@ func LinkSpec(s *Spec, ld_command string) error {
return err
}
cmd := exec.Command(ld_command, "-G 0", "-noinhibit-exec", "-T", ld_path, "-o", fmt.Sprintf("%s.out", name), "-M")
var out bytes.Buffer
var errout bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &errout
var out bytes.Buffer
var errout bytes.Buffer
cmd.Stdout = &out
cmd.Stderr = &errout
err = cmd.Run()
if glog.V(2) {
glog.V(2).Info("Ld stdout: ", out.String())
}
if err != nil {
glog.Error(errout.String())
}
return err
if glog.V(2) {
glog.V(2).Info("Ld stdout: ", out.String())
}
if err != nil {
glog.Error(errout.String())
}
return err
}

6 changes: 3 additions & 3 deletions rom_image.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package spicy

import (
"os"
"os"
)

func CreateRomImage() (*os.File, error) {
return nil, nil
func WriteRomImage(out *os.File, romheader *os.File, bootstrap *os.File, font *os.File, entry *os.File, code *os.File, raw *os.File) error {
return nil
}

0 comments on commit 55baba2

Please sign in to comment.