Skip to content

Commit

Permalink
Fixing build errors and warnings: round 1 of 100000000
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Sep 22, 2024
1 parent 18403d5 commit 8bf0fbb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/greentea_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ jobs:
if: ${{ matrix.baremetal == 1 }}
run: |
rm -rf __build
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
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
cmake --build __build
- name: Build ${{ matrix.target }} with full profile
if: ${{ matrix.baremetal == 0 }}
run: |
rm -rf __build
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 }}
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 }}
cmake --build __build
6 changes: 3 additions & 3 deletions drivers/tests/TESTS/mbed_drivers/reset_reason/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#if DEVICE_WATCHDOG
# include "hal/watchdog_api.h"
# define MSG_VALUE_WATCHDOG_STATUS 1
# define WDG_TIMEOUT_MS 50UL
# define WDG_TIMEOUT_MS 50ms
#else
# define MSG_VALUE_WATCHDOG_STATUS 0
#endif
Expand Down Expand Up @@ -60,7 +60,7 @@
* (1 start_bit + 8 data_bits + 1 stop_bit) * 128 * 1000 / 9600 = 133.3 ms.
* To be on the safe side, set the wait time to 150 ms.
*/
#define SERIAL_FLUSH_TIME_MS 150
#define SERIAL_FLUSH_TIME_MS 150ms

typedef enum {
CMD_STATUS_CONTINUE,
Expand Down Expand Up @@ -113,7 +113,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_WATCHDOG) == 0) {
greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS };
watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS.count() };
if (hal_watchdog_init(&config) != WATCHDOG_STATUS_OK) {
TEST_ASSERT_MESSAGE(0, "hal_watchdog_init() error.");
return CMD_STATUS_ERROR;
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/include/usb/internal/USBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ class USBDevice: public USBPhyEvents {
void _complete_set_configuration();
void _complete_set_interface();

void _clear_endpoints();

struct endpoint_info_t {
mbed::Callback<void()> callback;
uint16_t max_packet_size;
Expand Down
14 changes: 11 additions & 3 deletions drivers/usb/source/USBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void USBDevice::_complete_set_configuration()
if ((_abort_control || !success) && !configured()) {
// The set configuration request was aborted or failed so
// reset any endpoints which may have been added.
memset(_endpoint_info, 0, sizeof(_endpoint_info));
_clear_endpoints();
_device.configuration = 0;
_endpoint_add_remove_allowed = false;
}
Expand Down Expand Up @@ -1348,7 +1348,7 @@ USBDevice::USBDevice(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1
this->product_id = product_id;
this->product_release = product_release;

memset(_endpoint_info, 0, sizeof(_endpoint_info));
_clear_endpoints();
memset(&_transfer, 0, sizeof(_transfer));
_transfer.user_callback = None;

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

if (leaving_configured_state) {
memset(_endpoint_info, 0, sizeof(_endpoint_info));
_clear_endpoints();
_device.configuration = 0;
_endpoint_add_remove_allowed = false;
}
Expand All @@ -1771,3 +1771,11 @@ void USBDevice::_run_later(void (USBDevice::*function)())
{
_post_process = function;
}

void USBDevice::_clear_endpoints()
{
for(auto & info : _endpoint_info)
{
info = endpoint_info_t{};
}
}
6 changes: 3 additions & 3 deletions drivers/usb/tests/TESTS/usb_device/msd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void msd_process(USBMSD *msd)
Semaphore proc;
msd->attach(callback(run_processing, &proc));
while (!msd_process_done) {
proc.try_acquire_for(100);
proc.try_acquire_for(100ms);
msd->process();
if (msd->media_removed()) {
media_remove_event.release();
Expand All @@ -233,7 +233,7 @@ void msd_process(USBMSD *msd)
for (int x = 0; x < 15; x++) { \
prev_read_counter = usb.get_read_counter();\
prev_program_counter = usb.get_program_counter();\
ThisThread::sleep_for(1000);\
ThisThread::sleep_for(1000ms);\
if ((usb.get_read_counter() == prev_read_counter) && \
(usb.get_program_counter() == prev_program_counter)) {\
break;\
Expand Down Expand Up @@ -436,7 +436,7 @@ void mount_unmount_and_data_test(BlockDevice *bd, FileSystem *fs)
TEST_ASSERT_EQUAL_STRING("passed", _key);

do {
ThisThread::sleep_for(1);
ThisThread::sleep_for(1ms);
} while (test_files_exist(fs_root));
TEST_ASSERT_EQUAL(false, test_files_exist(fs_root));

Expand Down
2 changes: 1 addition & 1 deletion targets/targets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6748,7 +6748,7 @@
},
"MCU_EFM32_GECKO": { // Family target for EFM32 Gecko MCUs
"inherits": [
"Target"
"EFM32"
],
"device_has": [
"ANALOGIN",
Expand Down

0 comments on commit 8bf0fbb

Please sign in to comment.