Skip to content

Commit 5d7f5bd

Browse files
authored
Merge pull request #12082 from ARMmbed/release-candidate
Release candidate for mbed-os-5.15.0-rc2
2 parents b14f495 + 5d94703 commit 5d7f5bd

File tree

45 files changed

+321
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+321
-234
lines changed

TESTS/configs/baremetal.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
{
2-
"requires": [
3-
"bare-metal",
1+
{
2+
"requires": [
3+
"bare-metal",
44
"rtos-api",
5-
"greentea-client",
6-
"utest",
5+
"greentea-client",
6+
"utest",
77
"unity",
88
"psa",
9-
"mbed-crypto",
9+
"mbed-crypto",
1010
"mbedtls",
1111
"psa-compliance-framework",
1212
"filesystem",
@@ -37,7 +37,6 @@
3737
],
3838
"target_overrides": {
3939
"*": {
40-
"target.device_has_remove": ["EMAC", "USBDEVICE"],
4140
"mbed-trace.fea-ipv6": false
4241
}
4342
}

TESTS/integration/COMMON/common_defines_fs_test.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
#include "mbed_trace.h"
20-
21-
#define TRACE_GROUP "GRNT"
2219

2320
#define FS_FAT 1
2421
#define FS_LFS 2

TESTS/integration/COMMON/download_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "unity/unity.h"
2828
#include "greentea-client/test_env.h"
2929
#include <string>
30-
#include "common_defines_test.h"
30+
#include "download_test.h"
3131

3232
#define MAX_THREADS 5
3333

TESTS/integration/COMMON/download_test.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
/*
2121
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
2222
*/
23+
24+
#include "mbed_trace.h"
25+
26+
#define TRACE_GROUP "GRNT"
2327
size_t download_test(NetworkInterface *interface, const unsigned char *data, size_t data_length, size_t buff_size, uint32_t thread_id = 0);
2428

TESTS/integration/COMMON/file_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "mbed.h"
2626
#include "unity/unity.h"
27-
#include "common_defines_test.h"
27+
#include "file_test.h"
2828

2929
void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size)
3030
{

TESTS/integration/COMMON/file_test.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
/*
2121
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
2222
*/
23+
#include "mbed_trace.h"
24+
25+
#define TRACE_GROUP "GRNT"
26+
2327
void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size);
2428

2529
void file_test_read(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size);

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,28 @@ SDBlockDevice::SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName c
271271
_erase_size = BLOCK_SIZE_HC;
272272
}
273273

274+
#if MBED_CONF_SD_CRC_ENABLED
275+
SDBlockDevice::SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz, bool crc_on)
276+
: _sectors(0), _spi(spi_pinmap), _cs(cs), _is_initialized(0),
277+
_init_ref_count(0), _crc_on(crc_on)
278+
#else
279+
SDBlockDevice::SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz, bool crc_on)
280+
: _sectors(0), _spi(spi_pinmap), _cs(cs), _is_initialized(0),
281+
_init_ref_count(0)
282+
#endif
283+
{
284+
_cs = 1;
285+
_card_type = SDCARD_NONE;
286+
287+
// Set default to 100kHz for initialisation and 1MHz for data transfer
288+
MBED_STATIC_ASSERT(((MBED_CONF_SD_INIT_FREQUENCY >= 100000) && (MBED_CONF_SD_INIT_FREQUENCY <= 400000)),
289+
"Initialization frequency should be between 100KHz to 400KHz");
290+
_init_sck = MBED_CONF_SD_INIT_FREQUENCY;
291+
_transfer_sck = hz;
292+
293+
_erase_size = BLOCK_SIZE_HC;
294+
}
295+
274296
SDBlockDevice::~SDBlockDevice()
275297
{
276298
if (_is_initialized) {

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
#include "drivers/DigitalOut.h"
2828
#include "platform/platform.h"
2929
#include "platform/PlatformMutex.h"
30+
#include "hal/static_pinmap.h"
3031

3132
/** SDBlockDevice class
3233
*
3334
* Access an SD Card using SPI bus
3435
*/
3536
class SDBlockDevice : public mbed::BlockDevice {
3637
public:
37-
/** Creates an SDBlockDevice on a SPI bus specified by pins
38+
/** Creates an SDBlockDevice on a SPI bus specified by pins (using dynamic pin-map)
3839
*
3940
* @param mosi SPI master out, slave in pin
4041
* @param miso SPI master in, slave out pin
@@ -44,6 +45,15 @@ class SDBlockDevice : public mbed::BlockDevice {
4445
* @param crc_on Enable cyclic redundancy check (defaults to disabled)
4546
*/
4647
SDBlockDevice(PinName mosi, PinName miso, PinName sclk, PinName cs, uint64_t hz = 1000000, bool crc_on = 0);
48+
49+
/** Creates an SDBlockDevice on a SPI bus specified by pins (using static pin-map)
50+
*
51+
* @param spi_pinmap Static SPI pin-map
52+
* @param hz Clock speed of the SPI bus (defaults to 1MHz)
53+
* @param crc_on Enable cyclic redundancy check (defaults to disabled)
54+
*/
55+
SDBlockDevice(const spi_pinmap_t &spi_pinmap, PinName cs, uint64_t hz = 1000000, bool crc_on = 0);
56+
4757
virtual ~SDBlockDevice();
4858

4959
/** Initialize a block device

drivers/SerialBase.h

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ class SerialBase : private NonCopyable<SerialBase> {
330330
/** Initialize serial port
331331
*/
332332
void _init();
333+
void _init_direct();
334+
/* Pointer to serial init function */
335+
void (SerialBase::*_init_func)();
333336

334337
/** Deinitialize serial port
335338
*/
@@ -345,18 +348,22 @@ class SerialBase : private NonCopyable<SerialBase> {
345348
bool _rx_asynch_set = false;
346349
#endif
347350

348-
serial_t _serial {};
349-
Callback<void()> _irq[IrqCnt];
350-
int _baud;
351-
bool _rx_enabled = true;
352-
bool _tx_enabled = true;
353-
const PinName _tx_pin;
354-
const PinName _rx_pin;
351+
serial_t _serial {};
352+
Callback<void()> _irq[IrqCnt];
353+
int _baud;
354+
bool _rx_enabled = true;
355+
bool _tx_enabled = true;
356+
const PinName _tx_pin;
357+
const PinName _rx_pin;
358+
const serial_pinmap_t *_static_pinmap = NULL;
359+
void (SerialBase::*_set_flow_control_dp_func)(Flow, PinName, PinName) = NULL;
355360

356361
#if DEVICE_SERIAL_FC
357-
Flow _flow_type = Disabled;
358-
PinName _flow1 = NC;
359-
PinName _flow2 = NC;
362+
Flow _flow_type = Disabled;
363+
PinName _flow1 = NC;
364+
PinName _flow2 = NC;
365+
const serial_fc_pinmap_t *_static_pinmap_fc = NULL;
366+
void (SerialBase::*_set_flow_control_sp_func)(Flow, const serial_fc_pinmap_t &) = NULL;
360367
#endif
361368

362369
#endif

drivers/source/SerialBase.cpp

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
2929
#endif
3030
_baud(baud),
3131
_tx_pin(tx),
32-
_rx_pin(rx)
32+
_rx_pin(rx),
33+
_init_func(&SerialBase::_init)
3334
{
3435
// No lock needed in the constructor
3536

3637
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
3738
_irq[i] = NULL;
3839
}
3940

40-
_init();
41+
(this->*_init_func)();
4142
}
4243

4344
SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) :
@@ -50,17 +51,17 @@ SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) :
5051
_serial(),
5152
_baud(baud),
5253
_tx_pin(static_pinmap.tx_pin),
53-
_rx_pin(static_pinmap.rx_pin)
54+
_rx_pin(static_pinmap.rx_pin),
55+
_static_pinmap(&static_pinmap),
56+
_init_func(&SerialBase::_init_direct)
5457
{
5558
// No lock needed in the constructor
5659

5760
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
5861
_irq[i] = NULL;
5962
}
6063

61-
serial_init_direct(&_serial, &static_pinmap);
62-
serial_baud(&_serial, _baud);
63-
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
64+
(this->*_init_func)();
6465
}
6566

