Skip to content

Commit 182197d

Browse files
committed
Merge branch 'master' into feature/lwip_broadcast
2 parents b6219d7 + 20eb127 commit 182197d

File tree

237 files changed

+27076
-9406
lines changed

Some content is hidden

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

237 files changed

+27076
-9406
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ mbed OS is an open-source embedded operating system designed specifically for th
55
mbed OS accelerates the process of creating a connected product by providing a platform operating system that includes robust security foundations, standards based communication capabilities, built-in cloud management services, and drivers for sensors, I/O devices and connectivity. mbed OS is built as a modular, configurable software stack so that you can readily customize it to the device you're developing for, and reduce memory requirements by excluding unnecessary software components.
66

77
## Current release
8-
9-
Our current release series is mbed OS 5.2:
108

11-
- [Release Note](https://docs.mbed.com/docs/mbed-os-release-notes/en/latest/5_2/release_note/)
9+
The current release, along with a selection of previous versions are detailed here:
10+
[Release Notes](https://docs.mbed.com/docs/mbed-os-release-notes/en/latest/)
1211

1312
## Getting Started for Developers
1413

features/FEATURE_LWIP/TESTS/mbedmicro-net/host_tests/tcp_echo_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ def find_interface_to_target_addr(target_ip):
128128
:return:
129129
"""
130130
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
131-
s.connect((target_ip, 0)) # Target IP, Any port
131+
try:
132+
s.connect((target_ip, 0)) # Target IP, any port
133+
except socket.error:
134+
s.connect((target_ip, 8000)) # Target IP, 'random' port
132135
ip = s.getsockname()[0]
133136
s.close()
134137
return ip

features/FEATURE_LWIP/TESTS/mbedmicro-net/host_tests/udp_echo_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ def find_interface_to_target_addr(target_ip):
5555
:return:
5656
"""
5757
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
58-
s.connect((target_ip, 0)) # Target IP, Any port
58+
try:
59+
s.connect((target_ip, 0)) # Target IP, any port
60+
except socket.error:
61+
s.connect((target_ip, 8000)) # Target IP, 'random' port
5962
ip = s.getsockname()[0]
6063
s.close()
6164
return ip

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_eth.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define ETH_DISABLE_TX() do{EMAC->CTL &= ~EMAC_CTL_TXON;}while(0)
3434
#define ETH_DISABLE_RX() do{EMAC->CTL &= ~EMAC_CTL_RXON;}while(0)
3535

36+
3637
/*
3738
#ifdef __ICCARM__
3839
#pragma data_alignment=4
@@ -99,7 +100,7 @@ static int reset_phy(void)
99100
}
100101

101102
if(delay == 0) {
102-
printf("Reset phy failed\n");
103+
LWIP_DEBUGF(LWIP_DBG_LEVEL_SEVERE|LWIP_DBG_ON,("Reset phy failed\n"));
103104
return(-1);
104105
}
105106

@@ -120,23 +121,23 @@ static int reset_phy(void)
120121
}
121122

122123
if(delay == 0) {
123-
printf("AN failed. Set to 100 FULL\n");
124+
LWIP_DEBUGF(LWIP_DBG_LEVEL_SEVERE|LWIP_DBG_ON , ("AN failed. Set to 100 FULL\n"));
124125
EMAC->CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
125126
return(-1);
126127
} else {
127128
reg = mdio_read(CONFIG_PHY_ADDR, MII_LPA);
128129

129130
if(reg & ADVERTISE_100FULL) {
130-
printf("100 full\n");
131+
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("100 full\n"));
131132
EMAC->CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
132133
} else if(reg & ADVERTISE_100HALF) {
133-
printf("100 half\n");
134+
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("100 half\n"));
134135
EMAC->CTL = (EMAC->CTL & ~EMAC_CTL_FUDUP_Msk) | EMAC_CTL_OPMODE_Msk;
135136
} else if(reg & ADVERTISE_10FULL) {
136-
printf("10 full\n");
137+
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("10 full\n"));
137138
EMAC->CTL = (EMAC->CTL & ~EMAC_CTL_OPMODE_Msk) | EMAC_CTL_FUDUP_Msk;
138139
} else {
139-
printf("10 half\n");
140+
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("10 half\n"));
140141
EMAC->CTL &= ~(EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
141142
}
142143
}
@@ -267,7 +268,7 @@ void EMAC_RX_IRQHandler(void)
267268
EMAC->INTSTS = m_status;
268269
if (m_status & EMAC_INTSTS_RXBEIF_Msk) {
269270
// Shouldn't goes here, unless descriptor corrupted
270-
printf("RX descriptor corrupted \r\n");
271+
LWIP_DEBUGF(LWIP_DBG_LEVEL_SERIOUS|LWIP_DBG_ON, ("RX descriptor corrupted \r\n"));
271272
//return;
272273
}
273274
ack_emac_rx_isr();

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* search-and-replace for the word "ethernetif" to replace it with
4343
* something that better describes your network interface.
4444
*/
45-
45+
4646
#include "lwip/opt.h"
4747

4848
#include "lwip/def.h"
@@ -494,16 +494,15 @@ static void __phy_task(void *data) {
494494
// Compare with previous state
495495

496496
if( !(ETH_link_ok()) && (netif->flags & NETIF_FLAG_LINK_UP) ) {
497-
//tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1);
497+
/* tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1); */
498498
netif_set_link_down(netif);
499-
printf("Link Down\r\n");
499+
LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING|LWIP_DBG_ON, ("Link Down\r\n"));
500500
}else if ( ETH_link_ok() && !(netif->flags & NETIF_FLAG_LINK_UP) ) {
501-
//tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1);
501+
/* tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1); */
502502
netif_set_link_up(netif);
503-
printf("Link Up\r\n");
503+
LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING|LWIP_DBG_ON, ("Link Up\r\n"));
504504
}
505505

506-
// printf("-");
507506
osDelay(200);
508507
}
509508
}

