8000 extmod/nimble: Run the eventq in micropython.schedule. by andrewleech · Pull Request #1 · jimmo/micropython · GitHub
[go: up one dir, main page]

Skip to content

extmod/nimble: Run the eventq in micropython.schedule. #1

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

Open
wants to merge 141 commits into
base: modbluetooth-1.13-fixes
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
ac94e06
zephyr: Include storage/flash_map.h unconditionally.
MaureenHelm Aug 7, 2020
17689a7
travis: Add zephyr build to CI.
MaureenHelm Jul 27, 2020
e76c746
docs: Change `\*` to `*` in argument lists.
agniutkarsh Jul 11, 2020
8727c4e
stm32/pin_defs_stm32: Fix pin printing to show IN mode correctly.
davehylands Aug 11, 2020
60cf2c0
tools/pyboard.py: Replace eval() of received data with alternative.
mbuesch Aug 12, 2020
492cf34
tools/mpy-tool.py: Fix offset of line number info.
mmilata Aug 13, 2020
448319a
tools/makemanifest.py: Use os.makedirs to make path for generated files.
dpgeorge Aug 21, 2020
5f9b105
py/runtime: Fix builtin compile() in "single" mode so it prints exprs.
dpgeorge Aug 21, 2020
20948a3
tests/extmod: Add test for uasyncio.sleep of a negative time.
dpgeorge Aug 20, 2020
55c76ea
extmod/uasyncio: Truncate negative sleeps to 0.
dpgeorge Aug 20, 2020
9289935
unix/fatfs_port: Implement get_fattime.
dpgeorge Jul 28, 2020
badd351
lib/timeutils: Add helper functions to deal with nanosecs since 1970.
dpgeorge Aug 1, 2020
ee50a6e
py/mphal.h: Introduce mp_hal_time_ns and implement on various ports.
dpgeorge Aug 1, 2020
2acc087
extmod/vfs_lfs: Add mtime support to littlefs files.
dpgeorge Jul 28, 2020
3d9a7ed
extmod/btstack: Implement GAP scan duration_ms parameter.
jimmo Aug 14, 2020
0bc2c1c
extmod/modbluetooth: Fix race between READ_REQUEST and other IRQs.
jimmo Aug 17, 2020
a80a146
extmod/bluetooth: Support active scanning in BLE.gap_scan().
pi-anl Aug 14, 2020
5fb276d
tests/extmod: Make uasyncio_fair test more reliable by adjusting sleeps.
dpgeorge Aug 26, 2020
91c5d16
nrf/Makefile: Improve user C modules support.
rcolistete Aug 15, 2020
405893a
tests/run-tests: Use absolute paths where possible.
stinos Apr 8, 2020
0c3f9d5
tests/run-tests: Make test output directory configurable.
stinos Apr 7, 2020
cef678b
extmod/machine_i2c: Fix buffer overrun if 'addrsize' is bigger than 32.
mbuesch Aug 23, 2020
a93a378
zephyr/README: Update required Zephyr version and mention new features.
dpgeorge Aug 28, 2020
338b12d
LICENSE,docs: Update copyright year range to include 2020.
dpgeorge Aug 29, 2020
40d174a
stm32/powerctrl.h: Include stdbool.h to get definition of bool.
dpgeorge Aug 29, 2020
0c7354a
tests: Split out complex reverse-op tests to separate test file.
dpgeorge Aug 29, 2020
0665907
all: Update Python code to conform to latest black formatting.
dpgeorge Aug 29, 2020
d1995e5
extmod/modlwip: Fix error return for TCP recv when not connected.
dpgeorge Aug 30, 2020
836bca9
unix/variants: Fix fast and freedos variants so they build again.
dpgeorge Aug 30, 2020
40153b8
esp32/mphalport: Fix mp_hal_time_ns offset.
dpgeorge Aug 30, 2020
c70e599
extmod/vfs: Support larger integer range in VFS stat time fields.
dpgeorge Aug 31, 2020
0385b21
unix/modos: Support larger integer range in uos.stat fields.
dpgeorge Aug 31, 2020
2a72e90
extmod/vfs: Add option to use 1970 as Epoch.
dpgeorge Aug 31, 2020
a909c21
unix/fatfs_port: Fix month offset in timestamp calculation.
dpgeorge Aug 31, 2020
0e6ef40
tests/extmod: Add tests for verifying FAT and littlefs mtime values.
dpgeorge Aug 31, 2020
b0932fc
all: Bump version to 1.13.
dpgeorge Sep 2, 2020
40ad8f1
all: Rename "sys" module to "usys".
stinos Jun 18, 2020
38959ed
lib/libm: Reduce size of static two_over_pi array.
dpgeorge Sep 3, 2020
5e69926
stm32/mpconfigport.h: Enable MICROPY_PY_REVERSE_SPECIAL_METHODS.
dpgeorge Sep 3, 2020
3ff7079
lib/utils/mpirq: Add mp_irq_init func, and clean up unused init method.
dpgeorge Sep 4, 2020
2310998
stm32/uart: Allow static IRQ handler registration.
jimmo Aug 14, 2020
5ff265a
stm32/modbluetooth_hci: Use a static mp_irq_obj_t for BT HCI UART IRQ.
jimmo Aug 14, 2020
e46aac2
extmod/modbluetooth: Rename logging macro to be just DEBUG_printf.
jimmo Aug 14, 2020
ed14435
extmod/modbluetooth: Refactor stack/hci/driver/port bindings.
jimmo Aug 14, 2020
5b08676
extmod/nimble: Set struct alignment correctly on 64-bit arch.
jimmo Aug 17, 2020
f3f31ac
extmod/nimble: Make nimble_malloc work with allocated size.
jimmo Aug 14, 2020
aa18ab7
extmod/nimble: Implement NimBLE mutex.
jimmo Aug 14, 2020
feed69a
unix/Makefile: Always enable -f*-sections regardless of DEBUG setting.
jimmo Aug 14, 2020
1b1b229
unix: Implement BLE H4 HCI UART for btstack/nimble.
jimmo Aug 14, 2020
c4af714
extmod/modbluetooth: Implement configuration of address modes.
jimmo Aug 14, 2020
26b6680
tests/multi_bluetooth: Update to new config('mac') behaviour.
jimmo Aug 14, 2020
67d8139
docs/library/ubluetooth.rst: Document BLE address modes.
jimmo Aug 14, 2020
52a2ce4
extmod/modbluetooth: Allow using mp_hal_get_mac as a static address.
jimmo Aug 17, 2020
8b00aea
extmod/btstack: Add btstack support for _IRQ_GATTS_READ_REQUEST.
pi-anl Aug 15, 2020
6077c63
stm32/mpbthciport: Increase char timeout of BT HCI UART.
pi-anl Aug 15, 2020
99a29ec
extmod/btstack: Detect HCI UART init failure.
jimmo Aug 18, 2020
311b851
esp32: Pin MicroPython and NimBLE tasks to core 0.
jimmo Aug 19, 2020
126f972
extmod/nimble: Add timeout for HCI sync on startup.
jimmo Aug 19, 2020
b27edb8
stm32/make-stmconst.py: Add support for WB55 header files.
jimmo Aug 20, 2020
30e8162
stm32/rfcore: Update rfcore.c to match how ST examples work.
jimmo Aug 20, 2020
9c9cc7a
stm32/boards/USBDONGLE_WB55: Add USE_MBOOT support.
jimmo Sep 8, 2020
0f28020
stm32/powerctrlboot: Acquire HSEM5 on STM32WB during SystemClock_Config.
jimmo Aug 28, 2020
5eda362
tests/multi_bluetooth: Make ble_gap_connect robust against event timing.
jimmo Aug 31, 2020
01f2d77
stm32/rfcore: Fix length matching in HCI parser.
jimmo Aug 31, 2020
8b4ebd7
stm32/rfcore: Refactor some helper funcs, and remove some magic numbers.
jimmo Sep 1, 2020
e2390d5
stm32/rfcore: Enable RX IRQ on BLE IPCC channel for better performance.
jimmo Sep 1, 2020
632e3b7
stm32/boards/NUCLEO_WB55: Add Python helper code for rfcore.
jimmo Aug 28, 2020
5f50568
mimxrt/boards: Add MIMXRT1064_EVK board.
Albort12138 Apr 7, 2020
4f2fe34
tools/mpy-tool.py: Fix merge of multiple mpy files to POP_TOP correctly.
dpgeorge Sep 4, 2020
75344af
nrf/main: Make mp_builtin_open signature match that in py/builtin.h.
dpgeorge Sep 8, 2020
27e1173
nrf: Remove unnecessary includes of mpconfigport.h and its header guard.
dpgeorge Sep 8, 2020
547688c
stm32/usb: Don't nul pyb_hid_report_desc if MICROPY_HW_USB_HID disabled.
dpgeorge Sep 10, 2020
709398d
stm32/rtc.h: Include py/obj.h to make header self contained.
dpgeorge Sep 10, 2020
8d5a40c
py/objfloat: Fix handling of negative float to power of nan.
dpgeorge Sep 4, 2020
2e54d9d
py: Fix handling of NaN in certain pow implementations.
stinos Sep 8, 2020
373b400
extmod/modussl_axtls: Reduce size of code that makes exception.
dpgeorge Sep 3, 2020
4b35aa5
tools: Write msvc-compatible frozen content.
stinos Sep 10, 2020
2a9ea69
windows/msvc: Support freezing modules.
stinos Sep 10, 2020
5b94c61
windows/Makefile: Support freezing modules.
stinos Sep 10, 2020
70bec41
windows: Show test failures in the Appveyor builds.
stinos Sep 10, 2020
50efce8
esp32/mpconfigport.h: Remove duplicate uhashlib registration.
jimmo Sep 10, 2020
85f2b23
py/showbc: Pass in an mp_print_t struct to all bytecode-print functions.
dpgeorge Sep 11, 2020
acdb060
py/parse: Pass in an mp_print_t to mp_parse_node_print.
dpgeorge Sep 11, 2020
b31cb21
stm32/servo: Fix angle and speed methods to work again with -ve args.
dpgeorge Sep 12, 2020
504522b
extmod/modbluetooth: Fix handling of optional data/uuid args.
jimmo Sep 11, 2020
6a6a5f9
extmod/modbluetooth: Make BLE.irq() method positional only.
jimmo Sep 11, 2020
19faf55
docs/library/ubluetooth.rst: Clarify position/kw arguments.
jimmo Sep 11, 2020
5be3bfc
extmod/modbluetooth: Print UUIDs correctly.
jimmo Sep 15, 2020
c200759
docs/library/ubluetooth.rst: Clarify peripheral/central vs server/client
jimmo Sep 11, 2020
fe642ce
tests/multi_bluetooth: Update UUID format in .exp files.
jimmo Sep 18, 2020
f271b96
docs/library/ubluetooth.rst: Add docs for MTU API.
jimmo Sep 11, 2020
857e2c8
extmod/modbluetooth: Implement MTU.
jimmo Sep 11, 2020
06dda48
tests/run-multitests.py: Show test/truth diff.
jimmo Sep 14, 2020
3086d35
tests/multi_bluetooth/ble_mtu.py: Add multitest for BLE MTU.
jimmo Sep 14, 2020
5c503de
travis: Install setuptools for black code formatting.
dpgeorge Sep 16, 2020
52d6eeb
esp32/boards/sdkconfig.base: Set default IDF log level to ERROR.
jimmo Sep 10, 2020
ecb36d2
esp32/modnetwork: Re-enable PPP support for IDF-SDK >=v4.
Sep 16, 2020
b287580
esp8266: Remove release-specific manifest, disable osdebug by default.
dpgeorge Sep 11, 2020
bd7af61
ports: Add utime.gmtime() function.
dpgeorge Sep 13, 2020
8f20cdc
all: Rename absolute time-based functions to include "epoch".
dpgeorge Sep 14, 2020
9d1983f
py/dynruntime.h: Add mp_import_* and mp_load/store_*.
jimmo Sep 16, 2020
8af9796
stm32/led: Support PWM output without TIM3.
Tweako Sep 16, 2020
c410a86
tests/basics: Enable == and != special-method tests now that they work.
dpgeorge Sep 17, 2020
42342fa
tests/basics: Add test for MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS ops.
dpgeorge Sep 17, 2020
3e16763
stm32/rfcore: Fix FUS layout and size of ipcc_device_info_table_t.
dpgeorge Sep 22, 2020
71adf50
extmod/vfs: Fix lookup of entry in root dir so it fails correctly.
dpgeorge Sep 22, 2020
bada8c9
windows: Update build instructions in README.
stinos Sep 22, 2020
ca01784
py/objstr: Make bytes(bytes_obj) return bytes_obj.
iyassou Sep 23, 2020
50e34f9
py/objarray.h: Add mp_obj_memoryview_init() helper function.
dpgeorge Sep 23, 2020
81f2162
extmod/modbluetooth: Change module-owned bytes objects to memoryview.
dpgeorge Sep 23, 2020
c8ade2b
docs/develop: Add notes on prerequisite tools for building native .mpy.
dpgeorge Sep 23, 2020
9123b67
tests/run-tests: Use -BS flags when running CPython.
dpgeorge Sep 24, 2020
0fd0eb0
examples/bluetooth: Update to use positional-only args to irq().
jimmo Sep 24, 2020
319437d
extmod/modure: Allow \\ in re.sub replacements.
pi-anl Sep 25, 2020
ce49be4
zephyr: Replace zephyr integer types with C99 types.
MaureenHelm Sep 12, 2020
f842e32
zephyr: Const-ify struct device instance pointers.
MaureenHelm Sep 12, 2020
c2a7aac
travis: Update zephyr build to v2.4.0.
MaureenHelm Sep 12, 2020
997ec9e
zephyr: Update build instructions to v2.4.0.
MaureenHelm Sep 28, 2020
ee7568c
docs/reference/packages.rst: Fix typo, remove duplicate "port".
dlech Sep 25, 2020
c711c00
py/makeversionhdr.py: Match only git tags which look like versions.
mikewadsten Sep 22, 2020
c35deb2
extmod/machine_i2c: Rename type to SoftI2C and add custom print method.
dpgeorge Sep 16, 2020
aaed338
extmod/machine_i2c: Remove "id" arg in SoftI2C constructor.
dpgeorge Sep 16, 2020
9e0533b
extmod/machine_spi: Remove "id" arg in SoftSPI constructor.
dpgeorge Sep 16, 2020
39d50d1
ports: Add SoftI2C and SoftSPI to machine module where appropriate.
dpgeorge Sep 16, 2020
71f3ade
ports: Support legacy soft I2C/SPI construction via id=-1 arg.
dpgeorge Sep 25, 20 8000 20
98182a9
docs: Update I2C and SPI docs to add reference to SoftI2C and SoftSPI.
dpgeorge Sep 29, 2020
905a18a
unix,windows: Implement mp_hal_time_ns using gettimeofday.
dpgeorge Sep 24, 2020
d4b61b0
extmod/utime_mphal: Add generic utime.time_ns() function.
dpgeorge Sep 24, 2020
843dcd4
py/parse: Expose rule-name printing as MICROPY_DEBUG_PARSE_RULE_NAME.
dpgeorge Sep 30, 2020
817b80a
unix/variants: Enable MICROPY_DEBUG_PARSE_RULE_NAME on coverage build.
dpgeorge Sep 30, 2020
0fff2e0
stm32/Makefile: Allow boards to extend SRC_C, SRC_O and OBJ variables.
dpgeorge Oct 2, 2020
1dc6435
esp32: Use path relative to root for netutils/timeutils headers.
dpgeorge Sep 23, 2020
7497d89
stm32/sdio: Don't change any DMA2 settings on H7 MCUs.
iabdalkader Oct 2, 2020
9855b9c
stm32/sdcard: Fix H7 build when using SDMMC2.
iabdalkader Oct 2, 2020
7c76a2d
stm32/rfcore: Add Python API for basic rfcore operations.
jimmo Oct 1, 2020
222ec1a
stm32/boards/NUCLEO_WB55: Add standalone WB55 FUS/WS firmware updater.
jimmo Sep 29, 2020
fa12bfc
stm32/rfcore: Update to support WS=1.9.0.0.4.
jimmo Oct 9, 2020
880875b
py/objdict: Add mp_const_empty_dict_obj, use it for mp_const_empty_map.
jimmo Oct 9, 2020
b137d06
py/objtype: Handle __dict__ attribute when type has no locals.
jimmo Aug 4, 2020
fef28eb
extmod/nimble: Run the eventq in micropython.schedule.
pi-anl Aug 28, 2020
4e9448c
extmod/bluetooth: Ensure uuid object always have base type assigned.
pi-anl Oct 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
extmod/machine_i2c: Fix buffer overrun if 'addrsize' is bigger than 32.
The memory operation functions read_mem() and write_mem() create a
temporary buffer on the local C stack for the address bytes with the size
of 4 bytes.  This buffer is filled in a loop from the user supplied address
and address length.  If the user supplied 'addrsize' is bigger than 32, the
local buffer is overrun.

