Skip to content

Commit 7177b02

Browse files
Merge branch 'arduino:main' into client-fixes
2 parents bee676f + 702daa0 commit 7177b02

File tree

15 files changed

+507
-165
lines changed

15 files changed

+507
-165
lines changed

boards.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ nicla_sense.upload.wait_for_upload_port=true
443443
nicla_sense.upload.native_usb=true
444444
nicla_sense.upload.maximum_size=527616
445445
nicla_sense.upload.maximum_data_size=64288
446+
nicla_sense.programmer.protocol=cmsis-dap
447+
nicla_sense.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg
446448

447449
nicla_sense.bootloader.tool=openocd
448450
nicla_sense.bootloader.tool.default=openocd
@@ -496,6 +498,8 @@ nicla_voice.upload.wait_for_upload_port=true
496498
nicla_voice.upload.native_usb=true
497499
nicla_voice.upload.maximum_size=527616
498500
nicla_voice.upload.maximum_data_size=64288
501+
nicla_voice.programmer.protocol=cmsis-dap
502+
nicla_voice.programmer.transport_script={runtime.platform.path}/debugger/select_swd.cfg
499503

500504
nicla_voice.bootloader.tool=openocd
501505
nicla_voice.bootloader.tool.default=openocd

libraries/Ethernet/src/Ethernet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ int arduino::EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPA
5555

5656
eth_if->set_dhcp(false);
5757
eth_if->set_network(_ip, _netmask, _gateway);
58+
59+
auto ret = _begin(mac, timeout, responseTimeout);
60+
5861
char if_name[5];
5962
eth_if->get_interface_name(if_name);
6063
eth_if->add_dns_server(_dnsServer1, if_name);
6164

62-
auto ret = _begin(mac, timeout, responseTimeout);
6365
return ret;
6466
}
6567

libraries/PDM/src/STM32H747_dfsdm/audio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@ int py_audio_init(size_t channels, uint32_t frequency)
391391

392392
void py_audio_gain_set(int gain_db)
393393
{
394-
attenuation = 8 - gain_db;
394+
attenuation = 8 - (gain_db / 3);
395+
if (attenuation < 0) {
396+
attenuation = 0;
397+
}
395398
}
396399

397400
void py_audio_deinit()

libraries/RPC/LICENSE

Lines changed: 373 additions & 0 deletions
Large diffs are not rendered by default.

libraries/RPC/src/RPC.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024 Arduino SA
2+
// SPDX-License-Identifier: MPL-2.0
13
#include "RPC.h"
24

35
#define ENDPOINT_ID_RAW 0
@@ -161,6 +163,35 @@ int RPCClass::begin() {
161163
#endif
162164

163165
#ifdef CORE_CM4
166+
#if (CM4_BINARY_START >= 0x60000000) && (CM4_BINARY_START < 0xe0000000)
167+
class M4Init {
168+
public:
169+
M4Init() {
170+
// If the Cortex-M4 core is booting from SDRAM, the memory region must be
171+
// configured as Strongly Ordered. Note that the Cortex-M4 core does not
172+
// seem to implement speculative prefetching, so there is no need to protect
173+
// the whole region from speculative prefetching with a second MPU region.
174+
HAL_MPU_Disable();
175+
MPU_Region_InitTypeDef MPU_InitStruct;
176+
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
177+
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
178+
MPU_InitStruct.BaseAddress = CM4_BINARY_START;
179+
MPU_InitStruct.Size = MPU_REGION_SIZE_1MB;
180+
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
181+
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
182+
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
183+
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
184+
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
185+
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
186+
MPU_InitStruct.SubRegionDisable = 0x00;
187+
HAL_MPU_ConfigRegion(&MPU_InitStruct);
188+
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
189+
}
190+
};
191+
192+
M4Init __m4init __attribute__ ((init_priority (101)));
193+
#endif
194+
164195
int RPCClass::begin() {
165196
eventThread = new rtos::Thread(osPriorityHigh, 16*1024, nullptr, "rpc_evt");
166197
eventThread->start(&eventHandler);

libraries/RPC/src/RPC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024 Arduino SA
2+
// SPDX-License-Identifier: MPL-2.0
13
#ifdef __cplusplus
24

35
#ifndef __ARDUINO_RPC_IMPLEMENTATION__

libraries/RPC/src/RPC_client.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024 Arduino SA
2+
// SPDX-License-Identifier: MPL-2.0
13
#include "Arduino.h"
24
#include "mbed.h"
35
#include "rpc/dispatcher.h"

libraries/RPC/src/SerialRPC.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024 Arduino SA
2+
// SPDX-License-Identifier: MPL-2.0
13
#include "SerialRPC.h"
24
#include "RPC.h"
35

@@ -22,4 +24,4 @@ arduino::SerialRPCClass::operator bool() {
2224
return RPC;
2325
}
2426

25-
arduino::SerialRPCClass SerialRPC;
27+
arduino::SerialRPCClass SerialRPC;

libraries/RPC/src/SerialRPC.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2024 Arduino SA
2+
// SPDX-License-Identifier: MPL-2.0
13
#ifndef __SERIAL_RPC__
24
#define __SERIAL_RPC__
35

@@ -69,4 +71,4 @@ class SerialRPCClass : public Stream {
6971

7072
extern arduino::SerialRPCClass SerialRPC;
7173

72-
#endif
74+
#endif

libraries/WiFi/src/WiFi.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,18 @@ int arduino::WiFiClass::begin(const char* ssid, const char* passphrase, wl_enc_t
6666
wifi_if->set_dhcp(!_useStaticIP);
6767
if (_useStaticIP) {
6868
wifi_if->set_network(_ip, _netmask, _gateway);
69-
char if_name[5];
70-
wifi_if->get_interface_name(if_name);
71-
wifi_if->add_dns_server(_dnsServer2, if_name);
72-
wifi_if->add_dns_server(_dnsServer1, if_name); // pushes dnsServer2 at index 1
7369
}
7470

7571
nsapi_error_t result = wifi_if->connect(ssid, passphrase, _security);
7672

7773
if(result == NSAPI_ERROR_IS_CONNECTED) {
7874
wifi_if->disconnect();
75+
} else
76+
if (_useStaticIP) {
77+
char if_name[5];
78+
wifi_if->get_interface_name(if_name);
79+
wifi_if->add_dns_server(_dnsServer2, if_name);
80+
wifi_if->add_dns_server(_dnsServer1, if_name); // pushes dnsServer2 at index 1
7981
}
8082
_currentNetworkStatus = (result == NSAPI_ERROR_OK && setSSID(ssid)) ? WL_CONNECTED : WL_CONNECT_FAILED;
8183

0 commit comments

Comments
 (0)