Skip to content

[RFC] API change: Device - Const-ify device driver instances. #24873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Sep 2, 2020

Conversation

tbursztyka
Copy link
Contributor

@tbursztyka tbursztyka commented Apr 30, 2020

This is a fix for #27399

(Part of #22941, take a look if unaware of the device driver model rework)

Making all device instances constant.

Note: ALL checkpatch warnings are due to original code and not from this PR, so nevermind.

@zephyrbot

This comment has been minimized.

@tbursztyka tbursztyka closed this May 1, 2020
@tbursztyka tbursztyka reopened this May 1, 2020
@tbursztyka tbursztyka force-pushed the device_constify branch 2 times, most recently from 367da0b to 4eaf4fc Compare May 4, 2020 09:30
@github-actions github-actions bot added area: ARC ARC Architecture area: ARM ARM (32-bit) Architecture area: Boards area: X86 x86 Architecture (32-bit) has-conflicts Issue/PR has conflicts with another issue/PR and removed has-conflicts Issue/PR has conflicts with another issue/PR labels Jun 29, 2020
@github-actions github-actions bot added the platform: STM32 ST Micro STM32 label Jul 7, 2020
@tbursztyka tbursztyka changed the title [RFC] Const-ify device driver instances. [RFC] API change: Device - Const-ify device driver instances. Jul 14, 2020
tejlmand added a commit to tejlmand/nrfxlib that referenced this pull request Oct 1, 2020
- nrf_security: update mbedtls heap to const struct device

  Zephyr upmerge introduces device bindings const struct as part of:
  zephyrproject-rtos/zephyr#24873

  This const'ify mbedtls_heap.c init function.

- mpls: Added `select MULTITHREADING_LOCK` to Kconfig

  With the changes related to:
  nrfconnect/sdk-nrf#2861
  zephyrproject-rtos/zephyr#27398

  The mpsl clock control is no longer needed, but mpsl still requires
  MULTITHREADING_LOCK, and is therefore moved to its right location.

Signed-off-by: Torsten Rasmussen <[email protected]>
tejlmand added a commit to tejlmand/nrfxlib that referenced this pull request Oct 2, 2020
- nrf_security: update mbedtls heap to const struct device

  Zephyr upmerge introduces device bindings const struct as part of:
  zephyrproject-rtos/zephyr#24873

  This const'ify mbedtls_heap.c init function.

- mpls: Added `select MULTITHREADING_LOCK` to Kconfig

  With the changes related to:
  nrfconnect/sdk-nrf#2861
  zephyrproject-rtos/zephyr#27398

  The mpsl clock control is no longer needed, but mpsl still requires
  MULTITHREADING_LOCK, and is therefore moved to its right location.

- softdevice_controller: Mark 2M and Coded PHY as supported

  These helper configs were introduced in upstream zephyr.

Signed-off-by: Torsten Rasmussen <[email protected]>
Signed-off-by: Rubin Gerritsen <[email protected]>
tejlmand added a commit to tejlmand/fw-nrfconnect-nrf that referenced this pull request Oct 2, 2020
sdk-zephyr: pull/354/head
sdk-mcuboot: pull/120/head
sdk-mcumgr: pull/10/head
sdk-nrfxlib: pull/266/head

Summary of changes needed for this upmerge:

- modules: device: Const-ify all device driver instance pointers.

  See also ttps://github.com/zephyrproject-rtos/zephyr/pull/24873

- jenkins: remove --board-root zephyr/boards

  zephyr/boards are always part of sanity-check and with duplicate board
  checking with: zephyrproject-rtos/zephyr#27549
  this now results in CI failures.

- samples: whitelist -> allow

  sanitycheck: inclusive language

  change whitelist -> allow for all sample.yaml and testcase.yaml files

- scripts: ncs_commands: add hal_quicklogic to _BLOCKED_PROJECTS

  This is a vendor HAL for an SoC family not supported in NCS.

- doc: upmerge changes to docs

  Adjusted `CONFIG_BT_GATT_DIS` -> `CONFIG_BT_DIS` in docs.

- samples: remove GATT infix in conf files for applications and samples

- usb: hid: All hid_ops callbacks get device pointer.

  Updated usb_state.c to new hid_ops callbacks which includes the device
  pointer.

- cmake: bintools elfconvert

  Updated according to new toolchain abstraction.

- partition_manager: cmake: update regex for runner hex file

  The format of the runner yaml has changed. Update the regex used to
  replace the hex_file variable to match it.

Signed-off-by: Håkon Øye Amundsen <[email protected]>
Signed-off-by: Torsten Rasmussen <[email protected]>
tejlmand added a commit to tejlmand/nrfxlib that referenced this pull request Oct 6, 2020
- nrf_security: update mbedtls heap to const struct device

  Zephyr upmerge introduces device bindings const struct as part of:
  zephyrproject-rtos/zephyr#24873

  This const'ify mbedtls_heap.c init function.

- mpls: Added `select MULTITHREADING_LOCK` to Kconfig

  With the changes related to:
  nrfconnect/sdk-nrf#2861
  zephyrproject-rtos/zephyr#27398

  The mpsl clock control is no longer needed, but mpsl still requires
  MULTITHREADING_LOCK, and is therefore moved to its right location.

- softdevice_controller: Mark 2M and Coded PHY as supported

  These helper configs were introduced in upstream zephyr.

Signed-off-by: Torsten Rasmussen <[email protected]>
Signed-off-by: Rubin Gerritsen <[email protected]>
mbolivar-nordic pushed a commit to nrfconnect/sdk-nrfxlib that referenced this pull request Oct 6, 2020
- nrf_security: update mbedtls heap to const struct device

  Zephyr upmerge introduces device bindings const struct as part of:
  zephyrproject-rtos/zephyr#24873

  This const'ify mbedtls_heap.c init function.

- mpls: Added `select MULTITHREADING_LOCK` to Kconfig

  With the changes related to:
  nrfconnect/sdk-nrf#2861
  zephyrproject-rtos/zephyr#27398

  The mpsl clock control is no longer needed, but mpsl still requires
  MULTITHREADING_LOCK, and is therefore moved to its right location.

- softdevice_controller: Mark 2M and Coded PHY as supported

  These helper configs were introduced in upstream zephyr.

Signed-off-by: Torsten Rasmussen <[email protected]>
Signed-off-by: Rubin Gerritsen <[email protected]>
utzig pushed a commit to tejlmand/fw-nrfconnect-nrf that referenced this pull request Oct 6, 2020
sdk-zephyr: a4ead98051404e3b63845d9944b0c689162f1db1 (PR nrfconnect#354)
sdk-mcuboot: ec441e0a700280673e11f4e242ff5de696d4f962 (PR nrfconnect#120)
sdk-mcumgr: b3716c64bde95ea5911a36001fd8f8d4b46eb310 (PR nrfconnect#10)
sdk-nrfxlib: f1dd2ee (PR nrfconnect#266)

Summary of changes needed for this upmerge:

- modules: device: Const-ify all device driver instance pointers.

  See also zephyrproject-rtos/zephyr#24873

- jenkins: remove --board-root zephyr/boards

  zephyr/boards are always part of sanity-check and with duplicate board
  checking with: zephyrproject-rtos/zephyr#27549
  this now results in CI failures.

- samples: whitelist -> allow

  sanitycheck: inclusive language.

  change whitelist -> allow for all sample.yaml and testcase.yaml files.

- scripts: ncs_commands: add hal_quicklogic to _BLOCKED_PROJECTS

  This is a vendor HAL for an SoC family not supported in NCS.

- doc: upmerge changes to docs

  Adjusted `CONFIG_BT_GATT_DIS` -> `CONFIG_BT_DIS` in docs.

- samples: remove GATT infix in conf files for applications and samples

- usb: hid: All hid_ops callbacks get device pointer.

  Updated usb_state.c to new hid_ops callbacks which includes the device
  pointer.

- cmake: bintools elfconvert

  Updated according to new toolchain abstraction.

- partition_manager: cmake: update regex for runner hex file

  The format of the runner yaml has changed. Update the regex used to
  replace the hex_file variable to match it.

- spm: align with updated API for setting irq state

  The API for setting IRQ state has changed.
  Update to align with the new functionailty.

  Ref: NCSDK-6463

- nrf_desktop: using CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y

  Updated nrf_desktop applications to use upstream
  SYSTEM_CLOCK_WAIT_FOR_STABILITY instead of
  CLOCK_CONTROL_NRF_K32SRC_BLOCKING.

- dts/Kconfig: Remove HAS_DTS_I2C

  HAS_DTS_I2C is now selected by I2C and
  always used as I2C && HAS_DTS_I2C.

  It could then be purely removed.

- drivers: mpsl: clock_control: Provide nrfx_clock shim

  Replace clock_control_mpsl with nrfx_clock implementation which is
  using mpsl_clock API. This way standard clock_control driver is
  used and only thin, straightforward nrfx_clock API is replaced with
  implementation which is utilizing mpsl_clock API.

- mpsl: removing clock control in mpsl

- applications: nrf_desktop: Disable mem protection in mcuboot

  Disable HW stack protection in MCUBoot. This seems to cause
  problems as region protection migrates to application and can
  cause faults during kernel initialization.

Signed-off-by: Håkon Øye Amundsen <[email protected]>
Signed-off-by: Torsten Rasmussen <[email protected]>
Signed-off-by: Pawel Dunaj <[email protected]>
Signed-off-by: Krzysztof Chruscinski <[email protected]>
mbolivar-nordic pushed a commit to nrfconnect/sdk-nrf that referenced this pull request Oct 6, 2020
sdk-zephyr: a4ead98051404e3b63845d9944b0c689162f1db1 (PR #354)
sdk-mcuboot: ec441e0a700280673e11f4e242ff5de696d4f962 (PR #120)
sdk-mcumgr: b3716c64bde95ea5911a36001fd8f8d4b46eb310 (PR #10)
sdk-nrfxlib: f1dd2ee (PR #266)

Summary of changes needed for this upmerge:

- modules: device: Const-ify all device driver instance pointers.

  See also zephyrproject-rtos/zephyr#24873

- jenkins: remove --board-root zephyr/boards

  zephyr/boards are always part of sanity-check and with duplicate board
  checking with: zephyrproject-rtos/zephyr#27549
  this now results in CI failures.

- samples: whitelist -> allow

  sanitycheck: inclusive language.

  change whitelist -> allow for all sample.yaml and testcase.yaml files.

- scripts: ncs_commands: add hal_quicklogic to _BLOCKED_PROJECTS

  This is a vendor HAL for an SoC family not supported in NCS.

- doc: upmerge changes to docs

  Adjusted `CONFIG_BT_GATT_DIS` -> `CONFIG_BT_DIS` in docs.

- samples: remove GATT infix in conf files for applications and samples

- usb: hid: All hid_ops callbacks get device pointer.

  Updated usb_state.c to new hid_ops callbacks which includes the device
  pointer.

- cmake: bintools elfconvert

  Updated according to new toolchain abstraction.

- partition_manager: cmake: update regex for runner hex file

  The format of the runner yaml has changed. Update the regex used to
  replace the hex_file variable to match it.

- spm: align with updated API for setting irq state

  The API for setting IRQ state has changed.
  Update to align with the new functionailty.

  Ref: NCSDK-6463

- nrf_desktop: using CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY=y

  Updated nrf_desktop applications to use upstream
  SYSTEM_CLOCK_WAIT_FOR_STABILITY instead of
  CLOCK_CONTROL_NRF_K32SRC_BLOCKING.

- dts/Kconfig: Remove HAS_DTS_I2C

  HAS_DTS_I2C is now selected by I2C and
  always used as I2C && HAS_DTS_I2C.

  It could then be purely removed.

- drivers: mpsl: clock_control: Provide nrfx_clock shim

  Replace clock_control_mpsl with nrfx_clock implementation which is
  using mpsl_clock API. This way standard clock_control driver is
  used and only thin, straightforward nrfx_clock API is replaced with
  implementation which is utilizing mpsl_clock API.

- mpsl: removing clock control in mpsl

- applications: nrf_desktop: Disable mem protection in mcuboot

  Disable HW stack protection in MCUBoot. This seems to cause
  problems as region protection migrates to application and can
  cause faults during kernel initialization.

Signed-off-by: Håkon Øye Amundsen <[email protected]>
Signed-off-by: Torsten Rasmussen <[email protected]>
Signed-off-by: Pawel Dunaj <[email protected]>
Signed-off-by: Krzysztof Chruscinski <[email protected]>
@pabigot pabigot mentioned this pull request Oct 14, 2020
mbolivar-nordic added a commit to mbolivar-nordic/zephyr that referenced this pull request Jun 7, 2021
Pull request zephyrproject-rtos#24873
marked all the struct devices const.

However, the linker scripts were never updated to actually allocate
the struct devices in ROM. They're still in RAM, so the main benefit
of this work has not been realized.

Fix it.

Signed-off-by: Martí Bolívar <[email protected]>
carlescufi pushed a commit that referenced this pull request Jun 9, 2021
Pull request #24873
marked all the struct devices const.

However, the linker scripts were never updated to actually allocate
the struct devices in ROM. They're still in RAM, so the main benefit
of this work has not been realized.

Fix it.

Signed-off-by: Martí Bolívar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARC ARC Architecture area: ARM ARM (32-bit) Architecture area: Boards area: native port Host native arch port (native_sim) area: NIOS2 NIOS2 Architecture area: X86 x86 Architecture (32-bit) area: Xtensa Xtensa Architecture Breaking API Change Breaking changes to stable, public APIs platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.