features/netsocket/Socket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ nsapi_error_t Socket::close()
6060
_socket = 0;
6161
ret = _stack->socket_close(socket);
6262
}
63+
_stack = 0;
6364

6465
// Wakeup anything in a blocking operation
6566
// on this socket

features/storage/FEATURE_STORAGE/TESTS/cfstore/create/create.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,11 @@ int32_t cfstore_create_test_05_core(const size_t call_count)
536536
snprintf(kv_name_tag_buf, kv_name_tag_len+1, "%0d", (int) i);
537537
ret = cfstore_create_kv_create(kv_name_min_len, kv_name_tag_buf, value_buf, kv_value_min_len/64 * (i+1));
538538
if(ret == ARM_CFSTORE_DRIVER_ERROR_OUT_OF_MEMORY){
539-
CFSTORE_ERRLOG("Out of memory on %d-th KV, trying to allocate memory totalling %d.\n", (int) i, (int) bytes_stored);
539+
CFSTORE_ERRLOG("Out of memory on %d-th KV.\n", (int) i);
540540
break;
541541
}
542542
/* revert CFSTORE_LOG for more trace */
543-
CFSTORE_DBGLOG("Successfully stored %d-th KV bytes, totalling %d.\n", (int) i, (int) bytes_stored);
543+
CFSTORE_DBGLOG("Successfully stored %d-th KV.\n", (int) i);
544544
}
545545
ret = cfstore_test_delete_all();
546546
CFSTORE_TEST_UTEST_MESSAGE(cfstore_create_utest_msg_g, CFSTORE_UTEST_MSG_BUF_SIZE, "%s:Error: failed to delete_all() attributes to clean up after test.\n", __func__);

features/storage/FEATURE_STORAGE/cfstore/source/cfstore_debug.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <stdint.h>
1111
#include <assert.h>
12+
#include <stdio.h>
1213