6667
void SerialBase::baud(int baudrate)
@@ -150,7 +151,21 @@ void SerialBase::_init()
150151
{
151152
serial_init(&_serial, _tx_pin, _rx_pin);
152153
#if DEVICE_SERIAL_FC
153-
set_flow_control(_flow_type, _flow1, _flow2);
154+
if (_set_flow_control_dp_func) {
155+
(this->*_set_flow_control_dp_func)(_flow_type, _flow1, _flow2);
156+
}
157+
#endif
158+
serial_baud(&_serial, _baud);
159+
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
160+
}
161+
162+
void SerialBase::_init_direct()
163+
{
164+
serial_init_direct(&_serial, _static_pinmap);
165+
#if DEVICE_SERIAL_FC
166+
if (_static_pinmap_fc && _set_flow_control_dp_func) {
167+
(this->*_set_flow_control_sp_func)(_flow_type, *_static_pinmap_fc);
168+
}
154169
#endif
155170
serial_baud(&_serial, _baud);
156171
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
@@ -166,7 +181,7 @@ void SerialBase::enable_input(bool enable)
166181
lock();
167182
if (_rx_enabled != enable) {
168183
if (enable && !_tx_enabled) {
169-
_init();
184+
(this->*_init_func)();
170185
}
171186

172187
core_util_critical_section_enter();
@@ -203,7 +218,7 @@ void SerialBase::enable_output(bool enable)
203218
lock();
204219
if (_tx_enabled != enable) {
205220
if (enable && !_rx_enabled) {
206-
_init();
221+
(this->*_init_func)();
207222
}
208223

209224
core_util_critical_section_enter();
@@ -289,6 +304,8 @@ SerialBase::~SerialBase()
289304
#if DEVICE_SERIAL_FC
290305
void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
291306
{
307+
MBED_ASSERT(_static_pinmap == NULL); // this function must be used when serial object has been created using dynamic pin-map constructor
308+
_set_flow_control_dp_func = &SerialBase::set_flow_control;
292309
lock();
293310

294311
_flow_type = type;
@@ -318,9 +335,13 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
318335

319336
void SerialBase::set_flow_control(Flow type, const serial_fc_pinmap_t &static_pinmap)
320337
{
338+
MBED_ASSERT(_static_pinmap != NULL); // this function must be used when serial object has been created using static pin-map constructor
339+
_set_flow_control_sp_func = &SerialBase::set_flow_control;
321340
lock();
341+
_static_pinmap_fc = &static_pinmap;
342+
_flow_type = type;
322343
FlowControl flow_type = (FlowControl)type;
323-
serial_set_flow_control_direct(&_serial, flow_type, &static_pinmap);
344+
serial_set_flow_control_direct(&_serial, flow_type, _static_pinmap_fc);
324345
unlock();
325346
}
326347
#endif

features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cb_uint32 handleWlanTargetGetDataFrameSize(cbWLANTARGET_dataFrame* frame);
3939
cb_uint8 handleWlanTargetGetDataFrameTID(cbWLANTARGET_dataFrame* frame);
4040
void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data);
4141
void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo);
42-
void send_wlan_packet(void *buf);
42+
void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf);
4343

4444
static const cbWLANTARGET_Callback _wlanTargetCallback =
4545
{
@@ -202,9 +202,19 @@ OdinWiFiEMAC::OdinWiFiEMAC()
202202
cbWLANTARGET_registerCallbacks((cbWLANTARGET_Callback*)&_wlanTargetCallback);
203203
}
204204

205-
void send_wlan_packet(void *buf)
205+
cbWLAN_Handle OdinWiFiEMAC::get_wifi_emac_handle()
206206
{
207-
cbWLAN_sendPacket(cbWLAN_DEFAULT_HANDLE, buf);
207+
return this->handle;
208+
}
209+
210+
void OdinWiFiEMAC::set_wifi_emac_handle(cbWLAN_Handle _handle)
211+
{
212+
this->handle = _handle;
213+
}
214+
215+
void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf)
216+
{
217+
cbWLAN_sendPacket(ptr->handle, buf);
208218
}
209219

