Skip to content

Commit

Permalink
Merge pull request #3467 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.3.1
  • Loading branch information
0xc0170 committed Dec 20, 2016
2 parents c3b9436 + b0889da commit 0789928
Show file tree
Hide file tree
Showing 578 changed files with 116,418 additions and 22,123 deletions.
4 changes: 4 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/malloc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#endif

#define NUM_THREADS 5
#if defined(__CORTEX_A9)
#define THREAD_STACK_SIZE DEFAULT_STACK_SIZE
#else
#define THREAD_STACK_SIZE 256
#endif

DigitalOut led1(LED1);
volatile bool should_exit = false;
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/mutex/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#define STACK_SIZE 768
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
#define STACK_SIZE 1536
#elif (defined(TARGET_EFR32)) && !defined(TOOLCHAIN_ARM_MICRO)
#define STACK_SIZE 768
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
#define STACK_SIZE 1024
#elif defined(TARGET_XDOT_L151CC)
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/semaphore/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#define STACK_SIZE 768
#elif (defined(TARGET_EFM32GG_STK3700)) && !defined(TOOLCHAIN_ARM_MICRO)
#define STACK_SIZE 1536
#elif (defined(TARGET_EFR32)) && !defined(TOOLCHAIN_ARM_MICRO)
#define STACK_SIZE 768
#elif defined(TARGET_MCU_NRF51822) || defined(TARGET_MCU_NRF52832)
#define STACK_SIZE 768
#elif defined(TARGET_XDOT_L151CC)
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/threads/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#define STACK_SIZE 1024
#elif defined(TARGET_HI2110)
#define STACK_SIZE 512
#elif defined(TARGET_EFR32)
#define STACK_SIZE 512
#else
#define STACK_SIZE DEFAULT_STACK_SIZE
#endif
Expand Down
5 changes: 5 additions & 0 deletions docs/exporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ The dname (device name) field on line 156 directly corresponds to that in the Uv
##### IAR
[`tools/export/iar/iar_definitions.json`](https://github.com/ARMmbed/mbed-os/blob/master/tools/export/iar/iar_definitions.json) utilizes this device name to store information necessary to set the target in an IAR project.

##### Updating index.json
You can regenerate `index.json` to contain a newly made CMSIS pack with the following command:

`mbed export -i [IDE] --update-packs`

You should include the changes to `index.json` in your PR that adds support for the new target.



Expand Down
9 changes: 5 additions & 4 deletions drivers/I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class I2C {
* @param repeated Repeated start, true - do not send stop at end
*
* @returns
* 0 on success (ack),
* non-0 on failure (nack)
* 0 or non-zero - written number of bytes,
* negative - I2C_ERROR_XXX status
*/
int write(int address, const char *data, int length, bool repeated = false);

Expand All @@ -127,8 +127,9 @@ class I2C {
* @param data data to write out on bus
*
* @returns
* '1' if an ACK was received,
* '0' otherwise
* '0' - NAK was received
* '1' - ACK was received,
* '2' - timeout
*/
int write(int data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def find_interface_to_target_addr(target_ip):
:return:
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((target_ip, 0)) # Target IP, Any port
try:
s.connect((target_ip, 0)) # Target IP, any port
except socket.error:
s.connect((target_ip, 8000)) # Target IP, 'random' port
ip = s.getsockname()[0]
s.close()
return ip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def find_interface_to_target_addr(target_ip):
:return:
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((target_ip, 0)) # Target IP, Any port
try:
s.connect((target_ip, 0)) # Target IP, any port
except socket.error:
s.connect((target_ip, 8000)) # Target IP, 'random' port
ip = s.getsockname()[0]
s.close()
return ip
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "fsl_port.h"

/*******************************************************************************
* Code
******************************************************************************/
void k66f_init_eth_hardware(void)
{
port_pin_config_t configENET = {0};

#ifndef FEATURE_UVISOR
/* Disable MPU only when uVisor is not around. */
MPU->CESR &= ~MPU_CESR_VLD_MASK;
#endif/*FEATURE_UVISOR*/

/* Ungate the port clock */
CLOCK_EnableClock(kCLOCK_PortA);
CLOCK_EnableClock(kCLOCK_PortB);
CLOCK_EnableClock(kCLOCK_PortE);

/* Affects PORTE_PCR26 register, configured as ENET_1588 CLKIN */
PORT_SetPinMux(PORTE, 26u, kPORT_MuxAlt2);
/* Affects PORTB_PCR1 register */
PORT_SetPinMux(PORTB, 1u, kPORT_MuxAlt4);

configENET.openDrainEnable = kPORT_OpenDrainEnable;
configENET.mux = kPORT_MuxAlt4;
configENET.pullSelect = kPORT_PullUp;
/* Affects PORTB_PCR0 register */
PORT_SetPinConfig(PORTB, 0u, &configENET);

/* Affects PORTA_PCR13 register */
PORT_SetPinMux(PORTA, 13u, kPORT_MuxAlt4);
/* Affects PORTA_PCR12 register */
PORT_SetPinMux(PORTA, 12u, kPORT_MuxAlt4);
/* Affects PORTA_PCR14 register */
PORT_SetPinMux(PORTA, 14u, kPORT_MuxAlt4);
/* Affects PORTA_PCR5 register */
PORT_SetPinMux(PORTA, 5u, kPORT_MuxAlt4);
/* Affects PORTA_PCR16 register */
PORT_SetPinMux(PORTA, 16u, kPORT_MuxAlt4);
/* Affects PORTA_PCR17 register */
PORT_SetPinMux(PORTA, 17u, kPORT_MuxAlt4);
/* Affects PORTA_PCR15 register */
PORT_SetPinMux(PORTA, 15u, kPORT_MuxAlt4);

/* Set RMII clock src. */
CLOCK_SetRmii0Clock(1U);

/* Select the Ethernet timestamp clock source */
CLOCK_SetEnetTime0Clock(0x2);
}

/*******************************************************************************
* EOF
******************************************************************************/


Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ uint32_t *rx_ptr[ENET_RX_RING_LEN];
********************************************************************************/
#define ENET_BuffSizeAlign(n) ENET_ALIGN(n, ENET_BUFF_ALIGNMENT)
#define ENET_ALIGN(x,align) ((unsigned int)((x) + ((align)-1)) & (unsigned int)(~(unsigned int)((align)- 1)))
#if (defined(TARGET_K64F) && (defined(TARGET_FRDM)))
extern void k64f_init_eth_hardware(void);
#endif

#if (defined(TARGET_K66F) && (defined(TARGET_FRDM)))
extern void k66f_init_eth_hardware(void);
#endif

/* K64F EMAC driver data structure */
struct k64f_enetdata {
Expand Down Expand Up @@ -204,8 +210,13 @@ static err_t low_level_init(struct netif *netif)
(uint8_t *)&rx_ptr,
NULL,
};

#if (defined(TARGET_K64F) && (defined(TARGET_FRDM)))
k64f_init_eth_hardware();
#endif

#if (defined(TARGET_K66F) && (defined(TARGET_FRDM)))
k66f_init_eth_hardware();
#endif

sysClock = CLOCK_GetFreq(kCLOCK_CoreSysClk);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define ETH_DISABLE_TX() do{EMAC->CTL &= ~EMAC_CTL_TXON;}while(0)
#define ETH_DISABLE_RX() do{EMAC->CTL &= ~EMAC_CTL_RXON;}while(0)


/*
#ifdef __ICCARM__
#pragma data_alignment=4
Expand Down Expand Up @@ -99,7 +100,7 @@ static int reset_phy(void)
}

if(delay == 0) {
printf("Reset phy failed\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_SEVERE|LWIP_DBG_ON,("Reset phy failed\n"));
return(-1);
}

Expand All @@ -120,23 +121,23 @@ static int reset_phy(void)
}

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

if(reg & ADVERTISE_100FULL) {
printf("100 full\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("100 full\n"));
EMAC->CTL |= (EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
} else if(reg & ADVERTISE_100HALF) {
printf("100 half\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("100 half\n"));
EMAC->CTL = (EMAC->CTL & ~EMAC_CTL_FUDUP_Msk) | EMAC_CTL_OPMODE_Msk;
} else if(reg & ADVERTISE_10FULL) {
printf("10 full\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("10 full\n"));
EMAC->CTL = (EMAC->CTL & ~EMAC_CTL_OPMODE_Msk) | EMAC_CTL_FUDUP_Msk;
} else {
printf("10 half\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_ALL|LWIP_DBG_ON, ("10 half\n"));
EMAC->CTL &= ~(EMAC_CTL_OPMODE_Msk | EMAC_CTL_FUDUP_Msk);
}
}
Expand Down Expand Up @@ -267,7 +268,7 @@ void EMAC_RX_IRQHandler(void)
EMAC->INTSTS = m_status;
if (m_status & EMAC_INTSTS_RXBEIF_Msk) {
// Shouldn't goes here, unless descriptor corrupted
printf("RX descriptor corrupted \r\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_SERIOUS|LWIP_DBG_ON, ("RX descriptor corrupted \r\n"));
//return;
}
ack_emac_rx_isr();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* search-and-replace for the word "ethernetif" to replace it with
* something that better describes your network interface.
*/

#include "lwip/opt.h"

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

if( !(ETH_link_ok()) && (netif->flags & NETIF_FLAG_LINK_UP) ) {
//tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1);
/* tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, (void*) netif, 1); */
netif_set_link_down(netif);
printf("Link Down\r\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING|LWIP_DBG_ON, ("Link Down\r\n"));
}else if ( ETH_link_ok() && !(netif->flags & NETIF_FLAG_LINK_UP) ) {
//tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1);
/* tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, (void*) netif, 1); */
netif_set_link_up(netif);
printf("Link Up\r\n");
LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING|LWIP_DBG_ON, ("Link Up\r\n"));
}

// printf("-");
osDelay(200);
}
}
Expand Down
3 changes: 3 additions & 0 deletions features/FEATURE_LWIP/lwip-interface/lwip/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ HISTORY

++ Bugfixes:

2016-11-25: Simon Goldschmidt
* dhcp.c: fixed bug #49676 (Possible endless loop when parsing dhcp options)

2016-07-20: Simon Goldschmidt
* memp.h/.c: fixed bug #48442 (memp stats don't work for MEMP_MEM_MALLOC)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,8 @@ dhcp_parse_reply(struct dhcp *dhcp, struct pbuf *p)
#endif /* LWIP_DHCP_GET_NTP_SRV*/
case(DHCP_OPTION_OVERLOAD):
LWIP_ERROR("len == 1", len == 1, return ERR_VAL;);
/* decode overload only in options, not in file/sname: invalid packet */
LWIP_ERROR("overload in file/sname", options_idx == DHCP_OPTIONS_OFS, return ERR_VAL;);
decode_idx = DHCP_OPTION_IDX_OVERLOAD;
break;
case(DHCP_OPTION_MESSAGE_TYPE):
Expand Down
Loading

0 comments on commit 0789928

Please sign in to comment.