[stm32] Gate stm32cubef4 targets behind flag
This allows the default build to succeed without having the ST
submodules checked out.
Change-Id: I5ef70c47a85e89abec9d5e9834908bd75822a6db
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/experimental/+/39907
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Ali Zhang <alizhang@google.com>
Commit-Queue: Varun Sharma <vars@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index c6c63f6..fd0d4ec 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -16,6 +16,7 @@
import("$dir_pw_arduino_build/arduino.gni")
import("$dir_pw_build/python.gni")
+import("$dir_pw_third_party_stm32cubef4/stm32cubef4.gni")
import("$dir_pw_tokenizer/database.gni")
import("$dir_pw_unit_test/test.gni")
@@ -93,17 +94,19 @@
"//applications/strings:all(//targets/stm32f429i-disc1:stm32f429i_disc1_debug)",
]
- # STMicroelectronics STM32F429I-DISC1 STM32Cube applications steps.
- deps += [
- ":applications_tests(//targets/stm32f429i-disc1-stm32cube:stm32f429i_disc1_stm32cube_debug)",
- "//applications/blinky:blinky(//targets/stm32f429i-disc1-stm32cube:stm32f429i_disc1_stm32cube_debug)",
- ]
+ if (pw_third_party_stm32cubef4_enabled != "") {
+ # STMicroelectronics STM32F429I-DISC1 STM32Cube applications steps.
+ deps += [
+ ":applications_tests(//targets/stm32f429i-disc1-stm32cube:stm32f429i_disc1_stm32cube_debug)",
+ "//applications/blinky:blinky(//targets/stm32f429i-disc1-stm32cube:stm32f429i_disc1_stm32cube_debug)",
+ ]
- # STMicroelectronics STM32F439ZI-Nucleo applications steps.
- deps += [
- ":applications_tests(//targets/stm32f439zi-nucleo:stm32f439zi_nucleo_debug)",
- "//applications/blinky:blinky(//targets/stm32f439zi-nucleo:stm32f439zi_nucleo_debug)",
- ]
+ # STMicroelectronics STM32F439ZI-Nucleo applications steps.
+ deps += [
+ ":applications_tests(//targets/stm32f439zi-nucleo:stm32f439zi_nucleo_debug)",
+ "//applications/blinky:blinky(//targets/stm32f439zi-nucleo:stm32f439zi_nucleo_debug)",
+ ]
+ }
# Host applications steps.
deps += [
diff --git a/applications/rpc/tokenizer_database.csv b/applications/rpc/tokenizer_database.csv
index 7fa6687..bcf40f7 100644
--- a/applications/rpc/tokenizer_database.csv
+++ b/applications/rpc/tokenizer_database.csv
@@ -3,16 +3,20 @@
0fbd23ba, ,"Failed to send response packet for channel %u"
130e2c4b, ,"Received incomplete packet on interface %s"
1ea870fb, ,"Blink Low!"
+22997f2f, ,"Failed to send response packet for channel %u, status %u"
2bc3cb0f, ," The current allocated heap memory is %u bytes."
39b2c339, ,"Failed to decode packet on interface %s"
3dfbffed, ,"Got packet with no destination; address: %llu"
3f774ea7, ,"Unable to handle packet of type %u"
+47c93d0f, ,"Failed to encode RPC response packet to channel %u buffer"
5a592684, ," malloc() is called %u times. (realloc()/calloc() counted as one time)"
6271ad9a, ,"Got complete packet!"
74627b3f, ,"Received CANCEL packet for method that is not pending"
+787ce38d, ,"Nanopb failed to decode request payload from channel %u"
92a63809, ,"Received %lu-byte frame; frame must be at least 6 bytes"
974389bc, ,"Got packet with no destination; address: %d"
9dcacd5c, ," The cumulative allocated heap memory is %u bytes."
+a2f7c8a2, ,"Nanopb failed to encode response packet for channel %u, status %u"
aecb244f, ,"Frame size [%lu] exceeds the maximum buffer size [%lu]"
af49fb70, ,"Blink High!"
b0ebaaab, ,"Registering pw_rpc services"
diff --git a/build_overrides/pigweed.gni b/build_overrides/pigweed.gni
index 8985dc7..6a2e6a7 100644
--- a/build_overrides/pigweed.gni
+++ b/build_overrides/pigweed.gni
@@ -40,4 +40,6 @@
get_path_info("//pw_spin_delay_stm32cubef4", "abspath")
dir_pw_sys_io_stm32cubef4 =
get_path_info("//pw_sys_io_stm32cubef4", "abspath")
+ dir_pw_third_party_stm32cubef4 =
+ get_path_info("//third_party/stm32cubef4", "abspath")
}
diff --git a/pw_board_led_stm32cubef4/BUILD.gn b/pw_board_led_stm32cubef4/BUILD.gn
index 843f13d..4ae70d1 100644
--- a/pw_board_led_stm32cubef4/BUILD.gn
+++ b/pw_board_led_stm32cubef4/BUILD.gn
@@ -37,7 +37,7 @@
public_configs = [ ":flags" ]
deps = [
"$dir_pw_board_led:pw_board_led.facade",
- "//third_party/stm32cubef4:stm32f4xx_hal",
+ "$dir_pw_third_party_stm32cubef4:stm32f4xx_hal",
]
sources = [ "led.cc" ]
}
diff --git a/pw_spin_delay_stm32cubef4/BUILD.gn b/pw_spin_delay_stm32cubef4/BUILD.gn
index cd22d24..4c8a6e5 100644
--- a/pw_spin_delay_stm32cubef4/BUILD.gn
+++ b/pw_spin_delay_stm32cubef4/BUILD.gn
@@ -19,7 +19,7 @@
pw_source_set("pw_spin_delay_stm32cubef4") {
deps = [
"$dir_pw_spin_delay:pw_spin_delay.facade",
- "//third_party/stm32cubef4:stm32f4xx_hal",
+ "$dir_pw_third_party_stm32cubef4:stm32f4xx_hal",
]
sources = [ "delay.cc" ]
}
diff --git a/pw_sys_io_stm32cubef4/BUILD.gn b/pw_sys_io_stm32cubef4/BUILD.gn
index f783f21..01351f0 100644
--- a/pw_sys_io_stm32cubef4/BUILD.gn
+++ b/pw_sys_io_stm32cubef4/BUILD.gn
@@ -47,7 +47,7 @@
public = []
public_deps = [
"$dir_pw_status",
- "//third_party/stm32cubef4:stm32f4xx_hal",
+ "$dir_pw_third_party_stm32cubef4:stm32f4xx_hal",
]
deps = [
"$dir_pw_sys_io:default_putget_bytes",
diff --git a/targets/stm32f429i-disc1-stm32cube/BUILD.gn b/targets/stm32f429i-disc1-stm32cube/BUILD.gn
index 56301c1..dee4a8a 100644
--- a/targets/stm32f429i-disc1-stm32cube/BUILD.gn
+++ b/targets/stm32f429i-disc1-stm32cube/BUILD.gn
@@ -40,7 +40,7 @@
deps = [
"$dir_pw_malloc",
"$dir_pw_preprocessor",
- "//third_party/stm32cubef4:stm32f4xx_hal",
+ "$dir_pw_third_party_stm32cubef4:stm32f4xx_hal",
]
sources = [
"boot.cc",
diff --git a/targets/stm32f429i-disc1-stm32cube/README.md b/targets/stm32f429i-disc1-stm32cube/README.md
index b45f276..93d05aa 100644
--- a/targets/stm32f429i-disc1-stm32cube/README.md
+++ b/targets/stm32f429i-disc1-stm32cube/README.md
@@ -1,3 +1,12 @@
+##Building
+In order to build this target, the submodules in `//third_party/stm32cubef4`
+need to be checked out and the following flag needs to be added to your
+gn args (gn args out)
+
+```
+pw_third_party_stm32cubef4_enabled = "yes"
+```
+
##Flashing
Images can be flashed using the same scripts as the in-tree variant.
diff --git a/targets/stm32f439zi-nucleo/BUILD.gn b/targets/stm32f439zi-nucleo/BUILD.gn
index b7b7f02..4dce168 100644
--- a/targets/stm32f439zi-nucleo/BUILD.gn
+++ b/targets/stm32f439zi-nucleo/BUILD.gn
@@ -40,7 +40,7 @@
deps = [
"$dir_pw_malloc",
"$dir_pw_preprocessor",
- "//third_party/stm32cubef4:stm32f4xx_hal",
+ "$dir_pw_third_party_stm32cubef4:stm32f4xx_hal",
]
sources = [
"boot.cc",
diff --git a/targets/stm32f439zi-nucleo/README.md b/targets/stm32f439zi-nucleo/README.md
index e217bbf..7fade22 100644
--- a/targets/stm32f439zi-nucleo/README.md
+++ b/targets/stm32f439zi-nucleo/README.md
@@ -1,3 +1,12 @@
+##Building
+In order to build this target, the submodules in `//third_party/stm32cubef4`
+need to be checked out and the following flag needs to be added to your
+gn args (gn args out)
+
+```
+pw_third_party_stm32cubef4_enabled = "yes"
+```
+
##Flashing
Images can be flashed using the same scripts as the in-tree variant.
diff --git a/third_party/stm32cubef4/BUILD.gn b/third_party/stm32cubef4/BUILD.gn
index 83043e6..f223f4e 100644
--- a/third_party/stm32cubef4/BUILD.gn
+++ b/third_party/stm32cubef4/BUILD.gn
@@ -16,13 +16,7 @@
import("$dir_pw_build/target_types.gni")
-declare_args() {
- # Product (ex. "STM32F429xx")
- pw_third_party_stm32cubef4_product = ""
-
- # External clock frequency (ex. "8000000" for 8Mhz)
- pw_third_party_stm32cubef4_hse_hz = ""
-}
+import("$dir_pw_third_party_stm32cubef4/stm32cubef4.gni")
config("flags") {
cflags = [
diff --git a/third_party/stm32cubef4/stm32cubef4.gni b/third_party/stm32cubef4/stm32cubef4.gni
new file mode 100644
index 0000000..79e163d
--- /dev/null
+++ b/third_party/stm32cubef4/stm32cubef4.gni
@@ -0,0 +1,24 @@
+# Copyright 2021 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.
+
+declare_args() {
+ # Enable stm32cubef4. Requires all 3 submodules to be checked out. (ex. "yes")
+ pw_third_party_stm32cubef4_enabled = ""
+
+ # Product (ex. "STM32F429xx")
+ pw_third_party_stm32cubef4_product = ""
+
+ # External clock frequency (ex. "8000000" for 8Mhz)
+ pw_third_party_stm32cubef4_hse_hz = ""
+}