Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release candidate for mbed-os-5.2.2 #3227

Merged
merged 107 commits into from
Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
b6366e3
Making building and linking tests fully parallel.
bridadan Oct 10, 2016
d1eaefe
Modifying behavior of 'silent' option in toolchains
bridadan Oct 11, 2016
09a09f7
Handling output of parallelized test building.
bridadan Oct 11, 2016
32b4e60
Removing need for memap to printed through toolchains
bridadan Oct 11, 2016
beb7ec2
Removing dependency on StringIO, only change return type of table export
bridadan Oct 11, 2016
62c5298
Fix wrong timer channel number of pwm PB_5 pin
bcostm Oct 13, 2016
f118e89
STM32xx - Change how the ADC internal pins are checked before pinmap_…
bcostm Oct 13, 2016
ad11567
digital_loop tests update for STM32
jeromecoutant Oct 12, 2016
957c073
nRF5 - added serial flow control configure API implementation
nvlsianpu Oct 17, 2016
f549391
Making IAR exporter build test parallelized
bridadan Oct 20, 2016
1b82e8c
nrf5 fix - gpioe pin was uninitialzied for new mode, should been unin…
nvlsianpu Oct 20, 2016
2a9bc59
Add u-blox Sara-N target.
RobMeades Oct 13, 2016
5b7d40b
LOAD_ADDRESS added
pradeep-gr Oct 20, 2016
5b9638c
To resolve conflict
pradeep-gr Oct 26, 2016
c968f58
Conflict resolved
pradeep-gr Oct 26, 2016
c07b9a0
mbed-os-tests-mbedtls-selftest issue fixed
pradeep-gr Oct 26, 2016
bd3f728
Handle [NOT_SUPPORTED] exception in make.py
bulislaw Oct 26, 2016
c254e07
STM32F207: GCC_ARM remove zero bss, in startup. zero bss is done in l…
jamike Oct 17, 2016
829c053
STM32F3xxx : GCC_ARM remove zero bss, in startup. zero bss is done in…
jamike Oct 17, 2016
0bd2ba6
STM32F4xx: GCC_ARM remove zero bss, in startup. zero bss is done in l…
jamike Oct 17, 2016
58fbe60
STM32L4xx : GCC_ARM remove zero bss, in startup. zero bss is done in …
jamike Oct 17, 2016
981ebbc
STM32F7xx : GCC_ARM remove zero bss, in startup. zero bss is done in …
jamike Oct 17, 2016
b6f411e
STM32L1xx : GCC_ARM a call to _start which performs zero bss, C++ ini…
jamike Oct 17, 2016
550afdf
STM32L1xx : GCC_ARM remove zero bss, in startup. zero bss is done in …
jamike Oct 17, 2016
00c9839
STM32L0xx : GCC_ARM remove zero bss, in startup. zero bss is done in …
jamike Oct 17, 2016
0af5d10
STM32F0xx : GCC_ARM use a call to _start which performs zero bss, C++…
jamike Oct 17, 2016
3245ad6
STM32F0xx: GCC_ARM remove zero bss, in startup. zero bss is done in l…
jamike Oct 17, 2016
142cdb1
STM32F1xx : GCC_ARM remove zero bss done at startup. Zero bss is done…
jamike Oct 17, 2016
169e577
INIT:GCC add call to HAL_Init system_init, stops all on going timer. …
jamike Oct 7, 2016
9e8f5bc
Replacing getchar with RawSerial getc in greentea-client.
bridadan Oct 26, 2016
9e8195f
Added support for 6lowpan PAN ID filter to mbed mesh api configuration
Oct 28, 2016
45bd8ce
Update of can_api.c fixing #2987
martinjaeger Oct 11, 2016
5a153dd
Fixing some typos
martinjaeger Oct 30, 2016
af21169
Updating IAR definition for the NCS36510 for IAR EW v7.8
bridadan Oct 31, 2016
1106c36
Preventing test from printing before Greentea __sync
bridadan Oct 31, 2016
7cccf2e
Update USB driver for devices with Kinetis SDK support
mmahadevan108 Oct 13, 2016
81733d3
FAT tests: Add support for KL43Z
mmahadevan108 Oct 28, 2016
e3561fa
Add K64F, K22F and KL43Z to travis build
mmahadevan108 Oct 27, 2016
25fa65c
Adding Kinetis devices to mbed 2 tests and updating build_travis script
bridadan Oct 31, 2016
4600de6
Removed static declaration for the StorageVolumeManager in the CFStor…
Oct 27, 2016
14f9518
lwip - Fixed memory leak in k64f cyclic-buffer overflow
geky Oct 25, 2016
5c97ea9
lwip - Change k64f emac layer to drop frames on buffer exhaustion
geky Oct 28, 2016
0665a17
Make update.py test compile examples prior to updating mbed-os version.
adbridge Oct 17, 2016
56c0a4d
Review: Update example_lib.py to use rmtree rather than rm system cal…
adbridge Oct 18, 2016
1a1c41e
Minor review comments plus add new 'compile' option to examples json …
adbridge Oct 25, 2016
7801c50
Update ble example meta data to fix unsupported compilation combinati…
adbridge Oct 26, 2016
dbe95cf
Remove superfluous debugging line.
adbridge Oct 28, 2016
9d7049e
Switch off compilation of wifi example while awaiting a fix for issue…
adbridge Oct 28, 2016
7efae2e
lwip/nsapi - Cleaned up warnings in network code
geky Oct 28, 2016
7657db4
nsapi - Added better heuristic for the default record of DNS queries
geky Oct 28, 2016
8194427
Add a device_name to microbit entry in targets.json
sarahmarshy Oct 31, 2016
f6ced86
i2c_loop tests update for STM32
jeromecoutant Oct 19, 2016
efa90de
Allowing mbed_app.json files to be discovered for tests.
bridadan Oct 6, 2016
c268f97
nRF52 - switch irq priorities of driver handlers to level (APP_IRQ_PR…
nvlsianpu Oct 10, 2016
9e25e1e
lwip: Allow several configuration macros to be set externally.
Oct 3, 2016
3eefc86
lwip: Annotate with memory used by config parameters
Oct 5, 2016
d484d57
lwip: Expose principal socket limits as configuration parameters.
Oct 19, 2016
7f4986f
Adding new Maxim Integrated target.
jeremybrodt Aug 31, 2016
8d9174e
Adding new Maxim Integrated target.
jeremybrodt Oct 7, 2016
5d9df77
Prevent serial activity if tx/rx pin is NC.
jeremybrodt Oct 25, 2016
9363f2b
Add wait for serial characters to transmit before deleting serial obj…
jeremybrodt Oct 25, 2016
8e9e595
Removed progen from target configuration.
jeremybrodt Nov 2, 2016
c1403a9
Add support for FRDM-K82F
mmahadevan108 Sep 20, 2016
6582aa4
NanostackInterface: Check input address is IPv6
kjbracey Oct 31, 2016
cef0a8f
NanostackInterface: Allow binding to address
kjbracey Oct 31, 2016
df07f61
NanostackInterface: Remove string round-trips
kjbracey Oct 31, 2016
24016a1
nsapi_dns: Provide 2 IPv6-hosted default servers
kjbracey Oct 31, 2016
2130701
Fixing project.py -S printing problem
bridadan Oct 31, 2016
fe02951
Adding check to Travis for exporter support matrix
bridadan Nov 1, 2016
027f2b2
New export-build tests.
sarahmarshy Oct 31, 2016
5e4289a
changing variable names and respecting requirement kwargs
sarahmarshy Oct 31, 2016
718d0c0
Make ArmPackManager cache a static variable (to avoid reading index.j…
sarahmarshy Oct 31, 2016
21ac243
Build method documentation. Removal of unused Exception classes.
sarahmarshy Nov 1, 2016
96259cd
Add boolean 'export' to examples.json.
sarahmarshy Nov 1, 2016
9b1c735
Folder re-org to fit new MCU K22F variances
Oct 25, 2016
15f3d3f
Incorporating Brian Daniel's review comments for PR 3136
Nov 1, 2016
f3ec635
Remove the variable ret due to compiler warning: Compile [ 94.6%]: tr…
Nov 2, 2016
dc7f020
Update tests to fix build failures. Also make the code similar to oth…
mmahadevan108 Nov 2, 2016
06b7d5d
Rename SD_0/SD_1 SD_0_0/SD_0_1 to match real SD H/W
ccli8 Oct 13, 2016
c4f0ce2
Fix PWM1 clock source setting error
ccli8 Oct 18, 2016
6af9ee2
support NUC472 CAN
cyliangtw Oct 18, 2016
ad329f7
Support CAN
cyliangtw Oct 20, 2016
b0df87c
Fix SetBaudRate 5% inaccuracy issue
cyliangtw Oct 21, 2016
83d657b
replace tab by 4 space char
cyliangtw Oct 27, 2016
a3698ab
remove dead code in device.h of NUC472 & M453
cyliangtw Oct 28, 2016
12f3cb8
remove dead code in can_api.c of NUC472 & M453
cyliangtw Nov 1, 2016
f824231
fixed misaligned lines in can_api.c of NUC472 & M453
cyliangtw Nov 1, 2016
9cf3c56
Exporter documentation
sarahmarshy Nov 2, 2016
0058695
add back SPI3 pins that shouldn't have been removed
mfiore02 Nov 2, 2016
07cb268
Use internal class variable for resolving templates in makefiles
theotherjimmy Nov 2, 2016
9ef6986
Quote the shell call in mkdir and rmdir
theotherjimmy Nov 3, 2016
8f138f6
Quote make invocation too
theotherjimmy Nov 4, 2016
93e5e23
Directory traversal error
sarahmarshy Nov 4, 2016
8a37995
Force make exporter to search PATH for compilers
theotherjimmy Nov 2, 2016
868dcdc
Using Popen for uvision and unifying the structure of the build funct…
bridadan Nov 3, 2016
67dcb9f
nsapi - Added standardized return types for size and errors
geky Oct 18, 2016
e769c79
nsapi - Adopted standardized return types in lwip
geky Oct 18, 2016
33b600e
nsapi - Adopted standardized return types in the Odin wifi interface
geky Nov 2, 2016
a49783c
nsapi - Adopted standardized return types in the Nanostack interfaces
geky Nov 2, 2016
10cfea3
Added emac_stack_mem_copy. Needed by the u-blox ODIN-W2 driver.
Oct 27, 2016
2c1c845
Added copying of the wifi_link_out buffer since the buffer might chan…
Oct 27, 2016
9ddfed2
Added missing checks for wifi_link_out when allocating packets
Oct 31, 2016
d255de6
Added cbMAIN_dispatchEventQueue
Nov 6, 2016
3fccdea
Fixed dynamic message queue for scan results
Nov 6, 2016
4736cab
Updated ublox ODIN-W2 binaries
Nov 7, 2016
f764479
Tab -> spaces
Nov 7, 2016
639bd4f
Update MBED_LIBRARY_VERSION to 129
adbridge Nov 8, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ script:
- python tools/test/pylint.py
- py.test tools/test/toolchains/api.py
- python tools/test/memap/memap_test.py
- python tools/project.py -S
- python tools/build_travis.py
before_install:
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
Expand All @@ -16,9 +17,7 @@ before_install:
- arm-none-eabi-gcc --version
- python --version
install:
- sudo pip install colorama
- sudo pip install prettytable
- sudo pip install jinja2
- sudo pip install -r requirements.txt
- sudo pip install pytest
- sudo pip install pylint
- sudo pip install hypothesis
Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_drivers/lp_timeout/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void lp_timeout_500us(void)

}

status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
greentea_case_failure_abort_handler(source, reason);
return STATUS_CONTINUE;
}
Expand All @@ -134,7 +134,7 @@ Case cases[] = {
#endif /* DEVICE_SLEEP */
};

