You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/10 22:38:18 UTC

[06/50] incubator-mynewt-newt git commit: newt - Remove obsolete mfg header code

newt - Remove obsolete mfg header code

Some unused mfg code remained in the newt tool.  This code generated or
parsed the old mfg image header and mfg image section header structures
that are no longer used.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/cd7eec89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/cd7eec89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/cd7eec89

Branch: refs/heads/master
Commit: cd7eec89408c509f7aea8e132d9175c8467a2e27
Parents: 53574f4
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Oct 26 09:14:12 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Oct 26 09:15:33 2016 -0700

----------------------------------------------------------------------
 newt/mfg/create.go | 31 -------------------------------
 newt/mfg/mfg.go    | 22 ----------------------
 2 files changed, 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/cd7eec89/newt/mfg/create.go
----------------------------------------------------------------------
diff --git a/newt/mfg/create.go b/newt/mfg/create.go
index 5653b3a..46058f3 100644
--- a/newt/mfg/create.go
+++ b/newt/mfg/create.go
@@ -20,8 +20,6 @@
 package mfg
 
 import (
-	"bytes"
-	"encoding/binary"
 	"encoding/json"
 	"fmt"
 	"io/ioutil"
@@ -131,35 +129,6 @@ func (mi *MfgImage) section0Data(parts []mfgPart) ([]byte, int, error) {
 
 }
 
-func createImageHeader(hashOffset int) ([]byte, error) {
-	buf := &bytes.Buffer{}
-
-	hdr := mfgImageHeader{
-		Version:    uint8(MFG_IMAGE_VERSION),
-		HashOffset: uint32(hashOffset),
-	}
-	if err := binary.Write(buf, binary.BigEndian, hdr); err != nil {
-		return nil, util.ChildNewtError(err)
-	}
-
-	return buf.Bytes(), nil
-}
-
-func createSectionHeader(deviceId int, offset int, size int) ([]byte, error) {
-	buf := &bytes.Buffer{}
-
-	sectionHdr := mfgImageSectionHeader{
-		DeviceId: uint8(deviceId),
-		Offset:   uint32(offset),
-		Size:     uint32(size),
-	}
-	if err := binary.Write(buf, binary.BigEndian, sectionHdr); err != nil {
-		return nil, util.ChildNewtError(err)
-	}
-
-	return buf.Bytes(), nil
-}
-
 // @return						[section0blob, section1blob,...], hash, err
 func (mi *MfgImage) createSections(parts []mfgPart) (
 	[][]byte, []byte, error) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/cd7eec89/newt/mfg/mfg.go
----------------------------------------------------------------------
diff --git a/newt/mfg/mfg.go b/newt/mfg/mfg.go
index f912c33..30e25b2 100644
--- a/newt/mfg/mfg.go
+++ b/newt/mfg/mfg.go
@@ -20,31 +20,12 @@
 package mfg
 
 import (
-	"encoding/binary"
-
 	"mynewt.apache.org/newt/newt/pkg"
 	"mynewt.apache.org/newt/newt/target"
 )
 
 const MFG_YAML_FILENAME string = "mfg.yml"
 
-const MFG_IMAGE_VERSION = 1
-
-type mfgImageHeader struct {
-	Version    uint8 // 0x01
-	_          uint8
-	_          uint16
-	HashOffset uint32
-}
-
-type mfgImageSectionHeader struct {
-	DeviceId uint8
-	_        uint8
-	_        uint16
-	Offset   uint32 // Offset within flash device.
-	Size     uint32 // Does not include header.
-}
-
 type MfgRawEntry struct {
 	offset   int
 	filename string
@@ -68,6 +49,3 @@ type MfgImage struct {
 	images     []*target.Target
 	rawEntries []MfgRawEntry
 }
-
-var MFG_IMAGE_HEADER_SIZE = binary.Size(mfgImageHeader{})
-var MFG_IMAGE_SECTION_HEADER_SIZE = binary.Size(mfgImageSectionHeader{})