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

micropython on Beetle (Zephyr) #3

Closed
wants to merge 32 commits into from
Closed

micropython on Beetle (Zephyr) #3

wants to merge 32 commits into from

Conversation

fvincenzo
Copy link
Contributor

I completed the porting of micropython on Beetle via Zephyr and I found few minor issues that have been solved with my patch set below.

@pfalcon
Copy link
Owner

pfalcon commented Oct 26, 2016

@fvincenzo : Thanks for the patches. I've cherry-picked "lib: Remove compilation warning" to master, but turned it broke other ports, so I had to redo it differently. Anyway, that issue is fixed now.

For other 2 changes, I'd prefer to squash them with earlier @daniel-thompson's patches, the motivation being is that I'd like to have Zephyr port be a "model" for new ports, and thus have a clean history. The drawback is that your authorship info will be lost. The changes are small, so I hope that's ok, but let me know if that's of concern to you.

4th change you just pushed looks good, will cherry pick to master next step.

Another note: I found that yesterday's change to zephyt master broke the build: https://gerrit.zephyrproject.org/r/#/c/5863/ . I pushed a stop-gap fix to this branch, while raising this issue and seeing if it can be fixed differently. Depending on the version of zephyr you use, you may need to revert that change locally ("zephyr/zephyr_getchar: Update for recent Zephyr refactor of console hooks.")

pfalcon and others added 28 commits October 26, 2016 19:02
An interpreted language needs good size of stack to do anything useful
(minimum can be set to a lower value of course).
Zephyr actually filters these out, and requires patching to let them thru.
And underlying uIP uses them to e.g. communicate changes in connection
state (like peer closed connection). Without this change (and associated
Zephyr patch), socket read requests may hang if peer close happened after
read request was issued.
Using Zephyr's builtin mbedtls.
TODO: Think about connection reset in other places too.
Zephyr appear to include only constrained config, we need more features to
access real-world HTTPS, etc.
More heavier use, like real-world TLS, can smash default 4K. And *this*
stack appears to be used by main(), not CONFIG_MAIN_STACK_SIZE.
…ate.

The fact that *now* connection closed doesn't mean there's no data in the
queue. We should process packet queue in order, and consider connection
closed only when hit corresponding state change packet (the latter requires
patches to Zephyr, because otherwise it doesn't deliver connection state
change packets to an app).
It has issues even on various ARM variants (e.g. armv7e-m errors out).
…dr).

Talking to Internet won't work without this.
TLS generates a lot, plus there're leaks.
The outputexpors target, which exports Zephyr environment variables, was
recently added to Zephyr. By exploiting this feature we can hugely simplify
the build system, improving robustness at the same time.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Allow micropython to automatically disable features that
Zephyr has been configured not to support.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
daniel-thompson and others added 2 commits October 26, 2016 19:02
The integration with Zephyr is fairly clean but requires us to use
two arguments to describe a pin:

  drv_name - Name to be sent to device_get_binding()
  pin      - Pin number within the port identified by drv_name

There is support for in/out pins and pull up/pull down but currently
there is no interrupt support.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
…ooks.

uart_irq_input_hook_set() was renamed to uart_console_in_debug_hook_install()
and accepts different params.
@pfalcon
Copy link
Owner

pfalcon commented Oct 26, 2016

Ok, please rebase your branch.

@fvincenzo
Copy link
Contributor Author

@pfalcon I do not have any problem to loose the authorship if you keep the signed-off information into the commit message.

Vincenzo Frascino added 2 commits October 26, 2016 17:36
This patch removes some compilation warnings present in modpybpin and
mpconfigport.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This patch fixes a compilation issue experienced into modpyb due to a
change in the API from MP_DECLARE_CONST_FUN_OBJ to
MP_DECLARE_CONST_FUN_OBJ_x.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
@pfalcon pfalcon force-pushed the zephyr branch 2 times, most recently from f3a7a82 to b8aacb2 Compare October 26, 2016 21:52
@pfalcon
Copy link
Owner

pfalcon commented Oct 26, 2016

Ok, these changes were squashed with Pin impl (sign-off's preserved), and pushed upstream as micropython/micropython@67b6d9d (please see it for more comments). Thanks!

@pfalcon pfalcon closed this Oct 26, 2016
pfalcon pushed a commit that referenced this pull request Dec 2, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        #5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        #6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        #7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        #8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants