targets: Update pw_sys_io_stm32cube configs
Updates stm32 targets to use the config system to configure
pw_sys_io_stm32cube rather than relying on the now-removed explicit
build args.
Change-Id: I59688de764cceae78ef36883cb3b079cb3c3bdeb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/experimental/+/74220
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/targets/stm32f207zg-nucleo/BUILD.gn b/targets/stm32f207zg-nucleo/BUILD.gn
index 2c908db..170b0f4 100644
--- a/targets/stm32f207zg-nucleo/BUILD.gn
+++ b/targets/stm32f207zg-nucleo/BUILD.gn
@@ -24,6 +24,18 @@
toolchains = pw_target_toolchain_stm32f207zg_nucleo_list
}
+config("module_config_options") {
+ cflags = [
+ "-include",
+ rebase_path("module_config_overrides.h", root_build_dir),
+ ]
+}
+
+pw_source_set("module_config_overrides") {
+ public_configs = [ ":module_config_options" ]
+ sources = [ "module_config_overrides.h" ]
+}
+
if (current_toolchain != default_toolchain) {
pw_source_set("pre_init") {
public_deps = [ "$dir_pw_sys_io_stm32cube" ]
diff --git a/targets/stm32f207zg-nucleo/module_config_overrides.h b/targets/stm32f207zg-nucleo/module_config_overrides.h
new file mode 100644
index 0000000..b73e0d6
--- /dev/null
+++ b/targets/stm32f207zg-nucleo/module_config_overrides.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed 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
+//
+// https://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.
+#pragma once
+
+// Configure the UART for pw_sys_io_stm32cube.
+#define PW_SYS_IO_STM32CUBE_USART_NUM 3
+#define PW_SYS_IO_STM32CUBE_GPIO_PORT D
+#define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 8
+#define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 9
diff --git a/targets/stm32f207zg-nucleo/target_toolchains.gni b/targets/stm32f207zg-nucleo/target_toolchains.gni
index 5f57d74..9c6bd8d 100644
--- a/targets/stm32f207zg-nucleo/target_toolchains.gni
+++ b/targets/stm32f207zg-nucleo/target_toolchains.gni
@@ -59,10 +59,8 @@
"$dir_pw_sync_baremetal:interrupt_spin_lock"
pw_log_BACKEND = dir_pw_log_basic
pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube
- pw_sys_io_stm32cube_usart_num = "3"
- pw_sys_io_stm32cube_gpio_port = "D"
- pw_sys_io_stm32cube_gpio_tx_pin = "8"
- pw_sys_io_stm32cube_gpio_rx_pin = "9"
+ pw_sys_io_stm32cube_CONFIG =
+ "//targets/stm32f207zg-nucleo:module_config_overrides"
#TODO: remove dependency on stm32f429i-disc1 rpc server.
pw_rpc_system_server_BACKEND =
diff --git a/targets/stm32f429i_disc1_stm32cube/BUILD.gn b/targets/stm32f429i_disc1_stm32cube/BUILD.gn
index 2e3c575..fd0495a 100644
--- a/targets/stm32f429i_disc1_stm32cube/BUILD.gn
+++ b/targets/stm32f429i_disc1_stm32cube/BUILD.gn
@@ -24,6 +24,18 @@
toolchains = pw_target_toolchain_stm32f429i_disc1_list
}
+config("module_config_options") {
+ cflags = [
+ "-include",
+ rebase_path("module_config_overrides.h", root_build_dir),
+ ]
+}
+
+pw_source_set("module_config_overrides") {
+ public_configs = [ ":module_config_options" ]
+ sources = [ "module_config_overrides.h" ]
+}
+
config("pw_malloc_active") {
if (pw_malloc_BACKEND != "") {
defines = [ "PW_MALLOC_ACTIVE=1" ]
diff --git a/targets/stm32f429i_disc1_stm32cube/module_config_overrides.h b/targets/stm32f429i_disc1_stm32cube/module_config_overrides.h
new file mode 100644
index 0000000..5451e2c
--- /dev/null
+++ b/targets/stm32f429i_disc1_stm32cube/module_config_overrides.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed 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
+//
+// https://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.
+#pragma once
+
+// Configure the UART for pw_sys_io_stm32cube.
+#define PW_SYS_IO_STM32CUBE_USART_NUM 1
+#define PW_SYS_IO_STM32CUBE_GPIO_PORT A
+#define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 9
+#define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 10
diff --git a/targets/stm32f429i_disc1_stm32cube/target_toolchains.gni b/targets/stm32f429i_disc1_stm32cube/target_toolchains.gni
index 85ac957..f8c9e61 100644
--- a/targets/stm32f429i_disc1_stm32cube/target_toolchains.gni
+++ b/targets/stm32f429i_disc1_stm32cube/target_toolchains.gni
@@ -53,10 +53,8 @@
"$dir_pw_sync_baremetal:interrupt_spin_lock"
pw_log_BACKEND = dir_pw_log_basic
pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube
- pw_sys_io_stm32cube_usart_num = "1"
- pw_sys_io_stm32cube_gpio_port = "A"
- pw_sys_io_stm32cube_gpio_tx_pin = "9"
- pw_sys_io_stm32cube_gpio_rx_pin = "10"
+ pw_sys_io_stm32cube_CONFIG =
+ "//targets/stm32f429i_disc1_stm32cube:module_config_overrides"
#TODO: remove dependency on stm32f429i-disc1 rpc server.
pw_rpc_system_server_BACKEND =
diff --git a/targets/stm32f439zi_nucleo/BUILD.gn b/targets/stm32f439zi_nucleo/BUILD.gn
index 374039d..4996547 100644
--- a/targets/stm32f439zi_nucleo/BUILD.gn
+++ b/targets/stm32f439zi_nucleo/BUILD.gn
@@ -25,6 +25,18 @@
toolchains = pw_target_toolchain_stm32f439zi_nucleo_list
}
+config("module_config_options") {
+ cflags = [
+ "-include",
+ rebase_path("module_config_overrides.h", root_build_dir),
+ ]
+}
+
+pw_source_set("module_config_overrides") {
+ public_configs = [ ":module_config_options" ]
+ sources = [ "module_config_overrides.h" ]
+}
+
config("pw_malloc_active") {
if (pw_malloc_BACKEND != "") {
defines = [ "PW_MALLOC_ACTIVE=1" ]
diff --git a/targets/stm32f439zi_nucleo/module_config_overrides.h b/targets/stm32f439zi_nucleo/module_config_overrides.h
new file mode 100644
index 0000000..b73e0d6
--- /dev/null
+++ b/targets/stm32f439zi_nucleo/module_config_overrides.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed 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
+//
+// https://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.
+#pragma once
+
+// Configure the UART for pw_sys_io_stm32cube.
+#define PW_SYS_IO_STM32CUBE_USART_NUM 3
+#define PW_SYS_IO_STM32CUBE_GPIO_PORT D
+#define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 8
+#define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 9
diff --git a/targets/stm32f439zi_nucleo/target_toolchains.gni b/targets/stm32f439zi_nucleo/target_toolchains.gni
index d235ad0..7770896 100644
--- a/targets/stm32f439zi_nucleo/target_toolchains.gni
+++ b/targets/stm32f439zi_nucleo/target_toolchains.gni
@@ -58,10 +58,8 @@
"$dir_pw_sync_baremetal:interrupt_spin_lock"
pw_log_BACKEND = dir_pw_log_basic
pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube
- pw_sys_io_stm32cube_usart_num = "3"
- pw_sys_io_stm32cube_gpio_port = "D"
- pw_sys_io_stm32cube_gpio_tx_pin = "8"
- pw_sys_io_stm32cube_gpio_rx_pin = "9"
+ pw_sys_io_stm32cube_CONFIG =
+ "//targets/stm32f439zi_nucleo:module_config_overrides"
#TODO: remove dependency on stm32f429i-disc1 rpc server.
pw_rpc_system_server_BACKEND =
diff --git a/targets/stm32h753zi-nucleo/BUILD.gn b/targets/stm32h753zi-nucleo/BUILD.gn
index ce47909..a6df66d 100644
--- a/targets/stm32h753zi-nucleo/BUILD.gn
+++ b/targets/stm32h753zi-nucleo/BUILD.gn
@@ -24,6 +24,18 @@
toolchains = pw_target_toolchain_stm32h753zi_nucleo_list
}
+config("module_config_options") {
+ cflags = [
+ "-include",
+ rebase_path("module_config_overrides.h", root_build_dir),
+ ]
+}
+
+pw_source_set("module_config_overrides") {
+ public_configs = [ ":module_config_options" ]
+ sources = [ "module_config_overrides.h" ]
+}
+
if (current_toolchain != default_toolchain) {
pw_source_set("pre_init") {
public_deps = [ "$dir_pw_sys_io_stm32cube" ]
diff --git a/targets/stm32h753zi-nucleo/module_config_overrides.h b/targets/stm32h753zi-nucleo/module_config_overrides.h
new file mode 100644
index 0000000..b73e0d6
--- /dev/null
+++ b/targets/stm32h753zi-nucleo/module_config_overrides.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed 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
+//
+// https://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.
+#pragma once
+
+// Configure the UART for pw_sys_io_stm32cube.
+#define PW_SYS_IO_STM32CUBE_USART_NUM 3
+#define PW_SYS_IO_STM32CUBE_GPIO_PORT D
+#define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 8
+#define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 9
diff --git a/targets/stm32h753zi-nucleo/target_toolchains.gni b/targets/stm32h753zi-nucleo/target_toolchains.gni
index f142cfa..6945b99 100644
--- a/targets/stm32h753zi-nucleo/target_toolchains.gni
+++ b/targets/stm32h753zi-nucleo/target_toolchains.gni
@@ -59,10 +59,8 @@
"$dir_pw_sync_baremetal:interrupt_spin_lock"
pw_log_BACKEND = dir_pw_log_basic
pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube
- pw_sys_io_stm32cube_usart_num = "3"
- pw_sys_io_stm32cube_gpio_port = "D"
- pw_sys_io_stm32cube_gpio_tx_pin = "8"
- pw_sys_io_stm32cube_gpio_rx_pin = "9"
+ pw_sys_io_stm32cube_CONFIG =
+ "//targets/stm32h753zi-nucleo:module_config_overrides"
#TODO: remove dependency on stm32f429i-disc1 rpc server.
pw_rpc_system_server_BACKEND =
diff --git a/targets/stm32l552ze-nucleo/BUILD.gn b/targets/stm32l552ze-nucleo/BUILD.gn
index 4c20aee..815cc40 100644
--- a/targets/stm32l552ze-nucleo/BUILD.gn
+++ b/targets/stm32l552ze-nucleo/BUILD.gn
@@ -24,6 +24,18 @@
toolchains = pw_target_toolchain_stm32l552ze_nucleo_list
}
+config("module_config_options") {
+ cflags = [
+ "-include",
+ rebase_path("module_config_overrides.h", root_build_dir),
+ ]
+}
+
+pw_source_set("module_config_overrides") {
+ public_configs = [ ":module_config_options" ]
+ sources = [ "module_config_overrides.h" ]
+}
+
if (current_toolchain != default_toolchain) {
pw_source_set("pre_init") {
public_deps = [ "$dir_pw_sys_io_stm32cube" ]
diff --git a/targets/stm32l552ze-nucleo/module_config_overrides.h b/targets/stm32l552ze-nucleo/module_config_overrides.h
new file mode 100644
index 0000000..49d6ab7
--- /dev/null
+++ b/targets/stm32l552ze-nucleo/module_config_overrides.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Pigweed Authors
+//
+// Licensed 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
+//
+// https://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.
+#pragma once
+
+// Configure the UART for pw_sys_io_stm32cube.
+#define PW_SYS_IO_STM32CUBE_USART_NUM 1
+#define PW_SYS_IO_STM32CUBE_GPIO_PORT G
+#define PW_SYS_IO_STM32CUBE_GPIO_TX_PIN 7
+#define PW_SYS_IO_STM32CUBE_GPIO_RX_PIN 8
diff --git a/targets/stm32l552ze-nucleo/target_toolchains.gni b/targets/stm32l552ze-nucleo/target_toolchains.gni
index ce84684..2531419 100644
--- a/targets/stm32l552ze-nucleo/target_toolchains.gni
+++ b/targets/stm32l552ze-nucleo/target_toolchains.gni
@@ -59,10 +59,8 @@
"$dir_pw_sync_baremetal:interrupt_spin_lock"
pw_log_BACKEND = dir_pw_log_basic
pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube
- pw_sys_io_stm32cube_usart_num = "1"
- pw_sys_io_stm32cube_gpio_port = "G"
- pw_sys_io_stm32cube_gpio_tx_pin = "7"
- pw_sys_io_stm32cube_gpio_rx_pin = "8"
+ pw_sys_io_stm32cube_CONFIG =
+ "//targets/stm32l552ze-nucleo:module_config_overrides"
#TODO: remove dependency on stm32f429i-disc1 rpc server.
pw_rpc_system_server_BACKEND =