builder: sizes: list interrupt vector as a pseudo-package for -size=full

This is another bit of memory that is now correctly accounted for in
`-size=full`.
Этот коммит содержится в:
Ayke van Laethem 2023-03-06 00:06:08 +01:00 коммит произвёл Ron Evans
родитель de281191e0
коммит ea97c60959
3 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -371,7 +371,7 @@ func loadProgramSize(path string, packagePathMap map[string]string) (*programSiz
if section.Flags&elf.SHF_ALLOC == 0 {
continue
}
if packageSymbolRegexp.MatchString(symbol.Name) {
if packageSymbolRegexp.MatchString(symbol.Name) || symbol.Name == "__isr_vector" {
addresses = append(addresses, addressLine{
Address: symbol.Value,
Length: symbol.Size,
@ -834,6 +834,8 @@ func findPackagePath(path string, packagePathMap map[string]string) string {
} else if packageSymbolRegexp.MatchString(path) {
// Parse symbol names like main$alloc or runtime$string.
packagePath = path[:strings.LastIndex(path, "$")]
} else if path == "__isr_vector" {
packagePath = "C interrupt vector"
} else if path == "<Go type>" {
packagePath = "Go types"
} else if path == "<Go interface assert>" {

Просмотреть файл

@ -23,6 +23,7 @@ Default_Handler:
.section .isr_vector, "a", %progbits
.global __isr_vector
__isr_vector:
// Interrupt vector as defined by Cortex-M, starting with the stack top.
// On reset, SP is initialized with *0x0 and PC is loaded with *0x4, loading
// _stack_top and Reset_Handler.
@ -54,3 +55,5 @@ Default_Handler:
IRQ DebugMon_Handler
IRQ PendSV_Handler
IRQ SysTick_Handler
.size __isr_vector, .-__isr_vector

Просмотреть файл

@ -1422,6 +1422,9 @@ __isr_vector:
for _, intr := range device.Interrupts {
fmt.Fprintf(w, " IRQ %s_IRQHandler\n", intr.Name)
}
w.WriteString(`
.size __isr_vector, .-__isr_vector
`)
return w.Flush()
}