Skip to content

Commit b263864

Browse files
committed
Merge remote-tracking branch 'ARMmbed/master'
2 parents b0739d7 + cd55625 commit b263864

File tree

690 files changed

+80870
-94681
lines changed

Some content is hidden

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

690 files changed

+80870
-94681
lines changed

cmsis/core_cmSecureAccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
/* ########################### Core Secure Access ########################### */
4343

4444
#ifdef FEATURE_UVISOR
45-
#include "uvisor-lib.h"
45+
#include "uvisor-lib/uvisor-lib.h"
4646

4747
/* Secure uVisor implementation. */
4848

docs/build_profiles.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ the the profile.
77

88
## Default profile
99
* Small and fast code
10-
* Full error information - e.x. asserts have filename and line number
10+
* Full error information - e.g. asserts have filename and line number
1111
* Hard to follow code flow when using a debugger
1212

1313
## Debug profile
1414
* Easy to step through code with a debugger
15-
* Full error information - e.x. asserts have filename and line number
15+
* Full error information - e.g. asserts have filename and line number
1616
* Largest and slowest profile
1717

1818
## Small profile
1919
* Smallest profile and still fast
2020
* Minimal error information
21-
* Hard to follow code flow when using a debugger
21+
* Chip is put to sleep when going idle:
22+
* debugger is likely to drop connection
23+
* breaks the [local file system](https://developer.mbed.org/handbook/LocalFileSystem) on the [mbed interface](https://developer.mbed.org/handbook/mbed-interface) (only for few NXP boards & if used)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#include "stm32f4xx_hal.h"
2+
3+
/**
4+
* Override HAL Eth Init function
5+
*/
6+
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
7+
{
8+
GPIO_InitTypeDef GPIO_InitStructure;
9+
if (heth->Instance == ETH) {
10+
11+
/* Enable GPIOs clocks */
12+
__HAL_RCC_GPIOA_CLK_ENABLE();
13+
__HAL_RCC_GPIOB_CLK_ENABLE();
14+
__HAL_RCC_GPIOC_CLK_ENABLE();
15+
__HAL_RCC_GPIOG_CLK_ENABLE();
16+
17+
/** ETH GPIO Configuration
18+
RMII_REF_CLK ----------------------> PA1
19+
RMII_MDIO -------------------------> PA2
20+
RMII_MDC --------------------------> PC1
21+
RMII_MII_CRS_DV -------------------> PA7
22+
RMII_MII_RXD0 ---------------------> PC4
23+
RMII_MII_RXD1 ---------------------> PC5
24+
RMII_MII_RXER ---------------------> PG2
25+
RMII_MII_TX_EN --------------------> PG11
26+
RMII_MII_TXD0 ---------------------> PG13
27+
RMII_MII_TXD1 ---------------------> PB13
28+
*/
29+
/* Configure PA1, PA2 and PA7 */
30+
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
31+
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
32+
GPIO_InitStructure.Pull = GPIO_NOPULL;
33+
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
34+
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
35+
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
36+
37+
/* Configure PB13 */
38+
GPIO_InitStructure.Pin = GPIO_PIN_13;
39+
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
40+
41+
/* Configure PC1, PC4 and PC5 */
42+
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
43+
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
44+
45+
/* Configure PG2, PG11 and PG13 */
46+
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13;
47+
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
48+
49+
/* Enable the Ethernet global Interrupt */
50+
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
51+
HAL_NVIC_EnableIRQ(ETH_IRQn);
52+
53+
/* Enable ETHERNET clock */
54+
__HAL_RCC_ETH_CLK_ENABLE();
55+
}
56+
}
57+
58+
/**
59+
* Override HAL Eth DeInit function
60+
*/
61+
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
62+
{
63+
if (heth->Instance == ETH) {
64+
/* Peripheral clock disable */
65+
__HAL_RCC_ETH_CLK_DISABLE();
66+
67+
/** ETH GPIO Configuration
68+
RMII_REF_CLK ----------------------> PA1
69+
RMII_MDIO -------------------------> PA2
70+
RMII_MDC --------------------------> PC1
71+
RMII_MII_CRS_DV -------------------> PA7
72+
RMII_MII_RXD0 ---------------------> PC4
73+
RMII_MII_RXD1 ---------------------> PC5
74+
RMII_MII_RXER ---------------------> PG2
75+
RMII_MII_TX_EN --------------------> PG11
76+
RMII_MII_TXD0 ---------------------> PG13
77+
RMII_MII_TXD1 ---------------------> PB13
78+
*/
79+
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
80+
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13);
81+
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
82+
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13);
83+
84+
/* Disable the Ethernet global Interrupt */
85+
NVIC_DisableIRQ(ETH_IRQn);
86+
}
87+
}

