apache / apache/mynewt-core

nRF52 syscfg.restrictions bug

Open
#3,273 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
891
Forks
381
Avg merge
2d 7h
Merged PRs (30d)
14

Description

The nRF52 syscfg (mcu/nordic/nrf52xxx/syscfg.yml) has a load of restrictions on it serial peripherals, e.g. `"!I2C_0 || (I2C_0_PIN_SCL && I2C_0_PIN_SDA)"`, aiming, presumably, the make sure that any enabled peripheral has it required pins configured.

It seems though that the settings are being evaluated numerically, i.e. the default empty string is true, but a value of 0 is false. This means that this setting passes through fine:

```
syscfg.vals:
I2C_0: 1
# I2C_0_PIN_SCL: "" (default)
# I2C_0_PIN_SDA: "" (default)
```

but this will generate an error:

```
syscfg.vals:
I2C_0: 1
I2C_0_PIN_SCL: 0
I2C_0_PIN_SDA: 1
```

I've tried changing the conditions to `"... I2C_0_PIN_SCL != \"\" ..."` with various different quote characters / methods of escaping, but couldn't find anything that tested the condition properly. So someone who knows a bit more about newt internals might have to take a look at it.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Read mcu/nordic/nrf52xxx/syscfg.yml and reproduce the two syscfg.vals examples to inspect how restriction expressions treat empty strings and numeric values. Trace the newt syscfg restriction evaluation, then verify that an enabled I2C peripheral with a pin value of 0 is handled consistently with the intended required-pin checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.