From edb3ff1bb15cc2ad800010bd2819a9fe4aec548f Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Thu, 15 Jul 2021 17:34:00 -0500 Subject: [PATCH 01/15] feat(boards): Add nice!nano v2 --- app/boards/arm/nice_nano/Kconfig | 2 +- app/boards/arm/nice_nano/Kconfig.board | 4 + app/boards/arm/nice_nano/Kconfig.defconfig | 6 +- app/boards/arm/nice_nano/nice_nano.dts | 95 +---------------- app/boards/arm/nice_nano/nice_nano.dtsi | 100 ++++++++++++++++++ app/boards/arm/nice_nano/nice_nano_v2.dts | 26 +++++ app/boards/arm/nice_nano/nice_nano_v2.yaml | 15 +++ .../arm/nice_nano/nice_nano_v2_defconfig | 20 ++++ 8 files changed, 171 insertions(+), 97 deletions(-) create mode 100644 app/boards/arm/nice_nano/nice_nano.dtsi create mode 100644 app/boards/arm/nice_nano/nice_nano_v2.dts create mode 100644 app/boards/arm/nice_nano/nice_nano_v2.yaml create mode 100644 app/boards/arm/nice_nano/nice_nano_v2_defconfig diff --git a/app/boards/arm/nice_nano/Kconfig b/app/boards/arm/nice_nano/Kconfig index fb5537ab..0c9fbc79 100644 --- a/app/boards/arm/nice_nano/Kconfig +++ b/app/boards/arm/nice_nano/Kconfig @@ -4,4 +4,4 @@ config BOARD_ENABLE_DCDC bool "Enable DCDC mode" select SOC_DCDC_NRF52X default y - depends on BOARD_NICE_NANO + depends on (BOARD_NICE_NANO || BOARD_NICE_NANO_V2) diff --git a/app/boards/arm/nice_nano/Kconfig.board b/app/boards/arm/nice_nano/Kconfig.board index 4fd394f4..4a80b448 100644 --- a/app/boards/arm/nice_nano/Kconfig.board +++ b/app/boards/arm/nice_nano/Kconfig.board @@ -7,3 +7,7 @@ config BOARD_NICE_NANO bool "nice!nano" depends on SOC_NRF52840_QIAA +config BOARD_NICE_NANO_V2 + bool "nice!nano v2" + depends on SOC_NRF52840_QIAA + diff --git a/app/boards/arm/nice_nano/Kconfig.defconfig b/app/boards/arm/nice_nano/Kconfig.defconfig index 205050af..0728bf00 100644 --- a/app/boards/arm/nice_nano/Kconfig.defconfig +++ b/app/boards/arm/nice_nano/Kconfig.defconfig @@ -1,7 +1,7 @@ -# Copyright (c) 2020 Pete Johanson +# Copyright (c) 2021 The ZMK Contributors # SPDX-License-Identifier: MIT -if BOARD_NICE_NANO +if BOARD_NICE_NANO || BOARD_NICE_NANO_V2 config BOARD default "nice_nano" @@ -28,4 +28,4 @@ config ZMK_USB config ZMK_BATTERY_VOLTAGE_DIVIDER default y -endif # BOARD_NICE_NANO +endif # BOARD_NICE_NANO || BOARD_NICE_NANO_V2 diff --git a/app/boards/arm/nice_nano/nice_nano.dts b/app/boards/arm/nice_nano/nice_nano.dts index 5efde4b2..cce3dba6 100644 --- a/app/boards/arm/nice_nano/nice_nano.dts +++ b/app/boards/arm/nice_nano/nice_nano.dts @@ -1,31 +1,13 @@ /* - * Copyright (c) 2020 Pete Johanson + * Copyright (c) 2021 The ZMK Contributors * * SPDX-License-Identifier: MIT */ /dts-v1/; -#include -#include "arduino_pro_micro_pins.dtsi" +#include "nice_nano.dtsi" / { - model = "nice!nano"; - compatible = "nice,nano"; - - chosen { - zephyr,code-partition = &code_partition; - zephyr,sram = &sram0; - zephyr,flash = &flash0; - }; - - leds { - compatible = "gpio-leds"; - blue_led: led_0 { - gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; - label = "Blue LED"; - }; - }; - ext-power { compatible = "zmk,ext-power-generic"; label = "EXT_POWER"; @@ -40,76 +22,3 @@ full-ohms = <(2000000 + 806000)>; }; }; - -&adc { - status = "okay"; -}; - -&gpiote { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&i2c0 { - compatible = "nordic,nrf-twi"; - sda-pin = <17>; - scl-pin = <20>; -}; - -&uart0 { - compatible = "nordic,nrf-uarte"; - tx-pin = <6>; - rx-pin = <8>; -}; - -&usbd { - status = "okay"; -}; - - -&flash0 { - /* - * For more information, see: - * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html - */ - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - sd_partition: partition@0 { - label = "softdevice"; - reg = <0x00000000 0x00026000>; - }; - code_partition: partition@26000 { - label = "code_partition"; - reg = <0x00026000 0x000c6000>; - }; - - /* - * The flash starting at 0x000ec000 and ending at - * 0x000f3fff is reserved for use by the application. - */ - - /* - * Storage partition will be used by FCB/LittleFS/NVS - * if enabled. - */ - storage_partition: partition@ec000 { - label = "storage"; - reg = <0x000ec000 0x00008000>; - }; - - boot_partition: partition@f4000 { - label = "adafruit_boot"; - reg = <0x000f4000 0x0000c000>; - }; - }; -}; diff --git a/app/boards/arm/nice_nano/nice_nano.dtsi b/app/boards/arm/nice_nano/nice_nano.dtsi new file mode 100644 index 00000000..45f0e31d --- /dev/null +++ b/app/boards/arm/nice_nano/nice_nano.dtsi @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "nice!nano"; + compatible = "nice,nano"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + sda-pin = <17>; + scl-pin = <20>; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + tx-pin = <6>; + rx-pin = <8>; +}; + +&usbd { + status = "okay"; +}; + + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "softdevice"; + reg = <0x00000000 0x00026000>; + }; + code_partition: partition@26000 { + label = "code_partition"; + reg = <0x00026000 0x000c6000>; + }; + + /* + * The flash starting at 0x000ec000 and ending at + * 0x000f3fff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@ec000 { + label = "storage"; + reg = <0x000ec000 0x00008000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; +}; diff --git a/app/boards/arm/nice_nano/nice_nano_v2.dts b/app/boards/arm/nice_nano/nice_nano_v2.dts new file mode 100644 index 00000000..7c044b4d --- /dev/null +++ b/app/boards/arm/nice_nano/nice_nano_v2.dts @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include "nice_nano.dtsi" + +/ { + ext-power { + compatible = "zmk,ext-power-generic"; + label = "EXT_POWER"; + control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + init-delay-ms = <10>; + }; + + vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc (0x0D - 1)>; + // Multiply ADC result by 5 + full-ohms = <5>; + output-ohms = <1>; + }; +}; diff --git a/app/boards/arm/nice_nano/nice_nano_v2.yaml b/app/boards/arm/nice_nano/nice_nano_v2.yaml new file mode 100644 index 00000000..d050ce99 --- /dev/null +++ b/app/boards/arm/nice_nano/nice_nano_v2.yaml @@ -0,0 +1,15 @@ +identifier: nice_nano_v2 +name: nice!nano v2 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/nice_nano/nice_nano_v2_defconfig b/app/boards/arm/nice_nano/nice_nano_v2_defconfig new file mode 100644 index 00000000..d061e389 --- /dev/null +++ b/app/boards/arm/nice_nano/nice_nano_v2_defconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_NICE_NANO_V2=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y + +CONFIG_MPU_ALLOW_FLASH_WRITE=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y +CONFIG_FLASH=y +CONFIG_FLASH_PAGE_LAYOUT=y +CONFIG_FLASH_MAP=y \ No newline at end of file From 9c1319c4ff37f71e7437219b0f65d045c6971e93 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Thu, 15 Jul 2021 17:16:33 -0500 Subject: [PATCH 02/15] feat(docs): Add nice!nano v2 to scripts, actions, and documentation asdf asdf asdf --- .github/workflows/build.yml | 5 +++-- docs/docs/hardware.md | 2 +- docs/src/data/power.js | 11 ++++++++++- docs/static/setup.ps1 | 4 ++-- docs/static/setup.sh | 9 +++++---- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d7011283..9345c3c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: board: - bluemicro840_v1 - nice_nano + - nice_nano_v2 - nrfmicro_13 - proton_c shield: @@ -69,11 +70,11 @@ jobs: - board: planck_rev6 - board: proton_c shield: clueboard_california - - board: nice_nano + - board: nice_nano_v2 shield: kyria_left cmake-args: -DCONFIG_ZMK_DISPLAY=y skip-archive: true - - board: nice_nano + - board: nice_nano_v2 shield: kyria_right cmake-args: -DCONFIG_ZMK_DISPLAY=y skip-archive: true diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md index 797acd02..210587b3 100644 --- a/docs/docs/hardware.md +++ b/docs/docs/hardware.md @@ -15,7 +15,7 @@ That being said, there are currently only a few specific [boards](/docs/faq#what ## Boards -- [nice!nano](https://nicekeyboards.com/products/nice-nano-v1-0) (`nice_nano`) +- [nice!nano](https://nicekeyboards.com/nice-nano) (`nice_nano`, `nice_nano_v2`) - [nrfMicro](https://github.com/joric/nrfmicro) (`nrfmicro_13`, `nrfmicro_11`, `nrfmicro_11_flipped`) - [BlueMicro840](https://store.jpconstantineau.com/#/group/bluemicro) (`bluemicro840_v1`) - [QMK Proton-C](https://qmk.fm/proton-c/) (`proton_c`) diff --git a/docs/src/data/power.js b/docs/src/data/power.js index bf34f17d..5fe5912c 100644 --- a/docs/src/data/power.js +++ b/docs/src/data/power.js @@ -37,7 +37,7 @@ export const zmkBase = { */ export const zmkBoards = { "nice!nano": { - name: "nice!nano", + name: "nice!nano v1", powerSupply: { type: "LDO", outputVoltage: 3.3, @@ -45,6 +45,15 @@ export const zmkBoards = { }, otherQuiescentMicroA: 4, }, + "nice!nano v2": { + name: "nice!nano v2", + powerSupply: { + type: "LDO", + outputVoltage: 3.3, + quiescentMicroA: 15, + }, + otherQuiescentMicroA: 3, + }, "nice!60": { powerSupply: { type: "SWITCHING", diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1 index bcea9f7a..307b402f 100644 --- a/docs/static/setup.ps1 +++ b/docs/static/setup.ps1 @@ -75,8 +75,8 @@ $repo_path = "https://github.com/zmkfirmware/zmk-config-split-template.git" $title = "ZMK Config Setup:" $prompt = "Pick an MCU board" -$options = "nice!nano", "QMK Proton-C", "BlueMicro840 (v1)", "makerdiary nRF52840 M.2" -$boards = "nice_nano", "proton_c", "bluemicro840_v1", "nrf52840_m2" +$options = "nice!nano v1", "nice!nano v2", "QMK Proton-C", "BlueMicro840 (v1)", "makerdiary nRF52840 M.2" +$boards = "nice_nano", "nice_nano_v2", "proton_c", "bluemicro840_v1", "nrf52840_m2" Write-Host "$title" Write-Host "" diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 2078ff3e..88949f39 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -66,7 +66,7 @@ repo_path="https://github.com/zmkfirmware/zmk-config-split-template.git" title="ZMK Config Setup:" prompt="Pick an MCU board:" -options=("nice!nano" "QMK Proton-C" "BlueMicro840 (v1)" "makerdiary nRF52840 M.2") +options=("nice!nano v1" "nice!nano v2" "QMK Proton-C" "BlueMicro840 (v1)" "makerdiary nRF52840 M.2") echo "$title" echo "" @@ -77,9 +77,10 @@ select opt in "${options[@]}" "Quit"; do case "$REPLY" in 1 ) board="nice_nano"; break;; - 2 ) board="proton_c"; break;; - 3 ) board="bluemicro840_v1"; break;; - 4 ) board="nrf52840_m2"; break;; + 2 ) board="nice_nano_v2" break;; + 3 ) board="proton_c"; break;; + 4 ) board="bluemicro840_v1"; break;; + 5 ) board="nrf52840_m2"; break;; $(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;; *) echo "Invalid option. Try another one."; continue;; From 71a85a0c8eeef8d5482ee06f7e06bf35cabbbf9b Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 10:56:48 +0100 Subject: [PATCH 03/15] feat: bump `zephyr` to `v2.5.0+zmk-fixes` PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/west.yml b/app/west.yml index ca5efad2..cab02a5a 100644 --- a/app/west.yml +++ b/app/west.yml @@ -9,7 +9,7 @@ manifest: projects: - name: zephyr remote: zmkfirmware - revision: v2.4.0+zmk-fixes + revision: v2.5.0+zmk-fixes clone-depth: 1 import: # TODO: Rename once upstream offers option like `exclude` or `denylist` From ad981c3bbda0c2f047b6387c41d4b02dd30508e7 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 10:57:33 +0100 Subject: [PATCH 04/15] refactor(core): update power API to Zephyr v2.5.0 See: https://github.com/zephyrproject-rtos/zephyr/pull/29410 PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/Kconfig | 5 +---- app/src/power.c | 14 ++++---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index d83561b7..f4a316b4 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -263,11 +263,8 @@ config ZMK_SLEEP if ZMK_SLEEP -config SYS_POWER_DEEP_SLEEP_STATES - default y - choice SYS_PM_POLICY - default SYS_PM_POLICY_APP + default PM_POLICY_APP endchoice config DEVICE_POWER_MANAGEMENT diff --git a/app/src/power.c b/app/src/power.c index 4af18cf4..47ef3a3b 100644 --- a/app/src/power.c +++ b/app/src/power.c @@ -23,18 +23,12 @@ bool is_usb_power_present() { #endif /* CONFIG_USB */ } -enum power_states sys_pm_policy_next_state(int32_t ticks) { -#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES -#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 +struct pm_state_info pm_policy_next_state(int32_t ticks) { if (zmk_activity_get_state() == ZMK_ACTIVITY_SLEEP && !is_usb_power_present()) { - return SYS_POWER_STATE_DEEP_SLEEP_1; + return (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0}; } -#endif /* CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1 */ -#endif /* CONFIG_SYS_POWER_DEEP_SLEEP_STATES */ - return SYS_POWER_STATE_ACTIVE; + return (struct pm_state_info){PM_STATE_ACTIVE, 0, 0}; } -bool sys_pm_policy_low_power_devices(enum power_states pm_state) { - return sys_pm_is_sleep_state(pm_state); -} \ No newline at end of file +__weak bool pm_policy_low_power_devices(enum pm_state state) { return pm_is_sleep_state(state); } From 2a69f31eb0d3af1290152afb1517142100b3316d Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 22 Mar 2021 10:31:55 -0400 Subject: [PATCH 05/15] refactor(core): Move away from deprecated DT API. * Move to `DEVICE_DT_INST_DEFINE` everywhere. See: https://docs.zephyrproject.org/2.5.0/releases/release-notes-2.5.html#deprecated-in-this-release PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/drivers/kscan/kscan_composite.c | 6 +++--- app/drivers/kscan/kscan_gpio_demux.c | 6 +++--- app/drivers/kscan/kscan_gpio_direct.c | 6 +++--- app/drivers/kscan/kscan_gpio_matrix.c | 6 +++--- app/drivers/kscan/kscan_mock.c | 6 +++--- .../battery_voltage_divider/battery_voltage_divider.c | 4 ++-- app/drivers/sensor/ec11/ec11.c | 6 +++--- app/src/behaviors/behavior_bt.c | 6 +++--- app/src/behaviors/behavior_ext_power.c | 4 ++-- app/src/behaviors/behavior_hold_tap.c | 8 ++++---- app/src/behaviors/behavior_key_press.c | 6 +++--- app/src/behaviors/behavior_mod_morph.c | 9 +++++---- app/src/behaviors/behavior_momentary_layer.c | 6 +++--- app/src/behaviors/behavior_none.c | 6 +++--- app/src/behaviors/behavior_outputs.c | 4 ++-- app/src/behaviors/behavior_reset.c | 6 +++--- app/src/behaviors/behavior_rgb_underglow.c | 6 +++--- app/src/behaviors/behavior_sensor_rotate_key_press.c | 7 +++---- app/src/behaviors/behavior_sticky_key.c | 6 +++--- app/src/behaviors/behavior_to_layer.c | 4 ++-- app/src/behaviors/behavior_toggle_layer.c | 6 +++--- app/src/behaviors/behavior_transparent.c | 7 +++---- app/src/ext_power_generic.c | 10 ++-------- 23 files changed, 67 insertions(+), 74 deletions(-) diff --git a/app/drivers/kscan/kscan_composite.c b/app/drivers/kscan/kscan_composite.c index d699cfa8..2aeb047c 100644 --- a/app/drivers/kscan/kscan_composite.c +++ b/app/drivers/kscan/kscan_composite.c @@ -108,6 +108,6 @@ static const struct kscan_composite_config kscan_composite_config = {}; static struct kscan_composite_data kscan_composite_data; -DEVICE_AND_API_INIT(kscan_composite, DT_INST_LABEL(0), kscan_composite_init, &kscan_composite_data, - &kscan_composite_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &mock_driver_api); +DEVICE_DT_INST_DEFINE(0, kscan_composite_init, device_pm_control_nop, &kscan_composite_data, + &kscan_composite_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &mock_driver_api); diff --git a/app/drivers/kscan/kscan_gpio_demux.c b/app/drivers/kscan/kscan_gpio_demux.c index 06a5d277..3f22797e 100644 --- a/app/drivers/kscan/kscan_gpio_demux.c +++ b/app/drivers/kscan/kscan_gpio_demux.c @@ -248,9 +248,9 @@ struct kscan_gpio_item_config { .cols = {UTIL_LISTIFY(INST_DEMUX_GPIOS(n), _KSCAN_GPIO_OUTPUT_CFG_INIT, n)}, \ }; \ \ - DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \ - &kscan_gpio_data_##n, &kscan_gpio_config_##n, APPLICATION, \ - CONFIG_APPLICATION_INIT_PRIORITY, &gpio_driver_api_##n); + DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \ + &kscan_gpio_config_##n, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, \ + &gpio_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT) diff --git a/app/drivers/kscan/kscan_gpio_direct.c b/app/drivers/kscan/kscan_gpio_direct.c index b68e4fc5..d810881b 100644 --- a/app/drivers/kscan/kscan_gpio_direct.c +++ b/app/drivers/kscan/kscan_gpio_direct.c @@ -238,9 +238,9 @@ static const struct kscan_driver_api gpio_driver_api = { .inputs = {UTIL_LISTIFY(INST_INPUT_LEN(n), KSCAN_DIRECT_INPUT_ITEM, n)}, \ .num_of_inputs = INST_INPUT_LEN(n), \ .debounce_period = DT_INST_PROP(n, debounce_period)}; \ - DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \ - &kscan_gpio_data_##n, &kscan_gpio_config_##n, POST_KERNEL, \ - CONFIG_ZMK_KSCAN_INIT_PRIORITY, &gpio_driver_api); + DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \ + &kscan_gpio_config_##n, POST_KERNEL, CONFIG_ZMK_KSCAN_INIT_PRIORITY, \ + &gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT) diff --git a/app/drivers/kscan/kscan_gpio_matrix.c b/app/drivers/kscan/kscan_gpio_matrix.c index 9af3171a..69859538 100644 --- a/app/drivers/kscan/kscan_gpio_matrix.c +++ b/app/drivers/kscan/kscan_gpio_matrix.c @@ -298,9 +298,9 @@ static int kscan_gpio_config_interrupts(const struct device **devices, .rows = {UTIL_LISTIFY(INST_MATRIX_ROWS(n), _KSCAN_GPIO_ROW_CFG_INIT, n)}, \ .cols = {UTIL_LISTIFY(INST_MATRIX_COLS(n), _KSCAN_GPIO_COL_CFG_INIT, n)}, \ }; \ - DEVICE_AND_API_INIT(kscan_gpio_##n, DT_INST_LABEL(n), kscan_gpio_init_##n, \ - &kscan_gpio_data_##n, &kscan_gpio_config_##n, APPLICATION, \ - CONFIG_APPLICATION_INIT_PRIORITY, &gpio_driver_api_##n); + DEVICE_DT_INST_DEFINE(n, kscan_gpio_init_##n, device_pm_control_nop, &kscan_gpio_data_##n, \ + &kscan_gpio_config_##n, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, \ + &gpio_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(GPIO_INST_INIT) diff --git a/app/drivers/kscan/kscan_mock.c b/app/drivers/kscan/kscan_mock.c index fc0c9c5f..8d1545cc 100644 --- a/app/drivers/kscan/kscan_mock.c +++ b/app/drivers/kscan/kscan_mock.c @@ -88,8 +88,8 @@ static int kscan_mock_configure(const struct device *dev, kscan_callback_t callb static struct kscan_mock_data kscan_mock_data_##n; \ static const struct kscan_mock_config_##n kscan_mock_config_##n = { \ .events = DT_INST_PROP(n, events), .exit_after = DT_INST_PROP(n, exit_after)}; \ - DEVICE_AND_API_INIT(kscan_mock_##n, DT_INST_LABEL(n), kscan_mock_init_##n, \ - &kscan_mock_data_##n, &kscan_mock_config_##n, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &mock_driver_api_##n); + DEVICE_DT_INST_DEFINE(n, kscan_mock_init_##n, device_pm_control_nop, &kscan_mock_data_##n, \ + &kscan_mock_config_##n, APPLICATION, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &mock_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(MOCK_INST_INIT) diff --git a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c index c56dab6b..9efd7fbd 100644 --- a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c +++ b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c @@ -217,5 +217,5 @@ static const struct bvd_config bvd_cfg = { .full_ohm = DT_INST_PROP(0, full_ohms), }; -DEVICE_AND_API_INIT(bvd_dev, DT_INST_LABEL(0), &bvd_init, &bvd_data, &bvd_cfg, POST_KERNEL, - CONFIG_SENSOR_INIT_PRIORITY, &bvd_api); +DEVICE_DT_INST_DEFINE(0, &bvd_init, device_pm_control_nop, &bvd_data, &bvd_cfg, POST_KERNEL, + CONFIG_SENSOR_INIT_PRIORITY, &bvd_api); diff --git a/app/drivers/sensor/ec11/ec11.c b/app/drivers/sensor/ec11/ec11.c index 38a0578d..14ccc91b 100644 --- a/app/drivers/sensor/ec11/ec11.c +++ b/app/drivers/sensor/ec11/ec11.c @@ -142,7 +142,7 @@ int ec11_init(const struct device *dev) { .b_flags = DT_INST_GPIO_FLAGS(n, b_gpios), \ COND_CODE_0(DT_INST_NODE_HAS_PROP(n, resolution), (1), (DT_INST_PROP(n, resolution))), \ }; \ - DEVICE_AND_API_INIT(ec11_##n, DT_INST_LABEL(n), ec11_init, &ec11_data_##n, &ec11_cfg_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &ec11_driver_api); + DEVICE_DT_INST_DEFINE(n, ec11_init, device_pm_control_nop, &ec11_data_##n, &ec11_cfg_##n, \ + POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &ec11_driver_api); -DT_INST_FOREACH_STATUS_OKAY(EC11_INST) \ No newline at end of file +DT_INST_FOREACH_STATUS_OKAY(EC11_INST) diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c index 9a171e0f..8f7dac94 100644 --- a/app/src/behaviors/behavior_bt.c +++ b/app/src/behaviors/behavior_bt.c @@ -49,7 +49,7 @@ static const struct behavior_driver_api behavior_bt_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_bt, DT_INST_LABEL(0), behavior_bt_init, NULL, NULL, APPLICATION, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_bt_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api); -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_ext_power.c b/app/src/behaviors/behavior_ext_power.c index 3ce1e747..fdd890c9 100644 --- a/app/src/behaviors/behavior_ext_power.c +++ b/app/src/behaviors/behavior_ext_power.c @@ -73,7 +73,7 @@ static const struct behavior_driver_api behavior_ext_power_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_ext_power, DT_INST_LABEL(0), behavior_ext_power_init, NULL, NULL, - APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index 0b6b587f..02ca5e3a 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -605,10 +605,10 @@ static struct behavior_hold_tap_data behavior_hold_tap_data; .flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \ .retro_tap = DT_INST_PROP(n, retro_tap), \ }; \ - DEVICE_AND_API_INIT(behavior_hold_tap_##n, DT_INST_LABEL(n), behavior_hold_tap_init, \ - &behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, device_pm_control_nop, \ + &behavior_hold_tap_data, &behavior_hold_tap_config_##n, APPLICATION, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_hold_tap_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_key_press.c b/app/src/behaviors/behavior_key_press.c index 8282977e..b8d765c7 100644 --- a/app/src/behaviors/behavior_key_press.c +++ b/app/src/behaviors/behavior_key_press.c @@ -36,8 +36,8 @@ static const struct behavior_driver_api behavior_key_press_driver_api = { .binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released}; #define KP_INST(n) \ - DEVICE_AND_API_INIT(behavior_key_press_##n, DT_INST_LABEL(n), behavior_key_press_init, NULL, \ - NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &behavior_key_press_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, device_pm_control_nop, NULL, NULL, \ + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_key_press_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_mod_morph.c b/app/src/behaviors/behavior_mod_morph.c index 36d109b8..9d6eac17 100644 --- a/app/src/behaviors/behavior_mod_morph.c +++ b/app/src/behaviors/behavior_mod_morph.c @@ -90,10 +90,11 @@ static int behavior_mod_morph_init(const struct device *dev) { return 0; } .mods = DT_INST_PROP(n, mods), \ }; \ static struct behavior_mod_morph_data behavior_mod_morph_data_##n = {}; \ - DEVICE_AND_API_INIT(behavior_mod_morph_##n, DT_INST_LABEL(n), behavior_mod_morph_init, \ - &behavior_mod_morph_data_##n, &behavior_mod_morph_config_##n, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mod_morph_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_mod_morph_init, device_pm_control_nop, \ + &behavior_mod_morph_data_##n, &behavior_mod_morph_config_##n, \ + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_mod_morph_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) -#endif \ No newline at end of file +#endif diff --git a/app/src/behaviors/behavior_momentary_layer.c b/app/src/behaviors/behavior_momentary_layer.c index 2b0206d0..8259b6c7 100644 --- a/app/src/behaviors/behavior_momentary_layer.c +++ b/app/src/behaviors/behavior_momentary_layer.c @@ -39,6 +39,6 @@ static const struct behavior_mo_config behavior_mo_config = {}; static struct behavior_mo_data behavior_mo_data; -DEVICE_AND_API_INIT(behavior_mo, DT_INST_LABEL(0), behavior_mo_init, &behavior_mo_data, - &behavior_mo_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &behavior_mo_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_mo_init, device_pm_control_nop, &behavior_mo_data, + &behavior_mo_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &behavior_mo_driver_api); diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c index 8b6172ff..93c1d1af 100644 --- a/app/src/behaviors/behavior_none.c +++ b/app/src/behaviors/behavior_none.c @@ -34,7 +34,7 @@ static const struct behavior_driver_api behavior_none_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_none, DT_INST_LABEL(0), behavior_none_init, NULL, NULL, APPLICATION, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_none_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api); -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_outputs.c b/app/src/behaviors/behavior_outputs.c index ccaa7200..f56468a1 100644 --- a/app/src/behaviors/behavior_outputs.c +++ b/app/src/behaviors/behavior_outputs.c @@ -42,7 +42,7 @@ static const struct behavior_driver_api behavior_outputs_driver_api = { .binding_pressed = on_keymap_binding_pressed, }; -DEVICE_AND_API_INIT(behavior_out, DT_INST_LABEL(0), behavior_out_init, NULL, NULL, APPLICATION, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_out_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index 95363512..e19cf329 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -41,9 +41,9 @@ static const struct behavior_driver_api behavior_reset_driver_api = { #define RST_INST(n) \ static const struct behavior_reset_config behavior_reset_config_##n = { \ .type = DT_INST_PROP(n, type)}; \ - DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, NULL, \ - &behavior_reset_config_##n, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_reset_init, device_pm_control_nop, NULL, \ + &behavior_reset_config_##n, APPLICATION, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api); DT_INST_FOREACH_STATUS_OKAY(RST_INST) diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c index 79592cac..0243b54b 100644 --- a/app/src/behaviors/behavior_rgb_underglow.c +++ b/app/src/behaviors/behavior_rgb_underglow.c @@ -136,8 +136,8 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_rgb_underglow, DT_INST_LABEL(0), behavior_rgb_underglow_init, NULL, - NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &behavior_rgb_underglow_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, device_pm_control_nop, NULL, NULL, + APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &behavior_rgb_underglow_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c index 589a3a57..c5b5a3f0 100644 --- a/app/src/behaviors/behavior_sensor_rotate_key_press.c +++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c @@ -59,10 +59,9 @@ static const struct behavior_driver_api behavior_sensor_rotate_key_press_driver_ .sensor_binding_triggered = on_sensor_binding_triggered}; #define KP_INST(n) \ - DEVICE_AND_API_INIT(behavior_sensor_rotate_key_press_##n, DT_INST_LABEL(n), \ - behavior_sensor_rotate_key_press_init, NULL, NULL, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &behavior_sensor_rotate_key_press_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_sensor_rotate_key_press_init, device_pm_control_nop, NULL, \ + NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + &behavior_sensor_rotate_key_press_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index 40ca3f89..825ec7a6 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -272,9 +272,9 @@ static struct behavior_sticky_key_data behavior_sticky_key_data; .release_after_ms = DT_INST_PROP(n, release_after_ms), \ .quick_release = DT_INST_PROP(n, quick_release), \ }; \ - DEVICE_AND_API_INIT(behavior_sticky_key_##n, DT_INST_LABEL(n), behavior_sticky_key_init, \ - &behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api); + DEVICE_DT_INST_DEFINE(n, behavior_sticky_key_init, device_pm_control_nop, \ + &behavior_sticky_key_data, &behavior_sticky_key_config_##n, APPLICATION, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_sticky_key_driver_api); DT_INST_FOREACH_STATUS_OKAY(KP_INST) diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c index e68736ef..a1707fc3 100644 --- a/app/src/behaviors/behavior_to_layer.c +++ b/app/src/behaviors/behavior_to_layer.c @@ -37,7 +37,7 @@ static const struct behavior_driver_api behavior_to_driver_api = { .binding_released = to_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_to, DT_INST_LABEL(0), behavior_to_init, NULL, NULL, APPLICATION, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_to_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_to_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c index c922634d..384f978a 100644 --- a/app/src/behaviors/behavior_toggle_layer.c +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -43,8 +43,8 @@ static const struct behavior_tog_config behavior_tog_config = {}; static struct behavior_tog_data behavior_tog_data; -DEVICE_AND_API_INIT(behavior_tog, DT_INST_LABEL(0), behavior_tog_init, &behavior_tog_data, - &behavior_tog_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &behavior_tog_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_tog_init, device_pm_control_nop, &behavior_tog_data, + &behavior_tog_config, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + &behavior_tog_driver_api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c index e9d49b21..9d4f0dd7 100644 --- a/app/src/behaviors/behavior_transparent.c +++ b/app/src/behaviors/behavior_transparent.c @@ -34,8 +34,7 @@ static const struct behavior_driver_api behavior_transparent_driver_api = { .binding_released = on_keymap_binding_released, }; -DEVICE_AND_API_INIT(behavior_transparent, DT_INST_LABEL(0), behavior_transparent_init, NULL, NULL, - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &behavior_transparent_driver_api); +DEVICE_DT_INST_DEFINE(0, behavior_transparent_init, device_pm_control_nop, NULL, NULL, APPLICATION, + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_transparent_driver_api); -#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ \ No newline at end of file +#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index 1f2e0d79..7464d428 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -231,13 +231,7 @@ static const struct ext_power_api api = {.enable = ext_power_generic_enable, #define ZMK_EXT_POWER_INIT_PRIORITY 81 -#ifdef CONFIG_DEVICE_POWER_MANAGEMENT -DEVICE_DEFINE(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, - &ext_power_generic_pm_control, &data, &config, POST_KERNEL, - ZMK_EXT_POWER_INIT_PRIORITY, &api); -#else -DEVICE_AND_API_INIT(ext_power_generic, DT_INST_LABEL(0), ext_power_generic_init, &data, &config, - POST_KERNEL, ZMK_EXT_POWER_INIT_PRIORITY, &api); -#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */ +DEVICE_DT_INST_DEFINE(0, ext_power_generic_init, &ext_power_generic_pm_control, &data, &config, + POST_KERNEL, ZMK_EXT_POWER_INIT_PRIORITY, &api); #endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */ From 6c23bb5c117edddb4a1321c63dfc641d013687b1 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 22 Mar 2021 15:13:06 -0400 Subject: [PATCH 06/15] fix(tests): Revert default to previous formatter. * new cbprintf formatter causes issues for our use of string formatting. See: https://github.com/zephyrproject-rtos/zephyr/pull/29876 PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Kconfig b/app/Kconfig index f4a316b4..68363d51 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -419,6 +419,11 @@ config ZMK_WPM config SENSOR default y +choice CBPRINTF_IMPLEMENTATION + default CBPRINTF_NANO + +endchoice + module = ZMK module-str = zmk source "subsys/logging/Kconfig.template.log_config" From d7475f792fd08a4a1d8fa011526284e979ff039a Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 22 Mar 2021 13:53:11 -0400 Subject: [PATCH 07/15] fix(boards): Enable pinmux for bdn9_rev2 by default. See: https://github.com/zephyrproject-rtos/zephyr/issues/28999 PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/boards/arm/bdn9/bdn9_rev2_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/boards/arm/bdn9/bdn9_rev2_defconfig b/app/boards/arm/bdn9/bdn9_rev2_defconfig index 139cf853..91f54eb4 100644 --- a/app/boards/arm/bdn9/bdn9_rev2_defconfig +++ b/app/boards/arm/bdn9/bdn9_rev2_defconfig @@ -11,6 +11,9 @@ CONFIG_FPU=y # enable GPIO CONFIG_GPIO=y +# Enable pinmux +CONFIG_PINMUX=y + # Needed to reduce this to size that will fit on F072 CONFIG_HEAP_MEM_POOL_SIZE=1024 From b2d64fe598d562af13ece92deb555af2e2498eaa Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Wed, 24 Mar 2021 21:54:41 -0400 Subject: [PATCH 08/15] refactor(boards): Switch proton_c to newer pinmux approach. See: https://github.com/zephyrproject-rtos/zephyr/issues/28999 PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/boards/arm/proton_c/CMakeLists.txt | 7 -- .../arm/proton_c/arduino_pro_micro_pins.dtsi | 2 +- app/boards/arm/proton_c/pinmux.c | 67 ------------------- app/boards/arm/proton_c/proton_c.dts | 13 ++++ 4 files changed, 14 insertions(+), 75 deletions(-) delete mode 100644 app/boards/arm/proton_c/CMakeLists.txt delete mode 100644 app/boards/arm/proton_c/pinmux.c diff --git a/app/boards/arm/proton_c/CMakeLists.txt b/app/boards/arm/proton_c/CMakeLists.txt deleted file mode 100644 index 940af1fe..00000000 --- a/app/boards/arm/proton_c/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: MIT - -if(CONFIG_PINMUX) -zephyr_library() -zephyr_library_sources(pinmux.c) -zephyr_library_include_directories(${ZEPHYR_BASE}/drivers) -endif() diff --git a/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi b/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi index 9b2a4757..2c32319e 100644 --- a/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi +++ b/app/boards/arm/proton_c/arduino_pro_micro_pins.dtsi @@ -48,5 +48,5 @@ }; pro_micro_i2c: &i2c1 {}; -pro_micro_spi: &spi1 {}; +pro_micro_spi: &spi2 {}; pro_micro_serial: &usart1 {}; diff --git a/app/boards/arm/proton_c/pinmux.c b/app/boards/arm/proton_c/pinmux.c deleted file mode 100644 index 4e32b32b..00000000 --- a/app/boards/arm/proton_c/pinmux.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017 I-SENSE group of ICCS - * - * SPDX-License-Identifier: MIT - */ - -#include -#include -#include -#include -#include - -#include - -/* pin assignments for STM32F3DISCOVERY board */ -static const struct pin_config pinconf[] = { -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart1), okay) && CONFIG_SERIAL - {STM32_PIN_PC4, STM32F3_PINMUX_FUNC_PC4_USART1_TX}, - {STM32_PIN_PC5, STM32F3_PINMUX_FUNC_PC5_USART1_RX}, -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(usart2), okay) && CONFIG_SERIAL - {STM32_PIN_PA2, STM32F3_PINMUX_FUNC_PA2_USART2_TX}, - {STM32_PIN_PA3, STM32F3_PINMUX_FUNC_PA3_USART2_RX}, -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C - {STM32_PIN_PB6, STM32F3_PINMUX_FUNC_PB6_I2C1_SCL}, - {STM32_PIN_PB7, STM32F3_PINMUX_FUNC_PB7_I2C1_SDA}, -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c2), okay) && CONFIG_I2C - {STM32_PIN_PA9, STM32F3_PINMUX_FUNC_PA9_I2C2_SCL}, - {STM32_PIN_PA10, STM32F3_PINMUX_FUNC_PA10_I2C2_SDA}, -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay) && CONFIG_SPI -#ifdef CONFIG_SPI_STM32_USE_HW_SS - {STM32_PIN_PA4, STM32F3_PINMUX_FUNC_PA4_SPI1_NSS}, -#endif /* CONFIG_SPI_STM32_USE_HW_SS */ - {STM32_PIN_PA5, STM32F3_PINMUX_FUNC_PA5_SPI1_SCK}, - {STM32_PIN_PA6, STM32F3_PINMUX_FUNC_PA6_SPI1_MISO}, - {STM32_PIN_PA7, STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI}, -#endif -#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi2), okay) && CONFIG_SPI -#ifdef CONFIG_SPI_STM32_USE_HW_SS - {STM32_PIN_PB12, STM32F3_PINMUX_FUNC_PB12_SPI2_NSS}, -#endif /* CONFIG_SPI_STM32_USE_HW_SS */ - {STM32_PIN_PB13, STM32F3_PINMUX_FUNC_PB13_SPI2_SCK}, - {STM32_PIN_PB14, STM32F3_PINMUX_FUNC_PB14_SPI2_MISO}, - {STM32_PIN_PB15, STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI}, -#endif -#ifdef CONFIG_USB_DC_STM32 - {STM32_PIN_PA11, STM32F3_PINMUX_FUNC_PA11_USB_DM}, - {STM32_PIN_PA12, STM32F3_PINMUX_FUNC_PA12_USB_DP}, -#endif /* CONFIG_USB_DC_STM32 */ -#if DT_NODE_HAS_STATUS(DT_NODELABEL(can1), okay) && CONFIG_CAN - {STM32_PIN_PD0, STM32F3_PINMUX_FUNC_PD0_CAN1_RX}, - {STM32_PIN_PD1, STM32F3_PINMUX_FUNC_PD1_CAN1_TX}, -#endif -}; - -static int pinmux_stm32_init(const struct device *port) { - ARG_UNUSED(port); - - stm32_setup_pins(pinconf, ARRAY_SIZE(pinconf)); - - return 0; -} - -SYS_INIT(pinmux_stm32_init, PRE_KERNEL_1, CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY); diff --git a/app/boards/arm/proton_c/proton_c.dts b/app/boards/arm/proton_c/proton_c.dts index 2ec57ad0..5a367d40 100644 --- a/app/boards/arm/proton_c/proton_c.dts +++ b/app/boards/arm/proton_c/proton_c.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include #include "arduino_pro_micro_pins.dtsi" / { @@ -26,6 +27,18 @@ }; }; +&usart1 { + pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; +}; + +&spi2 { + pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; +}; + &usb { status = "okay"; }; From 65ff995033eb882c2f09474ff8c50374f7599c6c Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Thu, 25 Mar 2021 12:29:19 -0400 Subject: [PATCH 09/15] fix(display): Avoid fault w/ LVGL API usage. * Increment the tick from within the ISR itself. * Don't call task handler until in the display callback. PR: https://github.com/zmkfirmware/zmk/pull/736 --- app/src/display/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/display/main.c b/app/src/display/main.c index b8b4bf5b..17d68bf3 100644 --- a/app/src/display/main.c +++ b/app/src/display/main.c @@ -26,14 +26,16 @@ static lv_obj_t *screen; __attribute__((weak)) lv_obj_t *zmk_display_status_screen() { return NULL; } -void display_tick_cb(struct k_work *work) { - lv_tick_inc(10); - lv_task_handler(); -} +void display_tick_cb(struct k_work *work) { lv_task_handler(); } + +#define TICK_MS 10 K_WORK_DEFINE(display_tick_work, display_tick_cb); -void display_timer_cb() { k_work_submit(&display_tick_work); } +void display_timer_cb() { + lv_tick_inc(TICK_MS); + k_work_submit(&display_tick_work); +} K_TIMER_DEFINE(display_timer, display_timer_cb, NULL); @@ -44,7 +46,7 @@ static void start_display_updates() { display_blanking_off(display); - k_timer_start(&display_timer, K_MSEC(10), K_MSEC(10)); + k_timer_start(&display_timer, K_MSEC(TICK_MS), K_MSEC(TICK_MS)); } static void stop_display_updates() { @@ -75,8 +77,6 @@ int zmk_display_init() { lv_scr_load(screen); - lv_task_handler(); - start_display_updates(); LOG_DBG(""); From 76979d293ad82f7488bc7bec5a115a8b294e2adc Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 10:33:11 +0100 Subject: [PATCH 10/15] docs(setup): bump `ZSDK_VERSION` to `0.12.4` PR: https://github.com/zmkfirmware/zmk/pull/736 --- docs/docs/development/setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/development/setup.md b/docs/docs/development/setup.md index 0786ff5a..a6cd6102 100644 --- a/docs/docs/development/setup.md +++ b/docs/docs/development/setup.md @@ -280,7 +280,7 @@ platform. To build firmwares for the ARM architecture (all supported MCUs/keyboards at this point), you'll need to install the Zephyr™ ARM SDK to your system: ``` -export ZSDK_VERSION=0.11.4 +export ZSDK_VERSION=0.12.4 wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" && \ sh "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ rm "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" @@ -315,7 +315,7 @@ export CROSS_COMPILE=/usr/bin/arm-none-eabi- To build firmwares for the ARM architecture (all supported MCUs/keyboards at this point), you'll need to install the Zephyr™ ARM SDK to your system: ``` -export ZSDK_VERSION=0.11.4 +export ZSDK_VERSION=0.12.4 wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" && \ sh "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ rm "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" From c03046e54a2cca7bdf3f84b71eba86918c0cd29f Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 11:58:35 +0100 Subject: [PATCH 11/15] docs(setup): add `x86_64-linux` to Zephyr SDK setup filename See: zmkfirmware/zmk-docker@b8341e185ab694f7c596b81d03ada34ac76d2f1c PR: https://github.com/zmkfirmware/zmk/pull/736 --- docs/docs/development/setup.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/development/setup.md b/docs/docs/development/setup.md index a6cd6102..f4065b87 100644 --- a/docs/docs/development/setup.md +++ b/docs/docs/development/setup.md @@ -281,9 +281,9 @@ To build firmwares for the ARM architecture (all supported MCUs/keyboards at thi ``` export ZSDK_VERSION=0.12.4 -wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" && \ - sh "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ - rm "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" +wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" && \ + sh "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ + rm "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" ``` The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. @@ -316,9 +316,9 @@ To build firmwares for the ARM architecture (all supported MCUs/keyboards at thi ``` export ZSDK_VERSION=0.12.4 -wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" && \ - sh "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ - rm "zephyr-toolchain-arm-${ZSDK_VERSION}-setup.run" +wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" && \ + sh "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \ + rm "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" ``` The installation will prompt with several questions about installation location, and creating a default `~/.zephyrrc` for you with various variables. The defaults should normally work as expected. From 47043c86e934bd3445d7b4fbd7600f8c198ebf83 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 10:29:42 +0100 Subject: [PATCH 12/15] docs: bump Zephyr documentation links to Zephyr v2.5.0 PR: https://github.com/zmkfirmware/zmk/pull/736 --- docs/docs/development/boards-shields-keymaps.md | 10 +++++----- docs/docs/development/build-flash.md | 4 ++-- docs/docs/development/new-shield.md | 2 +- docs/docs/development/setup.md | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/docs/development/boards-shields-keymaps.md b/docs/docs/development/boards-shields-keymaps.md index e78f5d38..4d5397cf 100644 --- a/docs/docs/development/boards-shields-keymaps.md +++ b/docs/docs/development/boards-shields-keymaps.md @@ -6,7 +6,7 @@ title: Boards, Shields, and Keymaps The foundational elements needed to get a specific keyboard working with ZMK can be broken down into: -- A [KSCAN driver](https://docs.zephyrproject.org/2.3.0/reference/peripherals/kscan.html), which uses `compatible="zmk,kscan-gpio-matrix"` for GPIO matrix based keyboards, or uses `compatible="zmk,kscan-gpio-direct"` for small direct wires. +- A [KSCAN driver](https://docs.zephyrproject.org/2.5.0/reference/peripherals/kscan.html), which uses `compatible="zmk,kscan-gpio-matrix"` for GPIO matrix based keyboards, or uses `compatible="zmk,kscan-gpio-direct"` for small direct wires. - An optional matrix transform, which defines how the KSCAN row/column events are translated into logical "key positions". This is required for non-rectangular keyboards/matrices, where the key positions don't naturally follow the row/columns from the GPIO matrix. - A keymap, which binds each key position to a behavior, e.g. key press, mod-tap, momentary layer, in a set of layers. @@ -27,8 +27,8 @@ in the `app/boards/${arch}/${board_name}` directory, e.g. `app/boards/arm/planck - A `${board_name}_defconfig` file that forces specific Kconfig settings that are specific to this hardware configuration. Mostly this is SoC settings around the specific hardware configuration. - `${board_name}.dts` which contains all the devicetree definitions, including: - An `#include` line that pulls in the specific microprocessor that is used, e.g. `#include `. - - A [chosen](https://docs.zephyrproject.org/2.3.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,kscan` which references the configured KSCAN driver (usually a GPIO matrix) - - (Optional) A [chosen](https://docs.zephyrproject.org/2.3.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,matrix_transform` that defines the mapping from KSCAN row/column values to the logical key position for the keyboard. + - A [chosen](https://docs.zephyrproject.org/2.5.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,kscan` which references the configured KSCAN driver (usually a GPIO matrix) + - (Optional) A [chosen](https://docs.zephyrproject.org/2.5.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,matrix_transform` that defines the mapping from KSCAN row/column values to the logical key position for the keyboard. - A `board.cmake` file with CMake directives for how to flash to the device. - A `keymap/keymap.overlay` file that includes the default keymap for that keyboard. Users will be able to override this keymap in their user configs. @@ -47,6 +47,6 @@ in the `app/boards/shields/${board_name}` directory, e.g. `app/boards/shields/cl - A `Kconfig.shield` that defines the toplevel Kconfig value for the shield, which uses a supplied utility to function to default the value based on the shield list, e.g. `def_bool $(shields_list_contains,clueboard_california)`. - A `Kconfig.defconfig` file to set default values for things like `ZMK_KEYBOARD_NAME` - A `${shield_name}.overlay` file, which is a devicetree overlay file, that includes: - - A [chosen](https://docs.zephyrproject.org/2.3.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,kscan` which references the configured KSCAN driver (usually a GPIO matrix). For these keyboards, to be compatible with any Pro Micro compatible boards, the KSCAN configuration should reference the [nexus node](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html#gpio-nexus-nodes) that ZMK has standardized on. In particular, the `&pro_micro_a` and `&pro_micro_d` aliases can be used to reference the standard `A#` and `D#` pins in shields. - - (Optional) A [chosen](https://docs.zephyrproject.org/2.3.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,matrix_transform` that defines the mapping from KSCAN row/column values to the logical key position for the keyboard. + - A [chosen](https://docs.zephyrproject.org/2.5.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,kscan` which references the configured KSCAN driver (usually a GPIO matrix). For these keyboards, to be compatible with any Pro Micro compatible boards, the KSCAN configuration should reference the [nexus node](https://docs.zephyrproject.org/2.5.0/guides/porting/shields.html#gpio-nexus-nodes) that ZMK has standardized on. In particular, the `&pro_micro_a` and `&pro_micro_d` aliases can be used to reference the standard `A#` and `D#` pins in shields. + - (Optional) A [chosen](https://docs.zephyrproject.org/2.5.0/guides/dts/intro.html#aliases-and-chosen-nodes) node named `zmk,matrix_transform` that defines the mapping from KSCAN row/column values to the logical key position for the keyboard. - A `keymap/keymap.overlay` file that includes the default keymap for that keyboard. Users will be able to override this keymap in their user configs. diff --git a/docs/docs/development/build-flash.md b/docs/docs/development/build-flash.md index acabfc07..ecc607c6 100644 --- a/docs/docs/development/build-flash.md +++ b/docs/docs/development/build-flash.md @@ -31,7 +31,7 @@ an onboard MCU, or one that uses an MCU board addon. ### Keyboard (Shield) + MCU Board -ZMK treats keyboards that take an MCU addon board as [shields](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) +ZMK treats keyboards that take an MCU addon board as [shields](https://docs.zephyrproject.org/2.5.0/guides/porting/shields.html), and treats the smaller MCU board as the true [board](https://docs.zephyrproject.org/2.5.0/guides/porting/board_porting.html) Given the following: @@ -47,7 +47,7 @@ west build -b proton_c -- -DSHIELD=kyria_left ### Keyboard With Onboard MCU -Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/2.3.0/guides/porting/board_porting.html) as far as Zephyr™ is concerned. +Keyboards with onboard MCU chips are simply treated as the [board](https://docs.zephyrproject.org/2.5.0/guides/porting/board_porting.html) as far as Zephyr™ is concerned. Given the following: diff --git a/docs/docs/development/new-shield.md b/docs/docs/development/new-shield.md index d82cb8ed..28904c07 100644 --- a/docs/docs/development/new-shield.md +++ b/docs/docs/development/new-shield.md @@ -19,7 +19,7 @@ The high level steps are: - Add support for features such as encoders, OLED displays, or RGB underglow. - Update build.yml -It may be helpful to review the upstream [shields documentation](https://docs.zephyrproject.org/2.3.0/guides/porting/shields.html#shields) to get a proper understanding of the underlying system before continuing. +It may be helpful to review the upstream [shields documentation](https://docs.zephyrproject.org/2.5.0/guides/porting/shields.html#shields) to get a proper understanding of the underlying system before continuing. :::note ZMK support for split keyboards requires a few more files than single boards to ensure proper connectivity between the central and peripheral units. Check the following guides thoroughly to ensure that all the files are in place. diff --git a/docs/docs/development/setup.md b/docs/docs/development/setup.md index f4065b87..3e5df916 100644 --- a/docs/docs/development/setup.md +++ b/docs/docs/development/setup.md @@ -205,9 +205,9 @@ The docker container includes `west` and the compilation toolchain. If you're us ### West Installation -`west` is the [Zephyr™ meta-tool](https://docs.zephyrproject.org/2.3.0/guides/west/index.html) used to configure and build Zephyr™ applications. +`west` is the [Zephyr™ meta-tool](https://docs.zephyrproject.org/2.5.0/guides/west/index.html) used to configure and build Zephyr™ applications. -West can be installed by using the `pip` python package manager. The [Zephyr™ instructions](https://docs.zephyrproject.org/latest/guides/west/install.html#installing-west) are summarized here: +West can be installed by using the `pip` python package manager. The [Zephyr™ instructions](https://docs.zephyrproject.org/2.5.0/guides/west/install.html#installing-west) are summarized here: Because Raspberry OS (Raspbian) runs on the same architecture (but different ABI) as the keyboard MCUs, -the operating system's installed [cross compilers](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_other_x_compilers.html) can be used to target the different ABI. +the operating system's installed [cross compilers](https://docs.zephyrproject.org/2.5.0/getting_started/toolchain_other_x_compilers.html) can be used to target the different ABI. First, the cross compiler should be installed: @@ -328,14 +328,14 @@ The installation will prompt with several questions about installation location, #### GNU ARM Embedded -Since the Zephyr™ SDK is not available for Windows, we recommending following the [Zephyr documentation](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded) to install a GNU ARM Embedded build. Note the warnings regarding installing the toolchain into a path with spaces, and make sure to follow the steps to add the environment variables which are also summarized with screenshots in the [Environment Variables](#environment-variables) section below. +Since the Zephyr™ SDK is not available for Windows, we recommending following the [Zephyr documentation](https://docs.zephyrproject.org/2.5.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded) to install a GNU ARM Embedded build. Note the warnings regarding installing the toolchain into a path with spaces, and make sure to follow the steps to add the environment variables which are also summarized with screenshots in the [Environment Variables](#environment-variables) section below. #### GNU ARM Embedded -Since the Zephyr™ SDK is not available for macOS, we recommending following the steps to install the [GNU ARM Embedded](https://docs.zephyrproject.org/2.3.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded). +Since the Zephyr™ SDK is not available for macOS, we recommending following the steps to install the [GNU ARM Embedded](https://docs.zephyrproject.org/2.5.0/getting_started/toolchain_3rd_party_x_compilers.html#gnu-arm-embedded). The install command is: @@ -345,7 +345,7 @@ brew install --cask gcc-arm-embedded :::warning Security Controls Workaround -Please be sure to read the [additional setup instructions](https://docs.zephyrproject.org/2.3.0/getting_started/installation_mac.html#mac-gatekeeper) needed to address security controls found in macOS 10.15 Catalina and newer +Please be sure to read the [additional setup instructions](https://docs.zephyrproject.org/2.5.0/getting_started/installation_mac.html#mac-gatekeeper) needed to address security controls found in macOS 10.15 Catalina and newer ::: @@ -514,7 +514,7 @@ On Windows, only two environment variables need to be set for ZMK to build prope #### For Zephyr By default, the Zephyr™ SDK will create a file named `~/.zephyrrc` with the correct environment variables to build ZMK. -We suggest two main [options](https://docs.zephyrproject.org/2.3.0/guides/env_vars.html?highlight=zephyrrc) for how to load those settings. +We suggest two main [options](https://docs.zephyrproject.org/2.5.0/guides/env_vars.html#option-3-using-zephyrrc-files) for how to load those settings. ##### Per Shell From 5542c105ed89a31275bee2217ddb9b7db2d28ac1 Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 11:13:14 +0100 Subject: [PATCH 13/15] ci: bump `zmk-build-arm` to `2.5` PR: https://github.com/zmkfirmware/zmk/pull/736 --- .github/workflows/build.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9345c3c1..36bca31d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: zmkfirmware/zmk-build-arm:2.4 + image: zmkfirmware/zmk-build-arm:2.5 strategy: matrix: board: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f7992ce..1f8e443a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: integration_test: runs-on: ubuntu-latest container: - image: zmkfirmware/zmk-build-arm:2.4 + image: zmkfirmware/zmk-build-arm:2.5 steps: - name: Checkout uses: actions/checkout@v2 From 03a39680180a0d459d054193c44228a1987ca11c Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sat, 19 Jun 2021 11:13:35 +0100 Subject: [PATCH 14/15] feat(devcontainer): bump `zmk-dev-arm` to `2.5` PR: https://github.com/zmkfirmware/zmk/pull/736 --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7808779e..40cf129d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM zmkfirmware/zmk-dev-arm:2.4 +FROM zmkfirmware/zmk-dev-arm:2.5 COPY .bashrc tmp RUN mv /tmp/.bashrc ~/.bashrc From 6217664bc32b673dc61fcc1825b3ceebe418b44b Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Mon, 21 Jun 2021 03:19:18 +0000 Subject: [PATCH 15/15] feat(docs): Add Zephyr 2.5 blog post. Simple blog post outlining the work done for the Zephyr 2.5 upgrade, and steps needed to make the most of it. Co-authored-by: innovaker <66737976+innovaker@users.noreply.github.com> --- docs/blog/2021-07-17-zephyr-2-5.md | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 docs/blog/2021-07-17-zephyr-2-5.md diff --git a/docs/blog/2021-07-17-zephyr-2-5.md b/docs/blog/2021-07-17-zephyr-2-5.md new file mode 100644 index 00000000..153027bb --- /dev/null +++ b/docs/blog/2021-07-17-zephyr-2-5.md @@ -0,0 +1,75 @@ +--- +title: "Zephyr 2.5 Update" +author: Pete Johanson +author_title: Project Creator +author_url: https://gitlab.com/petejohanson +author_image_url: https://www.gravatar.com/avatar/2001ceff7e9dc753cf96fcb2e6f41110 +tags: [firmware, zephyr, core] +--- + +I'm happy to announce that we have completed the [work](https://github.com/zmkfirmware/zmk/pull/736/) to upgrade ZMK to [Zephyr 2.5](https://docs.zephyrproject.org/2.5.0/releases/release-notes-2.5.html)! + +A big part of this work was some _major_ refactors and improvements by [innovaker] to our [zmk-docker](https://github.com/zmkfirmware/zmk-docker/) Docker image and GH Actions automation. + +- Faster build times with improved caching. +- Integration tests which automatically verify new images. +- PRs to the repo now build properly and run the tests as well. +- Build images for multiple target architectures, e.g. `zmk-build-riscv64`, all in parallel. +- Nightly builds to be sure we're pulling in the latest OS/package updates, to ensure we keep our images up to date, address any reported vulnerabilities, etc. +- Faster upgrade paths for future Zephyr SDK and Zephyr versions. + +In addition, [petejohanson] did the upgrade work to adjust ZMK for the Zephyr changes. + +- Updated to newer devicetree/driver Zephyr API +- Adjustment for Zephyr pinmux changes +- Fixes for power management, LVGL, and formatter changes + +## Getting The Changes + +Use the following steps to update to the latest tooling in order to properly use the new ZMK changes: + +### User Config Repositories Using GitHub Actions + +Existing user config repositories using Github Actions to build will pull down Zephyr 2.5 automatically, +and should work, fine as is. However, to upgrade to the newer Docker image, you should: + +- Open `.github/workflows/build.yml` in your editor/IDE +- Change `zmkfirmware/zmk-build-arm:2.4` to `zmkfirmware/zmk-build-arm:2.5` wherever it is found + +:::note + +If you created your user config repository a while ago, you may find that your `build.yml` file instead references +a `zephyr-west-action-arm` custom GitHub Action instead. In this case, the upgrade is not as direct. We suggest that +instead you [re-create your config repository](/docs/user-setup) to get an updated setup using the new automation +approach. + +::: + +### VS Code & Docker (Dev Container) + +If you build locally using VS Code & Docker then: + +- pull the latest ZMK `main` with `git pull` for your ZMK checkout +- reload the project +- if you are prompted to rebuild the remote container, click `Rebuild` +- otherwise, press `F1` and run `Remote Containers: Rebuild Container` +- Once the container has rebuilt and reloaded, run `west update` to pull the updated Zephyr version and its dependencies. + +Once the container has rebuilt, VS Code will be running the 2.5 Docker image. + +### Local Host Development + +The following steps will get you building ZMK locally against Zephyr 2.5: + +- Run the updated [toolchain installation](/docs/development/setup#toolchain-installation) steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work) +- pull the latest ZMK `main` with `git pull` for your ZMK checkout +- run `west update` to pull the updated Zephyr version and its dependencies + +From there, you should be ready to build as normal! + +## Thanks! + +Thanks again to [innovaker] for all the hard work, and to all the testers who have helped verify ZMK functionality on the newer Zephyr version. + +[petejohanson]: https://github.com/petejohanson +[innovaker]: https://github.com/innovaker