features/FEATURE_UVISOR/includes/uvisor-lib/rtx/rtx_box_index.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define __RTX_BOX_INDEX_H__
1919

2020
#include "cmsis_os.h"
21+
#include "api/inc/vmpu_exports.h"
2122

2223
#ifdef __cplusplus
2324
extern "C" {

features/netsocket/TCPServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "mbed.h"
1919

2020
TCPServer::TCPServer()
21-
: _pending(1), _accept_sem(0)
21+
: _pending(0), _accept_sem(0)
2222
{
2323
}
2424

features/netsocket/TCPServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TCPServer : public Socket {
4646
*/
4747
template <typename S>
4848
TCPServer(S *stack)
49-
: _pending(1), _accept_sem(0)
49+
: _pending(0), _accept_sem(0)
5050
{
5151
open(stack);
5252
}

features/netsocket/TCPSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "mbed_assert.h"
2020

2121
TCPSocket::TCPSocket()
22-
: _pending(1), _read_sem(0), _write_sem(0),
22+
: _pending(0), _read_sem(0), _write_sem(0),
2323
_read_in_progress(false), _write_in_progress(false)
2424
{
2525
}

features/netsocket/TCPSocket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TCPSocket : public Socket {
4545
*/
4646
template <typename S>
4747
TCPSocket(S *stack)
48-
: _pending(1), _read_sem(0), _write_sem(0),
48+
: _pending(0), _read_sem(0), _write_sem(0),
4949
_read_in_progress(false), _write_in_progress(false)
5050
{
5151
open(stack);

features/netsocket/UDPSocket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "mbed_assert.h"
2020

2121
UDPSocket::UDPSocket()
22-
: _pending(1), _read_sem(0), _write_sem(0)
22+
: _pending(0), _read_sem(0), _write_sem(0)
2323
{
2424
}
2525

features/netsocket/UDPSocket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class UDPSocket : public Socket {
4545
*/
4646
template <typename S>
4747
UDPSocket(S *stack)
48-
: _pending(1), _read_sem(0), _write_sem(0)
48+
: _pending(0), _read_sem(0), _write_sem(0)
4949
{
5050
open(stack);
5151
}

features/unsupported/USBDevice/USBDevice/TARGET_STM/USBHAL_STM_TARGET.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,27 @@
1515
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1616
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
*/
18+
1819
#ifdef TARGET_STM32F303ZE
1920
#include "USBHAL_STM32F303ZE.h"
2021
#endif
21-
#if defined(TARGET_STM32F429ZI) || defined(TARGET_STM32F446ZE) || defined(TARGET_STM32F207ZG) \
22-
|| defined(TARGET_STM32F767ZI) || defined (TARGET_STM32F746ZG) || defined(TARGET_STM32F411RE) \
23-
|| defined(TARGET_STM32F407VG) || defined(TARGET_STM32F401RE)
22+
23+
#if defined(TARGET_STM32F207ZG) || \
24+
defined(TARGET_STM32F401RE) || \
25+
defined(TARGET_STM32F407VG) || \
26+
defined(TARGET_STM32F411RE) || \
27+
defined(TARGET_STM32F412ZG) || \
28+
defined(TARGET_STM32F429ZI) || \
29+
defined(TARGET_STM32F446ZE) || \
30+
defined(TARGET_STM32F746ZG) || \
31+
defined(TARGET_STM32F767ZI)
2432
#include "USBHAL_STM_144_64pins.h"
2533
#endif
34+
2635
#ifdef TARGET_STM32L476VG
2736
#include "USBHAL_STM32L476VG.h"
2837
#endif
38+
2939
#ifdef TARGET_STM32F769NI
3040
#include "USBHAL_STM32F769NI.h"
3141
#endif

features/unsupported/USBDevice/USBDevice/USBHAL_STM32F4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ USBHAL::USBHAL(void) {
4848
// Enable power and clocking
4949
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
5050

51-
#if defined(TARGET_STM32F407VG) || defined(TARGET_STM32F401RE) || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F429ZI)
51+
#if defined(TARGET_STM32F407VG) || defined(TARGET_STM32F401RE) || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F412ZG) || defined(TARGET_STM32F429ZI)
5252
pin_function(PA_8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));
5353
pin_function(PA_9, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLDOWN, GPIO_AF10_OTG_FS));
5454
pin_function(PA_10, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS));

features/unsupported/USBHost/USBHost/TARGET_STM/USBHALHost_STM_TARGET.h

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

1919
/* 144 pins boards */
2020
#if defined(TARGET_NUCLEO_F429ZI) || defined(TARGET_NUCLEO_F446ZE) || defined(TARGET_NUCLEO_F207ZG) \
21-
|| defined(TARGET_NUCLEO_F767ZI) || defined(TARGET_NUCLEO_F746ZG)
21+
|| defined(TARGET_NUCLEO_F767ZI) || defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_NUCLEO_F412ZG)
2222
#include "USBHALHost_STM_144_64pins.h"
2323
#endif
2424

platform/toolchain.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@
268268
#endif
269269
#endif
270270

271+
#ifndef MBED_SECTION
272+
#if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM)
273+
#define MBED_SECTION(name) __attribute__ ((section (name)))
274+
#elif defined(__ICCARM__)
275+
#define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name))
276+
#else
277+
#error "Missing MBED_SECTION directive"
278+
#endif
279+
#endif
280+
271281
// FILEHANDLE declaration
272282
#if defined(TOOLCHAIN_ARM)
273283
#include <rt_sys.h>

rtos/rtos_idle.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
*/
2222

2323
#include "rtos/rtos_idle.h"
24+
#include "platform/sleep.h"
2425

2526
static void default_idle_hook(void)
2627
{
2728
/* Sleep: ideally, we should put the chip to sleep.
28-
Unfortunately, this usually requires disconnecting the interface chip (debugger).
29-
This can be done, but it would break the local file system.
29+
Unfortunately, this usually requires disconnecting the interface chip (debugger).
30+
This can be done, but it would break the local file system.
3031
*/
31-
// sleep();
32+
sleep();
3233
}
3334
static void (*idle_hook_fptr)(void) = &default_idle_hook;
3435

rtos/rtx/TARGET_CORTEX_A/RTX_Conf_CA.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@
107107
// <i> Initialize thread stack with watermark pattern for analyzing stack usage (current/maximum) in System and Thread Viewer.
108108
// <i> Enabling this option increases significantly the execution time of osThreadCreate.
109109
#ifndef OS_STKINIT
110-
#define OS_STKINIT 0
110+
#if (defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED)
111+
#define OS_STKINIT 1
112+
#else
113+
#define OS_STKINIT 0
114+
#endif
111115
#endif
112116

113117
// <o>Processor mode for thread execution

rtos/rtx/TARGET_CORTEX_A/rt_CMSIS.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,27 @@ os_InRegs osEvent_type svcThreadGetInfo (osThreadId thread_id, osThreadInfo info
843843
}
844844

845845
if (osThreadInfoStackMax == info) {
846-
// Cortex-A RTX does not have stack init so
847-
// the maximum stack usage cannot be obtained.
848-
ret.status = osErrorResource;
849-
return osEvent_ret_status;
846+
uint32_t i;
847+
uint32_t *stack_ptr;
848+
uint32_t stack_size;
849+
if (!(os_stackinfo & (1 << 28))) {
850+
// Stack init must be turned on for max stack usage
851+
ret.status = osErrorResource;
852+
return osEvent_ret_status;
853+
}
854+
stack_ptr = (uint32_t*)ptcb->stack;
855+
stack_size = ptcb->priv_stack;
856+
if (0 == stack_size) {
857+
// This is an OS task - always a fixed size
858+
stack_size = os_stackinfo & 0x3FFFF;
859+
}
860+
for (i = 1; i <stack_size / 4; i++) {
861+
if (stack_ptr[i] != MAGIC_PATTERN) {
862+
break;
863+
}
864+
}
865+
ret.value.v = stack_size - i * 4;
866+
return osEvent_ret_value;
850867
}
851868

852869
if (osThreadInfoEntry == info) {

0 commit comments

Comments
 (0)