Fix this by raising an exception for invalid 'addrsize' values.

Signed-off-by: Michael Buesch <m@bues.ch>
  • Loading branch information
mbuesch authored and dpgeorge committed Aug 27, 2020
commit cef678b2dbab528a54bc36bd6c3be84a38857629
22 changes: 15 additions & 7 deletions extmod/machine_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,24 @@ STATIC mp_obj_t machine_i2c_writevto(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_i2c_writevto_obj, 3, 4, machine_i2c_writevto);

STATIC int read_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, uint8_t *buf, size_t len) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);
uint8_t memaddr_buf[4];
STATIC size_t fill_memaddr_buf(uint8_t *memaddr_buf, uint32_t memaddr, uint8_t addrsize) {
size_t memaddr_len = 0;
if ((addrsize & 7) != 0 || addrsize > 32) {
mp_raise_ValueError(MP_ERROR_TEXT("invalid addrsize"));
}
for (int16_t i = addrsize - 8; i >= 0; i -= 8) {
memaddr_buf[memaddr_len++] = memaddr >> i;
}
return memaddr_len;
}

STATIC int read_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t addrsize, uint8_t *buf, size_t len) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);

// Create buffer with memory address
uint8_t memaddr_buf[4];
size_t memaddr_len = fill_memaddr_buf(&memaddr_buf[0], memaddr, addrsize);

int ret = mp_machine_i2c_writeto(self, addr, memaddr_buf, memaddr_len, false);
if (ret != memaddr_len) {
// must generate STOP
Expand All @@ -546,11 +557,8 @@ STATIC int write_mem(mp_obj_t self_in, uint16_t addr, uint32_t memaddr, uint8_t
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(self_in);

// Create buffer with memory address
size_t memaddr_len = 0;
uint8_t memaddr_buf[4];
for (int16_t i = addrsize - 8; i >= 0; i -= 8) {
memaddr_buf[memaddr_len++] = memaddr >> i;
}
size_t memaddr_len = fill_memaddr_buf(&memaddr_buf[0], memaddr, addrsize);

// Create partial write buffers
mp_machine_i2c_buf_t bufs[2] = {
Expand Down
0