Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest fixes in from upstream (Apr through June) #29

Merged
merged 29 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f9d4b70
add the possibility to customize the delimiter of the ATHandler in AT…
Apr 20, 2022
9810521
modify AT_CellularDevice_stub to pass test with the new feature
Tobi15 Apr 21, 2022
7a15d0b
modify method signatures to pass astyle tests
Tobi15 May 10, 2022
698d215
MTS001 - add custom clock configuration for MTS_MDOT_F411RE to use 26…
reissjason May 31, 2022
f78670a
MTS002: update MTS_MDOT_F411RE usb clock setting for 8MHz output
reissjason Jun 8, 2022
be045d9
lwiperf: fix double-free of pcb on error
hifoolno Jun 10, 2022
4f55323
update to mbed_generate_bin_hex cmake function
byq77 Jun 15, 2022
7b92fba
rename: read_pulsewitdth_us to read_pulsewidth_us
yutotnh Jun 21, 2022
2c4c04a
fix: typo in pwmout_api.h (pulsewitdth -> pulsewidth)
yutotnh Jun 21, 2022
45271ab
add: PwmOut::read_pulsewitdth_us() for compatibility
yutotnh Jun 23, 2022
3bdb515
fix: typo in PwmOut.h (pulsewith -> pulsewidth)
yutotnh Jun 24, 2022
e7c7b9f
Make STM32F412xE targets build
mikrodust-henrikp Jun 16, 2022
722c87b
Add targets.json definition for STM32F412xE
mikrodust-henrikp Jun 20, 2022
4ed562b
add missing unlock in file_truncate in FATFileSystem
horeich Jul 4, 2022
bdc5b7f
Use a cleaner CMake method to handle bin and hex file names
multiplemonomials Jul 9, 2022
e5dac0e
Bluetooth: Inform privacy risk of using signed writes.
pan- May 6, 2022
530f100
add ITM (SWO) tracing support to Ambiq Apollo3 targets
16L-YT May 5, 2022
34c5222
Enable ITM (SWO) tracing support to Ambiq Apollo3 targets
16L-YT May 5, 2022
82cff35
Add default SWO pin number and config if not defined in Ambiq target
16L-YT May 6, 2022
7346a96
MPS2 CM3DS ethernet fix deprecation warnings
May 11, 2022
e48e3d7
MPS2 CM3DS ethernet fix heap bug
May 11, 2022
2104284
MPS2 CM3DS ethernet fix packet bug
May 11, 2022
531257f
MPS2 CM3DS ethernet words instead of bytes
May 11, 2022
0dec47d
Fix serial low speed baud
pilotak May 13, 2022
85e809b
M487: Fix typo with DES H/W port
ccli8 May 24, 2022
dd8d956
M487: Fix ECP P + P operation
ccli8 May 24, 2022
3a8e474
Mbed TLS: Fix wrong MPI N in ECP Curve448 curve
ccli8 May 20, 2022
f9d6a0c
Fix typo in yaml
multiplemonomials Jul 9, 2022
2a7efd8
Add SingletonPtr.cpp to unittests source
multiplemonomials Jul 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/basic_checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This workflow performs the checks like license check,
# This workflow performs the checks like license check,
# doxygen, unit tests etc.
name: Basic Checks

Expand Down
16 changes: 16 additions & 0 deletions connectivity/FEATURE_BLE/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ This is the Github repository for the `BLE_API`. Please see the [Mbed OS Example
* [Mbed OS example BLE GitHub repo](https://github.com/ARMmbed/mbed-os-example-ble) for all Mbed OS BLE examples.
* [Mbed OS BLE introduction](https://os.mbed.com/docs/latest/apis/ble.html) for an introduction to Mbed BLE.
* [Mbed OS BLE API page](https://os.mbed.com/docs/latest/apis/bluetooth.html) for the Mbed BLE API documentation.

## Privacy notice

The Cordio Bluetooth stack only stores one single signing key. This key is then
shared across all bonded devices. If a malicious device bonds with the Mbed OS
application it then gains knowledge of the shared signing key of the Mbed OS device.
The malicious device can then track the Mbed OS device whenever a signing write
is issued from it.

To overcome this privacy issue do not issue signed writes from the Mbed OS device.
A signed write occurs when the member function `write` of `GattClient` is called
with its `cmd` argument set to `GATT_OP_SIGNED_WRITE_CMD`.

Instead of using signed writes, enable encryption on the connection. This is achieved
by calling the function `setLinkEncryption` of the `SecurityManager`. Set the encryption
to at least `ENCRYPTED`.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AT_CellularDevice : public CellularDevice {
};

public:
AT_CellularDevice(FileHandle *fh);
AT_CellularDevice(FileHandle *fh, char *delim = "\r");
virtual ~AT_CellularDevice();

virtual nsapi_error_t clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ using namespace std::chrono_literals;
#define DEFAULT_AT_TIMEOUT 1s // at default timeout
const int MAX_SIM_RESPONSE_LENGTH = 16;

AT_CellularDevice::AT_CellularDevice(FileHandle *fh) :
AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim):
CellularDevice(),
_at(fh, _queue, DEFAULT_AT_TIMEOUT, "\r"),
_at(fh, _queue, DEFAULT_AT_TIMEOUT, delim),
#if MBED_CONF_CELLULAR_USE_SMS
_sms(0),
#endif // MBED_CONF_CELLULAR_USE_SMS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ bool AT_CellularDevice_stub::pin_needed = false;
bool AT_CellularDevice_stub::supported_bool = false;
int AT_CellularDevice_stub::max_sock_value = 1;

AT_CellularDevice::AT_CellularDevice(FileHandle *fh) :
AT_CellularDevice::AT_CellularDevice(FileHandle *fh, char *delim) :
CellularDevice(),
_at(fh, _queue, get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), "\r"),
_at(fh, _queue, get_property(AT_CellularDevice::PROPERTY_AT_SEND_DELAY), delim),
#if MBED_CONF_CELLULAR_USE_SMS
_sms(0),
#endif // MBED_CONF_CELLULAR_USE_SMS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ emac_mem_buf_t *SMSC9220_EMAC::low_level_input()
message_length -= CRC_LENGTH_BYTES;
}

p = _memory_manager->alloc_heap(SMSC9220_ETH_MAX_FRAME_SIZE,
p = _memory_manager->alloc_heap(message_length,
SMSC9220_BUFF_ALIGNMENT);

if (p != NULL) {
_RXLockMutex.lock();
received_bytes = smsc9220_receive_by_chunks(dev,
(char*)_memory_manager->get_ptr(p),
_memory_manager->get_len(p));
received_bytes = smsc9220_receive_packet(dev,
_memory_manager->get_ptr(p));
if(received_bytes == 0){
_memory_manager->free(p);
p = nullptr;
Expand Down Expand Up @@ -148,7 +147,6 @@ bool SMSC9220_EMAC::link_out(emac_mem_buf_t *buf)
if(buf == NULL) {
return false;
} else {
uint32_t buffer_chain_length = 0;
enum smsc9220_error_t error = SMSC9220_ERROR_NONE;
/* If buffer is chained or not aligned then
* make a contiguous aligned copy of it */
Expand All @@ -170,16 +168,12 @@ bool SMSC9220_EMAC::link_out(emac_mem_buf_t *buf)
buf = copy_buf;
}

buffer_chain_length = _memory_manager->get_total_len(buf);

_TXLockMutex.lock();
error = smsc9220_send_by_chunks(dev,
buffer_chain_length,
true,
(const char*)_memory_manager->get_ptr(buf),
error = smsc9220_send_packet(dev,
_memory_manager->get_ptr(buf),
_memory_manager->get_len(buf));
_memory_manager->free(buf);
_TXLockMutex.unlock();
_TXLockMutex.unlock();
return (error == SMSC9220_ERROR_NONE);
}
}
Expand Down Expand Up @@ -211,7 +205,7 @@ bool SMSC9220_EMAC::power_up()
this));

/* Initialize the hardware */
enum smsc9220_error_t init_successful = smsc9220_init(dev, &ThisThread::sleep_for);
enum smsc9220_error_t init_successful = smsc9220_init(dev, &thread_sleep_for);
if (init_successful != SMSC9220_ERROR_NONE) {
return false;
}
Expand All @@ -237,7 +231,7 @@ bool SMSC9220_EMAC::power_up()
&SMSC9220_EMAC::link_status_task));

/* Allow the Link Status task to detect the initial link state */
ThisThread::sleep_for(10);
ThisThread::sleep_for(10ms);
_link_status_task_handle = mbed::mbed_event_queue()->call_every(
LINK_STATUS_TASK_PERIOD_MS,
mbed::callback(this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#define FLAG_RX 1U
#define LINK_STATUS_THREAD_PRIORITY (osPriorityNormal)
#define LINK_STATUS_THREAD_STACKSIZE 512U
#define LINK_STATUS_TASK_PERIOD_MS 200U
#define LINK_STATUS_TASK_PERIOD_MS 200ms
#define PHY_STATE_LINK_DOWN false
#define PHY_STATE_LINK_UP true
#define CRC_LENGTH_BYTES 4U
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_S
* 1. BE for byte sequence in word
* 2. BE for word sequence in double-word
*/
TDES_Open(CRPT
TDES_Open(CRPT,
0, // Channel number (0~4)
enc, // 0: decode, 1: encode
(tdes_opmode & CRPT_TDES_CTL_TMODE_Msk) ? 1 : 0, // 0: DES, 1: TDES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ NU_STATIC int internal_run_eccop(const mbedtls_ecp_group *grp,
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
}

/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
return internal_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE);
}

int ret;
bool ecc_done;

Expand Down
7 changes: 6 additions & 1 deletion connectivity/lwipstack/lwip/src/apps/lwiperf/lwip_lwiperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ lwiperf_tcp_close(lwiperf_state_tcp_t *conn, enum lwiperf_report_type report_typ
/* don't want to wait for free memory here... */
tcp_abort(conn->conn_pcb);
}
} else {
} else if (conn->server_pcb != NULL) {
/* no conn pcb, this is the listener pcb */
err = tcp_close(conn->server_pcb);
LWIP_ASSERT("error", err == ERR_OK);
Expand Down Expand Up @@ -565,6 +565,11 @@ lwiperf_tcp_err(void *arg, err_t err)
{
lwiperf_state_tcp_t *conn = (lwiperf_state_tcp_t *)arg;
LWIP_UNUSED_ARG(err);

/* pcb is already deallocated, prevent double-free */
conn->conn_pcb = NULL;
conn->server_pcb = NULL;

lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_REMOTE);
}

Expand Down
2 changes: 2 additions & 0 deletions connectivity/mbedtls/source/ecp_curves.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id )
ECP_VALIDATE_RET( grp != NULL );
mbedtls_ecp_group_free( grp );

mbedtls_ecp_group_init( grp );

grp->id = id;

switch( id )
Expand Down
9 changes: 8 additions & 1 deletion drivers/include/drivers/PwmOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@ class PwmOut {

/** Read the PWM pulsewidth
* @returns
* The PWM pulsewith, specified in microseconds (int)
* The PWM pulsewidth, specified in microseconds (int)
*/
int read_pulsewidth_us();

/** Read the PWM pulsewidth
* @returns
* The PWM pulsewidth, specified in microseconds (int)
*/
MBED_DEPRECATED("use read_pulsewidth_us() instead")
int read_pulsewitdth_us();

/** Suspend PWM operation
Expand Down
7 changes: 6 additions & 1 deletion drivers/source/PwmOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,19 @@ void PwmOut::pulsewidth_us(int us)
core_util_critical_section_exit();
}

int PwmOut::read_pulsewitdth_us()
int PwmOut::read_pulsewidth_us()
{
core_util_critical_section_enter();
auto val = pwmout_read_pulsewidth_us(&_pwm);
core_util_critical_section_exit();
return val;
}

int PwmOut::read_pulsewitdth_us()
{
return read_pulsewidth_us();
}

void PwmOut::suspend()
{
core_util_critical_section_enter();
Expand Down
2 changes: 1 addition & 1 deletion hal/include/hal/pwmout_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us);
/** Read the PWM pulsewidth specified in microseconds
*
* @param obj The pwmout object
* @return A int output pulsewitdth
* @return A int output pulsewidth
*/
int pwmout_read_pulsewidth_us(pwmout_t *obj);

Expand Down
1 change: 1 addition & 0 deletions platform/tests/UNITTESTS/doubles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ target_sources(mbed-stubs-platform
nvic_wrapper_stub.c
randLIB_stub.c
randLIB_stub.cpp
../../../source/SingletonPtr.cpp
)
target_include_directories(mbed-stubs-platform
PUBLIC
Expand Down
1 change: 1 addition & 0 deletions storage/filesystem/fat/source/FATFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ int FATFileSystem::file_truncate(fs_file_t file, off_t length)
return fat_error_remap(res);
}

unlock();
return 0;
}

Expand Down
Loading