Skip to content

Commit 8bf0fbb

Browse files
Fixing build errors and warnings: round 1 of 100000000
1 parent 18403d5 commit 8bf0fbb

File tree

6 files changed

+22
-12
lines changed

6 files changed

+22
-12
lines changed

.github/workflows/greentea_cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ jobs:
145145
if: ${{ matrix.baremetal == 1 }}
146146
run: |
147147
rm -rf __build
148-
cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_TEST_BAREMETAL=ON -DMBED_GREENTEA_SERIAL_PORT=/dev/ttyDUMMY -DMBED_TARGET=${{ matrix.target }} -DMBED_APP_JSON_PATH=TESTS/configs/baremetal.json
148+
cmake -S . -B __build -GNinja -DUPLOAD_METHOD=NONE -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_TEST_BAREMETAL=ON -DMBED_GREENTEA_SERIAL_PORT=/dev/ttyDUMMY -DMBED_TARGET=${{ matrix.target }} -DMBED_APP_JSON_PATH=TESTS/configs/baremetal.json
149149
cmake --build __build
150150
151151
- name: Build ${{ matrix.target }} with full profile
152152
if: ${{ matrix.baremetal == 0 }}
153153
run: |
154154
rm -rf __build
155-
cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_SERIAL_PORT=/dev/ttyDUMMY -DMBED_TARGET=${{ matrix.target }}
155+
cmake -S . -B __build -GNinja -DUPLOAD_METHOD=NONE -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_SERIAL_PORT=/dev/ttyDUMMY -DMBED_TARGET=${{ matrix.target }}
156156
cmake --build __build

drivers/tests/TESTS/mbed_drivers/reset_reason/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#if DEVICE_WATCHDOG
2828
# include "hal/watchdog_api.h"
2929
# define MSG_VALUE_WATCHDOG_STATUS 1
30-
# define WDG_TIMEOUT_MS 50UL
30+
# define WDG_TIMEOUT_MS 50ms
3131
#else
3232
# define MSG_VALUE_WATCHDOG_STATUS 0
3333
#endif
@@ -60,7 +60,7 @@
6060
* (1 start_bit + 8 data_bits + 1 stop_bit) * 128 * 1000 / 9600 = 133.3 ms.
6161
* To be on the safe side, set the wait time to 150 ms.
6262
*/
63-
#define SERIAL_FLUSH_TIME_MS 150
63+
#define SERIAL_FLUSH_TIME_MS 150ms
6464

6565
typedef enum {
6666
CMD_STATUS_CONTINUE,
@@ -113,7 +113,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
113113
if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_WATCHDOG) == 0) {
114114
greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
115115
ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
116-
watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS };
116+
watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS.count() };
117117
if (hal_watchdog_init(&config) != WATCHDOG_STATUS_OK) {
118118
TEST_ASSERT_MESSAGE(0, "hal_watchdog_init() error.");
119119
return CMD_STATUS_ERROR;

drivers/usb/include/usb/internal/USBDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@ class USBDevice: public USBPhyEvents {
547547
void _complete_set_configuration();
548548
void _complete_set_interface();
549549

550+
void _clear_endpoints();
551+
550552
struct endpoint_info_t {
551553
mbed::Callback<void()> callback;
552554
uint16_t max_packet_size;

drivers/usb/source/USBDevice.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void USBDevice::_complete_set_configuration()
402402
if ((_abort_control || !success) && !configured()) {
403403
// The set configuration request was aborted or failed so
404404
// reset any endpoints which may have been added.
405-
memset(_endpoint_info, 0, sizeof(_endpoint_info));
405+
_clear_endpoints();
406406
_device.configuration = 0;
407407
_endpoint_add_remove_allowed = false;
408408
}
@@ -1348,7 +1348,7 @@ USBDevice::USBDevice(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1
13481348
this->product_id = product_id;
13491349
this->product_release = product_release;
13501350

1351-
memset(_endpoint_info, 0, sizeof(_endpoint_info));
1351+
_clear_endpoints();
13521352
memset(&_transfer, 0, sizeof(_transfer));
13531353
_transfer.user_callback = None;
13541354

@@ -1754,7 +1754,7 @@ void USBDevice::_change_state(DeviceState new_state)
17541754
bool leaving_default_state = (old_state >= Default) && (new_state < Default);
17551755

17561756
if (leaving_configured_state) {
1757-
memset(_endpoint_info, 0, sizeof(_endpoint_info));
1757+
_clear_endpoints();
17581758
_device.configuration = 0;
17591759
_endpoint_add_remove_allowed = false;
17601760
}
@@ -1771,3 +1771,11 @@ void USBDevice::_run_later(void (USBDevice::*function)())
17711771
{
17721772
_post_process = function;
17731773
}
1774+
1775+
void USBDevice::_clear_endpoints()
1776+
{
1777+
for(auto & info : _endpoint_info)
1778+
{
1779+
info = endpoint_info_t{};
1780+
}
1781+
}

drivers/usb/tests/TESTS/usb_device/msd/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void msd_process(USBMSD *msd)
217217
Semaphore proc;
218218
msd->attach(callback(run_processing, &proc));
219219
while (!msd_process_done) {
220-
proc.try_acquire_for(100);
220+
proc.try_acquire_for(100ms);
221221
msd->process();
222222
if (msd->media_removed()) {
223223
media_remove_event.release();
@@ -233,7 +233,7 @@ void msd_process(USBMSD *msd)
233233
for (int x = 0; x < 15; x++) { \
234234
prev_read_counter = usb.get_read_counter();\
235235
prev_program_counter = usb.get_program_counter();\
236-
ThisThread::sleep_for(1000);\
236+
ThisThread::sleep_for(1000ms);\
237237
if ((usb.get_read_counter() == prev_read_counter) && \
238238
(usb.get_program_counter() == prev_program_counter)) {\
239239
break;\
@@ -436,7 +436,7 @@ void mount_unmount_and_data_test(BlockDevice *bd, FileSystem *fs)
436436
TEST_ASSERT_EQUAL_STRING("passed", _key);
437437

438438
do {
439-
ThisThread::sleep_for(1);
439+
ThisThread::sleep_for(1ms);
440440
} while (test_files_exist(fs_root));
441441
TEST_ASSERT_EQUAL(false, test_files_exist(fs_root));
442442

targets/targets.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6748,7 +6748,7 @@
67486748
},
67496749
"MCU_EFM32_GECKO": { // Family target for EFM32 Gecko MCUs
67506750
"inherits": [
6751-
"Target"
6751+
"EFM32"
67526752
],
67536753
"device_has": [
67546754
"ANALOGIN",

0 commit comments

Comments
 (0)