You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "David G. Simmons" <sa...@mac.com> on 2017/01/13 14:52:35 UTC

Override pin settings

Before I file a bug in Jira on this, I thought I'd ask if this is expected behavior:

From my project's syscfg.yml:
UART_0_PIN_TX:
        description: 'New Pin Assignment'
        value: 23
    UART_0_PIN_RX:
        description: 'New Pin Assignment'
        value: 24

Results in newt target config show air_q:

* Setting: UART_0_PIN_RX
    * Description: TBD
    * Value:
    * Overridden: targets/air_q, default=5
  * Setting: UART_0_PIN_TX
    * Description: TBD
    * Value:
    * Overridden: targets/air_q, default=6

So it picks up that the value was overridden, but it doesn't pick up the actual values. It looks like I have to go into hw/bsp/arduino_primo_nrf52/syscfg.yml and change it there for any effect to be seen.

Bug? Feature?

dg
--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: Override pin settings

Posted by "David G. Simmons" <sa...@mac.com>.
Hi Chris,


> On Jan 13, 2017, at 12:59 PM, Christopher Collins <cc...@apache.org> wrote:
> 
> The last two entries should look like this:
> 
>    UART_0_PIN_TX: 23
>    UART_0_PIN_RX: 24
> 
> I think this will be a common mistake, so we should look at making newt
> report an error here.



Thanks for clarifying that for me. And yes, it may very well be a common mistake.

I did file another bug report yesterday about existing values being wiped out in a syscfg.yml file if a value is set via newt and that one is probably more serious.

Thanks,
dg
--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: Override pin settings

Posted by Christopher Collins <cc...@apache.org>.
On Fri, Jan 13, 2017 at 11:35:13AM -0500, David G. Simmons wrote:
> Here's the entire syscfg.yml file:
> 
> ### Package: targets/air_q
> 
> syscfg.vals:
>     OPENOCD_DEBUG: 1
>     # Enable the shell task.
>     SHELL_TASK: 1
>     STATS_CLI: 1
> 
>     CONSOLE_TICKS: 1
>     CONSOLE_PROMPT: 1
> 
>     UART_0_PIN_TX:
>         description: 'New Pin Assignment'
>         value: 23
>     UART_0_PIN_RX:
>         description: 'New Pin Assignment'
>         value: 24
> 
> So I was trying to override them in the syscfg.vals section. And that is what fails. the old value from the package's syscfg.yml is removed, but the new value isn't substituted in its place.

The last two entries should look like this:

    UART_0_PIN_TX: 23
    UART_0_PIN_RX: 24

I think this will be a common mistake, so we should look at making newt
report an error here.

Thanks,
Chris

Re: Override pin settings

Posted by "David G. Simmons" <sa...@mac.com>.
> On Jan 13, 2017, at 11:31 AM, Christopher Collins <cc...@apache.org> wrote:
> 
> From your email, it looks like the target's syscfg.yml is redefining
> existing settings, which should cause newt to raise an error.  I'll look
> into this error reporting issue, but in the meantime, I would change
> those UART pin overrides to use the syscfg.vals mapping rather than
> syscfg.defs.



Here's the entire syscfg.yml file:

### Package: targets/air_q

syscfg.vals:
    OPENOCD_DEBUG: 1
    # Enable the shell task.
    SHELL_TASK: 1
    STATS_CLI: 1

    CONSOLE_TICKS: 1
    CONSOLE_PROMPT: 1

    UART_0_PIN_TX:
        description: 'New Pin Assignment'
        value: 23
    UART_0_PIN_RX:
        description: 'New Pin Assignment'
        value: 24

So I was trying to override them in the syscfg.vals section. And that is what fails. the old value from the package's syscfg.yml is removed, but the new value isn't substituted in its place.

Thanks!
dg
--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: Override pin settings

Posted by Christopher Collins <cc...@apache.org>.
Hi David,

On Fri, Jan 13, 2017 at 09:52:35AM -0500, David G. Simmons wrote:
> Before I file a bug in Jira on this, I thought I'd ask if this is expected behavior:
> 
> From my project's syscfg.yml:
> UART_0_PIN_TX:
>         description: 'New Pin Assignment'
>         value: 23
>     UART_0_PIN_RX:
>         description: 'New Pin Assignment'
>         value: 24
> 
> Results in newt target config show air_q:
> 
> * Setting: UART_0_PIN_RX
>     * Description: TBD
>     * Value:
>     * Overridden: targets/air_q, default=5
>   * Setting: UART_0_PIN_TX
>     * Description: TBD
>     * Value:
>     * Overridden: targets/air_q, default=6
> 
> So it picks up that the value was overridden, but it doesn't pick up the actual values. It looks like I have to go into hw/bsp/arduino_primo_nrf52/syscfg.yml and change it there for any effect to be seen.

It does look like there is a bug here.  Newt should report an error when
it encounters the syscfg file.  You may already know all this, but for
others' benefit- a syscfg.yml file can do two things:
    1. Define new settings
    2. Override existing settings

You define new settings with the "syscfg.defs" mapping, e.g.,

    syscfg.defs:
        UART_1:
            description: 'Bitbanger UART'
            value:  0

You override existing settings with "syscfg.vals", e.g.,

    syscfg.vals:
        UART_1: 1

That is, the description, value, and other fields are specified at the
point of definition.  When a setting is overridden, only the new value
gets specified.

From your email, it looks like the target's syscfg.yml is redefining
existing settings, which should cause newt to raise an error.  I'll look
into this error reporting issue, but in the meantime, I would change
those UART pin overrides to use the syscfg.vals mapping rather than
syscfg.defs.

Chris