main: include .data section in .hex file

The function extracting the firmware image for .hex and .bin files
wasn't working correctly: it only extracted the .text segment and not
the .data segment.
This commit fixes this issue, so that it behaves (hopefully) just like
objcopy -O{ihex|binary}.

Another small change is that the formatting of the .hex file was made
more like the output of objcopy: no entry addres (old Intel CPU
holdover) and 16 bytes of data on each line.
This commit is contained in:
Ayke van Laethem
2019-03-11 16:18:09 +01:00
committed by Ron Evans
parent b1744db2c8
commit a466dd8f2b
2 changed files with 63 additions and 14 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ import (
// ConvertELFFileToUF2File converts an ELF file to a UF2 file.
func ConvertELFFileToUF2File(infile, outfile string) error {
// Read the .text segment.
_, data, err := ExtractTextSegment(infile)
_, data, err := ExtractROM(infile)
if err != nil {
return err
}