summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2022-07-12 11:08:19 +0700
committerGitHub <[email protected]>2022-07-12 11:08:19 +0700
commit1a8c3a863bb1d172364ffe80029620fa75efc7a4 (patch)
treef86f35ea7d4d1ab3e6d9648edfa35a39456bf7c8 /examples
parent0bfb9d62de3a13b685437b503e2170550662bb96 (diff)
parent4ea27acd1da9e0144dbfbf805b87b22d16f7db8c (diff)
Merge pull request #1552 from hathach/fix-old-gcc
Fix warnings when compiling rp2040 with older version of gcc
Diffstat (limited to 'examples')
-rw-r--r--examples/device/webusb_serial/src/main.c6
-rw-r--r--examples/example.cmake19
2 files changed, 14 insertions, 11 deletions
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c
index 8eaad7706..604d30a83 100644
--- a/examples/device/webusb_serial/src/main.c
+++ b/examples/device/webusb_serial/src/main.c
@@ -71,7 +71,7 @@ enum {
static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED;
-#define URL "example.tinyusb.org/webusb-serial/"
+#define URL "example.tinyusb.org/webusb-serial/index.html"
const tusb_desc_webusb_url_t desc_url =
{
@@ -114,6 +114,7 @@ void echo_all(uint8_t buf[], uint32_t count)
if ( web_serial_connected )
{
tud_vendor_write(buf, count);
+ tud_vendor_flush();
}
// echo to cdc
@@ -211,7 +212,8 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
board_led_write(true);
blink_interval_ms = BLINK_ALWAYS_ON;
- tud_vendor_write_str("\r\nTinyUSB WebUSB device example\r\n");
+ tud_vendor_write_str("\r\nWebUSB interface connected\r\n");
+ tud_vendor_flush();
}else
{
blink_interval_ms = BLINK_MOUNTED;
diff --git a/examples/example.cmake b/examples/example.cmake
index 3e395d53f..6b5e41dd9 100644
--- a/examples/example.cmake
+++ b/examples/example.cmake
@@ -4,28 +4,29 @@ target_compile_options(${PROJECT} PUBLIC
-Werror
-Wfatal-errors
-Wdouble-promotion
- #-Wstrict-prototypes
- -Wstrict-overflow
- #-Werror-implicit-function-declaration
-Wfloat-equal
- #-Wundef
-Wshadow
-Wwrite-strings
-Wsign-compare
-Wmissing-format-attribute
-Wunreachable-code
-Wcast-align
- -Wcast-function-type
-Wcast-qual
-Wnull-dereference
-Wuninitialized
-Wunused
-Wredundant-decls
+ #-Wstrict-prototypes
+ #-Werror-implicit-function-declaration
+ #-Wundef
)
-# GCC version 9 or prior has a bug with incorrect Wconversion warnings
+# GCC 10
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
- target_compile_options(${PROJECT} PUBLIC
- -Wconversion
- )
+ target_compile_options(${PROJECT} PUBLIC -Wconversion)
+endif()
+
+# GCC 8
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
+ target_compile_options(${PROJECT} PUBLIC -Wcast-function-type -Wstrict-overflow)
endif()