Skip to content

Commit

Permalink
Use syscfg settings for sysinit stage numbers
Browse files Browse the repository at this point in the history
This allows the app or target to rearrange package initialization order
via syscfg overrides.

Note: This requires an updated version of newt
(apache/mynewt-newt#230).  Older versions of
newt fail to parse the updated `pkg.yml` files.
  • Loading branch information
ccollins476ad committed Oct 26, 2018
1 parent 314e434 commit 430f387
Show file tree
Hide file tree
Showing 86 changed files with 497 additions and 69 deletions.
4 changes: 2 additions & 2 deletions boot/boot_serial/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ pkg.cflags.SELFTEST:
- -DBOOT_SERIAL_DETECT_PIN_CFG=0

pkg.init:
boot_serial_os_dev_init: 0
boot_serial_pkg_init: 200
boot_serial_os_dev_init: 'MYNEWT_VAL(BOOT_SERIAL_SYSINIT_STAGE_OS_DEV)'
boot_serial_pkg_init: 'MYNEWT_VAL(BOOT_SERIAL_SYSINIT_STAGE_MAIN)'
11 changes: 11 additions & 0 deletions boot/boot_serial/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,14 @@ syscfg.defs:
- '(BOOT_SERIAL_DETECT_PIN != -1) ||
(BOOT_SERIAL_DETECT_TIMEOUT != 0) ||
(BOOT_SERIAL_NVREG_INDEX != -1)'

BOOT_SERIAL_SYSINIT_STAGE_OS_DEV:
description: >
Sysinit stage for OS device initialization. `os_init()` does not
get called for the boot loader, so this is needed as an
alternative.
value: 0

BOOT_SERIAL_SYSINIT_STAGE_MAIN:
description: Main sysinit stage for serial boot loader functionality.
value: 200
2 changes: 1 addition & 1 deletion boot/split/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pkg.req_apis:
- bootloader

pkg.init:
split_app_init: 500
split_app_init: 'MYNEWT_VAL(SPLIT_APP_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions boot/split/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
SPLIT_APP_SYSINIT_STAGE:
description: >
Sysinit stage for split image functionality.
value: 500
2 changes: 1 addition & 1 deletion crypto/tinycrypt/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ pkg.deps.TINYCRYPT_UECC_RNG_USE_TRNG:
- "@apache-mynewt-core/hw/drivers/trng"

pkg.init.TINYCRYPT_UECC_RNG_USE_TRNG:
mynewt_tinycrypt_pkg_init: 200
mynewt_tinycrypt_pkg_init: 'MYNEWT_VAL(TINYCRYPT_SYSINIT_STAGE)'
5 changes: 5 additions & 0 deletions crypto/tinycrypt/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ syscfg.defs:
description: >
Name of OS device to use as TRNG source.
value: '"trng"'

TINYCRYPT_SYSINIT_STAGE:
description: >
Sysinit stage for tinycrypt.
value: 200
2 changes: 1 addition & 1 deletion fs/fatfs/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ pkg.req_apis:
- stats

pkg.init:
fatfs_pkg_init: 200
fatfs_pkg_init: 'MYNEWT_VAL(FATFS_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions fs/fatfs/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
FATFS_SYSINIT_STAGE:
description: >
Sysinit stage for FATFS functionality.
value: 200
2 changes: 1 addition & 1 deletion fs/nffs/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ pkg.req_apis:
- stats

pkg.init:
nffs_pkg_init: 200
nffs_pkg_init: 'MYNEWT_VAL(NFFS_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions fs/nffs/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ syscfg.defs:
Number of areas to allocate in the NFFS disk. A smaller number is
used if the flash hardware cannot support this value.
value: 8
NFFS_SYSINIT_STAGE:
description: >
Sysinit stage for NFFS functionality.
value: 200
2 changes: 1 addition & 1 deletion hw/battery/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ pkg.req_apis:
- console

pkg.init:
battery_pkg_init: 501
battery_pkg_init: 'MYNEWT_VAL(BATTERY_SYSINIT_STAGE)'
5 changes: 5 additions & 0 deletions hw/battery/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ syscfg.defs:
Maximum number of supported battery properties. Number should
be a minimum multiple of 32 that is grater of supported properties.
value: 32

BATTERY_SYSINIT_STAGE:
description: >
Sysinit stage for battery functionality.
value: 501
2 changes: 1 addition & 1 deletion hw/bsp/nordic_pca20020/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ pkg.deps.LIS2DH12_ONB:
- "@apache-mynewt-core/hw/drivers/sensors/lis2dh12"

pkg.init:
config_lis2dh12_sensor: 400
config_lis2dh12_sensor: 'MYNEWT_VAL(NORDIC_PCA20020_SYSINIT_STAGE)'
5 changes: 5 additions & 0 deletions hw/bsp/nordic_pca20020/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ syscfg.defs:
description: 'NRF52 Thingy onboard lis2dh12 sensor'
value: 0

NORDIC_PCA20020_SYSINIT_STAGE:
description: >
Sysinit stage for the PCA20020 BSP.
value: 400

syscfg.vals:
# Enable nRF52832 MCU
MCU_NRF52832: 1
Expand Down
4 changes: 2 additions & 2 deletions hw/bsp/ruuvitag_rev_b/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ pkg.deps.LIS2DH12_ONB:
- "@apache-mynewt-core/hw/drivers/sensors/lis2dh12"

pkg.init:
config_bme280_sensor: 400
config_lis2dh12_sensor: 400
config_bme280_sensor: 'MYNEWT_VAL(RUUVITAG_REV_B_SYSINIT_STAGE_BME280)'
config_lis2dh12_sensor: 'MYNEWT_VAL(RUUVITAG_REV_B_SYSINIT_STAGE_LIS2DH12)'
11 changes: 11 additions & 0 deletions hw/bsp/ruuvitag_rev_b/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ syscfg.defs:
description: 'Enable RuuviTag onboard LIS2DH12 sensor (rev. B3 and newer)'
value: 0

RUUVITAG_REV_B_SYSINIT_STAGE_BME280:
description: >
Sysinit stage for the Ruuvitag, Rev. B; initializes the BME280
sensor.
value: 400
RUUVITAG_REV_B_SYSINIT_STAGE_LIS2DH12:
description: >
Sysinit stage for the Ruuvitag, Rev. B; initializes the LIS2DH12
sensor.
value: 400

syscfg.vals:
# Enable nRF52832 MCU
MCU_NRF52832: 1
Expand Down
3 changes: 1 addition & 2 deletions hw/charge-control/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ pkg.req_apis:
- console

pkg.init:
charge_control_pkg_init: 501

charge_control_pkg_init: 'MYNEWT_VAL(CHARGE_CONTROL_SYSINIT_STAGE)'
5 changes: 5 additions & 0 deletions hw/charge-control/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ syscfg.defs:
description: >
Specify the eventq to be used by the charge control manager
value:

CHARGE_CONTROL_SYSINIT_STAGE:
description:
Sysinit stage for charge control functionality.
value: 501
2 changes: 1 addition & 1 deletion hw/drivers/bq27z561/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ pkg.deps.BQ27Z561_CLI:
- "@apache-mynewt-core/util/parse"

pkg.init:
bq27z561_pkg_init: 500
bq27z561_pkg_init: 'MYNEWT_VAL(BQ27Z561_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions hw/drivers/bq27z561/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ syscfg.defs:
description: >
Number of OS ticks to wait for each I2C transaction to complete.
value: 6
BQ27Z561_SYSINIT_STAGE:
description: >
Sysinit stage for the BQ27Z561 driver.
value: 500
2 changes: 1 addition & 1 deletion hw/drivers/lwip/stm32_eth/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ pkg.deps.MCU_STM32F7:
pkg.req_apis:

pkg.init:
stm32_eth_open: 240
stm32_eth_open: 'MYNEWT_VAL(STM32_ETH_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions hw/drivers/lwip/stm32_eth/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
STM32_ETH_SYSINIT_STAGE:
description: >
Sysinit stage for the stm32 eth driver.
value: 240
2 changes: 1 addition & 1 deletion hw/sensor/creator/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ pkg.deps.LPS33HW_OFB:
pkg.deps.LPS33THW_OFB:
- "@apache-mynewt-core/hw/drivers/sensors/lps33thw"
pkg.init:
sensor_dev_create: 500
sensor_dev_create: 'MYNEWT_VAL(SENSOR_CREATOR_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions hw/sensor/creator/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ syscfg.defs:
LIS2DS12_OFB:
description: 'LIS2DS12 is present'
value : 0
SENSOR_CREATOR_SYSINIT_STAGE:
description: >
Sysinit stage for the sensor creator package.
value: 500
2 changes: 1 addition & 1 deletion hw/sensor/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ pkg.req_apis:
- console

pkg.init:
sensor_pkg_init: 501
sensor_pkg_init: 'MYNEWT_VAL(SENSOR_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions hw/sensor/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ syscfg.defs:
notification events so that multiple events can be put
on the eventq for processing'
value: 5
SENSOR_SYSINIT_STAGE:
description: >
Sysinit stage for the sensors framework.
value: 501
2 changes: 1 addition & 1 deletion kernel/os/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ pkg.deps.OS_CRASH_LOG:
- "@apache-mynewt-core/sys/reboot"

pkg.init:
os_pkg_init: 0
os_pkg_init: 'MYNEWT_VAL(OS_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions kernel/os/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ syscfg.defs:
Include filename and line number in crash messages. Aids in
debugging, but increases text size.
value: 0
OS_SYSINIT_STAGE:
description: >
Sysinit stage for the Mynewt kernel.
value: 0

syscfg.vals.OS_DEBUG_MODE:
OS_CRASH_STACKTRACE: 1
Expand Down
2 changes: 1 addition & 1 deletion mgmt/imgmgr/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ pkg.deps.IMGMGR_SHELL:
- "@apache-mynewt-core/sys/shell"

pkg.init:
imgmgr_module_init: 500
imgmgr_module_init: 'MYNEWT_VAL(IMGMGR_SYSINIT_STAGE)'
4 changes: 4 additions & 0 deletions mgmt/imgmgr/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ syscfg.defs:
description: >
Send verbose error message in responses.
value: 0
IMGMGR_SYSINIT_STAGE:
description: >
Sysinit stage for image management functionality.
value: 500
2 changes: 1 addition & 1 deletion mgmt/newtmgr/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ pkg.apis:
- newtmgr

pkg.init:
nmgr_pkg_init: 500
nmgr_pkg_init: 'MYNEWT_VAL(NEWTMGR_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions mgmt/newtmgr/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
NEWTMGR_SYSINIT_STAGE:
description: >
Sysinit stage for newtmgr functionality.
value: 500
2 changes: 1 addition & 1 deletion mgmt/newtmgr/transport/ble/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ pkg.deps:
- "@apache-mynewt-nimble/nimble/host"

pkg.init:
newtmgr_ble_pkg_init: 501
newtmgr_ble_pkg_init: 'MYNEWT_VAL(NEWTMGR_BLE_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions mgmt/newtmgr/transport/ble/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
NEWTMGR_BLE_SYSINIT_STAGE:
description: >
Sysinit stage for the BLE newtmgr transport.
value: 501
2 changes: 1 addition & 1 deletion mgmt/newtmgr/transport/nmgr_shell/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pkg.deps:
- "@apache-mynewt-core/mgmt/newtmgr"

pkg.init:
nmgr_shell_pkg_init: 501
nmgr_shell_pkg_init: 'MYNEWT_VAL(NMGR_SHELL_SYSINIT_STAGE)'
24 changes: 24 additions & 0 deletions mgmt/newtmgr/transport/nmgr_shell/syscfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

syscfg.defs:
NMGR_SHELL_SYSINIT_STAGE:
description: >
Sysinit stage for the shell newtmgr transport.
value: 501
2 changes: 1 addition & 1 deletion mgmt/newtmgr/transport/nmgr_uart/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ pkg.deps:
- "@apache-mynewt-core/util/crc"

pkg.init:
nmgr_uart_pkg_init: 501
nmgr_uart_pkg_init: 'MYNEWT_VAL(NMGR_UART_SYSINIT_STAGE)'

0 comments on commit 430f387

Please sign in to comment.