avr: convert initialization from asm to Go

This increases code size by 1 instruction (2 bytes) because LLVM isn't
yet smart enough to recognize that it doesn't need to clear a register
to use 0: it can just use r1 which is always 0 according to the
convention. It makes initialization a lot easier to read, however.
This commit is contained in:
Ayke van Laethem
2018-09-16 14:57:42 +02:00
parent 0d8a7e1666
commit 39e3fe28db
5 changed files with 38 additions and 18 deletions
+6
View File
@@ -22,9 +22,15 @@ var hasScheduler bool
// Entry point for Go. Initialize all packages and call main.main().
//go:export main
func main() int {
// Initialize memory etc.
preinit()
// Run initializers of all packages.
initAll()
// Enable interrupts etc.
postinit()
// This branch must be optimized away. Only one of the targets must remain,
// or there will be link errors.
if hasScheduler {