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 2019/10/25 20:16:44 UTC
[mynewt-newt] branch master updated: Provide method for BSP to
override image offset and padding
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push:
new 6bae1a2 Provide method for BSP to override image offset and padding
6bae1a2 is described below
commit 6bae1a2e9d62d67d3054001d8aa84f677d801bd2
Author: Andy Gross <an...@juul.com>
AuthorDate: Fri Oct 25 14:19:20 2019 -0500
Provide method for BSP to override image offset and padding
This patch adds the capability to set the image header offset
and image padding values via the BSP file. Command line settings
override the BSP settings.
Signed-off-by: Andy Gross <an...@juul.com>
---
newt/imgprod/imgprod.go | 9 +++++++++
newt/pkg/bsp_package.go | 6 ++++++
2 files changed, 15 insertions(+)
diff --git a/newt/imgprod/imgprod.go b/newt/imgprod/imgprod.go
index d784b58..5932048 100644
--- a/newt/imgprod/imgprod.go
+++ b/newt/imgprod/imgprod.go
@@ -277,6 +277,15 @@ func OptsFromTgtBldr(b *builder.TargetBuilder, ver image.ImageVersion,
img0Area := b.BspPkg().FlashMap.Areas[flash.FLASH_AREA_NAME_IMAGE_0]
baseAddr := img0Area.Offset
+ // If there is not a cmd line override, use the BSP values
+ // for header pad and image pad
+ if hdrPad <= 0 {
+ hdrPad = b.BspPkg().ImageOffset
+ }
+ if imagePad <= 0 {
+ imagePad = b.BspPkg().ImagePad
+ }
+
opts := ImageProdOpts{
AppSrcFilename: b.AppBuilder.AppBinPath(),
AppDstFilename: b.AppBuilder.AppImgPath(),
diff --git a/newt/pkg/bsp_package.go b/newt/pkg/bsp_package.go
index bbb53c2..c8a7ef1 100644
--- a/newt/pkg/bsp_package.go
+++ b/newt/pkg/bsp_package.go
@@ -42,6 +42,8 @@ type BspPackage struct {
DownloadScript string
DebugScript string
OptChkScript string
+ ImageOffset int
+ ImagePad int
FlashMap flashmap.FlashMap
BspV ycfg.YCfg
}
@@ -126,6 +128,10 @@ func (bsp *BspPackage) Reload(settings map[string]string) error {
bsp.CompilerName = bsp.BspV.GetValString("bsp.compiler", settings)
bsp.Arch = bsp.BspV.GetValString("bsp.arch", settings)
+ bsp.ImageOffset = bsp.BspV.GetValInt("bsp.image_offset", settings)
+
+ bsp.ImagePad = bsp.BspV.GetValInt("bsp.image_pad", settings)
+
bsp.LinkerScripts, err = bsp.resolveLinkerScriptSetting(
settings, "bsp.linkerscript")
if err != nil {