The renames are:
HAL_Delay -> mp_hal_delay_ms
sys_tick_udelay -> mp_hal_delay_us
sys_tick_get_microseconds -> mp_hal_ticks_us
And mp_hal_ticks_ms is added to provide the full set of timing functions.
Also, a separate HAL_Delay function is added which differs slightly from
mp_hal_delay_ms and is intended for use only by the ST HAL functions.
The sdk_12.1.0 nrf52_ble.c implementation was dependent on SDK components.
This has been replaced with the ble_uart.c implementation using a standalone
bluetooth driver implementation without need of SDK components.
Also, sdk.mk has been updated to not use a special linker script.
Script does not really work very well with blocking char read and
async ble notifications printing data when terminal stdout is blocked
by readchar. Bluetooth UART profile implemented in ble_uart.c is
now working with tralamazza's nus_console nodejs script.
Ref: https://github.com/tralamazza/nus_console
Disable Bluetooth UART to be used for REPL by default. Can be overridden
in nrf5_sdk_conf.h. It is defined in mpconfigport.h as it is connected to
mphalport.c, where the config is used to determine whether default print
functions should be using HW UART or Bluetooth UART.
ble_uart.c implements UART Bluetooth service on top of the
bluetooth stack driver api calls. Can be enabled to be compiled
in by defining MICROPY_PY_BLE_NUS = 1 in nrf5_sdk_conf.h.
If BLE UART service has been enabled, the mp_hal_stdout_tx_strn_cooked
is not defined by default anymore, and has to be implemented by the
UART driver (in this case BLE).
User can override PYTHON executable before running script,
gen-cpydiff.py works only with Python3 and most systems register
its executable as 'python3'.
I also didn't see any real reason for mkrules.mk to exist,
so I merged the contents into Makefile.
Now you can do:
```
make BOARD=pca10028 clean
make BOARD=pca10028 flash
```
and it will work properly.
In this case, raise an exception without a message.
This would allow to shove few code bytes comparing to currently used
mp_raise_msg(..., "") pattern. (Actual savings depend on function code
alignment used by a particular platform.)
In MicroPython, the path separator is guaranteed to be "/", extra unneeded
things take precious code space (in the port which doesn't have basic things
like floating-port support).
The parser was originally written to work without raising any exceptions
and instead return an error value to the caller. But it's now required
that a call to the parser be wrapped in an nlr handler, so we may as well
make use of that fact and simplify the parser so that it doesn't need to
keep track of any memory errors that it had. The parser anyway explicitly
raises an exception at the end if there was an error.
This patch simplifies the parser by letting the underlying memory
allocation functions raise an exception if they fail to allocate any
memory. And if there is an error parsing the "<id> = const(<val>)" pattern
then that also raises an exception right away instead of trying to recover
gracefully and then raise.
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data. Then in the
compiler this data would be turned into a str/bytes object. This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).
This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects). This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
This patch allows uPy consts to be bignums, eg:
X = const(1 << 100)
The infrastructure for consts to be a bignum (rather than restricted to
small integers) has been in place for a while, ever since constant folding
was upgraded to allow bignums. It just required a small change (in this
patch) to enable it.