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/07/01 22:20:25 UTC

[mynewt-newt] branch master updated: Export all syscfg settings to download script

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 407fe96  Export all syscfg settings to download script
407fe96 is described below

commit 407fe9617a50a91dd54633d1fc5971eba4321789
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Jun 28 12:42:30 2019 -0700

    Export all syscfg settings to download script
    
    Newt already exports some syscfg settings as environment variables when
    it runs a download script (e.g., `BOOT_LOADER`).
    
    This commit changes newt such that it exports all settings as
    environment variables.  The name of each variable uses the `MYNEWT_VAL_`
    prefix.  For example:
    
    ```
    MYNEWT_VAL_OS_COREDUMP=1
    MYNEWT_VAL_OS_CPUTIME_FREQ=32768
    ```
    
    This has the potential to create a lot of environment variables.
    However, some quick testing shows that it should be well within the
    limits of the OS.  I saw the following limits during testing:
    
        * macOS: 256kB
        * Linux (Gentoo): 2MB
    
    A fairly large project generated about 34kB of syscfg settings.
---
 newt/builder/load.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newt/builder/load.go b/newt/builder/load.go
index 4113e20..4938bde 100644
--- a/newt/builder/load.go
+++ b/newt/builder/load.go
@@ -146,6 +146,11 @@ func (b *Builder) Load(imageSlot int, extraJtagCmd string) error {
 	envSettings["FLASH_OFFSET"] = "0x" + strconv.FormatInt(int64(tgtArea.Offset), 16)
 	envSettings["FLASH_AREA_SIZE"] = "0x" + strconv.FormatInt(int64(tgtArea.Size), 16)
 
+	// Add all syscfg settings to the environment with the MYNEWT_VAL_ prefix.
+	for k, v := range settings {
+		envSettings["MYNEWT_VAL_"+k] = v
+	}
+
 	// Convert the binary path from absolute to relative.  This is required for
 	// compatibility with unix-in-windows environemnts (e.g., cygwin).
 	binPath := util.TryRelPath(b.AppBinBasePath())