Earlier we called AT+QICSGP only if the username and password was set.
It seems that we must call it also to set up APN while in AT mode.
This commit fixes the issue + updated IPv4/v6 handling to be correct in the same call
Assert it properly and thus give out the target name where the
issue is, rather than just error out with KeyError and leave the
poor sod wondering where exactly the issue is.
Before:
```
=================================== FAILURES ===================================
_____________________________ test_bl_has_sectors ______________________________
def test_bl_has_sectors():
"""Assert a bootloader supporting pack has sector information"""
cache = Cache(True, True)
named_targets = (
target for target in TARGETS if
(hasattr(target, "device_name") and getattr(target, "bootloader_supported", False))
)
for target in named_targets:
assert target.device_name in cache.index,\
("Target %s contains invalid device_name %s" %
(target.name, target.device_name))
> assert cache.index[target.device_name]["sectors"],\
("Device name %s is misssing sector information" %
(target.device_name))
E KeyError: 'sectors'
```
After
```
___________________________________________________ test_bl_has_sectors ___________________________________________________
def test_bl_has_sectors():
"""Assert a bootloader supporting pack has sector information"""
# ToDo: validity checks for the information IN the sectors!
cache = Cache(True, True)
named_targets = (
target for target in TARGETS if
(hasattr(target, "device_name") and getattr(target, "bootloader_supported", False))
)
for target in named_targets:
assert target.device_name in cache.index,\
("Target %s contains invalid device_name %s" %
(target.name, target.device_name))
> assert "sectors" in cache.index[target.device_name],\
("Target %s does not have sectors" %
(target.name))
E AssertionError: Target NUCLEO_L073RZ does not have sectors
E assert 'sectors' in {'algorithms': [{'default': True, 'file_name': 'CMSIS/Flash/STM32L0xx_192.FLM', 'ram_size': None, 'ram_start': None, ....on_secure_callable': False, 'peripheral': False, ...}, 'default': True, 'size': 196608, 'start': 134217728, ...}}, ...}
```
This helps you finding the offending target a bit faster.
Kudos to Jammu Kekkonen (jammu.kekkonen@arm.com) to figuring out how to actually
run this test & the assertion.
Ref: Mbed OS issue #12219
1. Fix 'spurious close' by adding close() in open(). 'spurious close' gets frequent and cannot ignore when send() changes to asynchronous. User can retry open() until 'spurious close' gets true.
2. Allow only one actively sending socket because:
(1) ESP8266 AT packets 'SEND OK'/'SEND FAIL' are not associated with socket ID. No way to tell them.
(2) In original implementation, ESP8266::send() is synchronous, which implies only one actively sending socket.
3. Register 'SEND OK'/'SEND FAIL' oobs, like others in ESP8266::ESP8266 constructor. Don't get involved in oob management with send status because ESP8266 modem possibly doesn't reply these packets on error case.
4. Now that ESP8266::send() changes to asynchronous, drop the code with _parser.recv("SEND OK")/_parser.recv("SEND FAIL"). _parser.recv("SEND OK")/_parser.recv("SEND FAIL") and 'SEND OK'/'SEND FAIL' oobs both consume 'SEND OK'/'SEND FAIL' packets and complicate flow control.
On some targets with very fast counters used for us ticker (e.g. 26 MHz) tested interrupt delays provided in the ticker_timeout array may be too short (execution of the set_interrupt() function takes longer than the tested delay).
We will skip tested ticker delay if the delay is less than assumed max set_interrupt() function execution time (20 us).
Also, the test array will be extended.
Per feedback from STM the correct ROM size is 1 MB, instead of
16 MB. The KEIL source information is (in the pack itself) wrong, since
the KEIL webpage lists it as a 16 MB part, too - but if you look into
other sources - it is indeed 1 MB.
Original default constructor implementation wasn't quite working
properly; it didn't cope with the new "mode_limit" parameter.
Change mechanism so that this now works:
MbedCRC<POLY32_BIT_ANSI_CRC, 32, CrcMode::TABLE> crc;
CRC tests failed to exercise handling of the initial and final-xor
values with respect to reflection parameters. Add tests covering this.
Expected behaviour is that the initial value is always non-reflected and
the final-xor happens after the optional output reflection.
Init values often need reflection, and use of `__RBIT` prevents constant
init being done at compile time (unless `__RBIT` uses a compiler
intrinsic, which it doesn't for GCC).
Rather than try to handle constants 0U and -1U with a special case to
avoid the RBIT, which can in turn lead to runtime bloat for nonconstant
inits, use a C++20 style is_constant_evaluated() check to switch between
C and assembly forms.
This reduces code-size for non-constant init, by eliminating a runtime
condition, and allows the bit-reversal of any constant init to happen at
compile time.
GCC 9 and sufficiently-new Clang (including ARM Compiler 6.13) give us
access to the C++20 (draft) `is_constant_evaluated` test. Allows us to
restrict code to compile-time only.
This is particularly useful when using assembler intrinsics, which the
compiler cannot optimise or compile-time evaluate. It allows us to write
something like
constexpr uint32_t reverse_bits(uint32_t x)
{
if (is_constant_evaluated(x)) {
// C code to do calculation here
return x;
} else {
// an assembler intrinsic that cannot be optimised
return __RBIT(x);
}
}
This can then be totally compile-time given a constant input.
(In this example, ultimately it would be a good idea to include this
functionality in CMSIS's GCC `__RBIT`, which needs it because GCC
requires use of assembler. Clang implements `__RBIT` as a built-in,
meaning it can already compute it at compile-time, so does not benefit.).
Clang emits warnings if it can see a declaration when it needs a
templated variable. Add declarations for the specialisations in
MbedCRC.cpp to MbedCRC.h keep it quiet.
Tighten up a little by making all `_crc_table` references conditional
on tables being configured on.
string_to_pdp_type is only used in CellularContext classes and by having
the conversion method in CellularContext it can be used to check also
the non-standard Non-IP PDP type string.
This will optimize down the time it takes to restore the clock
settings when getting out of deep sleep.
If 48MHz is available let's use it, otherwise at least 4MHz should be
available for any MCU with MSI.