1314

1415
/* Debug Support */
@@ -27,9 +28,7 @@
2728
printf(_fmt, __VA_ARGS__); \
2829
}while(0);
2930

30-
//todo: restore #define noCFSTORE_DEBUG
3131
#define noCFSTORE_DEBUG
32-
//#define CFSTORE_DEBUG
3332
#ifdef CFSTORE_DEBUG
3433

3534
extern uint32_t cfstore_optDebug_g;

features/storage/FEATURE_STORAGE/cfstore/source/cfstore_svm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ StorageVolumeManager volumeManager;
4747
/* used only for the initialization of the volume-manager. */
4848
static void cfstore_svm_volume_manager_initialize_callback(int32_t status)
4949
{
50-
CFSTORE_FENTRYLOG("%s: operation %d with status %d" , __func__, (int) operation, (int) status);
50+
CFSTORE_FENTRYLOG("%s: with status %d" , __func__, (int) status);
5151
}
5252

5353
static void cfstore_svm_journal_mtc_callback(int32_t status, ARM_STORAGE_OPERATION operation)

features/storage/FEATURE_STORAGE/cfstore/source/configuration_store.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@
4646

4747
#ifdef CFSTORE_DEBUG
4848
uint32_t cfstore_optDebug_g = 1;
49-
//todo: restore uint32_t cfstore_optLogLevel_g = CFSTORE_LOG_NONE; /*CFSTORE_LOG_NONE|CFSTORE_LOG_ERR|CFSTORE_LOG_DEBUG|CFSTORE_LOG_FENTRY */
50-
//uint32_t cfstore_optLogTracepoint_g = CFSTORE_TP_NONE; /*CFSTORE_TP_NONE|CFSTORE_TP_CLOSE|CFSTORE_TP_CREATE|CFSTORE_TP_DELETE|CFSTORE_TP_FILE|CFSTORE_TP_FIND|CFSTORE_TP_FLUSH|CFSTORE_TP_INIT|CFSTORE_TP_OPEN|CFSTORE_TP_READ|CFSTORE_TP_WRITE|CFSTORE_TP_VERBOSE1|CFSTORE_TP_VERBOSE2|CFSTORE_TP_VERBOSE3|CFSTORE_TP_FENTRY; */
51-
uint32_t cfstore_optLogLevel_g = CFSTORE_LOG_NONE|CFSTORE_LOG_ERR|CFSTORE_LOG_DEBUG|CFSTORE_LOG_FENTRY;
52-
uint32_t cfstore_optLogTracepoint_g = CFSTORE_TP_NONE|CFSTORE_TP_CLOSE|CFSTORE_TP_CREATE|CFSTORE_TP_DELETE|CFSTORE_TP_FILE|CFSTORE_TP_FIND|CFSTORE_TP_FLUSH|CFSTORE_TP_INIT|CFSTORE_TP_OPEN|CFSTORE_TP_READ|CFSTORE_TP_WRITE|CFSTORE_TP_VERBOSE1|CFSTORE_TP_VERBOSE2|CFSTORE_TP_VERBOSE3|CFSTORE_TP_FENTRY;
49+
uint32_t cfstore_optLogLevel_g = CFSTORE_LOG_NONE; /*CFSTORE_LOG_NONE|CFSTORE_LOG_ERR|CFSTORE_LOG_DEBUG|CFSTORE_LOG_FENTRY */
50+
uint32_t cfstore_optLogTracepoint_g = CFSTORE_TP_NONE; /*CFSTORE_TP_NONE|CFSTORE_TP_CLOSE|CFSTORE_TP_CREATE|CFSTORE_TP_DELETE|CFSTORE_TP_FILE|CFSTORE_TP_FIND|CFSTORE_TP_FLUSH|CFSTORE_TP_INIT|CFSTORE_TP_OPEN|CFSTORE_TP_READ|CFSTORE_TP_WRITE|CFSTORE_TP_VERBOSE1|CFSTORE_TP_VERBOSE2|CFSTORE_TP_VERBOSE3|CFSTORE_TP_FENTRY; */
5351
#endif
5452

