diff --git a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp index 97bff757138..d5cbdc4219e 100644 --- a/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp +++ b/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp @@ -18,6 +18,7 @@ #if DEVICE_EMAC #include +#include #include "cmsis_os.h" diff --git a/hal/tests/TESTS/mbed_hal/mpu/main.cpp b/hal/tests/TESTS/mbed_hal/mpu/main.cpp index 948a0070806..e7e467b7ea2 100644 --- a/hal/tests/TESTS/mbed_hal/mpu/main.cpp +++ b/hal/tests/TESTS/mbed_hal/mpu/main.cpp @@ -134,7 +134,7 @@ void mpu_fault_test_bss() void mpu_fault_test_stack() { - uint16_t stack_function; + volatile uint16_t stack_function; stack_function = ASM_BX_LR; clear_caches(); @@ -143,14 +143,14 @@ void mpu_fault_test_stack() void mpu_fault_test_heap() { - uint16_t *heap_function = (uint16_t *)malloc(2); + uint16_t volatile *heap_function = (uint16_t *)malloc(2); TEST_ASSERT_NOT_EQUAL(NULL, heap_function); *heap_function = ASM_BX_LR; clear_caches(); mpu_fault_test(heap_function); - free(heap_function); + free(const_cast(heap_function)); } utest::v1::status_t fault_override_setup(const Case *const source, const size_t index_of_case)