Compare commits

..

2 Commits

Author SHA1 Message Date
Ayke van Laethem a3ee85890d main: remove -no-debug flag
The -no-debug flag controls whether to emit DWARF debug information.
However, instead of limiting debug information altogether, I think it's
better to strip it off at the end if it isn't needed. For several
reasons:

  * Some parts of the compiler now rely on the presence of debug
    information for proper diagnostics.
  * It works better with the cache: there is no distinction between
    debug and no-debug builds.
  * It makes it easier (or possible at all) to enable debug information
    in the wasi-libc library without big downsides.

I'm doing this in a separate commit so this can be reverted if needed.
2021-07-12 14:25:59 +02:00
Ayke van Laethem 2930c44bfc main: add -debug flag that controls debuginfo stripping
Debug information is useful in many case, but in the case of WebAssembly
it increases the binary size by a large amount. It also inhibits
compression of relocations. Therefore I've made debug information
optional and disabled by default.

(Debug information is still generated, but stripped from the binary at
the link step).
2021-07-12 14:16:16 +02:00
177 changed files with 358 additions and 328 deletions
+35 -1
View File
@@ -100,7 +100,6 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
AutomaticStackSize: config.AutomaticStackSize(),
DefaultStackSize: config.Target.DefaultStackSize,
NeedsStackObjects: config.NeedsStackObjects(),
Debug: config.Debug(),
LLVMFeatures: config.LLVMFeatures(),
}
@@ -537,6 +536,41 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
ldflags = append(ldflags, lprogram.LDFlags...)
}
// Strip debug information if -debug is true. This is sometimes the default,
// such as with WebAssembly targets.
if !config.Debug() {
for _, tag := range config.BuildTags() {
if tag == "baremetal" {
// Don't use -debug=false on baremetal targets. It makes no
// sense: the debug information isn't flashed to the device
// anyway.
return fmt.Errorf("stripping debug information is unnecessary for baremetal targets")
}
}
if config.Target.Linker == "wasm-ld" {
// Don't just strip debug information, also compress relocations
// while we're at it. Relocations can only be compressed when debug
// information is stripped.
ldflags = append(ldflags, "--strip-debug", "--compress-relocations")
} else {
switch config.GOOS() {
case "linux":
// Either real linux or an embedded system (like AVR) that
// pretends to be Linux. It's a ELF linker wrapped by GCC in any
// case.
ldflags = append(ldflags, "-Wl,--strip-debug")
case "darwin":
// MacOS (darwin) doesn't have a linker flag to strip debug
// information. Apple expects you to use the strip command
// instead.
return errors.New("cannot remove debug information: MacOS doesn't suppor this linker flag")
default:
// Other OSes may have different flags.
return errors.New("cannot remove debug information: unknown OS: " + config.GOOS())
}
}
}
// Create a linker job, which links all object files together and does some
// extra stuff that can only be done after linking.
jobs = append(jobs, &compileJob{
+22 -6
View File
@@ -209,9 +209,8 @@ func (c *Config) CFlags() []string {
cflags = append(cflags, "-nostdlibinc", "-Xclang", "-internal-isystem", "-Xclang", filepath.Join(root, "lib", "picolibc", "newlib", "libc", "include"))
cflags = append(cflags, "-I"+filepath.Join(root, "lib/picolibc-include"))
}
if c.Debug() {
cflags = append(cflags, "-g")
}
// Always emit debug information. It is optionally stripped at link time.
cflags = append(cflags, "-g")
return cflags
}
@@ -250,10 +249,27 @@ func (c *Config) VerifyIR() bool {
return c.Options.VerifyIR
}
// Debug returns whether to add debug symbols to the IR, for debugging with GDB
// and similar.
// Debug returns whether debug (DWARF) information should be retained by the
// linker. The default varies by target but can be controlled with the -debug
// command line flag.
func (c *Config) Debug() bool {
return c.Options.Debug
switch c.Options.Debug {
case "true":
return true
case "false":
return false
case "auto":
// Emit debug information everywhere by default except on WebAssembly.
for _, tag := range c.BuildTags() {
if tag == "tinygo.wasm" {
return false
}
}
return true
default:
// This is already checked so shouldn't happen.
panic("unknown -debug flag")
}
}
// BinaryFormat returns an appropriate binary format, based on the file
+8 -1
View File
@@ -9,6 +9,7 @@ import (
var (
validGCOptions = []string{"none", "leaking", "extalloc", "conservative"}
validSchedulerOptions = []string{"none", "tasks", "coroutines"}
validDebugOptions = []string{"auto", "true", "false"}
validSerialOptions = []string{"none", "uart", "usb"}
validPrintSizeOptions = []string{"none", "short", "full"}
validPanicStrategyOptions = []string{"print", "trap"}
@@ -28,7 +29,7 @@ type Options struct {
DumpSSA bool
VerifyIR bool
PrintCommands func(cmd string, args ...string)
Debug bool
Debug string
PrintSizes string
PrintAllocs *regexp.Regexp // regexp string
PrintStacks bool
@@ -70,6 +71,12 @@ func (o *Options) Verify() error {
}
}
if !isInArray(validDebugOptions, o.Debug) {
return fmt.Errorf(`invalid debug option '%s': valid values are %s`,
o.Debug,
strings.Join(validDebugOptions, ", "))
}
if o.PrintSizes != "" {
valid := isInArray(validPrintSizeOptions, o.PrintSizes)
if !valid {
+42 -56
View File
@@ -58,7 +58,6 @@ type Config struct {
AutomaticStackSize bool
DefaultStackSize uint64
NeedsStackObjects bool
Debug bool // Whether to emit debug information in the LLVM module.
LLVMFeatures string
}
@@ -103,9 +102,7 @@ func newCompilerContext(moduleName string, machine llvm.TargetMachine, config *C
c.mod = c.ctx.NewModule(moduleName)
c.mod.SetTarget(config.Triple)
c.mod.SetDataLayout(c.targetData.String())
if c.Debug {
c.dibuilder = llvm.NewDIBuilder(c.mod)
}
c.dibuilder = llvm.NewDIBuilder(c.mod)
c.uintptrType = c.ctx.IntType(c.targetData.PointerSize() * 8)
if c.targetData.PointerSize() <= 4 {
@@ -263,15 +260,13 @@ func CompilePackage(moduleName string, pkg *loader.Package, ssaPkg *ssa.Package,
ssaPkg.Build()
// Initialize debug information.
if c.Debug {
c.cu = c.dibuilder.CreateCompileUnit(llvm.DICompileUnit{
Language: 0xb, // DW_LANG_C99 (0xc, off-by-one?)
File: "<unknown>",
Dir: "",
Producer: "TinyGo",
Optimized: true,
})
}
c.cu = c.dibuilder.CreateCompileUnit(llvm.DICompileUnit{
Language: 0xb, // DW_LANG_C99 (0xc, off-by-one?)
File: "<unknown>",
Dir: "",
Producer: "TinyGo",
Optimized: true,
})
// Load comments such as //go:extern on globals.
c.loadASTComments(pkg)
@@ -286,23 +281,21 @@ func CompilePackage(moduleName string, pkg *loader.Package, ssaPkg *ssa.Package,
c.createPackage(irbuilder, ssaPkg)
// see: https://reviews.llvm.org/D18355
if c.Debug {
c.mod.AddNamedMetadataOperand("llvm.module.flags",
c.ctx.MDNode([]llvm.Metadata{
llvm.ConstInt(c.ctx.Int32Type(), 1, false).ConstantAsMetadata(), // Error on mismatch
c.ctx.MDString("Debug Info Version"),
llvm.ConstInt(c.ctx.Int32Type(), 3, false).ConstantAsMetadata(), // DWARF version
}),
)
c.mod.AddNamedMetadataOperand("llvm.module.flags",
c.ctx.MDNode([]llvm.Metadata{
llvm.ConstInt(c.ctx.Int32Type(), 1, false).ConstantAsMetadata(),
c.ctx.MDString("Dwarf Version"),
llvm.ConstInt(c.ctx.Int32Type(), 4, false).ConstantAsMetadata(),
}),
)
c.dibuilder.Finalize()
}
c.mod.AddNamedMetadataOperand("llvm.module.flags",
c.ctx.MDNode([]llvm.Metadata{
llvm.ConstInt(c.ctx.Int32Type(), 1, false).ConstantAsMetadata(), // Error on mismatch
c.ctx.MDString("Debug Info Version"),
llvm.ConstInt(c.ctx.Int32Type(), 3, false).ConstantAsMetadata(), // DWARF version
}),
)
c.mod.AddNamedMetadataOperand("llvm.module.flags",
c.ctx.MDNode([]llvm.Metadata{
llvm.ConstInt(c.ctx.Int32Type(), 1, false).ConstantAsMetadata(),
c.ctx.MDString("Dwarf Version"),
llvm.ConstInt(c.ctx.Int32Type(), 4, false).ConstantAsMetadata(),
}),
)
c.dibuilder.Finalize()
return c.mod, c.diagnostics
}
@@ -812,20 +805,18 @@ func (b *builder) createFunction() {
b.llvmFn.AddFunctionAttr(noinline)
}
// Add debug info, if needed.
if b.Debug {
if b.fn.Synthetic == "package initializer" {
// Package initializers have no debug info. Create some fake debug
// info to at least have *something*.
filename := b.fn.Package().Pkg.Path() + "/<init>"
b.difunc = b.attachDebugInfoRaw(b.fn, b.llvmFn, "", filename, 0)
} else if b.fn.Syntax() != nil {
// Create debug info file if needed.
b.difunc = b.attachDebugInfo(b.fn)
}
pos := b.program.Fset.Position(b.fn.Pos())
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
// Add debug info.
if b.fn.Synthetic == "package initializer" {
// Package initializers have no debug info. Create some fake debug
// info to at least have *something*.
filename := b.fn.Package().Pkg.Path() + "/<init>"
b.difunc = b.attachDebugInfoRaw(b.fn, b.llvmFn, "", filename, 0)
} else if b.fn.Syntax() != nil {
// Create debug info file if needed.
b.difunc = b.attachDebugInfo(b.fn)
}
pos := b.program.Fset.Position(b.fn.Pos())
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
// Pre-create all basic blocks in the function.
for _, block := range b.fn.DomPreorder() {
@@ -850,7 +841,7 @@ func (b *builder) createFunction() {
b.locals[param] = b.collapseFormalParam(llvmType, fields)
// Add debug information to this parameter (if available)
if b.Debug && b.fn.Syntax() != nil {
if b.fn.Syntax() != nil {
dbgParam := b.getLocalVariable(param.Object().(*types.Var))
loc := b.GetCurrentDebugLocation()
if len(fields) == 1 {
@@ -910,9 +901,6 @@ func (b *builder) createFunction() {
b.currentBlock = block
for _, instr := range block.Instrs {
if instr, ok := instr.(*ssa.DebugRef); ok {
if !b.Debug {
continue
}
object := instr.Object()
variable, ok := object.(*types.Var)
if !ok {
@@ -1029,10 +1017,8 @@ func getPos(val posser) token.Pos {
// createInstruction builds the LLVM IR equivalent instructions for the
// particular Go SSA instruction.
func (b *builder) createInstruction(instr ssa.Instruction) {
if b.Debug {
pos := b.program.Fset.Position(getPos(instr))
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
}
pos := b.program.Fset.Position(getPos(instr))
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), b.difunc, llvm.Metadata{})
switch instr := instr.(type) {
case ssa.Value:
@@ -1298,15 +1284,15 @@ func (b *builder) createFunctionCall(instr *ssa.CallCommon) (llvm.Value, error)
return b.createMemoryCopyCall(fn, instr.Args)
case name == "runtime.memzero":
return b.createMemoryZeroCall(instr.Args)
case name == "github.com/sago35/device.Asm" || name == "github.com/sago35/device/arm.Asm" || name == "github.com/sago35/device/arm64.Asm" || name == "github.com/sago35/device/avr.Asm" || name == "github.com/sago35/device/riscv.Asm":
case name == "device.Asm" || name == "device/arm.Asm" || name == "device/arm64.Asm" || name == "device/avr.Asm" || name == "device/riscv.Asm":
return b.createInlineAsm(instr.Args)
case name == "github.com/sago35/device.AsmFull" || name == "github.com/sago35/device/arm.AsmFull" || name == "github.com/sago35/device/arm64.AsmFull" || name == "github.com/sago35/device/avr.AsmFull" || name == "github.com/sago35/device/riscv.AsmFull":
case name == "device.AsmFull" || name == "device/arm.AsmFull" || name == "device/arm64.AsmFull" || name == "device/avr.AsmFull" || name == "device/riscv.AsmFull":
return b.createInlineAsmFull(instr)
case strings.HasPrefix(name, "github.com/sago35/device/arm.SVCall"):
case strings.HasPrefix(name, "device/arm.SVCall"):
return b.emitSVCall(instr.Args)
case strings.HasPrefix(name, "github.com/sago35/device/arm64.SVCall"):
case strings.HasPrefix(name, "device/arm64.SVCall"):
return b.emitSV64Call(instr.Args)
case strings.HasPrefix(name, "(github.com/sago35/device/riscv.CSR)."):
case strings.HasPrefix(name, "(device/riscv.CSR)."):
return b.emitCSROperation(instr)
case strings.HasPrefix(name, "syscall.Syscall"):
return b.createSyscall(instr)
+40 -42
View File
@@ -182,27 +182,26 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri
entry := c.ctx.AddBasicBlock(wrapper, "entry")
builder.SetInsertPointAtEnd(entry)
if c.Debug {
pos := c.program.Fset.Position(pos)
diFuncType := c.dibuilder.CreateSubroutineType(llvm.DISubroutineType{
File: c.getDIFile(pos.Filename),
Parameters: nil, // do not show parameters in debugger
Flags: 0, // ?
})
difunc := c.dibuilder.CreateFunction(c.getDIFile(pos.Filename), llvm.DIFunction{
Name: "<goroutine wrapper>",
File: c.getDIFile(pos.Filename),
Line: pos.Line,
Type: diFuncType,
LocalToUnit: true,
IsDefinition: true,
ScopeLine: 0,
Flags: llvm.FlagPrototyped,
Optimized: true,
})
wrapper.SetSubprogram(difunc)
builder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
}
// Add debug information.
pos := c.program.Fset.Position(pos)
diFuncType := c.dibuilder.CreateSubroutineType(llvm.DISubroutineType{
File: c.getDIFile(pos.Filename),
Parameters: nil, // do not show parameters in debugger
Flags: 0, // ?
})
difunc := c.dibuilder.CreateFunction(c.getDIFile(pos.Filename), llvm.DIFunction{
Name: "<goroutine wrapper>",
File: c.getDIFile(pos.Filename),
Line: pos.Line,
Type: diFuncType,
LocalToUnit: true,
IsDefinition: true,
ScopeLine: 0,
Flags: llvm.FlagPrototyped,
Optimized: true,
})
wrapper.SetSubprogram(difunc)
builder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
// Create the list of params for the call.
paramTypes := fn.Type().ElementType().ParamTypes()
@@ -246,27 +245,26 @@ func (c *compilerContext) createGoroutineStartWrapper(fn llvm.Value, prefix stri
entry := c.ctx.AddBasicBlock(wrapper, "entry")
builder.SetInsertPointAtEnd(entry)
if c.Debug {
pos := c.program.Fset.Position(pos)
diFuncType := c.dibuilder.CreateSubroutineType(llvm.DISubroutineType{
File: c.getDIFile(pos.Filename),
Parameters: nil, // do not show parameters in debugger
Flags: 0, // ?
})
difunc := c.dibuilder.CreateFunction(c.getDIFile(pos.Filename), llvm.DIFunction{
Name: "<goroutine wrapper>",
File: c.getDIFile(pos.Filename),
Line: pos.Line,
Type: diFuncType,
LocalToUnit: true,
IsDefinition: true,
ScopeLine: 0,
Flags: llvm.FlagPrototyped,
Optimized: true,
})
wrapper.SetSubprogram(difunc)
builder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
}
// Add debug information.
pos := c.program.Fset.Position(pos)
diFuncType := c.dibuilder.CreateSubroutineType(llvm.DISubroutineType{
File: c.getDIFile(pos.Filename),
Parameters: nil, // do not show parameters in debugger
Flags: 0, // ?
})
difunc := c.dibuilder.CreateFunction(c.getDIFile(pos.Filename), llvm.DIFunction{
Name: "<goroutine wrapper>",
File: c.getDIFile(pos.Filename),
Line: pos.Line,
Type: diFuncType,
LocalToUnit: true,
IsDefinition: true,
ScopeLine: 0,
Flags: llvm.FlagPrototyped,
Optimized: true,
})
wrapper.SetSubprogram(difunc)
builder.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
// Get the list of parameters, with the extra parameters at the end.
paramTypes := fn.Type().ElementType().ParamTypes()
+4 -6
View File
@@ -501,12 +501,10 @@ func (c *compilerContext) getInterfaceInvokeWrapper(fn *ssa.Function, llvmFn llv
}
defer b.Builder.Dispose()
// add debug info if needed
if c.Debug {
pos := c.program.Fset.Position(fn.Pos())
difunc := c.attachDebugInfoRaw(fn, wrapper, "$invoke", pos.Filename, pos.Line)
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
}
// add debug info
pos := c.program.Fset.Position(fn.Pos())
difunc := c.attachDebugInfoRaw(fn, wrapper, "$invoke", pos.Filename, pos.Line)
b.SetCurrentDebugLocation(uint(pos.Line), uint(pos.Column), difunc, llvm.Metadata{})
// set up IR builder
block := b.ctx.AddBasicBlock(wrapper, "entry")
+11 -13
View File
@@ -52,19 +52,17 @@ func (b *builder) createInterruptGlobal(instr *ssa.CallCommon) (llvm.Value, erro
global.SetInitializer(initializer)
// Add debug info to the interrupt global.
if b.Debug {
pos := b.program.Fset.Position(instr.Pos())
diglobal := b.dibuilder.CreateGlobalVariableExpression(b.getDIFile(pos.Filename), llvm.DIGlobalVariableExpression{
Name: "interrupt" + strconv.FormatInt(id.Int64(), 10),
LinkageName: globalName,
File: b.getDIFile(pos.Filename),
Line: pos.Line,
Type: b.getDIType(globalType),
Expr: b.dibuilder.CreateExpression(nil),
LocalToUnit: false,
})
global.AddMetadata(0, diglobal)
}
pos := b.program.Fset.Position(instr.Pos())
diglobal := b.dibuilder.CreateGlobalVariableExpression(b.getDIFile(pos.Filename), llvm.DIGlobalVariableExpression{
Name: "interrupt" + strconv.FormatInt(id.Int64(), 10),
LinkageName: globalName,
File: b.getDIFile(pos.Filename),
Line: pos.Line,
Type: b.getDIType(globalType),
Expr: b.dibuilder.CreateExpression(nil),
LocalToUnit: false,
})
global.AddMetadata(0, diglobal)
// Create the runtime/interrupt.Interrupt type. It is a struct with a single
// member of type int.
+1 -1
View File
@@ -386,7 +386,7 @@ func (c *compilerContext) getGlobal(g *ssa.Global) llvm.Value {
llvmGlobal.SetAlignment(alignment)
}
if c.Debug && !info.extern {
if !info.extern {
// Add debug info.
pos := c.program.Fset.Position(g.Pos())
diglobal := c.dibuilder.CreateGlobalVariableExpression(c.difiles[pos.Filename], llvm.DIGlobalVariableExpression{
-1
View File
@@ -9,7 +9,6 @@ require (
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf
github.com/marcinbor85/gohex v0.0.0-20200531091804-343a4b548892
github.com/mattn/go-colorable v0.1.8
github.com/sago35/device v0.0.0-20210708114705-5c2c56419249
go.bug.st/serial v1.1.2
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78
golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2
+6 -7
View File
@@ -8,7 +8,6 @@ github.com/chromedp/sysutil v1.0.0 h1:+ZxhTpfpZlmchB58ih/LBHX52ky7w2VhQVKQMucy3I
github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww=
github.com/creack/goselect v0.1.1 h1:tiSSgKE1eJtxs1h/VgGQWuXUP0YS4CDIFMp6vaI1ls0=
github.com/creack/goselect v0.1.1/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
@@ -28,13 +27,11 @@ github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sago35/device v0.0.0-20210708114705-5c2c56419249 h1:GU6dEpii0PsE4TF8RuOcEWzbbCZQPtcqdVdZsQXy/Uw=
github.com/sago35/device v0.0.0-20210708114705-5c2c56419249/go.mod h1:N8KfLtl2y31BvW1T9LmO7P+QkfoJk7SurI+0N0lCuOo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
go.bug.st/serial v1.0.0 h1:ogEPzrllCsnG00EqKRjeYvPRsO7NJW6DqykzkdD6E/k=
go.bug.st/serial v1.0.0/go.mod h1:rpXPISGjuNjPTRTcMlxi9lN6LoIPxd1ixVjBd8aSk/Q=
go.bug.st/serial v1.1.2 h1:6xDpbta8KJ+VLRTeM8ghhxXRMLE/Lr8h9iDKwydarAY=
go.bug.st/serial v1.1.2/go.mod h1:VmYBeyJWp5BnJ0tw2NUJHZdJTGl2ecBGABHlzRK1knY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -46,6 +43,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 h1:ZBzSG/7F4eNKz2L3GE9o300RX0Az1Bw5HF7PDraD+qU=
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -56,9 +55,9 @@ golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2 h1:0sfSpGSa544Fwnbot3Oxq/U
golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
tinygo.org/x/go-llvm v0.0.0-20210308112806-9ef958b6bed4 h1:CMUHxVTb+UuUePuMf8vkWjZ3gTp9BBK91KrgOCwoNHs=
tinygo.org/x/go-llvm v0.0.0-20210308112806-9ef958b6bed4/go.mod h1:fv1F0BSNpxMfCL0zF3M4OPFbgYHnhtB6ST0HvUtu/LE=
tinygo.org/x/go-llvm v0.0.0-20210325115028-e7b85195e81c h1:vn9IPshzYmzZis10UEVrsIBRv9FpykADw6M3/tHHROg=
tinygo.org/x/go-llvm v0.0.0-20210325115028-e7b85195e81c/go.mod h1:fv1F0BSNpxMfCL0zF3M4OPFbgYHnhtB6ST0HvUtu/LE=
+2 -7
View File
@@ -1019,7 +1019,7 @@ func main() {
printStacks := flag.Bool("print-stacks", false, "print stack sizes of goroutines")
printAllocsString := flag.String("print-allocs", "", "regular expression of functions for which heap allocations should be printed")
printCommands := flag.Bool("x", false, "Print commands")
nodebug := flag.Bool("no-debug", false, "disable DWARF debug symbol generation")
debug := flag.String("debug", "auto", "remove debug information (auto, true, false)")
ocdCommandsString := flag.String("ocd-commands", "", "OpenOCD commands, overriding target spec (can specify multiple separated by commas)")
ocdOutput := flag.Bool("ocd-output", false, "print OCD daemon output during debug")
port := flag.String("port", "", "flash port (can specify multiple candidates separated by commas)")
@@ -1086,7 +1086,7 @@ func main() {
PrintIR: *printIR,
DumpSSA: *dumpSSA,
VerifyIR: *verifyIR,
Debug: !*nodebug,
Debug: *debug,
PrintSizes: *printSize,
PrintStacks: *printStacks,
PrintAllocs: printAllocs,
@@ -1173,11 +1173,6 @@ func main() {
err := Flash(pkgName, *port, options)
handleCompilerError(err)
} else {
if !options.Debug {
fmt.Fprintln(os.Stderr, "Debug disabled while running gdb?")
usage()
os.Exit(1)
}
err := FlashGDB(pkgName, *ocdOutput, options)
handleCompilerError(err)
}
+1 -1
View File
@@ -194,7 +194,7 @@ func runTest(name, target string, t *testing.T, cmdArgs, environmentVars []strin
PrintIR: false,
DumpSSA: false,
VerifyIR: true,
Debug: true,
EmitDWARF: true,
PrintSizes: "",
WasmAbi: "",
}
+1 -1
View File
@@ -7,7 +7,7 @@
package nxp
import (
"github.com/sago35/device/arm"
"device/arm"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/sago35/device/sam"
"device/sam"
"fmt"
"machine"
"time"
+1 -1
View File
@@ -1,7 +1,7 @@
package main
import (
"github.com/sago35/device/arm"
"device/arm"
"machine"
)
+1 -1
View File
@@ -9,7 +9,7 @@ package task
// space for interrupts.
import (
"github.com/sago35/device/arm"
"device/arm"
"unsafe"
)
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -2,7 +2,7 @@
package machine
import "github.com/sago35/device/sifive"
import "device/sifive"
// SPI on the HiFive1.
var (
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -2,7 +2,7 @@
package machine
import "github.com/sago35/device/kendryte"
import "device/kendryte"
// SPI on the MAix Bit.
var (
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -2,7 +2,7 @@
package machine
import "github.com/sago35/device/sam"
import "device/sam"
// used to reset into bootloader
const RESET_MAGIC_VALUE = 0xf01669ef
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nxp"
"device/nxp"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/interrupt"
"runtime/volatile"
"unsafe"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/interrupt"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/interrupt"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/volatile"
)
+2 -2
View File
@@ -8,8 +8,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/sam"
"device/arm"
"device/sam"
"errors"
"runtime/interrupt"
"runtime/volatile"
+1 -1
View File
@@ -8,7 +8,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
)
// Return the register and mask to enable a given GPIO pin. This can be used to
+1 -1
View File
@@ -8,7 +8,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
)
// Return the register and mask to enable a given GPIO pin. This can be used to
+2 -2
View File
@@ -8,8 +8,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/sam"
"device/arm"
"device/sam"
"errors"
"runtime/interrupt"
"runtime/volatile"
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00030000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00030000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00040000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00030000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00040000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00030000
+1 -1
View File
@@ -7,7 +7,7 @@
//
package machine
import "github.com/sago35/device/sam"
import "device/sam"
const HSRAM_SIZE = 0x00040000
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sam"
"device/sam"
"errors"
"runtime/interrupt"
"unsafe"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/avr"
"device/avr"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/esp"
"device/esp"
"errors"
"runtime/volatile"
"unsafe"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/esp"
"device/esp"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/sifive"
"device/sifive"
"runtime/interrupt"
"unsafe"
)
+2 -2
View File
@@ -3,8 +3,8 @@
package machine
import (
"github.com/sago35/device/kendryte"
"github.com/sago35/device/riscv"
"device/kendryte"
"device/riscv"
"errors"
"runtime/interrupt"
"unsafe"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nxp"
"device/nxp"
"math/bits"
"runtime/interrupt"
"runtime/volatile"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nxp"
"device/nxp"
"runtime/interrupt"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
"errors"
"runtime/interrupt"
"unsafe"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
)
func CPUFrequency() uint32 {
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
)
// Hardware pins
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
)
// Hardware pins
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
)
// Hardware pins
+2 -2
View File
@@ -3,8 +3,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/nrf"
"device/arm"
"device/nrf"
"runtime/interrupt"
"runtime/volatile"
"unsafe"
@@ -3,8 +3,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/nrf"
"device/arm"
"device/nrf"
)
const DFU_MAGIC_SERIAL_ONLY_RESET = 0xb0
@@ -3,8 +3,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/nrf"
"device/arm"
"device/nrf"
)
const (
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/nrf"
"device/nrf"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -32,7 +32,7 @@
package machine
import (
"github.com/sago35/device/nxp"
"device/nxp"
"runtime/volatile"
"unsafe"
)
+2 -2
View File
@@ -32,8 +32,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/nxp"
"device/arm"
"device/nxp"
"errors"
"runtime/interrupt"
"runtime/volatile"
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
)
func InitADC() {
+2 -2
View File
@@ -3,8 +3,8 @@
package machine
import (
"github.com/sago35/device/arm"
"github.com/sago35/device/rp"
"device/arm"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/interrupt"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/rp"
"device/rp"
"runtime/volatile"
"unsafe"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
"runtime/volatile"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
)
// This variant of the GPIO input interrupt logic is for
+1 -1
View File
@@ -3,7 +3,7 @@
package machine
import (
"github.com/sago35/device/stm32"
"device/stm32"
)
// This variant of the GPIO input interrupt logic is for
+1 -1
View File
@@ -6,7 +6,7 @@ package machine
// of MCUs.
import (
"github.com/sago35/device/stm32"
"device/stm32"
"unsafe"
)

Some files were not shown because too many files have changed in this diff Show More