210220
bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf)
@@ -215,7 +225,7 @@ bool OdinWiFiEMAC::link_out(emac_mem_buf_t *buf)
215225
emac_mem_buf_t *new_buf = mem->alloc_pool(mem->get_total_len(buf), 0);
216226
if (new_buf != NULL) {
217227
mem->copy(new_buf, buf);
218-
int id = cbMAIN_getEventQueue()->call(send_wlan_packet, new_buf);
228+
int id = cbMAIN_getEventQueue()->call(send_wlan_packet, this, new_buf);
219229
if (id != 0) {
220230
cbMAIN_dispatchEventQueue();
221231
} else {
@@ -262,9 +272,8 @@ void OdinWiFiEMAC::set_hwaddr(const uint8_t *addr)
262272
void OdinWiFiEMAC::set_link_input_cb(emac_link_input_cb_t input_cb)
263273
{
264274
emac_link_input_cb = input_cb;
265-
266275
cbMAIN_driverLock();
267-
cbWLAN_registerPacketIndicationCallback(cbWLAN_DEFAULT_HANDLE, handleWlanPacketIndication, NULL);
276+
cbWLAN_registerPacketIndicationCallback(get_wifi_emac_handle(), handleWlanPacketIndication, NULL);
268277
cbMAIN_driverUnlock();
269278
}
270279

features/netsocket/emac-drivers/TARGET_STM/TARGET_STM32F4/TARGET_MODULE_UBLOX_ODIN_W2/wifi_emac/wifi_emac.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ class OdinWiFiEMAC : public EMAC {
124124
virtual void remove_multicast_group(const uint8_t *address);
125125
virtual void set_all_multicast(bool all);
126126

127+
cbWLAN_Handle get_wifi_emac_handle();
128+
void set_wifi_emac_handle(cbWLAN_Handle _handle);
129+
127130
private:
128131

132+
cbWLAN_Handle handle = cbWLAN_DEFAULT_HANDLE;
133+
129134
emac_link_input_cb_t emac_link_input_cb; /**< Callback for incoming data */
130135
emac_link_state_change_cb_t emac_link_state_cb; /**< Link state change callback */
131136
EMACMemoryManager *memory_manager;
@@ -138,7 +143,7 @@ class OdinWiFiEMAC : public EMAC {
138143

139144
friend void handleWlanStatusIndication(void *dummy, cbWLAN_StatusIndicationInfo status, void *data);
140145
friend void handleWlanPacketIndication(void *dummy, cbWLAN_PacketIndicationInfo *packetInfo);
141-
friend void send_wlan_packet(void *buf);
146+
friend void send_wlan_packet(OdinWiFiEMAC *ptr, void *buf);
142147
};
143148

144149
#endif /* WIFI_EMAC_H_ */

features/storage/kvstore/conf/kv_config.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949

5050
#if COMPONENT_SD
5151
#include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h"
52+
53+
#if (STATIC_PINMAP_READY)
54+
constexpr spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC);
55+
#endif
5256
#endif
5357

5458
/**
@@ -564,12 +568,19 @@ BlockDevice *_get_blockdevice_SD(bd_addr_t start_address, bd_size_t size)
564568
bd_addr_t aligned_end_address;
565569
bd_addr_t aligned_start_address;
566570

571+
#if (STATIC_PINMAP_READY)
572+
static SDBlockDevice bd(
573+
static_spi_pinmap,
574+
MBED_CONF_SD_SPI_CS
575+
);
576+
#else
567577
static SDBlockDevice bd(
568578
MBED_CONF_SD_SPI_MOSI,
569579
MBED_CONF_SD_SPI_MISO,
570580
MBED_CONF_SD_SPI_CLK,
571581
MBED_CONF_SD_SPI_CS
572582
);
583+
#endif
573584

574585
if (bd.init() != MBED_SUCCESS) {
575586
tr_error("KV Config: SDBlockDevice init fail");

0 commit comments

Comments
 (0)