mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 10:43:29 +00:00
Reduce code size for AVR (#116)
* all: add support for specifying target CPU in target config * avr: specify the chip name in the target CPU This reduces code size by a large margin. For examples/blinky, it reduces code size from 1360 to 1266 when compiling for the Arduino Uno (94 bytes, or ~7%).
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
type TargetSpec struct {
|
||||
Inherits []string `json:"inherits"`
|
||||
Triple string `json:"llvm-target"`
|
||||
CPU string `json:"cpu"`
|
||||
BuildTags []string `json:"build-tags"`
|
||||
GC string `json:"gc"`
|
||||
Compiler string `json:"compiler"`
|
||||
@@ -44,6 +45,9 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) {
|
||||
if spec2.Triple != "" {
|
||||
spec.Triple = spec2.Triple
|
||||
}
|
||||
if spec2.CPU != "" {
|
||||
spec.CPU = spec2.CPU
|
||||
}
|
||||
spec.BuildTags = append(spec.BuildTags, spec2.BuildTags...)
|
||||
if spec2.GC != "" {
|
||||
spec.GC = spec2.GC
|
||||
|
||||
Reference in New Issue
Block a user