5553

features/unsupported/tests/mbed/can/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CAN can1(PD_0, PD_1);
2020
defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) || \
2121
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
2222
defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_NUCLEO_L476RG) || \
23-
defined(TARGET_NUCLEO_L432KC)
23+
defined(TARGET_NUCLEO_L432KC) || defined(TARGET_DISCO_F303VC)
2424
CAN can1(PA_11, PA_12);
2525
#elif defined(TARGET_DISCO_F469NI) ||defined(TARGET_DISCO_F746NG)
2626
CAN can1(PB_8, PB_9);
@@ -68,7 +68,7 @@ int main() {
6868
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
6969
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
7070
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_NUCLEO_L476RG) && \
71-
!defined(TARGET_NUCLEO_L432KC))
71+
!defined(TARGET_NUCLEO_L432KC)) && !defined(TARGET_DISCO_F303VC)
7272
printf("loop()\n");
7373
if(can2.read(msg)) {
7474
printmsg("Rx message:", &msg);

features/unsupported/tests/mbed/can_interrupt/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CAN can1(PD_0, PD_1);
2020
defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) || \
2121
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
2222
defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_NUCLEO_L476RG) || \
23-
defined(TARGET_NUCLEO_L432KC)
23+
defined(TARGET_NUCLEO_L432KC) || defined(TARGET_DISCO_F303VC)
2424
CAN can1(PA_11, PA_12);
2525
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG)
2626
CAN can1(PB_8, PB_9);
@@ -63,7 +63,7 @@ void send() {
6363
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
6464
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
6565
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_NUCLEO_L476RG) && \
66-
!defined(TARGET_NUCLEO_L432KC))
66+
!defined(TARGET_NUCLEO_L432KC) && !defined(TARGET_DISCO_F303VC))
6767
void read() {
6868
CANMessage msg;
6969
printf("rx()\n");
@@ -83,7 +83,7 @@ int main() {
8383
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
8484
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
8585
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_NUCLEO_L476RG) && \
86-
!defined(TARGET_NUCLEO_L432KC))
86+
!defined(TARGET_NUCLEO_L432KC) && !defined(TARGET_DISCO_F303VC))
8787
can2.attach(&read);
8888
#endif
8989
while(1) {

features/unsupported/tests/mbed/can_loopback/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ CAN can1(PA_11, PA_12);
2424
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG) || \
2525
defined(TARGET_NUCLEO_F446ZE) || defined(TARGET_NUCLEO_F103RB) || \
2626
defined(TARGET_NUCLEO_F207ZG) || defined(TARGET_NUCLEO_F303ZE) || \
27-
defined(TARGET_DISCO_F769NI) || defined(TARGET_NUCLEO_F767ZI)
27+
defined(TARGET_DISCO_F769NI) || defined(TARGET_NUCLEO_F767ZI) || \
28+
defined(TARGET_DISCO_F303VC)
2829
CAN can1(PB_8, PB_9);
2930
#endif
3031

features/unsupported/tests/mbed/i2c_master_slave_asynch/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#error [NOT_SUPPORTED] I2C Async is not supported
1515
#endif
1616

17-
#define ADDR (0x90)
17+
#define ADDR (0x80)
1818
#define FREQ 100000
1919
#define SIZE 10
2020

targets/TARGET_Freescale/TARGET_KSDK2_MCUS/api/i2c_api.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,20 @@ int i2c_byte_read(i2c_t *obj, int last)
179179