status_t greentea_test_setup(const size_t number_of_cases) {
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(20, "default_auto");
return greentea_test_setup_handler(number_of_cases);
}
Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_hal/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void lp_ticker_5s(void)
lp_ticker_delay_us(5000000, LONG_TIMEOUT);
}

status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
greentea_case_failure_abort_handler(source, reason);
return STATUS_CONTINUE;
}
Expand All @@ -149,7 +149,7 @@ Case cases[] = {
#endif /* DEVICE_SLEEP */
};

status_t greentea_test_setup(const size_t number_of_cases) {
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(20, "default_auto");
lp_ticker_data->interface->init();
return greentea_test_setup_handler(number_of_cases);
Expand Down
9 changes: 6 additions & 3 deletions TESTS/mbedmicro-mbed/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ class Test {
const int pattern;

public:
Test(const char* _name) : name(_name), pattern(PATTERN_CHECK_VALUE) {
print("init");
Test(const char* _name, bool print_message=true) : name(_name), pattern(PATTERN_CHECK_VALUE) {
if (print_message) {
print("init");
}
}

void print(const char *message) {
Expand Down Expand Up @@ -39,7 +41,7 @@ class Test {
};

/* Check C++ startup initialisation */
Test s("Static");
Test s("Static", false);

/* EXPECTED OUTPUT:
*******************
Expand All @@ -59,6 +61,7 @@ int main (void) {
bool result = true;
for (;;)
{
s.print("init");
// Global stack object simple test
s.stack_test();
if (s.check_init() == false)
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 @@ -25,6 +25,8 @@
#define STACK_SIZE 512
#elif defined(TARGET_XDOT_L151CC)
#define STACK_SIZE 1024
#elif defined(TARGET_HI2110)
#define STACK_SIZE 512
#else
#define STACK_SIZE DEFAULT_STACK_SIZE
#endif
Expand Down
60 changes: 60 additions & 0 deletions docs/exporters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# About the exporters

The mbed exporters are used to export your code to various 3rd party tools and IDEs. Each exporter implements a `generate` function that produces an IDE specific project file. Exporters benefit from [mbed build tools](https://github.com/ARMmbed/mbed-os/blob/master/docs/BUILDING.md#build-mbed-sdk-library-from-sources). However, instead of using your source and [config data](https://github.com/ARMmbed/mbed-os/blob/master/docs/config_system.md) to create an executable, we use that information to populate an IDE project file that will be configured to build, flash, and debug your code. You can find exporter implementations [here](https://github.com/ARMmbed/mbed-os/tree/master/tools/export).

## mbed-cli command

`mbed export -m [target] -i [IDE]`

# Adding export support for a target

If you have added new target to the mbed SDK, exporting will allow users to transition from mbed source code to the offline development environment of their choice. This functionality activates the use of your device for larger number of users.

## Eclipse and Make

Eclipse project export utilizes a generated Makefile for building. Other than target configuration within the [config system](https://github.com/ARMmbed/mbed-os/blob/master/docs/mbed_targets.md) for mbed build system support, there is no additional work to provide Make export.

### Available mbed-cli commands

`mbed export -m [target] -i [make_gcc_arm, make_iar, make_armc5, eclipse_gcc_arm, eclipse_iar, eclipse_armc5]`

## UVision and IAR

### CMSIS Packs

UVision and IAR both utilize [CMSIS packs](http://www.keil.com/pack/doc/CMSIS/Pack/html/index.html) to find target information necessary to create a valid project file.

We utilize the tool [ArmPackManager](https://github.com/ARMmbed/mbed-os/tree/master/tools/arm_pack_manager) to scrape [MDK5 Software Packs](https://www.keil.com/dd2/Pack/) for target information. This is achieved by parsing [http://www.keil.com/pack/index.idx](http://sadevicepacksprod.blob.core.windows.net/idxfile/index.idx). The relevant information in the [PDSC (Pack Description)](http://www.keil.com/pack/doc/CMSIS/Pack/html/_pack_format.html) retrieved from each URL in the index is stored in [index.json](https://github.com/ARMmbed/mbed-os/blob/master/tools/arm_pack_manager/index.json). A `.pdsc` file typically describes a family of devices. Each device is uniquely identified by its [device name](https://github.com/ARMmbed/mbed-os/blob/master/docs/mbed_targets.md#device_name). Thus, this name makes a natural key to associate a device with its information in `index.json`.

#### What's in a device name?
There is no reliable way to map an mbed alias like [NUCLEO_F030R8](https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json#L603) to its unique identifier, [STM32F030R8](https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json#L615), as it is listed in a CMSIS pack (and subsequently `index.json`). So, we added a [device name](https://github.com/ARMmbed/mbed-os/blob/master/docs/mbed_targets.md#device_name) field in `targets.json`. **This field is required for IAR or UVision exporter support**.

#### Code Usage
http://www.keil.com/pack/Keil.Kinetis_K20_DFP.pdsc is the PDSC that contains TEENSY_31 device (MK20DX256xxx7). It has been parsed by ArmPackManager and stored in `index.json`. The device information begins on line 156:
```xml
<device Dname="MK20DX256xxx7">
<processor Dfpu="0" Dmpu="0" Dendian="Little-endian" Dclock="72000000"/>
<compile header="Device\Include\MK20D7.h" define="MK20DX256xxx7"/>
<debug svd="SVD\MK20D7.svd"/>
<memory id="IROM1" start="0x00000000" size="0x40000" startup="1" default="1"/>
<memory id="IROM2" start="0x10000000" size="0x8000" startup="0" default="0"/>
<memory id="IRAM1" start="0x20000000" size="0x8000" init ="0" default="1"/>
<memory id="IRAM2" start="0x1FFF8000" size="0x8000" init ="0" default="0"/>
<algorithm name="Flash\MK_P256.FLM" start="0x00000000" size="0x40000" default="1"/>
<algorithm name="Flash\MK_D32_72MHZ.FLM" start="0x10000000" size="0x8000" default="1"/>
<book name="Documents\K20P100M72SF1RM.pdf" title="MK20DX256xxx7 Reference Manual"/>
<book name="Documents\K20P100M72SF1.pdf" title="MK20DX256xxx7 Data Sheet"/>
</device>
```

##### Uvision
The dname (device name) field on line 156 directly corresponds to that in the Uvision5 IDE target selection window. [`tools/export/uvision/uvision.tmpl`](https://github.com/ARMmbed/mbed-os/blob/master/tools/export/uvision/uvision.tmpl#L15), uses target information from these packs is used to generate valid Uvision5 projects. If the device name is not found, we use a generic ARM CPU target in Uvision5.

##### 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.






3 changes: 1 addition & 2 deletions docs/mbed_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,5 @@ The hook code can look quite different between different targets. Take a look at

This property is used to pass necessary data for exporting the mbed code to various 3rd party tools and IDEs.

This is possible because the device name corresponds to a field in publicly hosted CMSIS packs. These packs hold target properties. [This](http://www.keil.com/pack/Keil.Kinetis_K20_DFP.pdsc) is the pdsc that contains TEENSY_31 device (MK20DX256xxx7). The device information begins on line 156. The dname (device name) field on line 156 directly corresponds to that in the Uvision5 IDE target selection window. Beginning on line 15 of `tools/export/uvision/uvision.tmpl`, target information from these packs is used to generate valid Uvision5 projects. If the device name is not found, we use a generic ARM CPU target in Uvision5.
`tools/export/iar/iar_definitions.json` utilizes this device name to store information necessary to set the target in an IAR project.
Please see [exporters.md](exporters.md) for information about this field.

4 changes: 3 additions & 1 deletion docs/testing_mbed_OS_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ The full build process is:

When building an mbed application, the presence of a `mbed_app.json` file allows you to set or override different config settings from libraries and targets. However, because the tests share a common build, this can cause issues when tests have different configurations that affect the OS.

If you need to use app config, this must be set via the `--app-config` option when calling `mbed test`. **If this option is not specified, the build system will ignore all `mbed_app.json` files and use the default config values.**
The build system will look for an `mbed_app.json` file in your shared project files (any directory not inside of a `TESTS` folder). If this is found, this configuration file will be used for both the non-test code as well as each test case inside your project's source tree. If there is more than one `mbed_app.json` files in the source tree, the config system will error.

If you need to test with multiple configurations, then you can use the `--app-config` option. This will override the search for an `mbed_app.json` file and use the config file you specify for the build.

### Running tests

Expand Down
14 changes: 7 additions & 7 deletions features/FEATURE_LWIP/lwip-interface/EthernetInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,30 @@ EthernetInterface::EthernetInterface()
{
}

int EthernetInterface::set_network(const char *ip_address, const char *netmask, const char *gateway)
nsapi_error_t EthernetInterface::set_network(const char *ip_address, const char *netmask, const char *gateway)
{
_dhcp = false;
strncpy(_ip_address, ip_address ? ip_address : "", sizeof(_ip_address));
strncpy(_netmask, netmask ? netmask : "", sizeof(_netmask));
strncpy(_gateway, gateway ? gateway : "", sizeof(_gateway));
return 0;
return NSAPI_ERROR_OK;
}

int EthernetInterface::set_dhcp(bool dhcp)
nsapi_error_t EthernetInterface::set_dhcp(bool dhcp)
{
_dhcp = dhcp;
return 0;
return NSAPI_ERROR_OK;
}

int EthernetInterface::connect()
nsapi_error_t EthernetInterface::connect()
{
return mbed_lwip_bringup(_dhcp,
_ip_address[0] ? _ip_address : 0,
_netmask[0] ? _netmask : 0,
_gateway[0] ? _gateway : 0);
}

int EthernetInterface::disconnect()
nsapi_error_t EthernetInterface::disconnect()
{
return mbed_lwip_bringdown();
}
Expand All @@ -63,7 +63,7 @@ const char *EthernetInterface::get_ip_address()
return _ip_address;
}

return 0;
return NULL;
}

const char *EthernetInterface::get_netmask()
Expand Down
9 changes: 5 additions & 4 deletions features/FEATURE_LWIP/lwip-interface/EthernetInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class EthernetInterface : public EthInterface
* @param gateway Null-terminated representation of the local gateway
* @return 0 on success, negative error code on failure
*/
virtual int set_network(const char *ip_address, const char *netmask, const char *gateway);
virtual nsapi_error_t set_network(
const char *ip_address, const char *netmask, const char *gateway);

/** Enable or disable DHCP on the network
*
Expand All @@ -55,17 +56,17 @@ class EthernetInterface : public EthInterface
* @param dhcp False to disable dhcp (defaults to enabled)
* @return 0 on success, negative error code on failure
*/
virtual int set_dhcp(bool dhcp);
virtual nsapi_error_t set_dhcp(bool dhcp);

/** Start the interface
* @return 0 on success, negative on failure
*/
virtual int connect();
virtual nsapi_error_t connect();

/** Stop the interface
* @return 0 on success, negative on failure
*/
virtual int disconnect();
virtual nsapi_error_t disconnect();

/** Get the local MAC address
*
Expand Down
5 changes: 5 additions & 0 deletions features/FEATURE_LWIP/lwip-interface/emac_stack_lwip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ void emac_stack_mem_free(emac_stack_t* stack, emac_stack_mem_t *mem)
pbuf_free((struct pbuf*)mem);
}

void emac_stack_mem_copy(emac_stack_t* stack, emac_stack_mem_t *to, emac_stack_mem_t *from)
{
pbuf_copy((struct pbuf*)to, (struct pbuf*)from);
}

void *emac_stack_mem_ptr(emac_stack_t* stack, emac_stack_mem_t *mem)
{
return ((struct pbuf*)mem)->payload;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,22 @@ static void update_read_buffer(uint8_t *buf)
*/
static void k64f_tx_reclaim(struct k64f_enetdata *k64f_enet)
{
uint8_t i = 0 ;

/* Get exclusive access */
sys_mutex_lock(&k64f_enet->TXLockMutex);

i = k64f_enet->tx_consume_index;
// Traverse all descriptors, looking for the ones modified by the uDMA
while((i != k64f_enet->tx_produce_index) && (!(g_handle.txBdDirty->control & ENET_BUFFDESCRIPTOR_TX_READY_MASK))) {
pbuf_free(tx_buff[i]);
while((k64f_enet->tx_consume_index != k64f_enet->tx_produce_index) &&
(!(g_handle.txBdDirty->control & ENET_BUFFDESCRIPTOR_TX_READY_MASK))) {
pbuf_free(tx_buff[k64f_enet->tx_consume_index % ENET_TX_RING_LEN]);
if (g_handle.txBdDirty->control & ENET_BUFFDESCRIPTOR_TX_WRAP_MASK)
g_handle.txBdDirty = g_handle.txBdBase;
else
g_handle.txBdDirty++;

i = (i + 1) % ENET_TX_RING_LEN;
k64f_enet->tx_consume_index += 1;
osSemaphoreRelease(k64f_enet->xTXDCountSem.id);
}

k64f_enet->tx_consume_index = i;
/* Restore access */
sys_mutex_unlock(&k64f_enet->TXLockMutex);
}
Expand Down Expand Up @@ -524,17 +522,17 @@ static err_t k64f_low_level_output(struct netif *netif, struct pbuf *p)
dst += q->len;
}

/* Wait until a descriptor is available for the transfer. */
/* THIS WILL BLOCK UNTIL THERE ARE A DESCRIPTOR AVAILABLE */
while (g_handle.txBdCurrent->control & ENET_BUFFDESCRIPTOR_TX_READY_MASK)
osSemaphoreWait(k64f_enet->xTXDCountSem.id, osWaitForever);
/* Check if a descriptor is available for the transfer. */
int32_t count = osSemaphoreWait(k64f_enet->xTXDCountSem.id, 0);
if (count < 1)
return ERR_BUF;

/* Get exclusive access */
sys_mutex_lock(&k64f_enet->TXLockMutex);

/* Save the buffer so that it can be freed when transmit is done */
tx_buff[k64f_enet->tx_produce_index] = temp_pbuf;
k64f_enet->tx_produce_index = (k64f_enet->tx_produce_index + 1) % ENET_TX_RING_LEN;
tx_buff[k64f_enet->tx_produce_index % ENET_TX_RING_LEN] = temp_pbuf;
k64f_enet->tx_produce_index += 1;

/* Setup transfers */
g_handle.txBdCurrent->buffer = psend;
Expand Down
7 changes: 6 additions & 1 deletion features/FEATURE_LWIP/lwip-interface/lwip-sys/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ typedef uintptr_t mem_ptr_t;
#define SZT_F "uz"

/* ARM/LPC17xx is little endian only */
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
#ifdef BYTE_ORDER
#undef BYTE_ORDER
#endif
#define BYTE_ORDER LITTLE_ENDIAN
#endif

/* Use LWIP error codes */
#define LWIP_PROVIDE_ERRNO
Expand Down Expand Up @@ -92,7 +97,7 @@ typedef uintptr_t mem_ptr_t;
#define LWIP_CHKSUM_ALGORITHM 0

void* thumb2_memcpy(void* pDest, const void* pSource, size_t length);
u16_t thumb2_checksum(void* pData, int length);
u16_t thumb2_checksum(const void* pData, int length);
#else
/* Used with IP headers only */
#define LWIP_CHKSUM_ALGORITHM 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ pbuf_coalesce(struct pbuf *p, pbuf_layer layer)
return p;
}
err = pbuf_copy(q, p);
LWIP_UNUSED_ARG(err);
LWIP_ASSERT("pbuf_copy failed", err == ERR_OK);
pbuf_free(p);
return q;
Expand Down
Loading