This matches the timeout used in linux:
https://linux.die.net/man/5/dhclient.conf
This resolves several issues noticed during testing when we
have a very large number of devices that try to get an IP address
around the same time.
Before, the UDP test was very strict on the number of packets it would
try to match before failing. Now it will keep trying for the whole test
to get enough passing packets. It also includes the test's UUID so you
can validate which packets are being received.
The dtls test already has the ability to retry upon a UDP failure.
However the sockets are currently configured to be blocking and to wait
forever. I added a timeout of 1.5 seconds in order the test to correctly
timeout.
Based on lwip_ethernetif.c skeleton file,
use init, receive and transfer
functionality of SMSC9220 Ethernet driver
for the lightweight IP stack.
Receive mechanism is interrupt driven.
HW buffer sizes:
Tx = 4608 bytes (MTU)
Rx = 10560 bytes
lwIP fine tuning:
mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/include/lwip/opt.h
Change-Id: I0ea95650c65fb32cafb5c2d3dde11420c61dba66
Signed-off-by: Gabor Kertesz <gabor.kertesz@arm.com>
Basic TCP/UDP tests for PPP based onboard cellular modems.
Tests basic public APIs defined in CellularBase.h
A customer port must pass this test set, hence verifying their
particular implementation.
This commit includes:
* Add support for sending response to duplicate messages
* Add randomness for retransmission time
* Fix usage sn coap blockwise max time data stored
* CoAP parser option handler does not seem to handle "Option Length" completely according to spec
* Handle '0' value if duplication buffer size is set through the sn_coap_protocol_set_duplicate_buffer_size()
Silence deprecation warnings in the config store C and C++ files. This
removes warnings that not relevant to applications. Note - using
these deprecated functions still gives an error outside of these files.
Move the metrics mutex into the ifdef MBED_STACK_STATS_ENABLED since
it is not used ouside of it. This fixes the warning:
[Warning] greentea_metrics.cpp@37,28: 'mutex' defined but not used [-Wunused-variable]
The semaphore xTXDCountSem had the count to match the number of
resources available, but was being used as a binary semaphore in a
loop to listen for events. This patch updates the logic to make use of
the resource count.
With RTX5 the OS traps with an error if the a semaphore is released
more times than its count with an error similar to
"Semaphore 10000e6c error -17". Because xTXDCountSem is being used
as a binary semaphore it triggered this trap. With this patch the
semaphore is no longer used as a binary semaphore and no longer traps.
This patch split the Case class in two entities: Case and case_t. case_t contains the test case data structure while Case provide the interface to the test case. Unlike the class Case, case _t is a POD and can be instantiated at compile time and put in the constant data section (in ROM).
The Specification class has also been modified to accept arrays of case_t.
In class MBRBlockDevice the tole32 function had used union member
names u32 and u8. The introduction of REALTEK_RTL8195AM cauesd a
conflict with type names in basic_types given they're aliased as
macros to uint32_t and uint8_t respectively.
The old open/opendir functions did not provide a route for errors and
relied on implementations manually setting errno. Updated to return
errors directly.
Required for other representations of FileSystems, ie LocalFileSystem
Introduces FileSystemHandle for the same behaviour as FileHandle and
DirHandle.
Requires the following to hook into file/dir lookup:
```
int open(FileHandle **file, const char *filename, int flags)
int open(DirHandle **dir, const char *path)
```
This hook is provided by the FileSystem class, so requires no changes
from implementations.
This is necessary for support of block devices with >512 byte
blocks, such as most SPI flash parts.
- Enabled support of up to 4096 byte blocks
- Added support for heap-backed buffers using _FS_HEAPBUF
- Necessary to avoid stack overflows
- Avoids over-aggresive allocations of _MAX_SS
- Enabled _FS_TINY to further reduce memory footprint
- Haven't found a downside for this yet except for possible
thread contention
Add the attribute flash to enable priority inheritance and robust mode.
The robust flag allows mutexes held by terminated threads to be
properly released.
Move memory allocation to be done at a different location. Currently allocated
in a function that is called from the interrupt handler.
Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
External EMAC drivers are currently directly attaching to lwip_stack.c
via mbed_lwip_bringup et al. Restore the original prototypes to avoid
compatibility breakage.
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a future USBSerial etc.
ATParser becomes ATCmdParser.
* UARTSerial moves to /drivers
* APN_db.h is moved from platform to cellular/util/.
* Original CellularInterface is restored for backward compatability (again, supposedly there
are users of that).
* A new file, CellularBase is added which will now servce as the base class for all
upcoming drivers.
* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
between an on-board or an off-board implementation.
- PPPCellularInterface is a generic network interface that works with a generic FileHandle
and PPP. A derived class is needed to pass that FileHandle.
- PPPCellularInterface provides some base functionality like network registration, AT setup,
PPP connection etc. Lower level job is delegated to the derived classes and various modem
specific APIs are provided which are supposed to be overridden.
- UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
In future we could proive a USBInterface that would derive from PPPCellularInterface and could
pass the FileHandle back.
- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
a shield has to override the modem_init(), modem_power_up() etc as it cannot use
onboard_modem_api.h.
Some targets define MBEDTLS_md5_C in targets.json in order to force the system to use
external mbedtls instead of lwip internal crypt, i.e., polarssl.
LWIP's internal md5 mechanism is tied to PPP for some reason. In a previosly merged commit
an attempt was made to steal md5 functions by faking that PPP was turned on. However
that solution was broken in case of really turning on PPP functionality.
This commit fixes the breakage and also corrects the logic in case a target decides to use
external md5 implementation from mbedtls or otherwise (i.e, wants to stick to the internal
implementation).
* Implements CellularInterface
* Reference design for CellularInterface implementations
* Uses an external mbed-os IP stack and talks to modem over PPP.
GCC have not been capable enough to catch some linker errors which arose when
ethernet support for LWIP was disabled. Checks have been added to make sure that
unrefrenced code is not linked in.
nsapi_ppp glue layer is made more transparent to public cellular API. Storage of IP
addresses is removed. PPP layer already stores the addresses, so we pass the pointer back
to the upper layers.
If PPP is not used, we provide dummy functions.
* state machine corrections
* adding various standard API methods
* Addition/revision/enhancement of the nsapi_ppp glue layer
* Turning off debug by default
Mainly reutilizing code from ublox C027 support lib.
As we are using external PDP context, i.e., an external IP stack,
we will pass username and password to underlying stack running PPP.
We only support CHAP as the authentication protocol.
POSIX poll() provides a mechanism to attach a POLL_HUP event
if the modem or device hangs up on you. POLL_HUP and POLL_OUT are
mutually exclusive. We poll in the PPP_input() routine if the modem
hung up. If it did we stop the data consumption, close PPP and go back
to the driver for reserruction of AT parser and subsequent retries or
application specific actions.
This is achieved by attaching an interrupt to the DCD line of the modem.
When DCD line goes high (off), we have lost the carrier. So we record an
POLLHUP event using _poll_change().
In case of carrier lost, we would like to inform PPP data pump.
That involved setting up link status flag down semaphores.
mbed_lwip_bringup() and mbed_lwip_bringdown() had been Ethernet specific only.
We extend these routines to support PPP as well. Currently we support only one interface
at a time. However, future enhancement to multi interface support should be trivial.
mbed_ppp_init() is extended to take a function ptr.
ppp_lwip will call this callback upon a change in ppp link status.
in the beginning, the Ublox driver waits until the PPP link is established properly.
We introduce here mbed_trace to ppp_lwip shim layer.
If for some reason, FEATURE_COMMON_PAL is not included in the build,
dummies for trace functions are provided.
Add configuration to control Ethernet, PPP and TCP support.
Replaces LWIP_TRANSPORT_ETHERNET/PPP defines formerly used by targets.
Ethernet and PPP can be enabled simultaneously.
DHCPv4 is now only enabled if IPv4 and Ethernet are both enabled - we
assume PPP uses IPCP for configuration.
PPP configuration adjusted to cope with LWIP 2.0 changes, and
optimised for RAM a little.
This is a glue layer between LWIP PPP implementation and a device type FileHandle
stream. This enables an external interface which has a FileHandle, utilize LWIP network
stack via PPP, e.g., Cellular device, WiFi chips etc.
Its totally transparent to external device. Only thing this layer is interested in, is a
FileHandle. Similar is true for for the external device, it just hands over its stream to this
PPP layer and rest of the magic is done by this layer.
Use a newer version of uVisor that doesn't change the box main thread
function type. Previously, we required all box main thread definitions
to change from taking a `const void *` to a `void *` when moving to
RTX5. We now are backwards compatibile.
- Implicit MBR still allowed during mount
- maintains storage compatibility
- Not needed
- MBR utility is not exposed through the FAT filesystem,
so the only used partition was always the first. Omitting
the MBR is functionally equivalent
- Saves a few blocks on storage for MBR + offset
for FAT alignment
- Duplicated with MBRBlockDevice
- The implicit MBR actually prevents nesting a FAT filesystem
in the MBRBlockDevice
Thread device needs to wait for connectivity:
-routers will create new network and get local connectivity
-end device will get connectivity once attached to existing network
-devices without network settings gets connectivity once
commissioned and attached to network
Reduce RAM consumption so all tests can still be built when using
CMSIS/RTX5. Also reduce clutter by removing the per target stack size
defines in the tests.
Remove all unsupported net libraries from features/unsupported. There's already lwip for mbed OS that we support, and cellular will come soon to the codebase reworked.
Plus remove unsupported/tests for these libraries.
lwip now uses mbed client random library under common pal when available.
Ported lwip reference TCP initial sequence number handling to mbed-os
lwip stack. Handling is based on RFC 6528.
s140 headers renamed form ble_* to nrf_ble_*,
Removed s130 and s132 headers named form ble_*
(Them had been added by #2ff572682798562e812015dc775b5896e0fda5a4)
Headers inclusinons were changed in order to meet above changes.
Revrted bad change in us_ticker.c:
use __disable_irq lock instead of core_util_critical_section_enter lock
for setting rtc1 tick for systick emulation as was good before.
Observed during investigation of
https://github.com/ARMmbed/mbed-os/issues/4246 - DNS queries sent
the entire buffer, not just the bit filled in.
Inefficient, especially for 6LoWPAN, and a security hole - the trailing
data could be previously-used heap.
mbed_lwip_set_mac_address calls mbed_mac_address to get hwaddr
from device, but device may not be accessible until it is powered
up and initialized.
This patch delays mbed_lwip_set_mac_address call until device is
ready.
Signed-off-by: Tony Wu <tonywu@realtek.com>
Copy of changes from
features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/source
to
features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source
Minor change - List of key modifiers updated to include the
logo/GUI/windows key. Also added the options to specify the right hand
versions of the keys rather than just the left if for some reason
someone wants to do this.
Changes are limited to the keyboard header file and are backwards
compatible.
The new modifier values are in line with the table given on page 56 of
this document http://www.usb.org/developers/hidpage/HID1_11.pdf
1. added call to busReset() to KL25Z HAL; now the USB stack survives if you disconnect the cable, similar to LPC40 2. busReset callback to update terminal_connected in USBCDC 3. new bool USBSerial::connected() to read protected terminal_connected property, useful when you want to check if the terminal is ready from main app
The standard is intentionally vague on if filesystems must
have '.' and '..' entries, allowing filesystems to omit this
concept completely:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html
However, the '.' and '..' entries are common on FAT filesystems
and in most other filesystems.
This enables '.' and '..' entries in the FAT filesystem.
Define tcpip-thread-stacksize and default-thread-stacksize in
lwip's mbed_lib.json, and use them accordingly in lwipopts.h.
Signed-off-by: Tony Wu <tonywu@realtek.com>
Originally the ethernet ISR would be linked in to all mbed-os based
firmware because it was named ENET_IRQHandler() so that it would be
automatically placed in the FLASH image's interrupt vector table. This
meant that programs which made no use of the lwIP stack still pulled in
this ISR.
This commit changes the name of the routine so that the ISR isn't
automatically placed in the interrupt vector table at link time but is
instead dynamically placed in the interrupt vector table at runtime
when the lwIP stack is initialized. Now the ethernet ISR is only linked
in when it is actually needed.
Example arm-none-eabi-size output for a simple LED blinking program
showing the before and after size results:
text data bss dec hex filename
13208 148 7784 21140 5294 LPC1768/HelloWorld.elf
text data bss dec hex filename
12700 148 7468 20316 4f5c LPC1768/HelloWorld.elf
From opt.h:
IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
filter on recv operations.
The IP_SOF_BROADCAST_RECV option does not enable or disable recieving
broadcast packets, it only enables a software filter.