180180
int i2c_byte_write(i2c_t *obj, int data)
181181
{
182+
status_t ret_value;
182183
#if FSL_I2C_DRIVER_VERSION > MAKE_VERSION(2, 0, 1)
183-
if (I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1, kI2C_TransferNoStopFlag) == kStatus_Success) {
184-
return 1;
185-
}
184+
ret_value = I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1, kI2C_TransferNoStopFlag);
186185
#else
187-
if (I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1) == kStatus_Success) {
186+
ret_value = I2C_MasterWriteBlocking(i2c_addrs[obj->instance], (uint8_t *)(&data), 1);
187+
#endif
188+
189+
if (ret_value == kStatus_Success) {
188190
return 1;
191+
} else if (ret_value == kStatus_I2C_Nak) {
192+
return 0;
193+
} else {
194+
return 2;
189195
}
190-
#endif
191-
return 0;
192196
}
193197

194198

targets/TARGET_NUVOTON/TARGET_M451/device/StdDriver/m451_can.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ void CAN_WaitMsg(CAN_T *tCAN)
196196
}
197197

198198
if(tCAN->STATUS & CAN_STATUS_RXOK_Msk)
199+
{
199200
DEBUG_PRINTF("Rx OK\n");
200-
201+
}
201202
if(tCAN->STATUS & CAN_STATUS_LEC_Msk)
202203
{
203204
DEBUG_PRINTF("Error\n");

targets/TARGET_NUVOTON/TARGET_M451/device/StdDriver/m451_pwm.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ uint32_t PWM_ConfigCaptureChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u
5555
{
5656
//clock source is from PCLK
5757
SystemCoreClockUpdate();
58-
u32PWMClockSrc = SystemCoreClock;
58+
if(pwm == PWM0)
59+
u32PWMClockSrc = CLK_GetPCLK0Freq();
60+
else//(pwm == PWM1)
61+
u32PWMClockSrc = CLK_GetPCLK1Freq();
62+
5963
}
6064

6165
u32PWMClockSrc /= 1000;
@@ -142,7 +146,11 @@ uint32_t PWM_ConfigOutputChannel2(PWM_T *pwm,
142146
{
143147
//clock source is from PCLK
144148
SystemCoreClockUpdate();
145-
u32PWMClockSrc = SystemCoreClock;
149+
if(pwm == PWM0)
150+
u32PWMClockSrc = CLK_GetPCLK0Freq();
151+
else//(pwm == PWM1)
152+
u32PWMClockSrc = CLK_GetPCLK1Freq();
153+
146154
}
147155

148156
for(u16Prescale = 1; u16Prescale < 0xFFF; u16Prescale++)//prescale could be 0~0xFFF

targets/TARGET_NUVOTON/TARGET_M451/lp_ticker.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@ void lp_ticker_init(void)
9595
TIMER_EnableInt((TIMER_T *) NU_MODBASE(timer2_modinit.modname));
9696
TIMER_EnableWakeup((TIMER_T *) NU_MODBASE(timer2_modinit.modname));
9797

98-
// Schedule wakeup to match semantics of lp_ticker_get_compare_match()
99-
lp_ticker_set_interrupt(wakeup_tick);
98+
// NOTE: TIMER_Start() first and then lp_ticker_set_interrupt(); otherwise, we may get stuck in lp_ticker_read() because
99+
// timer is not running.
100100

101101
// Start timer
102102
TIMER_Start((TIMER_T *) NU_MODBASE(timer2_modinit.modname));
103+
104+
// Schedule wakeup to match semantics of lp_ticker_get_compare_match()
105+
lp_ticker_set_interrupt(wakeup_tick);
103106
}
104107

105108
timestamp_t lp_ticker_read()

targets/TARGET_NUVOTON/TARGET_M451/serial_api.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
300300
MBED_ASSERT(uart_rts == obj->serial.uart);
301301
// Enable the pin for RTS function
302302
pinmap_pinout(rxflow, PinMap_UART_RTS);
303-
// nRTS pin output is high level active
304-
uart_base->MODEM = (uart_base->MODEM & ~UART_MODEM_RTSACTLV_Msk);
303+
// nRTS pin output is low level active
304+
uart_base->MODEM |= UART_MODEM_RTSACTLV_Msk;
305305
uart_base->FIFO = (uart_base->FIFO & ~UART_FIFO_RTSTRGLV_Msk) | UART_FIFO_RTSTRGLV_8BYTES;
306306
// Enable RTS
307307
uart_base->INTEN |= UART_INTEN_ATORTSEN_Msk;
@@ -313,8 +313,8 @@ void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, Pi
313313
MBED_ASSERT(uart_cts == obj->serial.uart);
314314
// Enable the pin for CTS function
315315
pinmap_pinout(txflow, PinMap_UART_CTS);
316-
// nCTS pin input is high level active
317-
uart_base->MODEMSTS = (uart_base->MODEMSTS & ~UART_MODEMSTS_CTSACTLV_Msk);
316+
// nCTS pin input is low level active
317+
uart_base->MODEMSTS |= UART_MODEMSTS_CTSACTLV_Msk;
318318
// Enable CTS
319319
uart_base->INTEN |= UART_INTEN_ATOCTSEN_Msk;
320320
}
@@ -479,9 +479,6 @@ static void uart_irq(serial_t *obj)
479479
#if DEVICE_SERIAL_ASYNCH
480480
int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
481481
{
482-
// NOTE: tx_width is deprecated. Assume its value is databits ceiled to the nearest number among 8, 16, and 32.
483-
tx_width = (obj->serial.databits <= 8) ? 8 : (obj->serial.databits <= 16) ? 16 : 32;
484-
485482
MBED_ASSERT(tx_width == 8 || tx_width == 16 || tx_width == 32);
486483

487484
obj->serial.dma_usage_tx = hint;
@@ -536,9 +533,6 @@ int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx
536533

537534
void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_width, uint32_t handler, uint32_t event, uint8_t char_match, DMAUsage hint)
538535
{
539-
// NOTE: rx_width is deprecated. Assume its value is databits ceiled to the nearest number among 8, 16, and 32.
540-
rx_width = (obj->serial.databits <= 8) ? 8 : (obj->serial.databits <= 16) ? 16 : 32;
541-
542536
MBED_ASSERT(rx_width == 8 || rx_width == 16 || rx_width == 32);
543537

544538
obj->serial.dma_usage_rx = hint;

targets/TARGET_NUVOTON/TARGET_NUC472/crypto/sha/sha1_alt.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ void mbedtls_sha1_clone(mbedtls_sha1_context *dst,
6666
{
6767
unsigned char output[20];
6868
crypto_sha_getinternstate(output, sizeof (output));
69-
dst->sw_ctx.state[0] = nu_get32_be(output);
70-
dst->sw_ctx.state[1] = nu_get32_be(output + 4);
71-
dst->sw_ctx.state[2] = nu_get32_be(output + 8);
72-
dst->sw_ctx.state[3] = nu_get32_be(output + 12);
73-
dst->sw_ctx.state[4] = nu_get32_be(output + 16);
69+
unsigned char *output_pos = output;
70+
unsigned char *output_end = output + (sizeof (output) / sizeof (output[0]));
71+
uint32_t *state_pos = (uint32_t *) &(dst->sw_ctx.state[0]);
72+
while (output_pos != output_end) {
73+
*state_pos ++ = nu_get32_be(output_pos);
74+
output_pos += 4;
75+
}
7476
}
7577
memcpy(dst->sw_ctx.buffer, src->hw_ctx.buffer, src->hw_ctx.buffer_left);
7678
if (src->hw_ctx.buffer_left == src->hw_ctx.blocksize) {

targets/TARGET_NUVOTON/TARGET_NUC472/crypto/sha/sha1_alt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#if defined(MBEDTLS_SHA1_C)
2626
#if defined(MBEDTLS_SHA1_ALT)
2727

28-
#include "sha1.h"
2928
#include "sha_alt_hw.h"
3029
#include "sha1_alt_sw.h"
3130

0 commit comments

Comments
 (0)